3ds Max C++ API Reference
|
The face structure used with the MNMesh mesh. More...
#include <mnmesh.h>
Public Member Functions | |
MNFace () | |
Constructor. More... | |
MNFace (int d) | |
Constructor. More... | |
DllExport | MNFace (const MNFace *from) |
Constructor. More... | |
~MNFace () | |
Frees all arrays. More... | |
DllExport void | Init () |
Initialize the face. More... | |
DllExport void | SetDeg (int d) |
Set the number of edges and vertices this face has. More... | |
DllExport void | Clear () |
Frees all arrays, setting them to NULL, and resets degree. More... | |
int | TriNum () |
Returns the number of triangles in this face. More... | |
DllExport int | FindTriPoint (int edge) |
Given the index of a particular edge, this routine returns the point (distinct from edge and (edge+1)deg) that forms a triangle with the edge, given the current scheme of diagonals. More... | |
DllExport int | FindTriPoint (int a, int b) |
Given two verts that form a diagonal in the polygon, this method finds the vertex between them that connects by a diagonal or an outer edge to both of them. More... | |
DllExport void | GetTriangles (Tab< int > &tri) |
This method fills in the table with the full triangulation for the face, based on the internal diagonal list. More... | |
DllExport void | GetTriangles (Tab< int > &tri) const |
This method fills in the table with the full triangulation for the face, based on the internal diagonal list. More... | |
DllExport void | SetAlloc (int d) |
Allocates enough memory in the arrays for the face to have degree d, but does not actually set the degree. More... | |
DllExport void | MakePoly (int fdeg, int *vv, bool *vis=NULL, bool *sel=NULL) |
Makes this face into a polygon with the specified vertices and other information. More... | |
DllExport void | Insert (int pos, int num=1) |
Inserts space for more vertices and edges on this face. More... | |
DllExport bool | Delete (int pos, int num=1, int edir=1, bool fixtri=TRUE) |
Deletes vertices & edges from this face. More... | |
DllExport void | RemoveNullEdges (Tab< int > &nullEdges, Tab< int > &excisedVertices, const MNMesh *mesh) |
Searches the edge list for this face for "null" edges, defined as edges with identical start and end vertices. More... | |
DllExport void | RotateStart (int newstart) |
Re-indexes the vertices and edges so that the vertex in position newstart becomes the new first vertex. More... | |
DllExport void | Flip () |
Reverses order of verts, effectively inverting the face. More... | |
DllExport int | VertIndex (int vv, int ee=-1) |
Returns the position of vertex vv in this face's list of vertices. More... | |
DllExport int | EdgeIndex (int ee, int vv=-1) const |
Returns the position of edge ee in this face's list of edges. More... | |
DllExport void | ReplaceVert (int ov, int nv, int ee=-1) |
Replaces vertex ov with vertex nv in the list of vertices. More... | |
DllExport void | ReplaceEdge (int oe, int ne, int vv=-1) |
Replaces edge oe with edge ne in the list of edges. More... | |
DllExport MNFace & | operator= (const MNFace &from) |
Assignment operator. More... | |
DllExport bool | operator== (const MNFace &from) |
Comparison operator. More... | |
int & | operator[] (int i) |
Access operator. More... | |
const int & | operator[] (int i) const |
Access operator. More... | |
DllExport void | MNDebugPrint (bool triprint=FALSE) |
Uses DebugPrint to print out face information to the Debug Results window in DevStudio. More... | |
DllExport IOResult | Save (ISave *isave) |
DllExport IOResult | Load (ILoad *iload) |
Public Member Functions inherited from FlagUser | |
FlagUser ()=default | |
FlagUser (const FlagUser &)=default | |
FlagUser (FlagUser &&)=default | |
FlagUser & | operator= (const FlagUser &)=default |
FlagUser & | operator= (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 | deg |
This is the degree: the number of vertices and edges that this face has. More... | |
int * | vtx |
This is the list of vertices that make up the corners of this face. More... | |
int * | edg |
This is the list of edges that border this face, in order. More... | |
int * | diag |
This is where the triangulation is stored. More... | |
DWORD | smGroup |
This contains the smoothing groups assigned to this face. More... | |
MtlID | material |
This is the material ID assigned to this face. More... | |
int | track |
Generally for internal use, but may be used to track faces created by several methods. More... | |
BitArray | visedg |
Contains a visibility bit for each edge on this face. More... | |
BitArray | edgsel |
Contains a selection bit for each edge on this face. More... | |
BitArray | bndedg |
Boundary Edges. More... | |
Friends | |
class | MNMesh |
Additional Inherited Members | |
Static Public Member Functions inherited from MaxHeapOperators | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. More... | |
static UtilExport void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | aligned_malloc (size_t size, size_t alignment) |
Allocates memory on a specified alignment boundary. More... | |
static UtilExport void * | aligned_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... | |
The face structure used with the MNMesh mesh.
MNFace are not necessarily triangles. They also may contain hidden vertices which are used in converting the face back to triangles. This triangulation is always maintained in the face.
|
inline |
Constructor.
Initializes the face's arrays to NULL.
Constructor.
Initializes the face's degree to d and allocates space for all the arrays.
Constructor.
Copies flags, smoothing groups, and material from "from", but initializes the face's arrays to NULL and degree to 0.
|
inline |
Frees all arrays.
|
inline |
Returns the number of triangles in this face.
Given the index of a particular edge, this routine returns the point (distinct from edge and (edge+1)deg) that forms a triangle with the edge, given the current scheme of diagonals.
Given two verts that form a diagonal in the polygon, this method finds the vertex between them that connects by a diagonal or an outer edge to both of them.
(Here, "between them" means after a and before b in sequence around the outside of the polygon. If we have an octagon where a=6 and b=2, the result would be 7, 0, or 1. To get the other result, in the 3,4,5 range, call the method with a=2 and b=6.)
This method fills in the table with the full triangulation for the face, based on the internal diagonal list.
The table is set to size (deg-2)*3.
This method fills in the table with the full triangulation for the face, based on the internal diagonal list.
The table is set to size (deg-2)*3. The const version doesn't reorder diags.
Allocates enough memory in the arrays for the face to have degree d, but does not actually set the degree.
If the arrays are already large enough (or larger), it does not reallocate them. You generally don't need to use this method separately; MakePoly, Insert, and other methods which may require additional memory will call this if needed.
Makes this face into a polygon with the specified vertices and other information.
This routine also supplies a default triangulation for the face; however, since this MNFace-level routine cannot access the vertex positions contained in the parent MNMesh, this triangulation may not work for non-convex faces. If the face may not be convex, a call to MNMesh::RetriangulateFace for this face will correct the triangulation.
Inserts space for more vertices and edges on this face.
This is used, for example, when two faces are joined, to add room for the vertices & edges of one face to the other. This routine also renumbers the existing vertices and corrects the existing face triangulation, although it cannot provide the triangulation for the new vertices. It reserves space for the new triangles at the end of the triangle array. If you do not want to compute the triangulation for the new vertices yourself, you may use the MNMesh RetriangulateFace method after filling in the new vertices.
Deletes vertices & edges from this face.
This routine also corrects the face triangulation, removing those triangles that include the deleted edges and re-indexing the rest. However, delete may cause the triangulation to become invalid, by causing one or more of the corrected triangles to have a flipped normal.
DllExport void RemoveNullEdges | ( | Tab< int > & | nullEdges, |
Tab< int > & | excisedVertices, | ||
const MNMesh * | mesh | ||
) |
Searches the edge list for this face for "null" edges, defined as edges with identical start and end vertices.
These edges are excised from the face edge list, and the associated duplicate vertices are removed from the vertex list. The face is retriangulated if any null edges are encountered. If removing null edges would result in a degenerate face of degree less than three, the face simply flags itself as MN_DEAD and returns the identified edges in nullEdges.
[out] | nullEdges | list of indices in the owning MNMesh container of null edges identified in this face; if the same null edge was present N times in this face's edge list, it will appear N times in nullEdges |
[out] | excisedVertices | list of local indices, in face vtx container at entry to function, of duplicate vertices removed due to excision of a null edge |
[in] | mesh | mesh container in which this face resides |
Re-indexes the vertices and edges so that the vertex in position newstart becomes the new first vertex.
Triangulation is also corrected. Mapping coordinates and vertex colors are corrected automatically.
Reverses order of verts, effectively inverting the face.
vtx[0] remains unchanged, but vertex deg-1 becomes vertex 1, etc. Note that this operation wreaks havoc on nearby edges and should be used with caution.
Returns the position of vertex vv in this face's list of vertices.
For a given face fc, if fc.vtx[i] = vv, fc.VertIndex (vv) = i. Sometimes a single vertex from the MNMesh's MNVert list can be referenced more than once by a single face. The picture below illustrates this problem. The small triangle is actually outside of the face, and the vertex at the top of it is referenced twice by the face. Thus an additional edge parameter can be accepted. If ee is -1, it is ignored, and the first instance of vv is used. If ee>-1, this method looks for the instance of vv that starts out edge ee. Thus if fc.vtx[i] = vv and fc.vtx[j] = vv, but fc.edg[i] != ee and fc.edg[j] = ee, j is returned. IMPORTANT: If no vertex is found matching the given parameters, this method generates an assertion failure. Please be sure that vertex vv is actually on the face (and that edge ee follows it if ee is not -1) before using this method.
Returns the position of edge ee in this face's list of edges.
For a given face fc, if fc.edg[i] = ee, fc.EdgeIndex (ee) = i. Sometimes a single edge from the MNMesh's MNEdge list can be referenced more than once by a single face. The small rectangle is actually outside of the face, and the edge above it is referenced twice by the face, once in each direction. Thus an additional vertex parameter can be accepted. If vv is -1, it is ignored, and the first instance of ee is used. If vv>-1, this method looks for the instance of ee that starts out with vertex vv. Thus if fc.edg[i] = ee and fc.edg[j] = ee, but fc.vtx[i] != vv and fc.vtx[j] = vv, j is returned. IMPORTANT: If no edge is found matching the given parameters, this method generates an assertion failure. Please be sure that edge ee is actually on the face (and that vertex vv follows it if vv is not -1) before using this method.
Replaces vertex ov with vertex nv in the list of vertices.
It is possible for a face to reference the same vertex more than once, however the combination of a vertex followed by a specified edge is unique. Therefore if ee<0, all instances of ov are replaced by nv, but if not, only the instance of ov followed by ee is replaced.
Replaces edge oe with edge ne in the list of edges.
It is possible for a face to reference the same edge twice, however the combination of an edge preceded by a specified vertex is unique. Therefore if vv<0, all instances of oe are replaced by ne, but if not, only the instance of oe preceded by vv is replaced.
Assignment operator.
Copies all information from "from", including triangulation, hidden vertices, flags, smoothing & material info, and "track".
Access operator.
Uses DebugPrint to print out face information to the Debug Results window in DevStudio.
The information consists of the vertices and edges used by this face. 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:
|
friend |
int deg |
This is the degree: the number of vertices and edges that this face has.
int* vtx |
This is the list of vertices that make up the corners of this face.
Each value is an index into the parent MNMesh's list of MNVerts.
int* edg |
int* diag |
This is where the triangulation is stored.
The number of triangles in a face is given by deg - 2 + hdeg*2. This array contains three times this number, for all the corners of all the sub-triangles. The triangle values are indices into the vtx and hvtx arrays of this face. Hidden vertices are indicated by values less than zero: hvtx[i] is represented by -1-i. Thus a triangle (1, 2, -2) would represent a triangle using vtx[1], vtx[2], and hvtx[-1]. The diag array's allocated size is always (dalloc-3)*2. If dalloc==3 (triangle), this pointer is NULL.
DWORD smGroup |
This contains the smoothing groups assigned to this face.
MtlID material |
This is the material ID assigned to this face.
int track |
Generally for internal use, but may be used to track faces created by several methods.
BitArray visedg |
Contains a visibility bit for each edge on this face.
See the MNMesh note on edge selection & visibility for more information.
BitArray edgsel |
Contains a selection bit for each edge on this face.
See the MNMesh note on edge selection & visibility for more information.
BitArray bndedg |
Boundary Edges.