Class AdjEdgeList

3DS Max Plug-In SDK

Class AdjEdgeList

See Also: Class DWORDTab, Template Class Tab, Class MEdge, Class Mesh.

class AdjEdgeList

Description:

This class represents an edge adjacency list for meshes. For any given vertex in a mesh this class has a table of DWORDs. These DWORDs are indices into the edge table (Tab<MEdge> edge). The edges table stores the edges adjacent to the vertex. So, each vertex has a list of indices into the edge list that give it the list of edges adjacent to the vertex. All methods of the class are implemented by the system.

Data Members:

public:

DWORDTab *list;

This is an array of DWORDTabs, one per vertex. The Tab is a list of indices into the edge list, one for each edge adjacent to the vertex.

Tab<MEdge> edges;

The table of edges.

int nverts;

The size of list.

Methods:

Prototype:

AdjEdgeList(Mesh& amesh);

Remarks:

Constructor. Builds an adjacency list from the specified mesh. This class require the mesh to be constructed so that each edge has exactly one or two faces.

Parameters:

Mesh& amesh

The mesh to build the adjacency list from.

Prototype:

~AdjEdgeList();

Remarks:

Destructor. Deletes the list.

Prototype:

int FindEdge(DWORD v0, DWORD v1);

Remarks:

Finds the edge in the edge table that has the two specified vertices.

Parameters:

DWORD v0, DWORD v1

The vertices.

Return Value:

The index into the edge table.

Prototype:

int FindEdge(DWORDTab& vmap, DWORD v0, DWORD v1);

Remarks:

This method is used internally as part of the Optimize modifier.

Prototype:

void TransferEdges(DWORD from, DWORD to, DWORD except1,

 DWORD except2, DWORD del);

Remarks:

This method is used internally as part of the Optimize modifier.

Prototype:

void RemoveEdge(DWORD from, DWORD e);

Remarks:

This method is used internally as part of the Optimize modifier.

Prototype:

void OrderVertEdges(DWORD v, Face *faces, Tab<DWORD> *flist=NULL);

Remarks:

This method is available in release 3.0 and later only.

Each vertex has a list of edges in the data member AdjEdgeList::list. This method reorders the elements of that list so that the edges are in order going around the vertex. The direction should be counterclockwise as seen from outside the mesh surface, though this necessarily breaks down with some rats' nest situations.

Parameters:

DWORD v

The vertex whose edges should be ordered.

Face *faces

A pointer to the faces for this mesh.

Tab<DWORD> *flist=NULL

If non-NULL, this points to an array where the faces using this vertex should be stored (in order).

Prototype:

void OrderAllEdges(Face *faces);

Remarks:

This method is available in release 3.0 and later only.

This method simply calls OrderVertEdges() on all the vertices.

Parameters:

Face *faces

A pointer to the faces for this mesh.

Prototype:

void GetFaceList(DWORD v, Tab<DWORD> & flist);

Remarks:

This method is available in release 3.0 and later only.

This places a list of all faces using this vertex in flist. The faces are in no particular order.

Parameters:

DWORD v

The vertex to check.

Tab<DWORD> & flist

The table of faces.

Prototype:

void AddEdgeToVertex(DWORD v,DWORD e);

Remarks:

This method is available in release 3.0 and later only.

Appends the specified edge to the specified vertex.

Parameters:

DWORD v

The vertex the edge is added to.

DWORD e

The edge to add.

Prototype:

void AddEdge(DWORD fi, DWORD v1, DWORD v2);

Remarks:

This is used internally.

Operators:

Prototype:

DWORDTab& operator[](int i);

Remarks:

Array access operator. Returns the 'i-th' list element.