cee::geo::DataIndexedTriangles
-
class DataIndexedTriangles : public Data
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
GeometryModel, Part, Data, DataTriangleFan, and DataTriangleStrip
Public Functions
-
DataIndexedTriangles()
Constructs an empty data object.
-
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);
-
virtual Type type() const
Returns Data::INDEXED_TRIANGLES.
-
virtual BoundingBox boundingBox() const
Returns the bounding box of the part data.
-
std::vector<Vec3d> vertices() const
Returns array of vertices used to define the triangles.
See also
-
std::vector<unsigned int> 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
-
void 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
-
size_t triangleCount() const
Returns number of triangles in this data object.
-
void removeAll()
Clears all data.
-
DataIndexedTriangles()