Class MEdge

3DS Max Plug-In SDK

Class MEdge

See Also: Class AdjEdgeList, Class Mesh.

class MEdge

Description:

This class describes a single edge of a mesh object that is adjacent to a vertex. This is an edge that is coming out of the vertex. This is used in adjacency lists.

Data Members:

public:

DWORD f[2];

The indices into the meshes face table of the two faces that share this edge.

DWORD v[2];

The indices into the meshes vertex table of the two vertices of this edge.

Methods:

public:

Prototype:

int EdgeIndex(Face *faces, int side);

Remarks:

Returns the index of the edge in the face on side side. So: given a Mesh mesh and an MEdge *me, int eid = me->EdgeIndex (mesh.faces, 0); then mesh.faces[me->f[0]].v[eid] and mesh.faces[me->f[0]].v[(eid+1)%3] are the endpoints of the edge.

In particular, mesh.edgeSel[me->f[0]*3+eid] tells whether this edge is selected.

Parameters:

Face *faces

The list of faces from the mesh.

int side

Either 0 or 1, indicating whether we should find this result for the face on side 0 or on side 1.

Prototype:

BOOL Selected(Face *faces, BitArray &esel);

Remarks:

Returns TRUE if this edge is selected on either side; or FALSE if it is not selected on either.

Parameters:

Face *faces

The list of faces from the mesh.

BitArray &esel

The edge selection BitArray from the mesh.

Prototype:

BOOL Visible(Face *faces);

Remarks:

Returns TRUE if this edge is visible on either side; or FALSE if it is not visible on either.

Parameters:

Face *faces

The list of faces from the mesh.

Prototype:

BOOL Hidden(Face *faces);

Remarks:

Returns TRUE if all the faces using this edge are hidden; otherwise FALSE.

Parameters:

Face *faces

The list of faces from the mesh.

Prototype:

Point3 Center(Point3 *verts);

Remarks:

Returns the center of this edge.

Parameters:

Point3 *verts

The list of vertices from the mesh.

Prototype:

BOOL AFaceSelected(BitArray &fsel);

Remarks:

Returns TRUE if one (or both) of the faces sharing the edge is selected; otherwise FALSE.

Parameters:

BitArray &fsel

The face selection bit array.

Prototype:

Point3 ButterFlySubdivide(Mesh *mesh, AdjFaceList *af, float tens);

Remarks:

Returns a point suitable for use in standard tessellation.

Parameters:

Mesh *mesh

A pointer to the associated mesh.

AdjFaceList *af

A pointer to the associated AdjFaceList.

float tens

The tension parameter, as seen in the Tessellate modifier.

Prototype:

UVVert ButterFlyMapSubdivide (Mesh *mesh, AdjFaceList *af, float tens, int mp, bool & seam, UVVert & side2);

Remarks:

This method is available in release 4.0 and later only.

This method creates a map vertex for the middle of this edge using the Butterfly tessellation scheme. Designed to create map vertices to go with the vertex created by ButterFlySubdivide().

Parameters:

Mesh *mesh

A pointer to the associated mesh.

AdjFaceList *af

A pointer to the associated AdjFaceList.

float tens

The tension parameter, as seen in the Tessellate modifier.

int mp

The map channel we want to get a result for.

bool & seam

If this is set to true by the algorithm, then there's a mapping seam on this edge, and different map vertices should be used on each side.

UVVert & side2

If there's a seam, this contains the mapping result for the second side. The return value matches the mapping scheme on face f[0]; side2 matches the scheme on face f[1].

Return Value:

The desired mapping coordinates.

Prototype:

DWORD OtherVert(DWORD vv);

Remarks:

Returns the index of the other vertex using this edge.

Parameters:

DWORD vv

The index of a vertex using the edge.

Prototype:

DWORD OtherFace(DWORD ff);

Remarks:

Returns the index of the other face using this edge.

Parameters:

DWORD ff

The index of a face using this edge.