Class MNEdge
See Also: Class FlagUser, Class MNMesh.
class MNEdge : public FlagUser
Description:
This class is available in release 2.0 and later only.
MNEdge is the edge class 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.
Data Members:
public:
int v1, v2
The start and end vertices. These values are indices 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
This data member is obsolete and should not be used.
Flags:
For more information on flags, see Class FlagUser.
MN_SEL
Indicates that the edge is selected.
MN_TARG
Indicates that the edge is targeted. (See the MNMesh methods starting with the words TargetBy.)
MN_DEAD
Indicates that the edge is not used and should be ignored. Edges with the MN_DEAD flag are deleted in the next MNMesh call to CollapseDeadEdges ().
MN_EDGE_INVIS
Both faces using this edge consider it invisible.
MN_EDGE_HALFINVIS
One face using this edge considers it invisible.
MN_EDGE_NOCROSS
This edge should not be crossed in algorithms like MNMesh::SabinDoo that can "mix" faces across edges.
MN_EDGE_TV_SEAM
This edge lies on a mapping coordinate "seam". You must use MNMesh::SetTVSeamFlags on a mesh with mapping coordinates in order to set these flags correctly.
MN_EDGE_WHATEVER
Developers should not use this flag and should restrict themselves to MN_USER and higher bits.
MN_USER(1<<16)
Flag bits at or above MN_USER are reserved in all MNMesh components for the plug-in developer, if needed. Since FlagUser-derived classes have 32 flag bits, this allows for up to 16 user-defined flags.
Methods:
Prototype:
MNEdge();
Remarks:
Constructor. Initializes both faces to -1 and both vertices to 0.
Prototype:
MNEdge(int vv1, int vv2, int fc);
Remarks:
Constructor. Initializes edge to run from vv1 to vv2 with f1 set to fc.
Prototype:
void Init();
Remarks:
This method is available in release 3.0 and later only.
Initializes v1, v2 and f1 to 0, f2 to -1 and track to -1.
Prototype:
int OtherFace(int ff);
Remarks:
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.
Prototype:
int OtherVert(int vv);
Remarks:
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.
Prototype:
void Invert();
Remarks:
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.
Prototype:
void ReplaceFace(int of, int nf, int vv1=-1);
Remarks:
This method is available in release 2.5 or later only.
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.
Prototype:
void ReplaceVert(int ov, int nv);
Remarks:
This method is available in release 2.5 or later only.
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
Prototype:
bool Uncrossable();
Remarks:
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)).
Prototype:
void MNDebugPrint();
Remarks:
This method is available in release 2.5 and later only.
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("Edge %d: ", eid);
E(eid)->MNDebugPrint();
Prototype:
MNEdge & operator=(const MNEdge & from);
Remarks:
Assignment operator. Copies over all data.
Prototype:
int& operator[](int i);
Remarks:
This method is available in release 4.0 and later only.
Vertex access operator.
Default Implementation:
{ return i ? v2 : v1; }
Prototype:
const int& operator[](int i) const;
Remarks:
This method is available in release 4.0 and later only.
Vertex access operator.
Default Implementation:
{ return i ? v2 : v1; }