# CTriangleRefArray Class Reference

Related Scripting Object: TriangleCollection

An array of Triangle objects that represents all the triangles in the Geometry. More...

`#include <xsi_triangle.h>`

Inheritance diagram for CTriangleRefArray:

List of all members.

## Public Member Functions
| CTriangleRefArray (const CTriangleRefArray &in_array)
CRef | GetItem (LONG in_index) const
CRef | GetItem (const CString &in_name) const
LONG | GetCount () const
bool | IsValid () const
MATH::CVector3Array | GetPositionArray () const
MATH::CVector3Array | GetPolygonNodeNormalArray () const
CVertexColorArray | GetColorArray () const
CUVArray | GetUVArray () const
CLongArray | GetIndexArray () const

## Detailed Description

An array of Triangle objects that represents all the triangles in the Geometry.

Warning:
  This specialized array is returned by Geometry::GetTriangles, it is not meant to be created and modified in user-defined functions. If you want to add and remove arbitrary items to a collection, you must use a CRefArray instead.

See also:
  Geometry::GetTriangles, Triangle

Example:

              using namespace XSI;
              using namespace MATH;

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

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

              CTriangleRefArray triangles(myCube.GetActivePrimitive().GetGeometry().GetTriangles());
              CVector3Array normals( triangles.GetPolygonNodeNormalArray() );

              for (LONG i=0; i<normals.GetCount(); ++i )
              {
                  app.LogMessage( CValue(normals[i].GetX()).GetAsText() + L"," +
                      CValue(normals[i].GetY()).GetAsText() + L"," +
                      CValue(normals[i].GetZ()).GetAsText() );
              }

## Constructor & Destructor Documentation

CTriangleRefArray | ( | const CTriangleRefArray & | in_array | ) |

Copy constructor.

Parameters:

  | in_array | constant CTriangleRefArray reference object.

## Member Function Documentation

CRef GetItem | ( | LONG | in_index | ) | const`[virtual]`

Returns a Triangle object at a specified index in the array.

Parameters:

  | in_index | The index of the Triangle.

Returns:
  The Triangle object.

Reimplemented from CRefArray.

CRef GetItem | ( | const CString & | in_name | ) | const`[virtual]`

Returns the Triangle object in the array matching the specified name.

Parameters:

  | in_name | The name of the Triangle.

Returns:
  The Triangle object.

Reimplemented from CRefArray.

LONG GetCount | ( |  | ) | const`[virtual]`

Returns the number of Triangle objects in the array.

Returns:
  The number of Triangle objects.

Reimplemented from CRefArray.

bool IsValid | ( |  | ) | const`[virtual]`

Returns true if this array is a valid object or false otherwise.

Returns:
  true if valid, false otherwise.

Reimplemented from CRefArray.

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

Returns the TriangleVertex positions for all triangles of this array.

Returns:
  Array of CVector3 objects.

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

Returns the TriangleVertex normals for all triangles of this array.

Returns:
  Array of CVector3 objects.

CVertexColorArray GetColorArray | ( |  | ) | const

Returns the TriangleVertex colors for all triangles of this array.

Returns:
  Array of CVertexColor objects.

CUVArray GetUVArray | ( |  | ) | const

Returns the TriangleVertex UV coordinates for all triangles of this array.

Returns:
  Array of CUV objects.

CLongArray GetIndexArray | ( |  | ) | const

Returns the TriangleVertex indices for each triangle of this array.

Returns:
  Array of indices.

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

- xsi_triangle.h