[3913] | 1 | #ifndef _TRIANGLE_H_
|
---|
| 2 | #define _TRIANGLE_H_
|
---|
| 3 |
|
---|
| 4 | #include "./include.h"
|
---|
[5143] | 5 | #include "AdjacentTriangle.h"
|
---|
[3913] | 6 |
|
---|
| 7 | namespace bamg {
|
---|
| 8 |
|
---|
[5095] | 9 | class Mesh;
|
---|
[5120] | 10 | class BamgVertex;
|
---|
[3913] | 11 | class Triangle;
|
---|
| 12 |
|
---|
| 13 | class Triangle {
|
---|
| 14 |
|
---|
[5143] | 15 | friend class AdjacentTriangle;
|
---|
[3913] | 16 |
|
---|
| 17 | private:
|
---|
[5148] | 18 | BamgVertex *vertices[3]; // 3 vertices if t is triangle, t[i] allowed by access function, (*t)[i] if pointer
|
---|
[5340] | 19 | Triangle *adj[3]; // 3 pointers toward the adjacent triangles
|
---|
[5401] | 20 | short AdjEdgeIndex[3]; // edge id in the adjacent triangles. The edge number 1 is the edge number AdjEdgeIndex[1] in the Adjacent triangle 1
|
---|
[3913] | 21 |
|
---|
| 22 | public:
|
---|
[22758] | 23 | long long det; //Integer determinant (twice its area)
|
---|
[3913] | 24 | union {
|
---|
[5143] | 25 | Triangle *link;
|
---|
| 26 | long color;
|
---|
[3913] | 27 | };
|
---|
| 28 |
|
---|
| 29 | //Constructors/Destructors
|
---|
[9371] | 30 | Triangle();
|
---|
[5095] | 31 | Triangle(Mesh *Th,long i,long j,long k);
|
---|
[5120] | 32 | Triangle(BamgVertex *v0,BamgVertex *v1,BamgVertex *v2);
|
---|
[3913] | 33 |
|
---|
| 34 | //Operators
|
---|
[5148] | 35 | const BamgVertex & operator[](int i) const {return *vertices[i];};
|
---|
| 36 | BamgVertex & operator[](int i) {return *vertices[i];};
|
---|
| 37 | const BamgVertex * operator()(int i) const {return vertices[i];};
|
---|
| 38 | BamgVertex * & operator()(int i) {return vertices[i];};
|
---|
[3913] | 39 |
|
---|
| 40 | //Methods
|
---|
[5151] | 41 | void Echo();
|
---|
[11584] | 42 | double Length() const;
|
---|
[5151] | 43 | int swap(short a1,int=0);
|
---|
| 44 | long Optim(short a,int =0);
|
---|
| 45 | int Locked(int a)const;
|
---|
| 46 | int Hidden(int a)const;
|
---|
| 47 | int GetAllflag(int a);
|
---|
| 48 | short NuEdgeTriangleAdj(int i) const;
|
---|
| 49 | AdjacentTriangle Adj(int i) const;
|
---|
| 50 | Triangle *TriangleAdj(int i) const;
|
---|
| 51 | void Renumbering(Triangle *tb,Triangle *te, long *renu);
|
---|
| 52 | void Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu);
|
---|
| 53 | void SetAdjAdj(short a);
|
---|
| 54 | void SetAdj2(short a,Triangle *t,short aat);
|
---|
| 55 | void SetSingleVertexToTriangleConnectivity();
|
---|
| 56 | void SetHidden(int a);
|
---|
| 57 | void SetLocked(int a);
|
---|
| 58 | void SetMarkUnSwap(int a);
|
---|
| 59 | void SetUnMarkUnSwap(int a);
|
---|
[3913] | 60 |
|
---|
| 61 | //Inline methods
|
---|
[5095] | 62 | void Set(const Triangle &,const Mesh &,Mesh &);
|
---|
[5148] | 63 | int In(BamgVertex *v) const { return vertices[0]==v || vertices[1]==v || vertices[2]==v ;}
|
---|
[19605] | 64 | BamgVertex* GetVertex(int i){return vertices[i];}; // FIXME: this is used to avoid BamgVertex * operator()
|
---|
[3913] | 65 |
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | }
|
---|
| 69 | #endif
|
---|