TriMesh Class Reference
Detailed Description
Triangular Mesh Class.
#include <cyTriMesh.h>
Classes | |
| struct | Mtl |
| Material definition. More... | |
| struct | Str |
| Simple character string. More... | |
| struct | TriFace |
| Triangular Mesh Face. More... | |
Public Member Functions | |
Constructors and Destructor | |
| TriMesh (TriMesh const &t) | |
Component Access Methods | |
| Vec3f const & | V (int i) const |
| returns the i^th vertex | |
| Vec3f & | V (int i) |
| returns the i^th vertex | |
| TriFace const & | F (int i) const |
| returns the i^th face | |
| TriFace & | F (int i) |
| returns the i^th face | |
| Vec3f const & | VN (int i) const |
| returns the i^th vertex normal | |
| Vec3f & | VN (int i) |
| returns the i^th vertex normal | |
| TriFace const & | FN (int i) const |
| returns the i^th normal face | |
| TriFace & | FN (int i) |
| returns the i^th normal face | |
| Vec3f const & | VT (int i) const |
| returns the i^th vertex texture | |
| Vec3f & | VT (int i) |
| returns the i^th vertex texture | |
| TriFace const & | FT (int i) const |
| returns the i^th texture face | |
| TriFace & | FT (int i) |
| returns the i^th texture face | |
| Mtl const & | M (int i) const |
| returns the i^th material | |
| Mtl & | M (int i) |
| returns the i^th material | |
| unsigned int | NV () const |
| returns the number of vertices | |
| unsigned int | NF () const |
| returns the number of faces | |
| unsigned int | NVN () const |
| returns the number of vertex normals | |
| unsigned int | NVT () const |
| returns the number of texture vertices | |
| unsigned int | NM () const |
| returns the number of materials | |
| bool | HasNormals () const |
| returns true if the mesh has vertex normals | |
| bool | HasTextureVertices () const |
| returns true if the mesh has texture vertices | |
Set Component Count | |
| void | Clear () |
| Deletes all components of the mesh. | |
| void | SetNumVertex (unsigned int n) |
| Sets the number of vertices and allocates memory for vertex positions. | |
| void | SetNumFaces (unsigned int n) |
| Sets the number of faces and allocates memory for face data. Normal faces and texture faces are also allocated, if they are used. | |
| void | SetNumNormals (unsigned int n) |
| Sets the number of normals and allocates memory for normals and normal faces. | |
| void | SetNumTexVerts (unsigned int n) |
| Sets the number of texture coordinates and allocates memory for texture coordinates and texture faces. | |
| void | SetNumMtls (unsigned int n) |
| Sets the number of materials and allocates memory for material data. | |
| void | operator= (TriMesh const &t) |
| Copies mesh data from the given mesh. | |
Get Property Methods | |
| bool | IsBoundBoxReady () const |
| Returns true if the bounding box has been computed. | |
| Vec3f | GetBoundMin () const |
| Returns the minimum values of the bounding box. | |
| Vec3f | GetBoundMax () const |
| Returns the maximum values of the bounding box. | |
| Vec3f | GetVec (int faceID, Vec3f const &bc) const |
| Returns the point on the given face with the given barycentric coordinates (bc). | |
| Vec3f | GetNormal (int faceID, Vec3f const &bc) const |
| Returns the the surface normal on the given face at the given barycentric coordinates (bc). The returned vector is not normalized. | |
| Vec3f | GetTexCoord (int faceID, Vec3f const &bc) const |
| Returns the texture coordinate on the given face at the given barycentric coordinates (bc). | |
| int | GetMaterialIndex (int faceID) const |
| Returns the material index of the face. This method goes through material counts of all materials to find the material index of the face. Returns a negative number if the face as no material. | |
| int | GetMaterialFaceCount (int mtlID) const |
| Returns the number of faces associated with the given material ID. | |
| int | GetMaterialFirstFace (int mtlID) const |
| Returns the first face index associated with the given material ID. Other faces associated with the same material are placed are placed consecutively. | |
Compute Methods | |
| void | ComputeBoundingBox () |
| Computes the bounding box. | |
| void | ComputeNormals (bool clockwise=false) |
| Computes and stores vertex normals. | |
Protected Attributes | |
| Vec3f * | v |
| vertices | |
| TriFace * | f |
| faces | |
| Vec3f * | vn |
| vertex normal | |
| TriFace * | fn |
| normal faces | |
| Vec3f * | vt |
| texture vertices | |
| TriFace * | ft |
| texture faces | |
| Mtl * | m |
| materials | |
| int * | mcfc |
| material cumulative face count | |
| unsigned int | nv |
| number of vertices | |
| unsigned int | nf |
| number of faces | |
| unsigned int | nvn |
| number of vertex normals | |
| unsigned int | nvt |
| number of texture vertices | |
| unsigned int | nm |
| number of materials | |
| Vec3f | boundMin |
| Bounding box minimum bound. | |
| Vec3f | boundMax |
| Bounding box maximum bound. | |