NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | Protected Attributes | Friends | List of all members
niftk::BasicTriangle Class Reference

Simple triangle implementation that is used in the Surface Extraction and surface smoothing and decimation algorithms. It keeps hold of vertices, triangle index and has an active flag. More...

Collaboration diagram for niftk::BasicTriangle:
Collaboration graph
[legend]

Public Member Functions

 BasicTriangle ()
 Default constructor. More...
 
 BasicTriangle (int v1, int v2, int v3)
 Constructor with vertex indices as parameters. More...
 
 BasicTriangle (BasicMesh *mp, int v1, int v2, int v3)
 Constructor with mesh pointer and vertex indices as parameters. More...
 
virtual ~BasicTriangle ()
 Destructors. More...
 
 BasicTriangle (const BasicTriangle &t)
 Copy constructor. More...
 
BasicTriangleoperator= (const BasicTriangle &t)
 Assignment operator. More...
 
bool operator== (const BasicTriangle &t)
 Comparison operator. It assumes pointing to same list of verts. More...
 
void ChangeMesh (BasicMesh *mp)
 Changes the mesh pointer to the specified one. More...
 
bool IsActive () const
 Returns true if the triangle active, false if it was removed from the mesh. More...
 
void SetActive (bool b)
 Sets the active status of the triangle. False = triangle was removed. More...
 
bool HasVertex (int vi)
 Returns true if the triangle has a specific vertex (checked by index) More...
 
void ChangeVertex (int vFrom, int vTo)
 Changes a member vertex to another. When we collapse an edge, we need to change the vertex of a BasicTriangle. More...
 
void GetVertIndices (int &v1, int &v2, int &v3)
 Gets the currently stored vertex indices. More...
 
const float * GetVert1CoordArray ()
 Gets the coordinates of the first member vertex as a float array. More...
 
const float * GetVert2CoordArray ()
 Gets the coordinates of the second member vertex as a float array. More...
 
const float * GetVert3CoordArray ()
 Gets the coordinates of the third member vertex as a float array. More...
 
const BasicVec3DGetVert1Coords () const
 Gets the const reference to the coordinates (Vec3D) of the first member vertex. More...
 
const BasicVec3DGetVert2Coords () const
 Gets the const reference to the coordinates (Vec3D) of the second member vertex. More...
 
const BasicVec3DGetVert3Coords () const
 Gets the const reference to the coordinates (Vec3D) of the third member vertex. More...
 
const BasicVertexGetVert1 () const
 Gets the const reference to the first member vertex. More...
 
const BasicVertexGetVert2 () const
 Gets the const reference to the second member vertex. More...
 
const BasicVertexGetVert3 () const
 Gets the const reference to the third member vertex. More...
 
const float * GetVert1NormalArray ()
 Gets the coordinates of the first member vertex's normal as a float array. More...
 
const float * GetVert2NormalArray ()
 Gets the coordinates of the second member vertex's normal as a float array. More...
 
const float * GetVert3NormalArray ()
 Gets the coordinates of the third member vertex's normal as a float array. More...
 
const BasicVec3DGetVert1Normal () const
 Gets the const reference to the coordinates (Vec3D) of the first member vertex's normal. More...
 
const BasicVec3DGetVert2Normal () const
 Gets the const reference to the coordinates (Vec3D) of the second member vertex's normal. More...
 
const BasicVec3DGetVert3Normal () const
 Gets the const reference to the coordinates (Vec3D) of the third member vertex's normal. More...
 
void SetTriNormal (BasicVec3D triNorm)
 Sets the triangle normal (as Vec3D) More...
 
const BasicVec3DGetTriNormal () const
 Gets const refernece to the triangle normal (as Vec3D) More...
 
float * GetTriNormalArray ()
 Gets the coordinates of the triangle normal as a float[3] array. More...
 
float GetTriNormalX ()
 Gets the X component of the triangle normal. More...
 
float GetTriNormalY ()
 Gets the Y component of the triangle normal. More...
 
float GetTriNormalZ ()
 Gets the Z component of the triangle normal. More...
 
void SetTriNormalX (float nx)
 Sets the X component of the triangle normal. More...
 
void SetTriNormalY (float ny)
 Sets the Y component of the triangle normal. More...
 
void SetTriNormalZ (float nz)
 Sets the Z component of the triangle normal. More...
 
void CalcNormal ()
 Re-computes the normal for the BasicTriangle. More...
 
float CalcArea ()
 Returns area of BasicTriangle. More...
 
int GetVertIndex (int which)
 Returns the index of the member vertex with the specifed index (0-2) More...
 
void SetVertIndex (int which, int indexVal)
 Sets the index of the member vertex with the specifed index (0-2) More...
 
int GetVert1Index () const
 Returns the index of the first member vertex. More...
 
int GetVert2Index () const
 Returns the index of the second member vertex. More...
 
int GetVert3Index () const
 Returns the index of the third member vertex. More...
 
void SetVert1Index (int v1)
 Sets the index of the first member vertex. More...
 
void SetVert2Index (int v2)
 Sets the index of the second member vertex. More...
 
void SetVert3Index (int v3)
 Sets the index of the third member vertex. More...
 
int GetIndex () const
 Returns the index of the current triangle. More...
 
void SetIndex (int i)
 Sets the index of the current triangle. More...
 
float GetDParam () const
 Returns the'd' is from the plane equation ax + by + cz + d = 0. More...
 
void SetDParam (float d)
 Sets the'd' parameter of the plane equation ax + by + cz + d = 0. More...
 

Protected Attributes

int m_Vert1
 
int m_Vert2
 
int m_Vert3
 
BasicVec3D m_TriNormal
 
float m_TriNormalArray [3]
 
float m_DParam
 
bool m_Active
 
BasicMeshm_Mesh
 
int m_Index
 

Friends

std::ostream & operator<< (std::ostream &os, const BasicTriangle &to)
 Output to file or stream. More...
 

Detailed Description

Simple triangle implementation that is used in the Surface Extraction and surface smoothing and decimation algorithms. It keeps hold of vertices, triangle index and has an active flag.

Constructor & Destructor Documentation

niftk::BasicTriangle::BasicTriangle ( )

Default constructor.

niftk::BasicTriangle::BasicTriangle ( int  v1,
int  v2,
int  v3 
)

Constructor with vertex indices as parameters.

niftk::BasicTriangle::BasicTriangle ( BasicMesh mp,
int  v1,
int  v2,
int  v3 
)

Constructor with mesh pointer and vertex indices as parameters.

niftk::BasicTriangle::~BasicTriangle ( )
virtual

Destructors.

niftk::BasicTriangle::BasicTriangle ( const BasicTriangle t)

Copy constructor.

Member Function Documentation

float niftk::BasicTriangle::CalcArea ( )

Returns area of BasicTriangle.

void niftk::BasicTriangle::CalcNormal ( )

Re-computes the normal for the BasicTriangle.

void niftk::BasicTriangle::ChangeMesh ( BasicMesh mp)
inline

Changes the mesh pointer to the specified one.

void niftk::BasicTriangle::ChangeVertex ( int  vFrom,
int  vTo 
)

Changes a member vertex to another. When we collapse an edge, we need to change the vertex of a BasicTriangle.

FIX error

float niftk::BasicTriangle::GetDParam ( ) const
inline

Returns the'd' is from the plane equation ax + by + cz + d = 0.

int niftk::BasicTriangle::GetIndex ( ) const
inline

Returns the index of the current triangle.

const BasicVec3D& niftk::BasicTriangle::GetTriNormal ( ) const
inline

Gets const refernece to the triangle normal (as Vec3D)

float * niftk::BasicTriangle::GetTriNormalArray ( )

Gets the coordinates of the triangle normal as a float[3] array.

float niftk::BasicTriangle::GetTriNormalX ( )
inline

Gets the X component of the triangle normal.

float niftk::BasicTriangle::GetTriNormalY ( )
inline

Gets the Y component of the triangle normal.

float niftk::BasicTriangle::GetTriNormalZ ( )
inline

Gets the Z component of the triangle normal.

const BasicVertex & niftk::BasicTriangle::GetVert1 ( ) const

Gets the const reference to the first member vertex.

const float * niftk::BasicTriangle::GetVert1CoordArray ( )

Gets the coordinates of the first member vertex as a float array.

const BasicVec3D & niftk::BasicTriangle::GetVert1Coords ( ) const

Gets the const reference to the coordinates (Vec3D) of the first member vertex.

int niftk::BasicTriangle::GetVert1Index ( ) const
inline

Returns the index of the first member vertex.

const BasicVec3D & niftk::BasicTriangle::GetVert1Normal ( ) const

Gets the const reference to the coordinates (Vec3D) of the first member vertex's normal.

const float * niftk::BasicTriangle::GetVert1NormalArray ( )

Gets the coordinates of the first member vertex's normal as a float array.

const BasicVertex & niftk::BasicTriangle::GetVert2 ( ) const

Gets the const reference to the second member vertex.

const float * niftk::BasicTriangle::GetVert2CoordArray ( )

Gets the coordinates of the second member vertex as a float array.

const BasicVec3D & niftk::BasicTriangle::GetVert2Coords ( ) const

Gets the const reference to the coordinates (Vec3D) of the second member vertex.

int niftk::BasicTriangle::GetVert2Index ( ) const
inline

Returns the index of the second member vertex.

const BasicVec3D & niftk::BasicTriangle::GetVert2Normal ( ) const

Gets the const reference to the coordinates (Vec3D) of the second member vertex's normal.

const float * niftk::BasicTriangle::GetVert2NormalArray ( )

Gets the coordinates of the second member vertex's normal as a float array.

const BasicVertex & niftk::BasicTriangle::GetVert3 ( ) const

Gets the const reference to the third member vertex.

const float * niftk::BasicTriangle::GetVert3CoordArray ( )

Gets the coordinates of the third member vertex as a float array.

const BasicVec3D & niftk::BasicTriangle::GetVert3Coords ( ) const

Gets the const reference to the coordinates (Vec3D) of the third member vertex.

int niftk::BasicTriangle::GetVert3Index ( ) const
inline

Returns the index of the third member vertex.

const BasicVec3D & niftk::BasicTriangle::GetVert3Normal ( ) const

Gets the const reference to the coordinates (Vec3D) of the third member vertex's normal.

const float * niftk::BasicTriangle::GetVert3NormalArray ( )

Gets the coordinates of the third member vertex's normal as a float array.

int niftk::BasicTriangle::GetVertIndex ( int  which)

Returns the index of the member vertex with the specifed index (0-2)

void niftk::BasicTriangle::GetVertIndices ( int v1,
int v2,
int v3 
)

Gets the currently stored vertex indices.

bool niftk::BasicTriangle::HasVertex ( int  vi)

Returns true if the triangle has a specific vertex (checked by index)

bool niftk::BasicTriangle::IsActive ( ) const
inline

Returns true if the triangle active, false if it was removed from the mesh.

BasicTriangle & niftk::BasicTriangle::operator= ( const BasicTriangle t)

Assignment operator.

bool niftk::BasicTriangle::operator== ( const BasicTriangle t)

Comparison operator. It assumes pointing to same list of verts.

void niftk::BasicTriangle::SetActive ( bool  b)
inline

Sets the active status of the triangle. False = triangle was removed.

void niftk::BasicTriangle::SetDParam ( float  d)
inline

Sets the'd' parameter of the plane equation ax + by + cz + d = 0.

void niftk::BasicTriangle::SetIndex ( int  i)
inline

Sets the index of the current triangle.

void niftk::BasicTriangle::SetTriNormal ( BasicVec3D  triNorm)
inline

Sets the triangle normal (as Vec3D)

void niftk::BasicTriangle::SetTriNormalX ( float  nx)
inline

Sets the X component of the triangle normal.

void niftk::BasicTriangle::SetTriNormalY ( float  ny)
inline

Sets the Y component of the triangle normal.

void niftk::BasicTriangle::SetTriNormalZ ( float  nz)
inline

Sets the Z component of the triangle normal.

void niftk::BasicTriangle::SetVert1Index ( int  v1)
inline

Sets the index of the first member vertex.

void niftk::BasicTriangle::SetVert2Index ( int  v2)
inline

Sets the index of the second member vertex.

void niftk::BasicTriangle::SetVert3Index ( int  v3)
inline

Sets the index of the third member vertex.

void niftk::BasicTriangle::SetVertIndex ( int  which,
int  indexVal 
)

Sets the index of the member vertex with the specifed index (0-2)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BasicTriangle to 
)
friend

Output to file or stream.

Member Data Documentation

bool niftk::BasicTriangle::m_Active
protected
float niftk::BasicTriangle::m_DParam
protected
int niftk::BasicTriangle::m_Index
protected
BasicMesh* niftk::BasicTriangle::m_Mesh
protected
BasicVec3D niftk::BasicTriangle::m_TriNormal
protected
float niftk::BasicTriangle::m_TriNormalArray[3]
mutableprotected
int niftk::BasicTriangle::m_Vert1
protected
int niftk::BasicTriangle::m_Vert2
protected
int niftk::BasicTriangle::m_Vert3
protected

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