Represents a triangle generated by a surface tesselation.
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>
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 |
Triangle | ( | ) |
Default constructor.
~Triangle | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
CTriangleRefArray GetNeighborTriangles | ( | ) | const |
CTriangleVertexRefArray GetPoints | ( | ) | const |
Returns an array of TriangleVertex objects for this triangle.
LONG GetIndex | ( | ) | const |
LONG GetPolygonIndex | ( | ) | const |
Returns the index of the polygon from which this Triangle comes.
MATH::CVector3Array GetPositionArray | ( | ) | const |
Returns an array of CVector3 objects representing the position of all TriangleVertex objects of this Triangle object.
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.
CVertexColorArray GetColorArray | ( | ) | const |
Returns the TriangleVertex colors for this Triangle as an array of VertexColor objects.
CUVArray GetUVArray | ( | ) | const |
Returns the TriangleVertex UV coordinates for this Triangle as an array of CUV objects.
CLongArray GetIndexArray | ( | ) | const |
Returns the TriangleVertex indices for this Triangle.