28 assert(i < 3 &&
"Triangle vertex indices are 0, 1 or 2");
34 assert(i < 3 &&
"Triangle vertex indices are 0, 1 or 2");
40 assert(i < 3 &&
"Triangle vertex indices are 0, 1 or 2");
46 assert(i < 3 &&
"Triangle vertex indices are 0, 1 or 2");
56 const double NaN = std::numeric_limits<double>::signaling_NaN();
57 const OPoint3D notAPoint(NaN, NaN, NaN);
70 _p1 =
_p2 =
_p3 = std::numeric_limits<unsigned>::max();
77 for (
unsigned i = 0; i < 3; ++i)
108 double s = (c1 + c2 + c3) * 0.5;
110 return sqrt(
s * (
s - c1) * (
s - c2) * (
s - c3));
131 using std::stringstream;
133 return std::string();
135 ss <<
"A " <<
_A <<
" ?= P(p1) " << points[
_p1] << endl;
136 ss <<
"B " <<
_B <<
" ?= P(p2) " << points[
_p2] << endl;
137 ss <<
"C " <<
_C <<
" ?= P(p3) " << points[
_p3] << endl;
144 for (
unsigned i = 0; i < 3; i++)
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
double distFrom(const OPoint3D &pt) const
Computes the distance from this point to another.
OPoint3D _A
First OPoint3D.
double getSurface()
Compute the triangle surface.
bool operator==(const OTriangle &other) const
static int OTriangle::* indices_m_ptr[3]
int _p1
Index of the first OPoint3D _A.
int _p3
Index of the third OPoint3D _C.
std::string reportInconsistencyWrtPointsTab(const std::deque< OPoint3D > &points)
If inconsistency found between indexes and OPoint3D points, prints it.
bool checkConsistencyWrtPointsTab(const std::deque< OPoint3D > &points) const
Check the consistency between indexes of points and the points of this OTriangle.
OPoint3D getCentre()
Gives back the triangle center.
OTriangle(int p1, int p2, int p3)
Constructor b.
OPoint3D _C
Third OPoint3D.
OPoint3D _B
Second OPoint3D.
static OPoint3D OTriangle::* vertices_m_ptr[3]
< A static table of OPoint3D.
int _p2
Index of the second OPoint3D _B.
OPoint3D & vertex(unsigned i)
Get the OPoint3D from the specific index.
::std::ostream & operator<<(::std::ostream &os, const OTriangle &t)