Public Member Functions
PolygonFace Class Reference

Detailed Description

The PolygonFace object gives access to the geometry polygons of an X3DObject's primitive.

See also:
PolygonMesh.GetPolygons(), CPolygonFaceArray
Example:
        using namespace XSI;
        Application app;
        Model root = app.GetActiveSceneRoot();

        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube );

        PolygonMesh mesh( myCube.GetActivePrimitive().GetGeometry() );
        PolygonFace face( mesh.GetPolygons().GetItem(0) );

        app.LogMessage(L"Number of nodes: " + CValue(face.GetNodes().GetCount()).GetAsText() );

#include <xsi_polygonface.h>

Inheritance diagram for PolygonFace:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  PolygonFace ()
  ~PolygonFace ()
  PolygonFace (const CRef &in_ref)
  PolygonFace (const PolygonFace &in_obj)
bool  IsA (siClassID in_ClassID) const
siClassID  GetClassID () const
PolygonFace operator= (const PolygonFace &in_obj)
PolygonFace operator= (const CRef &in_ref)
CPolygonNodeRefArray  GetNodes () const
CVertexRefArray  GetVertices () const
CEdgeRefArray  GetEdges () const
CVertexRefArray  GetNeighborVertices (LONG in_lDistance=1) const
CEdgeRefArray  GetNeighborEdges (LONG in_lDistance=1) const
CPolygonFaceRefArray  GetNeighborPolygons (LONG in_lDistance=1) const
CPolygonFaceRefArray  GrowNeighborPolygons (LONG in_lDistance=1) const
CLongArray  GetTriangleSubIndexArray () const
ULONG  GetTurnInternalEdgeOffset () const

Constructor & Destructor Documentation

Default constructor.

Default destructor.

PolygonFace ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
PolygonFace ( const PolygonFace in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID ) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from Facet.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from Facet.

PolygonFace& operator= ( const PolygonFace in_obj )

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_obj constant class object.
Returns:
The new PolygonFace object.
PolygonFace& operator= ( const CRef in_ref )

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_ref constant class object.
Returns:
The new PolygonFace object.

Reimplemented from Facet.

CPolygonNodeRefArray GetNodes ( ) const

Returns an array of PolygonNode objects on this PolygonFace object.

Returns:
Array of PolygonNode objects.
CVertexRefArray GetVertices ( ) const

Returns an array of Vertex objects on this PolygonFace object.

Returns:
Array of Vertex objects.
CEdgeRefArray GetEdges ( ) const

Returns an array of Edge objects on this PolygonFace object.

Returns:
Array of Edge objects.
CVertexRefArray GetNeighborVertices ( LONG  in_lDistance = 1 ) const

Returns an array of Vertex neighbors within a given distance.If the distance is 1 all Vertex objects comprising the current PolygonFace are returned in counter-clockwise order.

Parameters:
in_lDistance Value representing the degree of neighborhood (eg: degree=2 for a polygon means its adjacent vertices plus the adjacent vertices of the adjacent polygons).
Returns:
Array of Vertex objects
CEdgeRefArray GetNeighborEdges ( LONG  in_lDistance = 1 ) const

Returns an array of Edge neighbors within a given distance. If the distance is 1 all Edge objects comprising the current PolygonFace are returned in counter-clockwise order.

Parameters:
in_lDistance Value representing the degree of neighborhood (eg: degree=2 for a polygon means its adjacent vertices plus the adjacent vertices of the adjacent polygons).
Returns:
Array of Edge objects.
CPolygonFaceRefArray GetNeighborPolygons ( LONG  in_lDistance = 1 ) const

Returns an array of PolygonFace neighbors within a given distance. If the distance is 1 all PolygonFace objects that share an Edge with the current PolygonFace are returned in counter-clockwise order.

Parameters:
in_lDistance Value representing the degree of neighborhood (eg: degree=2 for a polygon means its adjacent vertices plus the adjacent vertices of the adjacent polygons).
Returns:
Array of PolygonFace objects.
CPolygonFaceRefArray GrowNeighborPolygons ( LONG  in_lDistance = 1 ) const

Returns an array of PolygonFace objects that are adjacent to this PolygonFace object, within a given distance.

Parameters:
in_lDistance Value representing the degree of neighborhood (eg: degree=2 for a polygon means its adjacent vertices plus the adjacent vertices of the adjacent polygons).
Returns:
Array of PolygonFace objects.
CLongArray GetTriangleSubIndexArray ( ) const

Returns a packed array of triangulation descriptions corresponding to the tesselation of the polygon. The polygon is tesselated into (Facet::NbPoints - 2) triangles, and 3 indices in the range (0..Facet::NbPoints-1) are returned for each triangle. Each index triplet describes a subtriangle of the polygon, and the indices correspond to the vertex or node ordering within the polygon.

Notice that the triangulation of a polygon may change accordingly to the deformation of the geometry.

Returns:
Array of packed triangle subindices triplets.
Example:
This example demonstrates how to describe the triangulation of some polygons.
        using namespace XSI;
        Application app;
        Model root = app.GetActiveSceneRoot();

        X3DObject meshSphereObj;
        root.AddGeometry( L"Sphere", L"MeshSurface", L"", meshSphereObj );
        PolygonMesh meshSphereGeom( meshSphereObj.GetActivePrimitive().GetGeometry() );

        CPolygonFaceRefArray polygons = meshSphereGeom.GetPolygons();

        LONG i;
        for(i = 0; i < polygons.GetCount(); i++)
        {
            PolygonFace polygon = polygons[i];
            LONG nbTriangles = polygon.GetNbPoints()-2;

            CLongArray polygonNeiVtxIndices = polygon.GetVertices().GetIndexArray();
            CLongArray polygonNeiNodIndices = polygon.GetNodes().GetIndexArray();
            CLongArray polygonTriSubIndices = polygon.GetTriangleSubIndexArray();

            LONG j;
            for(j = 0; j < nbTriangles; j++)
            {
                app.LogMessage(L"SubTriangle " + CString(CValue(j)) + L" of Polygon " + CString(CValue(i)) + L" correspond to vertices (" +
                    CString(CValue(polygonNeiVtxIndices[polygonTriSubIndices[j*3]])) + L", " +
                    CString(CValue(polygonNeiVtxIndices[polygonTriSubIndices[j*3+1]])) + L", " +
                    CString(CValue(polygonNeiVtxIndices[polygonTriSubIndices[j*3+2]])) + L") and nodes (" +
                    CString(CValue(polygonNeiNodIndices[polygonTriSubIndices[j*3]])) + L", " +
                    CString(CValue(polygonNeiNodIndices[polygonTriSubIndices[j*3+1]])) + L", " +
                    CString(CValue(polygonNeiNodIndices[polygonTriSubIndices[j*3+2]])) + L").");
            }
        }
        // Expected results:
        //INFO : SubTriangle 0 of Polygon 0 correspond to vertices (9, 2, 0) and nodes (0, 1, 2).
        //INFO : SubTriangle 0 of Polygon 1 correspond to vertices (2, 9, 10) and nodes (3, 4, 5).
        //INFO : SubTriangle 1 of Polygon 1 correspond to vertices (2, 10, 3) and nodes (3, 5, 6).
        //INFO : SubTriangle 0 of Polygon 2 correspond to vertices (3, 10, 11) and nodes (7, 8, 9).
        //INFO : SubTriangle 1 of Polygon 2 correspond to vertices (3, 11, 4) and nodes (7, 9, 10).
        //etc.
ULONG GetTurnInternalEdgeOffset ( ) const

Returns the polygon node used to start the triangle fan of the default triangulation of the polygon. This offset is controlled by applying the turnedgeinpolygons TurnEdge operator .

Returns:
The offset between 0 and NbPoints-1
Since:
8.0 (2010)

The documentation for this class was generated from the following file: