Classes | Namespaces | Defines | Enumerations | Functions | Variables

mnmesh.h File Reference

This reference page is linked to from the following overview topics: SDK Change Details.


This file contains a number of utility classes for manipulating triangle or generalized polygon meshes. More...

#include "maxheap.h"
#include "export.h"
#include "baseinterface.h"
#include "mncommon.h"
#include "hitdata.h"
#include "point3.h"
#include "bitarray.h"
#include "matrix3.h"
#include "box3.h"
#include "TabTypes.h"
#include "GraphicsConstants.h"
#include "channels.h"
#include "mesh.h"

Go to the source code of this file.

Classes

class   MNVert
  The vertex class used with the MNMesh mesh. More...
class   MNEdge
  An edge used with the MNMesh mesh. More...
class   MNMapFace
  Used to store map vertex information for a given face and map channel. More...
class   MNFace
  The face structure used with the MNMesh mesh. More...
class   MNMap
  Holds the mapping information for a particular map channel of the MNMesh. More...
class   MNDiagonalHitData
  This class is a new form of HitData used for hit-testing diagonals of polygons in Editable Poly and Edit Poly. More...
class   MNMesh
  The MNMesh class is provided for temporary use by plug-ins, to help with complex topology-based modifications to Meshes. More...
class   MNMeshBorder
  Hold boundary information for an MNMesh mesh. More...
class   MNFaceElement
  Used to assist in the process of sorting MNMesh faces into separate elements. More...
class   MNFaceClusters
  Used for grouping faces in an MNMesh into clusters for applying transformations. More...
class   MNEdgeClusters
  Represents a list of edge "clusters" for a given MNMesh. More...
class   MNChamferData
  Contains all the data needed to move points (and map vertices) as the user drags a chamfer or extrude. More...
class   MNTempData
  Used for caching face and edge clusters, vertex normals, and other derived data about an MNMesh. More...
class   IMNTempData10
  Interface for changes made to MNTempData in version 9.5. More...
class   BasisFinder
  Computes two components of a basis vector given a single input component. More...
class   MNMeshSelectionConverter
  When a Mesh object or modifier (such as Editable Mesh, Edit Mesh, or Mesh Select) handles viewport subobject selection, the flow is basically as follows from Editable Mesh. More...
class   MNMeshUtilities
  Provides a number of utility functions for working with MNMesh. More...
class   MNMapPreserveData
  This class is used to "preserve" mapping coordinates while moving vertices. More...
class   IMNMeshUtilities8
  IMNMeshUtilities8 extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More...
class   IMNMeshUtilities10
  Extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More...
class   IMNMeshUtilities13
  Extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More...

Namespaces

namespace   MaxGraphics

Defines

#define  REALLOC_SIZE   10
#define  MNMESH_FACEDATA_IMPL
  Enables Face Data in PolyObjects:
#define  MNM_SELCONV_REQUIRE_ALL   0x02
#define  MN_MESH_NONTRI   (1<<0)
  At least 2 triangles have been joined.
#define  MN_MESH_FILLED_IN   (1<<1)
  If set, all topological links, such as the list of edges, are complete.
#define  MN_MESH_RATSNEST   (1<<2)
  Some regular Meshes have more than two faces referencing the same edge, or more than one referencing it in the same direction.
#define  MN_MESH_NO_BAD_VERTS   (1<<3)
  This indicates that the mesh has had its vertices checked and "bad" ones eliminated by EliminateBadVerts.
#define  MN_MESH_VERTS_ORDERED   (1<<4)
  Set if face and edge tables in each vertex are ordered by the methods MNMesh::OrderVerts().
#define  MN_MESH_FACE_NORMALS_INVALID   (1<<6)
  Set if any of the face normals (fnorm) have become invalid.
#define  MN_MESH_HAS_VOLUME   (1<<7)
  This mesh has at least one connected component which contains volume, i.e.
#define  MN_MESH_HITTEST_REQUIRE_ALL   (1<<8)
#define  MN_MESH_PARTIALCACHEINVALID   (1<<16)
  Indicates that the MNMesh has only set some of the vertices as invalid and not to reprocess the entire mesh just the vertices that changed.
#define  MN_MESH_CACHE_FLAGS   (MN_MESH_FILLED_IN|MN_MESH_NO_BAD_VERTS|MN_MESH_VERTS_ORDERED)
#define  MNDISP_VERTTICKS   0x01
  Display vertex tick marks.
#define  MNDISP_SELVERTS   0x02
  Display selected vertices.
#define  MNDISP_SELFACES   0x04
  Display selected faces.
#define  MNDISP_SELEDGES   0x08
  Display selected edges.
#define  MNDISP_NORMALS   0x10
  Display face normals.
#define  MNDISP_SMOOTH_SUBSEL   0x20
  Analogous to the Mesh display flag MESH_SMOOTH_SUBSEL, this indicates whether we should display smooth faces with selection-color outlines (TRUE) or transparent shaded faces (FALSE)
#define  MNDISP_BEEN_DISP   0x40
  Set when the MNMesh has been displayed (at the end of the render method.)
#define  MNDISP_DIAGONALS   0x80
  Set when diagonals should be displayed.
#define  MNDISP_HIDE_SUBDIVISION_INTERIORS   0x100
#define  IMNMESHUTILITIES10_INTERFACE_ID   Interface_ID(0x7b1acb31, 0x763982d5)
#define  IMNMESHUTILITIES13_INTERFACE_ID   Interface_ID(0x4dfa07c3, 0x637941b0)
General MNMesh Component Flags

For MNVerts, MNEdges, and MNFaces, bits 0-7 are used for common characteristics of all components.

Bits 8-15 are used for component-specific flags. Bits 16-23 are reserved for temporary use in MNMesh algorithms. Bits 24-31 are reserved for MNMath.lib users.

#define  MN_SEL   (1<<0)
  Indicates that a component is selected.
#define  MN_DEAD   (1<<1)
  Indicates that a component is not used and should be ignored.
#define  MN_TARG   (1<<2)
  Indicates that a component is targeted.
#define  MN_BACKFACING   (1<<3)
  Indicates that the vertex faces "backwards" in the current viewport.
#define  MN_HIDDEN   (1<<4)
#define  MN_CACHEINVALID   (1<<5)
#define  MN_INFOREGROUND   (1<<7)
  Tags a face as not renderable but can be hit-test.
#define  MN_WHATEVER   (1<<16)
#define  MN_LOCAL_SEL   (1<<17)
  Alternate selections (not passed up the pipe).
#define  MN_HITTEST_CULLED   (1<<18)
  Used to indicate culled components (neither selected nor not selected) in window-region hit testing.
#define  MN_USER   (1<<24)
  Any value above this can be used by applications.
Vertex Flags
#define  MN_VERT_DONE   (1<<8)
  Set in algorithms that may accidentally revisit the same vertex (MNVertext twice, to keep them from processing it the second time.
#define  MN_VERT_WELDED   (1<<9)
  Used by MNMesh::WeldBorderVerts()
#define  MN_VERT_SUBDIVISION_CORNER   (1<<10)
  Track which vertices are direct "descendants" of the original cage vertices in subdivision.
Edge flags
#define  MN_EDGE_INVIS   (1<<8)
  Both faces using this edge consider it invisible.
#define  MN_EDGE_NOCROSS   (1<<9)
  This edge should not be crossed in algorithms like MNMesh::SabinDoo that can mix faces across edges.
#define  MN_EDGE_MAP_SEAM   (1<<10)
  Track which edges are direct descendants of the original cage edges in subdivision.
#define  MN_EDGE_SUBDIVISION_BOUNDARY   (1<<11)
  Track unwanted edges created by Cut, so they might be removed later.
#define  MN_EDGE_CUT_EXTRA   (1<<12)
  Used with MNMesh::CutPrepare() and MNMEsh::CutCleanUp()
Interface IDs
#define  IMNMESHUTILITIES8_INTERFACE_ID   Interface_ID(0xf5235e73, 0x3b304334)
  Interface id for IMNMeshUtilities8, se.g.
#define  IMNTEMPDATA10_INTERFACE_ID   Interface_ID(0x56d8fa2, 0x3459c774)
  Interface ID for IMNTempData10.
MNFace flags:
#define  MN_FACE_OPEN_REGION   (1<<8)
  This face is part of a region of the mesh that is not closed, i.e.
#define  MN_FACE_CHECKED   (1<<9)
#define  MN_FACE_CHANGED   (1<<10)
  This flag can be cleared on all faces before an operation that moves some of the vertices of an MNMesh, then set for each face touching one of the moved vertices.
#define  MN_FACE_CULLED   (1<<11)
  Used to indicate a face has been culled during hit-testing.
Per-edge Data
#define  MAX_EDGEDATA   10
#define  EDATA_KNOT   0
#define  EDATA_CREASE   1
Internal flags
#define  MN_MESH_TEMP_1   (1<<13)
#define  MN_MESH_TEMP_2   (1<<14)
#define  MN_MESH_DONTTRISTRIP   (1<<15)
Flags for Sub Object Hit-Test
#define  SUBHIT_MNUSECURRENTSEL   (1<<22)
  When this bit is set, the selection only and unselection only tests will use the current level (edge or face) selection when doing a vertex level hit test.
#define  SUBHIT_OPENONLY   (1<<23)
#define  SUBHIT_MNVERTS   (1<<24)
#define  SUBHIT_MNFACES   (1<<25)
#define  SUBHIT_MNEDGES   (1<<26)
#define  SUBHIT_MNDIAGONALS   (1<<27)
  Hit-test on "diagonals" of polygons - MNDiagonalHitData is the type of HitData returned.
#define  SUBHIT_MNTYPEMASK   (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES|SUBHIT_MNDIAGONALS)
Subdivision Flags
#define  MN_SUBDIV_NEWMAP   0x01
#define  MN_SUBDIV_HIDE_INTERNAL_EDGES   0x10

Enumerations

enum   PMeshSelLevel {
  MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, MNM_SL_FACE,
  MNM_SL_CURRENT
}
 

MNMesh selection levels.

More...

Functions

DllExport void  DiagSort (int dnum, int *diag)
  Puts diagonals in increase-by-last-index, decrease-by-first order.
DllExport int  EdgeDataType (int edID)
DllExport void *  EdgeDataDefault (int edID)
DllExport void  MNChamferDataDebugPrint (MNChamferData &mcd, int mapNum)
  Output all the data in the specified MNChamferData to the DebugPrint buffer during debug runs using using DebugPrint().
DllExport void  SelectionDistance (MNMesh &mesh, float *selDist, DWORD selFlags)
  This function computes the current distance of each vertex from the current selection.
DllExport void  SelectionDistance (MNMesh &mesh, float *selDist, int iters, DWORD selFlags)
  This function computes the current distance of each vertex from the current selection, along paths of edges.
DllExport void  ClustDistances (MNMesh &mesh, int numClusts, int *vclust, Tab< float > **clustDist)
  Computes the current distance of each vertex from the specified cluster.
DllExport void  ClustDistances (MNMesh &mesh, int numClusts, int *vclust, Tab< float > **clustDist, int iters)
  Computes the current distance of each vertex from the specified cluster.

Variables

const int  kMNNurmsHourglassLimit = 2500

Detailed Description

This file contains a number of utility classes for manipulating triangle or generalized polygon meshes.

The following files contains important grouping of constants and flags:

Definition in file mnmesh.h.


Define Documentation

#define REALLOC_SIZE   10

Definition at line 54 of file mnmesh.h.

#define MNMESH_FACEDATA_IMPL

Enables Face Data in PolyObjects:

Definition at line 57 of file mnmesh.h.

#define MNM_SELCONV_REQUIRE_ALL   0x02

Definition at line 103 of file mnmesh.h.

#define IMNMESHUTILITIES8_INTERFACE_ID   Interface_ID(0xf5235e73, 0x3b304334)

Interface id for IMNMeshUtilities8, se.g.

bridge edge methods.

Definition at line 108 of file mnmesh.h.

#define IMNTEMPDATA10_INTERFACE_ID   Interface_ID(0x56d8fa2, 0x3459c774)

Interface ID for IMNTempData10.

Definition at line 111 of file mnmesh.h.

#define MN_FACE_OPEN_REGION   (1<<8)

This face is part of a region of the mesh that is not closed, i.e.

there are 1-sided edges. This means that the mesh is not a solid object, it has gaps or holes.

Definition at line 120 of file mnmesh.h.

#define MN_FACE_CHECKED   (1<<9)

For recursive face-and-neighbor-checking

Definition at line 122 of file mnmesh.h.

#define MN_FACE_CHANGED   (1<<10)

This flag can be cleared on all faces before an operation that moves some of the vertices of an MNMesh, then set for each face touching one of the moved vertices.

This tells the parent MNMesh that these faces may need to have information such as triangulation recomputed. This flag is set by the MNMesh::SabinDoo() method.

Definition at line 127 of file mnmesh.h.

#define MN_FACE_CULLED   (1<<11)

Used to indicate a face has been culled during hit-testing.

Definition at line 129 of file mnmesh.h.

#define MAX_EDGEDATA   10

Definition at line 134 of file mnmesh.h.

#define EDATA_KNOT   0

Definition at line 135 of file mnmesh.h.

#define EDATA_CREASE   1

Definition at line 136 of file mnmesh.h.

#define MN_MESH_TEMP_1   (1<<13)

Definition at line 178 of file mnmesh.h.

#define MN_MESH_TEMP_2   (1<<14)

Definition at line 179 of file mnmesh.h.

#define MN_MESH_DONTTRISTRIP   (1<<15)

Definition at line 180 of file mnmesh.h.

#define SUBHIT_MNUSECURRENTSEL   (1<<22)

When this bit is set, the selection only and unselection only tests will use the current level (edge or face) selection when doing a vertex level hit test.

Definition at line 214 of file mnmesh.h.

#define SUBHIT_OPENONLY   (1<<23)

Definition at line 215 of file mnmesh.h.

#define SUBHIT_MNVERTS   (1<<24)

Definition at line 216 of file mnmesh.h.

#define SUBHIT_MNFACES   (1<<25)

Definition at line 217 of file mnmesh.h.

#define SUBHIT_MNEDGES   (1<<26)

Definition at line 218 of file mnmesh.h.

#define SUBHIT_MNDIAGONALS   (1<<27)

Hit-test on "diagonals" of polygons - MNDiagonalHitData is the type of HitData returned.

Definition at line 220 of file mnmesh.h.

#define SUBHIT_MNTYPEMASK   (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES|SUBHIT_MNDIAGONALS)

Definition at line 221 of file mnmesh.h.

#define MN_SUBDIV_NEWMAP   0x01

Definition at line 226 of file mnmesh.h.

#define MN_SUBDIV_HIDE_INTERNAL_EDGES   0x10

Definition at line 227 of file mnmesh.h.

#define IMNMESHUTILITIES10_INTERFACE_ID   Interface_ID(0x7b1acb31, 0x763982d5)

Definition at line 6349 of file mnmesh.h.

#define IMNMESHUTILITIES13_INTERFACE_ID   Interface_ID(0x4dfa07c3, 0x637941b0)

Definition at line 6389 of file mnmesh.h.


Enumeration Type Documentation

MNMesh selection levels.

MNM_SL_CURRENT is an acceptable argument to methods that take a selection level, indicating "use the current mesh selection level".

Enumerator:
MNM_SL_OBJECT 
MNM_SL_VERTEX 
MNM_SL_EDGE 
MNM_SL_FACE 
MNM_SL_CURRENT 

Definition at line 186 of file mnmesh.h.


Function Documentation

DllExport void DiagSort ( int  dnum,
int *  diag 
)

Puts diagonals in increase-by-last-index, decrease-by-first order.

This sorts the diagonals in the following fashion: each diagonal is reordered so that its smaller index comes first, then its larger. Then the list of diagonals is sorted so that it increases by second index, then decreases by first index. Such an ordered list for a 9-gon might be (1,3),(0,3), (0,4),(5,7),(4,7),(4,8). (This order is especially convenient for converting into triangles - it makes for a linear-time conversion.) DiagSort() uses qsort for speed.

Parameters:
int dnum

The size of the diag array - essentially double the number of diagonals.

int *diag

The diagonals.
DllExport int EdgeDataType ( int  edID )
DllExport void* EdgeDataDefault ( int  edID )
DllExport void MNChamferDataDebugPrint ( MNChamferData mcd,
int  mapNum 
)

Output all the data in the specified MNChamferData to the DebugPrint buffer during debug runs using using DebugPrint().

It is available for programmers' use, providing easy access to MNChamferData during development. It ought to be removed for release builds.

Parameters:
mcd The MNChamferData we want to investigate.
mapNum The number of map channels in the MNMesh associated with this MNChamferData . (For historical reasons, this information is not kept in the MNChamferData class.) Generally this is retrieved with a call to MNMesh::MNum().
DllExport void SelectionDistance ( MNMesh mesh,
float *  selDist,
DWORD  selFlags 
)

This function computes the current distance of each vertex from the current selection.

This is an N-Log(N) algorithm: it compares every non-selected vertex with every selected one.

Parameters:
MNMesh & mesh

The mesh we're computing distances in.

float *selDist

A pointer to an array of floats of size mesh.VNum(). This array is filled in with one float value per vertex. If this value is 0, the vertex is either selected or "on top of" a selected vertex. Otherwise it represents the distance to the closest selected vertex.

DWORD selFlags

Indicates what flag defines the hard selection we're basing this soft selection on. (MN_SEL is generally best.)
DllExport void SelectionDistance ( MNMesh mesh,
float *  selDist,
int  iters,
DWORD  selFlags 
)

This function computes the current distance of each vertex from the current selection, along paths of edges.

NOTE: This is an n-log-n algorithm: it compares every non-selected vertex with every selected one.

Parameters:
MNMesh & mesh

The mesh we're computing distances in.

float *selDist

A pointer to an array of floats of size mesh.VNum(). This array is filled in with one float value per vertex. If this value is 0, the vertex is either selected or "on top of" a selected vertex. Otherwise it represents the distance to the closest selected vertex. Values of -1 are used to indicate vertices that are more that iters edges away from any selected vertex.

int iters

This indicates the maximum number of edges the algorithm may travel along in finding the distance between vertices. (Maximum path length.).

DWORD selFlags

Indicates what flag defines the hard selection we're basing this soft selection on. (MN_SEL is generally best.)
DllExport void ClustDistances ( MNMesh mesh,
int  numClusts,
int *  vclust,
Tab< float > **  clustDist 
)

Computes the current distance of each vertex from the specified cluster.

If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters.

NOTE: This is an n-log-n algorithm for each cluster: it compares every vertex not in the cluster with every vertex in it.

Parameters:
MNMesh & mesh

The MNMesh these cluster distances are based on.

int numClusts

The number of clusters available.

int *vclust

A pointer into the vertex cluster table.

Tab<float> **clustDist

An array of pointers to tables which will be filled with one float value per vertex. The table pointed to by clustDist[i] contains the cluster distances for cluster i. Note that clustDist must be allocated, for instance by clustDist = new (Tab<float>*)[numClusts], and must have its members allocated, for instance by clustDist[i] = new Tab<float>, by the calling routine. If a value in a table is 0, the vertex is either selected or on top of a vertex in the cluster. Otherwise it represents the distance to the closest selected vertex. If useEdgeDist is TRUE, values of -1.0 are returned for vertices with no edgeIts-length path to a vertex in the cluster.
DllExport void ClustDistances ( MNMesh mesh,
int  numClusts,
int *  vclust,
Tab< float > **  clustDist,
int  iters 
)

Computes the current distance of each vertex from the specified cluster.

If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters.

NOTE: This algorithm takes time proportional to the number of verts in each cluster times iters times the number of clusters.

Parameters:
MNMesh & mesh

The MNMesh these cluster distances are based on.

int numClusts

The number of clusters available.

int *vclust

A pointer into the vertex cluster table.

Tab<float> **clustDist

An array of pointers to tables which will be filled with one float value per vertex. The table pointed to by clustDist[i] contains the cluster distances for cluster i. Note that clustDist must be allocated, for instance by clustDist = new (Tab<float> *)[numClusts], and must have its members allocated, for instance by clustDist[i] = new Tab<float>, by the calling routine. If a value in a table is 0, the vertex is either selected or on top of a vertex in the cluster. Otherwise it represents the distance to the closest selected vertex. Values of -1.0 are returned for vertices with no iters-length path to a vertex in the cluster.

int iters

The maximum edge path length to compute distance along (in number of edges).

Variable Documentation

const int kMNNurmsHourglassLimit = 2500

Definition at line 100 of file mnmesh.h.