class FullEdge
{
public:
FullEdge();
~FullEdge();
Vertex& GetOtherVertex(const Vertex &Vtx); Vertex& GetOtherVertex(const FullEdge &FullE); Vertex& GetSharedVertex(const FullEdge &FullE); Triangle& GetOtherTriangle(const Triangle &Tri); const Triangle& GetOtherTriangle(const Triangle &Tri) const;
bool ContainsVertex(const Vertex &Vtx) const; bool Boundary() const; bool Oriented() const;
void OrientMatchingBoundary();
double GetCotanTerm() const;
Vec3f ComputeLoopSubdivisionPos();
__forceinline HalfEdge& GetHalfEdge(UINT EdgeIndex)
{
Assert(EdgeIndex <= 1, "Invalid index on FullEdge::GetHalfEdge");
return _Triangles[EdgeIndex]->GetHalfEdge(*this);
}
__forceinline const HalfEdge& GetHalfEdge(UINT EdgeIndex) const
{
Assert(EdgeIndex <= 1, "Invalid index on FullEdge::GetHalfEdge");
return _Triangles[EdgeIndex]->GetHalfEdge(*this);
}
__forceinline Vertex& GetVertex(UINT VertexIndex)
{
Assert(VertexIndex <= 1, "Invalid index on FullEdge::GetVertex");
return *(_Vertices[VertexIndex]);
}
__forceinline const Vertex& GetVertex(UINT VertexIndex) const
{
Assert(VertexIndex <= 1, "Invalid index on FullEdge::GetVertex");
return *(_Vertices[VertexIndex]);
}
__forceinline Triangle& GetTriangle(UINT TriangleIndex)
{
Assert(TriangleIndex <= 1, "Invalid index on FullEdge::GetTriangle");
return *(_Triangles[TriangleIndex]);
}
__forceinline const Triangle& GetTriangle(UINT TriangleIndex) const
{
Assert(TriangleIndex <= 1, "Invalid index on FullEdge::GetTriangle");
return *(_Triangles[TriangleIndex]);
}
__forceinline UINT Index() const
{
return _Index;
}
__forceinline Vec3f Vector() const
{
return (_Vertices[1]->Pos() - _Vertices[0]->Pos());
}
__forceinline Vec3f Center() const
{
return (_Vertices[0]->Pos() + _Vertices[1]->Pos()) * 0.5f;
}
static FullEdge Invalid;
static FullEdge NotFound;
private:
Vertex *_Vertices[2];
Triangle *_Triangles[2];
UINT _Index;
friend class ComplexMesh;
};
class HalfEdge
{
public:
HalfEdge();
__forceinline FullEdge& AcrossEdge()
{
return *_AcrossEdge;
}
__forceinline const FullEdge& AcrossEdge() const
{
return *_AcrossEdge;
}
__forceinline HalfEdge& NextEdge()
{
return *_NextEdge;
}
__forceinline const HalfEdge& NextEdge() const
{
return *_NextEdge;
}
static HalfEdge Invalid;
private:
FullEdge *_AcrossEdge; HalfEdge *_NextEdge;
friend class ComplexMesh;
};
__forceinline bool operator == (const HalfEdge &A, const HalfEdge &B)
{
return ((&A) == (&B));
}
__forceinline bool operator != (const HalfEdge &A, const HalfEdge &B)
{
return ((&A) != (&B));
}
__forceinline bool operator == (const FullEdge &A, const FullEdge &B)
{
return ((&A) == (&B));
}
__forceinline bool operator != (const FullEdge &A, const FullEdge &B)
{
return ((&A) != (&B));
}