3ds Max C++ API Reference
mnmesh.h File Reference
#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"

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 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
 
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...
 
class  IMNMeshUtilities14
 Extends the MNMeshUtilities class for 2018 Update 4, adding new functionality applied on a MNMesh. More...
 
class  IMNMeshUtilities15
 Extends the MNMeshUtilities class for 2019.1. More...
 
class  IMNMeshUtilities16
 Extends the MNMeshUtilities class for 2020. More...
 
class  IMNMeshUtilities17
 Extends the MNMeshUtilities class for 2020 Update 1. More...
 
class  IMNMeshUtilities18
 Extends the MNMeshUtilities class for 2020 Update 2. More...
 
class  IMNFaceExtrude
 Interface class for handling interactive face extrude operations, such as the shift-drag face extrude implemented in Editable Poly and Edit Poly. More...
 

Namespaces

 MaxGraphics
 
 MaxGraphics::BackfaceWireframe
 
 MaxSDK
 
 MaxSDK::Graphics
 

Macros

#define REALLOC_SIZE   10
 
#define MNMESH_FACEDATA_IMPL
 Enables Face Data in PolyObjects: More...
 
#define MNM_SELCONV_REQUIRE_ALL   0x02
 
#define QCHAM_OPTION_ELWOOD_DEFAULTS   (0)
 Elwood (Max 2015) defaults. More...
 
#define QCHAM_OPTION_LIMIT_EFFECT   (1<<0)
 Provides legacy-style limiting of chamfering. More...
 
#define QCHAM_OPTION_QUAD_INTERSECTIONS   (1<<1)
 Provides quad intersections. More...
 
#define QCHAM_OPTION_FIXED_EDGE_WEIGHTS   (1<<2)
 Provides parallel edges on chamfers. More...
 
#define QCHAM_OPTION_VARIABLE_EDGE_WEIGHTS   (1<<3)
 Provides variable-weight chamfered edges based on Edge Crease value. More...
 
#define QCHAM_OPTION_ABSOLUTE_EDGE_WEIGHTS   (1<<7)
 Provides per-edge chamfer weight define by absolute weighting values and scale factor; weight is constant for a particular edge, implying differing weights for edges meeting at a cluster. More...
 
#define QCHAM_OPTION_USE_INSET   (1<<4)
 Provides insets from chamfered edges. More...
 
#define QCHAM_OPTION_SUPPORT_LOOP_INSET   (1<<10)
 When set, any insets are formed following the Flow Loop definition, otherwise, the Face Inset definition is employed; this parameter has no effect when insets are not requested. More...
 
#define QCHAM_OPTION_FORCE_POSITIVE_OFFSET   (1<<5)
 Forces a positive offset value to be applied at mitered edges. More...
 
#define QCHAM_OPTION_USE_CONSTANT_OFFSET   (1<<6)
 Uses a constant offset value at each chamfer cluster, regardless of cluster type. More...
 
#define QCHAM_OPTION_BIAS_END_POINTS   (1<<8)
 Adjusts tension-0.5 endpoint and hub point positions when radius bias is adjusted. More...
 
#define QCHAM_OPTION_VARIABLE_DEPTH   (1<<9)
 Indicates variable edge chamfer depth specification, fetched from the mesh's Depth channel. More...
 
#define QCHAM_OPTION_PATCH_CORNERS   (1<<11)
 Indicates use of "patch" type corners (otherwise identical to "Uniform") More...
 
#define QCHAM_OPTION_RADIAL_CORNERS   (1<<12)
 Indicates use of "radial" type corners (otherwise identical to "Uniform") More...
 
#define QCHAM_VERSION_ELWOOD   (0)
 Elwood (3ds Max 2015) More...
 
#define QCHAM_VERSION_PHOENIX   (100)
 Phoenix (3ds Max 2016) - Includes edge selection fix. More...
 
#define QCHAM_VERSION_IMOOGI   (200)
 Imoogi (3ds Max 2018) - Includes Quad Intersections upgrade. More...
 
#define QCHAM_VERSION_ATHENA_ALPHA1   (290)
 Athena (3ds Max 2020) - New options starting with QCHAM_OPTION_FIXED_EDGE_WEIGHTS. More...
 
#define QCHAM_VERSION_ATHENA_UPDATE1   (295)
 Athena (3ds Max 2020) Update 1 - New functionality, and modifications to some geometric calculations, such as chamfer inset point positions, for improved appearance. More...
 
#define QCHAM_VERSION_ATHENA_UPDATE2   (300)
 Athena (3ds Max 2020) Update 2 - New functionality, and fix for texture vertices on "shared" edge types. More...
 
#define QCHAM_VERSION_ATHENA_UPDATE3   (305)
 Athena (3ds Max 2020) Update 3 - Improvements for the chamfered surface geometry at concave face corners. More...
 
#define QCHAM_VERSION_THESEUS   (400)
 Theseus (3ds Max 2021) - Extending new chamfer functiontality to EditPoly modifier. More...
 
#define QCHAM_VERSION_THESEUS_UPDATE1   (405)
 Theseus (3ds Max 2021) Update 1 - Improved treatment for chamfers on nearly-flat edges. More...
 
#define QCHAM_VERSION_THESEUS_UPDATE3   (410)
 Theseus (3ds Max 2021) Update 3 - Lower minimum chamfer amount to FLT_EPSILON from 0.001. More...
 
#define QCHAM_VERSION_HEIMDALL_UPDATE1   (500)
 Heimdall (3ds Max 2022) Update 1 - Impose a minimum edge weight for By Weight chamfers to rectify a regression in the zero weight case. More...
 
#define MN_FACE_OPEN_REGION   (1<<8)
 This face is part of a region of the mesh that is not closed, i.e. More...
 
#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. More...
 
#define MN_FACE_CULLED   (1<<11)
 Used to indicate a face has been culled during hit-testing. More...
 
#define MN_FACE_CREATED   (1<<12)
 Used to indicate a face has been created by an operation. More...
 
#define MAX_EDGEDATA   10
 Developer defined data. More...
 
#define EDATA_KNOT   0
 The edge knot data. More...
 
#define EDATA_CREASE   1
 The crease data. More...
 
#define EDATA_COLOR   2
 
#define EDATA_DEPTH   3
 Chamfer depth data. More...
 
#define MN_MESH_NONTRI   (1<<0)
 At least 2 triangles have been joined. More...
 
#define MN_MESH_FILLED_IN   (1<<1)
 If set, all topological links, such as the list of edges, are complete. More...
 
#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. More...
 
#define MN_MESH_NO_BAD_VERTS   (1<<3)
 This indicates that the mesh has had its vertices checked and "bad" ones eliminated by EliminateBadVerts. More...
 
#define MN_MESH_VERTS_ORDERED   (1<<4)
 Set if face and edge tables in each vertex are ordered by the methods MNMesh::OrderVerts(). More...
 
#define MN_MESH_FACE_NORMALS_INVALID   (1<<6)
 Set if any of the face normals (fnorm) have become invalid. More...
 
#define MN_MESH_HAS_VOLUME   (1<<7)
 This mesh has at least one connected component which contains volume, i.e. More...
 
#define MN_MESH_HITTEST_REQUIRE_ALL   (1<<8)
 
#define MN_MESH_DIASBLE_NULL_EDGE_CHECK   (1<<9)
 When set, disables the "null" edge check and remediation in EliminateNullEdges. More...
 
#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. More...
 
#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. More...
 
#define MNDISP_SELVERTS   0x02
 Display selected vertices. More...
 
#define MNDISP_SELFACES   0x04
 Display selected faces. More...
 
#define MNDISP_SELEDGES   0x08
 Display selected edges. More...
 
#define MNDISP_NORMALS   0x10
 Display face normals. More...
 
#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)
More...
 
#define MNDISP_BEEN_DISP   0x40
 Set when the MNMesh has been displayed (at the end of the render method.) More...
 
#define MNDISP_DIAGONALS   0x80
 Set when diagonals should be displayed. More...
 
#define MNDISP_HIDE_SUBDIVISION_INTERIORS   0x100
 
#define MNDISP_USE_VERTEX_COLORS   0x200
 Set when vertex color data (VDATA_COLOR, if present) should be used to draw edges (used by OpenSubdiv) More...
 
#define MNDISP_USE_EDGE_COLORS   0x400
 Set when edge color data (EDATA_COLOR, if present) should be used to draw vertices (used by OpenSubdiv) More...
 
#define SUBHIT_MNUSECURRENTSEL   (1<<22)
 
#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. More...
 
#define SUBHIT_MNTYPEMASK   (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES|SUBHIT_MNDIAGONALS)
 
#define SUBHIT_IGNOREOPENBACKFACE   (1 << 29)
 Indicates that back face culling should be ignored for open edges/vertices. More...
 
#define MN_SUBDIV_NEWMAP   0x01
 
#define MN_SUBDIV_HIDE_INTERNAL_EDGES   0x10
 
#define IMNMESHUTILITIES10_INTERFACE_ID   Interface_ID(0x7b1acb31, 0x763982d5)
 
#define IMNMESHUTILITIES13_INTERFACE_ID   Interface_ID(0x4dfa07c3, 0x637941b0)
 
#define IMNMESHUTILITIES14_INTERFACE_ID   Interface_ID(0x484a5448, 0x22ae6acd)
 
#define IMNMESHUTILITIES15_INTERFACE_ID   Interface_ID(0x484a5448, 0x22ae6ace)
 
#define IMNMESHUTILITIES16_INTERFACE_ID   Interface_ID(0x2555776b, 0x61143448)
 
#define IMNMESHUTILITIES17_INTERFACE_ID   Interface_ID(0x355a5448, 0x1214322c)
 
#define IMNMESHUTILITIES18_INTERFACE_ID   Interface_ID(0x6c6e34f7, 0x798f5a9d)
 
#define IMNFACEEXTRUDE_INTERFACE_ID   Interface_ID(0x8a8c52b5, 0x970d7e1b)
 
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. More...
 
#define MN_DEAD   (1<<1)
 Indicates that a component is not used and should be ignored. More...
 
#define MN_TARG   (1<<2)
 Indicates that a component is targeted. More...
 
#define MN_BACKFACING   (1<<3)
 Indicates that the vertex faces "backwards" in the current viewport. More...
 
#define MN_HIDDEN   (1<<4)
 Indicates that a component is selected. More...
 
#define MN_CACHEINVALID   (1<<5)
 Indicates that a component is selected. More...
 
#define MN_INFOREGROUND   (1<<7)
 Tags a face as not renderable but can be hit-test. More...
 
#define MN_WHATEVER   (1<<16)
 
#define MN_LOCAL_SEL   (1<<17)
 Alternate selections (not passed up the pipe). More...
 
#define MN_HITTEST_CULLED   (1<<18)
 Used to indicate culled components (neither selected nor not selected) in window-region hit testing. More...
 
#define MN_USER   (1<<24)
 Any value above this can be used by applications. More...
 
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. More...
 
#define MN_VERT_WELDED   (1<<9)
 Used by MNMesh::WeldBorderVerts() More...
 
#define MN_VERT_SUBDIVISION_CORNER   (1<<10)
 Track which vertices are direct "descendants" of the original cage vertices in subdivision. More...
 
Edge flags


#define MN_EDGE_INVIS   (1<<8)
 Both faces using this edge consider it invisible. More...
 
#define MN_EDGE_NOCROSS   (1<<9)
 This edge should not be crossed in algorithms like MNMesh::SabinDoo that can mix faces across edges. More...
 
#define MN_EDGE_MAP_SEAM   (1<<10)
 Track which edges are direct descendants of the original cage edges in subdivision. More...
 
#define MN_EDGE_SUBDIVISION_BOUNDARY   (1<<11)
 Track unwanted edges created by Cut, so they might be removed later. More...
 
#define MN_EDGE_CUT_EXTRA   (1<<12)
 Used with MNMesh::CutPrepare() and MNMEsh::CutCleanUp() More...
 
#define MN_EDGE_WAS_PROCESSED   (1<<13)
 This flag is a general-purpose informational one that methods can set to indicate edges that were processed as part of their work, so that callers can act on them if desired. More...
 
Interface IDs
#define IMNMESHUTILITIES8_INTERFACE_ID   Interface_ID(0xf5235e73, 0x3b304334)
 Interface id for IMNMeshUtilities8, se.g. More...
 
#define IMNTEMPDATA10_INTERFACE_ID   Interface_ID(0x56d8fa2, 0x3459c774)
 Interface ID for IMNTempData10. More...
 
Internal flags
#define MN_MESH_TEMP_1   (1<<13)
 
#define MN_MESH_TEMP_2   (1<<14)
 
#define MN_MESH_DONTTRISTRIP   (1<<15)
 
#define MN_MESH_SUBSELECTION_INVALID   (1<<17)
 
#define MN_MESH_SOFTSELECTION_WEIGHT_INVALID   (1<<18)
 
#define MN_MESH_USE_MAX2012_WELD_MATH   (1<<19)
 
#define MN_CLEARMAPCHANNEL   (1<<20)
 Mesh Flag if set new tv face data will be cleared otherwise it will use a default planar. More...
 
#define MN_MESH_VERTEXCOLOR_INVALID   (1<<21)
 
#define MN_MESH_FACEFLAGS_INVALID   (1<<22)
 

Enumerations

enum  MN_QCHAM_TYPE { QCHAM_CHAMFEREDOBJECT =0 , QCHAM_NOCHAMFERS , QCHAM_CHAMFERSONLY }
 
enum  PMeshSelLevel {
  MNM_SL_OBJECT , MNM_SL_VERTEX , MNM_SL_EDGE , MNM_SL_FACE ,
  MNM_SL_CURRENT
}
 MNMesh selection levels. More...
 

Functions

DllExport int EdgeDataType (int edID)
 
DllExport voidEdgeDataDefault (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(). More...
 
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. More...
 
DllExport void ClustDistances (MNMesh &mesh, int numClusts, int *vclust, Tab< float > **clustDist)
 Computes the current distance of each vertex from the specified cluster. More...
 
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. More...
 

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:
- \ref MNMesh_Component_Flags
- \ref MN_MESH_Flags
- \ref MNDISP_Flags 

Macro Definition Documentation

◆ REALLOC_SIZE

#define REALLOC_SIZE   10

◆ MNMESH_FACEDATA_IMPL

#define MNMESH_FACEDATA_IMPL

Enables Face Data in PolyObjects:

◆ MNM_SELCONV_REQUIRE_ALL

#define MNM_SELCONV_REQUIRE_ALL   0x02

◆ IMNMESHUTILITIES8_INTERFACE_ID

#define IMNMESHUTILITIES8_INTERFACE_ID   Interface_ID(0xf5235e73, 0x3b304334)

Interface id for IMNMeshUtilities8, se.g.

bridge edge methods.

◆ IMNTEMPDATA10_INTERFACE_ID

#define IMNTEMPDATA10_INTERFACE_ID   Interface_ID(0x56d8fa2, 0x3459c774)

◆ MN_MESH_TEMP_1

#define MN_MESH_TEMP_1   (1<<13)

◆ MN_MESH_TEMP_2

#define MN_MESH_TEMP_2   (1<<14)

◆ MN_MESH_DONTTRISTRIP

#define MN_MESH_DONTTRISTRIP   (1<<15)

◆ MN_MESH_SUBSELECTION_INVALID

#define MN_MESH_SUBSELECTION_INVALID   (1<<17)

Mesh flag to determine if selection state of vertices, edges or faces has changed or not.

◆ MN_MESH_SOFTSELECTION_WEIGHT_INVALID

#define MN_MESH_SOFTSELECTION_WEIGHT_INVALID   (1<<18)

Mesh flag to determine if soft selection weight of vertices has changed or not.

◆ MN_MESH_USE_MAX2012_WELD_MATH

#define MN_MESH_USE_MAX2012_WELD_MATH   (1<<19)

Mesh flag to determine whether to use a different math for MNMesh::WeldBorderVerts (float thresh, DWORD flag) since between 2012 and 2013 the FPU math changed slightly and this corrects for that

◆ MN_CLEARMAPCHANNEL

#define MN_CLEARMAPCHANNEL   (1<<20)

Mesh Flag if set new tv face data will be cleared otherwise it will use a default planar.

◆ MN_MESH_VERTEXCOLOR_INVALID

#define MN_MESH_VERTEXCOLOR_INVALID   (1<<21)

Mesh flag that means any of the vertex color channel data is changed.

◆ MN_MESH_FACEFLAGS_INVALID

#define MN_MESH_FACEFLAGS_INVALID   (1<<22)

Mesh flag that means mesh's face flags have changed.

◆ IMNMESHUTILITIES10_INTERFACE_ID

#define IMNMESHUTILITIES10_INTERFACE_ID   Interface_ID(0x7b1acb31, 0x763982d5)

◆ IMNMESHUTILITIES13_INTERFACE_ID

#define IMNMESHUTILITIES13_INTERFACE_ID   Interface_ID(0x4dfa07c3, 0x637941b0)

◆ IMNMESHUTILITIES14_INTERFACE_ID

#define IMNMESHUTILITIES14_INTERFACE_ID   Interface_ID(0x484a5448, 0x22ae6acd)

◆ IMNMESHUTILITIES15_INTERFACE_ID

#define IMNMESHUTILITIES15_INTERFACE_ID   Interface_ID(0x484a5448, 0x22ae6ace)

◆ IMNMESHUTILITIES16_INTERFACE_ID

#define IMNMESHUTILITIES16_INTERFACE_ID   Interface_ID(0x2555776b, 0x61143448)

◆ IMNMESHUTILITIES17_INTERFACE_ID

#define IMNMESHUTILITIES17_INTERFACE_ID   Interface_ID(0x355a5448, 0x1214322c)

◆ IMNMESHUTILITIES18_INTERFACE_ID

#define IMNMESHUTILITIES18_INTERFACE_ID   Interface_ID(0x6c6e34f7, 0x798f5a9d)

◆ IMNFACEEXTRUDE_INTERFACE_ID

#define IMNFACEEXTRUDE_INTERFACE_ID   Interface_ID(0x8a8c52b5, 0x970d7e1b)

Enumeration Type Documentation

◆ PMeshSelLevel

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 
@ MNM_SL_VERTEX
Definition: mnmesh.h:254
@ MNM_SL_OBJECT
Definition: mnmesh.h:254
@ MNM_SL_FACE
Definition: mnmesh.h:254
@ MNM_SL_CURRENT
Definition: mnmesh.h:254
@ MNM_SL_EDGE
Definition: mnmesh.h:254

Function Documentation

◆ EdgeDataType()

DllExport int EdgeDataType ( int  edID)

◆ EdgeDataDefault()

DllExport void* EdgeDataDefault ( int  edID)

◆ MNChamferDataDebugPrint()

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
mcdThe MNChamferData we want to investigate.
mapNumThe 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().

◆ SelectionDistance()

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

◆ ClustDistances() [1/2]

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.

◆ ClustDistances() [2/2]

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

◆ kMNNurmsHourglassLimit

const int kMNNurmsHourglassLimit = 2500