cee::geo::DataIndexedTriangles Class Reference

Data structure representing indexed triangles data for a geometry part More...

Public Member Functions

 DataIndexedTriangles ()
 Constructs an empty data object. More...
 
 DataIndexedTriangles (const std::vector< Vec3d > &vertices, const std::vector< unsigned int > &indices)
 Constructs triangle data defined by an array of vertices and an array of connectivity indices. More...
 
virtual Type type () const
 Returns Data::INDEXED_TRIANGLES. More...
 
virtual BoundingBox boundingBox () const
 Returns the bounding box of the part data. More...
 
std::vector< Vec3dvertices () const
 Returns array of vertices used to define the triangles. More...
 
void setVertices (const std::vector< Vec3d > &vertices)
 Sets vertices for all the triangles. More...
 
std::vector< unsigned int > indices () const
 Returns the array of connectivity indices used to tell which coordinates to build up the each triangle. More...
 
void setIndices (const std::vector< unsigned int > &indices)
 Sets connectivity indices used to tell which coordinates to build up each triangle. More...
 
size_t triangleCount () const
 Returns number of triangles in this data object. More...
 
void removeAll ()
 Clears all data. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 

Additional Inherited Members

- Public Types inherited from cee::geo::Data
enum  Type {
  INDEXED_TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, INDEXED_POLYLINES,
  POINTS
}
 Enumerator for each of the available primitives. More...
 
- Protected Member Functions inherited from cee::geo::Data
 Data ()
 Constructs an empty part data. More...
 
Inheritance diagram for cee::geo::DataIndexedTriangles:
cee::geo::Data cee::RefCountedObject

Detailed Description

Data structure representing indexed triangles data for a geometry part

Each triangle is defined by three connectivity indices into the vertices array. The created data will have indices.size()/3 triangles.

See also
cee::geo::GeometryModel
cee::geo::Part
cee::geo::Data
cee::geo::DataTriangleFan
cee::geo::DataTriangleStrip

Constructor & Destructor Documentation

cee::geo::DataIndexedTriangles::DataIndexedTriangles ( )

Constructs an empty data object.

cee::geo::DataIndexedTriangles::DataIndexedTriangles ( const std::vector< Vec3d > &  vertices,
const std::vector< unsigned int > &  indices 
)

Constructs triangle data defined by an array of vertices and an array of connectivity indices.

Each triangle is defined by three indices. The created data will have indices.size()/3 triangles.

// Triangle vertices and indices
std::vector<cee::Vec3d> triangleVertices;
triangleVertices.push_back(cee::Vec3d(0.0, 0.0, 2.0));
triangleVertices.push_back(cee::Vec3d(2.0, 0.0, 2.0));
triangleVertices.push_back(cee::Vec3d(1.0, 0.0, 3.0));
std::vector<unsigned int> triangleIndices = { 0, 1, 2 };
// Create a triangle data part using the vertices and connectivities
cee::PtrRef<cee::geo::DataIndexedTriangles> triangleDataPart = new cee::geo::DataIndexedTriangles(triangleVertices, triangleIndices);

Member Function Documentation

cee::BoundingBox cee::geo::DataIndexedTriangles::boundingBox ( ) const
virtual

Returns the bounding box of the part data.

Implements cee::geo::Data.

std::vector< unsigned int > cee::geo::DataIndexedTriangles::indices ( ) const

Returns the array of connectivity indices used to tell which coordinates to build up the each triangle.

Each triangle is defined by three indices. The data will have indices.size()/3 triangles.

See also
setIndices
void cee::geo::DataIndexedTriangles::removeAll ( )

Clears all data.

void cee::geo::DataIndexedTriangles::setIndices ( const std::vector< unsigned int > &  indices)

Sets connectivity indices used to tell which coordinates to build up each triangle.

The array must contain 3 indices per triangle.

See also
indices
void cee::geo::DataIndexedTriangles::setVertices ( const std::vector< Vec3d > &  vertices)

Sets vertices for all the triangles.

See also
vertices
size_t cee::geo::DataIndexedTriangles::triangleCount ( ) const

Returns number of triangles in this data object.

Data::Type cee::geo::DataIndexedTriangles::type ( ) const
virtual
std::vector< Vec3d > cee::geo::DataIndexedTriangles::vertices ( ) const

Returns array of vertices used to define the triangles.

See also
setVertices