86 template <
typename InputType,
typename ComputeType,
typename RationalType>
117 bool GetIndices(
int t, std::array<int, 3>& indices)
const;
118 bool GetAdjacencies(
int t, std::array<int, 3>& adjacencies)
const;
137 template <
typename InputType,
typename ComputeType,
typename RationalType>
145 if (numVertices < 3 || !vertices || numTriangles < 1 || !indices)
153 for (
int t = 0;
t < numTriangles; ++
t)
172 int const numIndices = 3 * numTriangles;
175 std::copy(indices, indices + numIndices,
mIndices.begin());
176 for (
int t = 0, vIndex = 0;
t < numTriangles; ++
t)
178 int v0 = indices[vIndex++];
179 int v1 = indices[vIndex++];
180 int v2 = indices[vIndex++];
187 for (
int t = 0, base = 0;
t < numTriangles; ++
t, base += 3)
189 int v0 = indices[base];
190 int v1 = indices[base + 1];
191 int v2 = indices[base + 2];
193 auto element = tmap.find(key);
194 for (
int i = 0; i < 3; ++i)
196 auto adj = element->second->T[i].lock();
210 template <
typename InputType,
typename ComputeType,
typename RationalType>
218 if (numVertices < 3 || !vertices || mesh.
GetTriangles().size() < 1)
233 int tIndex = 0, vIndex = 0;
234 for (
auto const& element : tmap)
236 mTriIndexMap.insert(std::make_pair(element.first, tIndex++));
237 for (
int i = 0; i < 3; ++i, ++vIndex)
239 mIndices[vIndex] = element.second->V[i];
245 for (
auto const& element : tmap)
247 for (
int i = 0; i < 3; ++i, ++vIndex)
249 auto adj = element.second->T[i].lock();
263 template <
typename InputType,
typename ComputeType,
typename RationalType>
270 template <
typename InputType,
typename ComputeType,
typename RationalType>
276 template <
typename InputType,
typename ComputeType,
typename RationalType>
282 template <
typename InputType,
typename ComputeType,
typename RationalType>
288 template <
typename InputType,
typename ComputeType,
typename RationalType>
294 template <
typename InputType,
typename ComputeType,
typename RationalType>
301 int triangle = startTriangle;
304 int ibase = 3 * triangle;
343 template <
typename InputType,
typename ComputeType,
typename RationalType>
351 int triangle = startTriangle;
354 visited.insert(triangle);
355 int ibase = 3 * triangle;
361 if (triangle == -1 || visited.find(triangle) != visited.end())
371 if (triangle == -1 || visited.find(triangle) != visited.end())
381 if (triangle == -1 || visited.find(triangle) != visited.end())
394 template <
typename InputType,
typename ComputeType,
typename RationalType>
400 for (
int i = 0, vIndex = 3 * t; i < 3; ++i, ++vIndex)
409 template <
typename InputType,
typename ComputeType,
typename RationalType>
411 int t, std::array<int, 3>&
indices)
const 415 for (
int i = 0, vIndex = 3 * t; i < 3; ++i, ++vIndex)
424 template <
typename InputType,
typename ComputeType,
typename RationalType>
426 int t, std::array<int, 3>& adjacencies)
const 430 for (
int i = 0, vIndex = 3 * t; i < 3; ++i, ++vIndex)
439 template <
typename InputType,
typename ComputeType,
typename RationalType>
447 std::array<Vector2<RationalType>, 3> rtV;
448 for (
int i = 0; i < 3; ++i)
451 for (
int j = 0; j < 2; ++j)
453 rtV[i][j] = (RationalType)V[j];
457 RationalType rtBary[3];
460 for (
int i = 0; i < 3; ++i)
462 bary[i] = (InputType)rtBary[i];
470 template <
typename InputType,
typename ComputeType,
typename RationalType>
483 template <
typename InputType,
typename ComputeType,
typename RationalType>
492 for (
int j = 0; j < 2; ++j)
std::vector< Vector2< ComputeType > > mComputeVertices
int GetNumTriangles() const
void Set(int numVertices, Vector2< Real > const *vertices)
int GetNumVertices() const
bool Contains(int triangle, Vector2< InputType > const &P) const
Vector2< InputType > const * GetVertices() const
PrimalQuery2< ComputeType > mQuery
std::map< TriangleKey< true >, int > mTriIndexMap
int GetContainingTriangle(Vector2< InputType > const &P, int startTriangle=0) const
bool Contains(Vector2< Real > const &p) const
int ToLine(int i, int v0, int v1) const
GLsizei GLenum const void * indices
#define LogError(message)
void CreateVertices(int numVertices, Vector2< InputType > const *vertices)
int const * GetIndices() const
bool GetBarycentrics(int t, Vector2< InputType > const &P, std::array< InputType, 3 > &bary) const
virtual std::shared_ptr< Triangle > Insert(int v0, int v1, int v2)
bool ComputeBarycentrics(Vector2< Real > const &p, Vector2< Real > const &v0, Vector2< Real > const &v1, Vector2< Real > const &v2, Real bary[3], Real epsilon=(Real) 0)
TMap const & GetTriangles() const
GLfloat GLfloat GLfloat v2
int const * GetAdjacencies() const
std::vector< int > mAdjacencies
Vector2< InputType > const * mVertices
PlanarMesh(int numVertices, Vector2< InputType > const *vertices, int numTriangles, int const *indices)
std::vector< int > mIndices