Public Member Functions
Triangle Class Reference

## Detailed Description

Represents a triangle generated by a surface tesselation.

See also:
  CTriangleRefArray, Triangle, Geometry

Example:
  This example shows how to print out the point positions and the triangle data for a polygon mesh.

            using namespace XSI;
            using namespace MATH;

            Application app;
            Model root = app.GetActiveSceneRoot();

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

            Geometry geom(myCube.GetActivePrimitive().GetGeometry());
            CPointRefArray points(geom.GetPoints());
            CVector3Array positions( geom.GetPoints().GetPositionArray() );

            LONG ulCount = positions.GetCount();
            app.LogMessage( L"Object: " + myCube.GetName() );
            app.LogMessage( L"Points: " + CValue((LONG)ulCount).GetAsText() );

            // Print out the x,y,z positions of each point
            for (LONG i=0; i<ulCount; ++i )
            {
                app.LogMessage(
                    CValue(positions[i].GetX()).GetAsText() + L"," +
                    CValue(positions[i].GetY()).GetAsText() + L"," +
                    CValue(positions[i].GetZ()).GetAsText() );
            }

            // Print out the point indices for each triangle
            CTriangleRefArray triangles(geom.GetTriangles());
            CLongArray indices( triangles.GetIndexArray() );

            app.LogMessage( L"Triangles: " + CValue(triangles.GetCount()).GetAsText());

            ulCount = indices.GetCount();
            for (i=0; i<ulCount; i += 3 )
            {
                app.LogMessage( CValue(indices[i]).GetAsText() + L"," +
                    CValue(indices[i+1]).GetAsText() + L"," +
                    CValue(indices[i+2]).GetAsText() );
            }

`#include <xsi_triangle.h>`

Inheritance diagram for Triangle:
[legend]

List of all members.

## Public Member Functions
| Triangle ()
| ~Triangle ()
| Triangle (const CRef &in_ref)
| Triangle (const Triangle &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
Triangle & | operator= (const Triangle &in_obj)
Triangle & | operator= (const CRef &in_ref)
CTriangleRefArray | GetNeighborTriangles () const
CTriangleVertexRefArray | GetPoints () const
LONG | GetIndex () const
LONG | GetPolygonIndex () const
MATH::CVector3Array | GetPositionArray () const
MATH::CVector3Array | GetPolygonNodeNormalArray () const
CVertexColorArray | GetColorArray () const
CUVArray | GetUVArray () const
CLongArray | GetIndexArray () const

## Constructor & Destructor Documentation

Triangle | ( |  | ) |

Default constructor.

~Triangle | ( |  | ) |

Default destructor.

Triangle | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

Triangle | ( | const Triangle & | 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 SIObject.

siClassID GetClassID | ( |  | ) | const `[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from SIObject.

Triangle& operator= | ( | const Triangle & | 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 Triangle object.

Triangle& 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 Triangle object.

Reimplemented from SIObject.

CTriangleRefArray GetNeighborTriangles | ( |  | ) | const

Returns an array of neighbor Triangle objects for this triangle. The array may contain empty objects whose represent the unexisting neighbour triangles.

Returns:
  Array of neighbor Triangle objects.

CTriangleVertexRefArray GetPoints | ( |  | ) | const

Returns an array of TriangleVertex objects for this triangle.

Returns:
  Array of TriangleVertex objects.

LONG GetIndex | ( |  | ) | const

Returns the index of this Triangle object in its geometry.

Returns:
  The Triangle index.

LONG GetPolygonIndex | ( |  | ) | const

Returns the index of the polygon from which this Triangle comes.

Returns:
  The Polygon index.

MATH::CVector3Array GetPositionArray | ( |  | ) | const

Returns an array of CVector3 objects representing the position of all TriangleVertex objects of this Triangle object.

Returns:
  Array of CVector3 objects.

MATH::CVector3Array GetPolygonNodeNormalArray | ( |  | ) | const

Returns the TriangleVertex normals for this Triangle as an array of CVector3 objects. Triangle objects that belong to the same polygon will have the same normal values.

Returns:
  Array of CVector3 objects.

CVertexColorArray GetColorArray | ( |  | ) | const

Returns the TriangleVertex colors for this Triangle as an array of VertexColor objects.

Returns:
  Array of CVertexColor objects.

CUVArray GetUVArray | ( |  | ) | const

Returns the TriangleVertex UV coordinates for this Triangle as an array of CUV objects.

Returns:
  Array of CUV objects.

CLongArray GetIndexArray | ( |  | ) | const

Returns the TriangleVertex indices for this Triangle.

Returns:
  Array of indices.

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

- xsi_triangle.h