MNEdge Class Reference

#include <mnmesh.h>

Class 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.

+ Inheritance diagram for MNEdge:

Public Member Functions

 MNEdge ()
 Constructor. More...
 
 MNEdge (int vv1, int vv2, int fc)
 Constructor. More...
 
void Init ()
 Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1. More...
 
int OtherFace (int ff)
 Assuming that ff is one of the faces using this edge, OtherFace will return the other. More...
 
int OtherVert (int vv)
 Assuming that vv is one of the vertices on this edge, OtherVert will return the other. More...
 
void Invert ()
 Flips the edge around, so that it now goes from what was v2 to what was v1. More...
 
DllExport void ReplaceFace (int of, int nf, int vv1=-1)
 Replaces face of with face nf in the edge records. More...
 
void ReplaceVert (int ov, int nv)
 Replaces vertex ov in the edge records with vertex nv. More...
 
DllExport bool Uncrossable ()
 If this edge has the MN_EDGE_NOCROSS flag set, or if it has no second face, this method returns TRUE. More...
 
DllExport MNEdgeoperator= (const MNEdge &from)
 Assignment operator. More...
 
bool operator== (MNEdge &f)
 Comparison operator. More...
 
intoperator[] (int i)
 Vertex access operator. More...
 
const intoperator[] (int i) const
 Vertex access operator. More...
 
DllExport void MNDebugPrint ()
 Uses DebugPrint to print out edge information to the Debug Results window in DevStudio. More...
 
- Public Member Functions inherited from FlagUser
 FlagUser ()
 
void SetFlag (DWORD fl, bool val=TRUE)
 
void ClearFlag (DWORD fl)
 
bool GetFlag (DWORD fl) const
 
void ClearAllFlags ()
 
void CopyFlags (DWORD fl)
 
void CopyFlags (const FlagUser &fu)
 
void CopyFlags (const FlagUser *fu)
 
void CopyFlags (DWORD fl, DWORD mask)
 
void CopyFlags (const FlagUser &fu, DWORD mask)
 
void CopyFlags (const FlagUser *fu, DWORD mask)
 
void OrFlags (const FlagUser &fu)
 
void OrFlags (const FlagUser *fu)
 
void AndFlags (const FlagUser &fu)
 
void AndFlags (const FlagUser *fu)
 
bool FlagMatch (DWORD fmask, DWORD fl) const
 
bool FlagMatch (DWORD fmask, const FlagUser &fu) const
 
bool FlagMatch (DWORD fmask, const FlagUser *fu) const
 
DWORD ExportFlags () const
 
void ImportFlags (DWORD fl)
 
IOResult WriteFlags (ISave *isave, ULONG *nb) const
 
IOResult ReadFlags (ILoad *iload, ULONG *nb)
 

Public Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

Constructor & Destructor Documentation

MNEdge ( )
inline

Constructor.

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

320 { Init(); }
void Init()
Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1.
Definition: mnmesh.h:326
MNEdge ( int  vv1,
int  vv2,
int  fc 
)
inline

Constructor.

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

323 { f1=fc; f2=-1; v1=vv1; v2=vv2; track=-1; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int f2
The face (if any) that references this edge in the backward direction.
Definition: mnmesh.h:315
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
int track
Definition: mnmesh.h:317
int f1
The (unique) face that references this edge in the forward direction.
Definition: mnmesh.h:310

Member Function Documentation

void Init ( )
inline

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

326 { v1=v2=f1=0; f2=-1; track=-1; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int f2
The face (if any) that references this edge in the backward direction.
Definition: mnmesh.h:315
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
int track
Definition: mnmesh.h:317
int f1
The (unique) face that references this edge in the forward direction.
Definition: mnmesh.h:310
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.

332 { return (ff==f1) ? f2 : f1; }
int f2
The face (if any) that references this edge in the backward direction.
Definition: mnmesh.h:315
int f1
The (unique) face that references this edge in the forward direction.
Definition: mnmesh.h:310
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.

337 { return (vv==v1) ? v2 : v1; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
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.

342 { int hold=v1; v1=v2; v2=hold; hold=f1; f1=f2; f2=hold; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int f2
The face (if any) that references this edge in the backward direction.
Definition: mnmesh.h:315
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
int f1
The (unique) face that references this edge in the forward direction.
Definition: mnmesh.h:310
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

356 { if (v1 == ov) v1 = nv; else { DbgAssert (v2==ov); v2 = nv; } }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
#define DbgAssert(expr)
Definition: assert1.h:72
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.

367 { return (f.v1==v1)&&(f.v2==v2)&&(f.f1==f1)&&(f.f2==f2)&&(f.ExportFlags()==ExportFlags()); }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
DWORD ExportFlags() const
Definition: mncommon.h:96
int f2
The face (if any) that references this edge in the backward direction.
Definition: mnmesh.h:315
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
int f1
The (unique) face that references this edge in the forward direction.
Definition: mnmesh.h:310
int& operator[] ( int  i)
inline

Vertex access operator.

370 { return i ? v2 : v1; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
const int& operator[] ( int  i) const
inline

Vertex access operator.

373 { return i ? v2 : v1; }
int v1
The start vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:303
int v2
The end vertex index into the parent MNMesh's list of MNVerts.
Definition: mnmesh.h:306
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.