Class MNEdgeClusters

3DS Max Plug-In SDK

Class MNEdgeClusters

See Also: Class MNTempData, Class MNMesh

class MNEdgeClusters

Description:

This class is available in release 4.0 and later only.

This class represents a list of edge "clusters" for a given MNMesh. A typical application would be in Editable Poly, where the user has selected a two separate groups of edges on different parts of the mesh and wants to rotate both around their local centers. Each "cluster" is a contiguous group of selected edges (ie they all touch each other). This class is only defined in relation to some MNMesh.

For convenient caching, it is recommended that you use this class through the MNTempData class.

Data Members:

public:

Tab<int> clust;

The cluster IDs of all the edges – this table has size MNMesh::nume. clust[i] is UNDEFINED if edge i is not in any cluster.

int count;

The total number of clusters.

Methods:

public:

Prototype:

MNEdgeClusters (MNMesh &mesh, DWORD clusterFlags);

Remarks:

Constructor.

Parameters:

MNMesh &m

The mesh these clusters are based on.

DWORD clusterFlags

The edge flags to cluster the edges by.

For instance, if this value was set to MN_SEL, then edges would be clustered by their selection.

Prototype:

int operator[](int i);

Remarks:

Index operator to access cluster data.

Default Implementation:

{ return clust[i]; }

Prototype:

void MakeVertCluster (MNMesh &mesh, Tab<int> & vclust);

Remarks:

This method will create a list of cluster IDs for vertices.

Parameters:

MNMesh &m

The mesh associated with these MNEdgeClusters.

Tab<int> & vclust

This is where the output goes: vclust is set to size MNMesh::numv, and the value of each entry in this table tells which cluster the vertex has been assigned to, based on the edges using it. If vertex "v" is not in any clusters (i.e. none of the edges that use it are in any clusters), vclust[v] is UNDEFINED.

Prototype:

void GetNormalsCenters (MNMesh &mesh, Tab<Point3> & norm, Tab<Point3> & ctr);

Remarks:

This method extracts normal and center information for each of the edge clusters.

Parameters:

MNMesh &m

The mesh associated with these MNEdgeClusters.

Tab<Point3> & norm

This table has its size set to the number of clusters in the cluster list. Normals are computed as the normalized average of the normal vectors of all edges in the cluster.

Tab<Point3> & ctr

This table has its size set to the number of clusters in the cluster list. Centers are the average location of the edge centers -- thus a point on three edges in the same cluster has more weight than a point on only one edge in the cluster.