3ds Max C++ API Reference
MNEdge Class Reference

An edge used with the MNMesh mesh. More...

#include <mnmesh.h>

+ 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) const
 Assuming that ff is one of the faces using this edge, OtherFace will return the other. More...
 
int OtherVert (int vv) const
 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 ()=default
 
 FlagUser (const FlagUser &)=default
 
 FlagUser (FlagUser &&)=default
 
FlagUseroperator= (const FlagUser &)=default
 
FlagUseroperator= (FlagUser &&)=default
 
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...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

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.

Constructor & Destructor Documentation

◆ MNEdge() [1/2]

MNEdge ( )
inline

Constructor.

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

350 { Init(); }
void Init()
Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1.
Definition: mnmesh.h:356

◆ MNEdge() [2/2]

MNEdge ( int  vv1,
int  vv2,
int  fc 
)
inline

Constructor.

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

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

Member Function Documentation

◆ Init()

void Init ( )
inline

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

356 { v1=v2=f1=0; f2=-1; track=-1; }

◆ OtherFace()

int OtherFace ( int  ff) const
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.

363  {
364  return (ff == f1) ? f2 : f1;
365  }

◆ OtherVert()

int OtherVert ( int  vv) const
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.

371  {
372  return (vv == v1) ? v2 : v1;
373  }

◆ Invert()

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.

378 { int hold=v1; v1=v2; v2=hold; hold=f1; f1=f2; f2=hold; }

◆ ReplaceFace()

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.

◆ ReplaceVert()

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

392 { if (v1 == ov) v1 = nv; else { DbgAssert (v2==ov); v2 = nv; } }
#define DbgAssert(expr)
Definition: assert1.h:82

◆ Uncrossable()

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

◆ operator=()

DllExport MNEdge& operator= ( const MNEdge from)

Assignment operator.

Copies over all data.

◆ operator==()

bool operator== ( MNEdge f)
inline

Comparison operator.

403 { return (f.v1==v1)&&(f.v2==v2)&&(f.f1==f1)&&(f.f2==f2)&&(f.ExportFlags()==ExportFlags()); }
DWORD ExportFlags() const
Definition: mncommon.h:150

◆ operator[]() [1/2]

int& operator[] ( int  i)
inline

Vertex access operator.

406 { return i ? v2 : v1; }

◆ operator[]() [2/2]

const int& operator[] ( int  i) const
inline

Vertex access operator.

409 { return i ? v2 : v1; }

◆ MNDebugPrint()

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();
DllExport void MNDebugPrint()
Uses DebugPrint to print out edge information to the Debug Results window in DevStudio.
UtilExport void DebugPrint(const MCHAR *format,...)
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

Member Data Documentation

◆ v1

int v1

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

◆ v2

int v2

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

◆ f1

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.

◆ f2

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.

◆ track

int track

General purpose value.