Public Member Functions | Public Attributes

MNEdge Class Reference

This reference page is linked to from the following overview topics: MNMesh Edges, MNMesh Note on Debugging.


Search for all occurrences

Detailed Description

An edge used with the MNMesh mesh.

MNEdges are winged-edge structures, which means they keep track of a start vertex, an end vertex, and the (unique) face that uses the start and end vertices in that order. If there is a face that uses the end and start vertices in that order, i.e. that travels this edge in the other direction, it is also recorded. All methods of this class are implemented by the system.

#include <mnmesh.h>

Inheritance diagram for MNEdge:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MNEdge ()
  Constructor.
  MNEdge (int vv1, int vv2, int fc)
  Constructor.
void  Init ()
  Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1.
int  OtherFace (int ff)
  Assuming that ff is one of the faces using this edge, OtherFace will return the other.
int  OtherVert (int vv)
  Assuming that vv is one of the vertices on this edge, OtherVert will return the other.
void  Invert ()
  Flips the edge around, so that it now goes from what was v2 to what was v1.
DllExport void  ReplaceFace (int of, int nf, int vv1=-1)
  Replaces face of with face nf in the edge records.
void  ReplaceVert (int ov, int nv)
  Replaces vertex ov in the edge records with vertex nv.
DllExport bool  Uncrossable ()
  If this edge has the MN_EDGE_NOCROSS flag set, or if it has no second face, this method returns TRUE.
DllExport MNEdge operator= (const MNEdge &from)
  Assignment operator.
bool  operator== (MNEdge &f)
  Comparison operator.
int &  operator[] (int i)
  Vertex access operator.
const int &  operator[] (int i) const
  Vertex access operator.
DllExport void  MNDebugPrint ()
  Uses DebugPrint to print out edge information to the Debug Results window in DevStudio.

Public Attributes

int  v1
  The start vertex index into the parent MNMesh's list of MNVerts.
int  v2
  The end vertex index into the parent MNMesh's list of MNVerts.
int  f1
  The (unique) face that references this edge in the forward direction.
int  f2
  The face (if any) that references this edge in the backward direction.
int  track

Constructor & Destructor Documentation

MNEdge ( ) [inline]

Constructor.

Initializes both faces to -1 and both vertices to 0.

{ Init(); }
MNEdge ( int  vv1,
int  vv2,
int  fc 
) [inline]

Constructor.

Initializes edge to run from vv1 to vv2 with f1 set to fc.

{ f1=fc; f2=-1; v1=vv1; v2=vv2; track=-1; }

Member Function Documentation

void Init ( ) [inline]

Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1.

{ v1=v2=f1=0; f2=-1; track=-1; }
int OtherFace ( int  ff ) [inline]

Assuming that ff is one of the faces using this edge, OtherFace will return the other.

If the edge is one-sided, -1 will be returned. If ff is not one of the faces, f2 (which may be -1) will be returned.

{ return (ff==f1) ? f2 : f1; }
int OtherVert ( int  vv ) [inline]

Assuming that vv is one of the vertices on this edge, OtherVert will return the other.

If vv is not one of the faces, v2 will be returned.

{ return (vv==v1) ? v2 : v1; }
void Invert ( ) [inline]

Flips the edge around, so that it now goes from what was v2 to what was v1.

f1 and f2 are also switched. This should not be called on one-sided edges.

{ int hold=v1; v1=v2; v2=hold; hold=f1; f1=f2; f2=hold; }
DllExport void ReplaceFace ( int  of,
int  nf,
int  vv1 = -1 
)

Replaces face of with face nf in the edge records.

NOTE that this method causes an assertion failure if face of is not currently used by the edge. If of is on both sides of the edge, which is possible on some valid NONTRI meshes, a nonnegative vv1 is used to specify which side is replaced. Vv1 should be the "starting vertex" for the edge on face of. Assertion failures will also result if vv1 is nonnegative and is not either of the edge's verts, or if vv1 indicates that of should be the edge's f1, but it is not, etc.

void ReplaceVert ( int  ov,
int  nv 
) [inline]

Replaces vertex ov in the edge records with vertex nv.

NOTE that this method causes an assertion failure if vertex ov is not used by this edge

{ if (v1 == ov) v1 = nv; else { DbgAssert (v2==ov); v2 = nv; } }
DllExport bool Uncrossable ( )

If this edge has the MN_EDGE_NOCROSS flag set, or if it has no second face, this method returns TRUE.

Otherwise, it returns FALSE. It's a shorthand equivalent for (GetFlag(MN_EDGE_NOCROSS) || (f2<0)).

DllExport MNEdge& operator= ( const MNEdge from )

Assignment operator.

Copies over all data.

bool operator== ( MNEdge f ) [inline]

Comparison operator.

{ return (f.v1==v1)&&(f.v2==v2)&&(f.f1==f1)&&(f.f2==f2)&&(f.ExportFlags()==ExportFlags()); }
int& operator[] ( int  i ) [inline]

Vertex access operator.

{ return i ? v2 : v1; }  
const int& operator[] ( int  i ) const [inline]

Vertex access operator.

{ return i ? v2 : v1; }  
DllExport void MNDebugPrint ( )

Uses DebugPrint to print out edge information to the Debug Results window in DevStudio.

The information consists of the vertices and faces using this edge. It is generally a good idea to put in a DebugPrint immediately before this with the index of the edge, so you know which one is being printed out:

    DebugPrint(_M("Edge %d: "), eid);\n\n
    E(eid)-\>MNDebugPrint();

Member Data Documentation

int v1

The start vertex index into the parent MNMesh's list of MNVerts.

int v2

The end vertex index into the parent MNMesh's list of MNVerts.

int f1

The (unique) face that references this edge in the forward direction.

This value is an index into the parent MNMesh's list of MNFaces.

int f2

The face (if any) that references this edge in the backward direction.

Faces with f2=-1 are considered "one-sided", and lie on the boundary of a hole in the mesh. This value is an index into the parent MNMesh's list of MNFaces.

int track

General purpose value.


MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge
MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge MNEdge