Triangle class
Triangle class
back to menu
This class describes mesh oriented triangles
class Triangle
{
private:
Mpoint * _vertice[3];vertices of the triangle - the triangle is oriented so the order is important
public:
Triangle(Mpoint* const p1,Mpoint* const p2,Mpoint* const p3);constructor - update the Mpoints p1, p2 and p3
~Triangle(void);destructor - you must remove neighbourhood relation between
Triangle(Triangle & t);Declared but undefined : prevents from using it
Triangle operator=(Triangle &t); Declared but undefined : prevents from using it
vector<double> data; used to store extra data attached to the triangle
Mpoint * const get_vertice(const int i) const;accessor for vertices
bool oriented;true if the triangle has been well oriented (will change this)
const Pt centroid() const;centroid of the triangle
const Vec normal() const;normal of the oriented triangle
void swap();change the orientation of the triangle
const int operator <(const Triangle *const t) const;check if two triangles are adjacent.
0 if they are not
1 if they are and if they are well oriented respectively to each other
2 if they are and if they are bad oriented respectively to each other
const bool operator ==(const Triangle & t) const;comparaison operator - compares the vertices
const bool intersect(const Triangle & t) const;check if two triangles are intersecting each other
};
back to menu