WTFIT
|
Minimalist class that handles simple geometric computations (operations on vectors, barycentric coordinates, etc.). More...
#include <Geometry.h>
Public Member Functions | |
Geometry () | |
virtual | ~Geometry () |
![]() | |
Debug () | |
virtual | ~Debug () |
virtual const int | dMsg (ostream &stream, string msg, const int &debugLevel=infoMsg) const |
const int | err (const string msg, const int &debugLevel=infoMsg) const |
const int | msg (const char *msg, const int &debugLevel=infoMsg) const |
virtual const int | setDebugLevel (const int &debugLevel) |
int | setThreadNumber (const int threadNumber) |
int | setWrapper (const Wrapper *wrapper) |
Static Public Member Functions | |
static double | angle (const double *vA0, const double *vA1, const double *vB0, const double *vB1) |
static bool | areVectorsColinear (const double *vA0, const double *vA1, const double *vB0, const double *vB1, vector< double > *coefficients=NULL, const double *tolerance=NULL) |
static int | computeBarycentricCoordinates (const double *p0, const double *p1, const double *p, vector< double > &baryCentrics, const int &dimension=3) |
static int | computeBarycentricCoordinates (const double &x0, const double &y0, const double &x1, const double &y1, const double &x, const double &y, vector< double > &baryCentrics) |
static int | computeBarycentricCoordinates (const double *p0, const double *p1, const double *p2, const double *p, vector< double > &baryCentrics) |
static int | computeBarycentricCoordinates (const float *p0, const float *p1, const float *p2, const float *p, vector< double > &baryCentrics) |
static bool | computeSegmentIntersection (const double &xA, const double &yA, const double &xB, const double &yB, const double &xC, const double &yC, const double &xD, const double &yD, double &x, double &y) |
static int | computeTriangleAngles (const double *p0, const double *p1, const double *p2, vector< double > &angles) |
static int | computeTriangleArea (const double *p0, const double *p1, const double *p2, double &area) |
static int | crossProduct (const double *vA0, const double *vA1, const double *vB0, const double *vB1, vector< double > &crossProduct) |
static int | crossProduct (const double *vA, const double *vB, double *vC) |
static double | distance (const double *p0, const double *p1, const int &dimension=3) |
static double | distance (const float *p0, const float *p1, const int &dimension=3) |
static double | dotProduct (const double *vA0, const double *vA1, const double *vB0, const double *vB1) |
static double | dotProduct (const double *vA, const double *vB) |
static int | getBoundingBox (const vector< vector< double > > &points, vector< pair< double, double >> &bBox) |
static bool | isPointInTriangle (const double *p0, const double *p1, const double *p2, const double *p) |
static bool | isPointInTriangle (const float *p0, const float *p1, const float *p2, const float *p) |
static bool | isPointOnSegment (const double &x, const double &y, const double &xA, const double &yA, const double &xB, const double &yB) |
static bool | isPointOnSegment (const double *p, const double *pA, const double *pB, const int &dimension=3) |
static bool | isTriangleColinear (const double *p0, const double *p1, const double *p2, const double *tolerance=NULL) |
static double | magnitude (const double *v) |
static double | magnitude (const double *o, const double *d) |
Additional Inherited Members | |
![]() | |
enum | debugPriority { fatalMsg, timeMsg, memoryMsg, infoMsg, detailedInfoMsg, advancedInfoMsg } |
![]() | |
bool | lastObject_ |
int | debugLevel_ |
int | threadNumber_ |
Wrapper * | wrapper_ |
Minimalist class that handles simple geometric computations (operations on vectors, barycentric coordinates, etc.).
Geometry::Geometry | ( | ) |
|
virtual |
|
static |
Compute the angle between two vectors
vA0 | xyz coordinates of vA's origin |
vA1 | xyz coordinates of vA's destination |
vB0 | xyz coordinates of vB's origin |
vB1 | xyz coordinates of vB's destination |
|
static |
Check if two 3D vectors vA and vB are colinear.
vA0 | xyz coordinates of vA's origin |
vA1 | xyz coordinates of vA's destination |
vB0 | xyz coordinates of vB's origin |
vB1 | xyz coordinates of vB's destination |
coefficients | Optional output vector of colinearity coefficients. |
|
static |
Compute the barycentric coordinates of point p
with regard to the edge defined by the 3D points p0
and p1
.
p0 | xyz coordinates of the first vertex of the edge |
p1 | xyz coordinates of the second vertex of the edge |
p | xyz coordinates of the queried point |
baryCentrics | Output barycentric coordinates (all in [0, 1] if p belongs to the edge). |
dimension | Optional parameter that specifies the dimension of the point set (by default 3). |
|
static |
Compute the barycentric coordinates of point xyz
with regard to the edge defined by the points xy0
and xy1
.
x0 | x coordinate of the first vertex of the edge |
y0 | y coordinate of the first vertex of the edge |
x1 | x coordinate of the second vertex of the edge |
y1 | y coordinate of the second vertex of the edge |
x | x coordinate of the queried point |
y | y coordinate of the queried point |
baryCentrics | Output barycentric coordinates (all in [0, 1] if p belongs to the edge). |
|
static |
Compute the barycentric coordinates of point p
with regard to the triangle defined by the 3D points p0
, p1
, and p2
.
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
p | xyz coordinates of the queried point |
baryCentrics | Output barycentric coordinates (all in [0, 1] if p belongs to the triangle). |
|
static |
Compute the barycentric coordinates of point p
with regard to the triangle defined by the points p0
, p1
, and p2
.
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
p | xyz coordinates of the queried point |
baryCentrics | Output barycentric coordinates (all in [0, 1] if p belongs to the triangle). |
|
static |
Compute the intersection between two 2D segments AB and CD.
xA | x coordinate of the first vertex of the first segment (AB) |
yA | y coordinate of the first vertex of the first segment (AB) |
xB | x coordinate of the second vertex of the first segment (AB) |
yB | y coordinate of the second vertex of the first segment (AB) |
xC | x coordinate of the first vertex of the second segment (CD) |
yC | y coordinate of the first vertex of the second segment (CD) |
xD | x coordinate of the second vertex of the second segment (CD) |
yD | y coordinate of the second vertex of the second segment (CD) |
x | x coordinate of the output intersection (if any). |
y | y coordinate of the output intersection (if any). |
|
static |
Compute the angles of a triangle
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
angles | Angles (p0p1, p1p2) (p1p2, p2p0) (p2p0, p0p1) |
|
static |
Compute the area of a 3D triangle.
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
area | Output area. |
|
static |
Compute the cross product of two 3D vectors
vA0 | xyz coordinates of vA's origin |
vA1 | xyz coordinates of vA's destination |
vB0 | xyz coordinates of vB's origin |
vB1 | xyz coordinates of vB's destination |
crossProduct | Output cross product. |
|
static |
Compute the cross product of two 3D vectors
vA | xyz coordinates of vA vector |
vB | xyz coordinates of vB vector |
vC | Output cross product. |
|
static |
Compute the Euclidean distance between two points
p0 | xyz coordinates of the first input point. |
p1 | xyz coordinates of the second input point. |
dimension | Optional parameter that specifies the dimension of the point set (by default 3). |
|
static |
Compute the Euclidean distance between two points
p0 | xyz coordinates of the first input point. |
p1 | xyz coordinates of the second input point. |
dimension | Optional parameter that specifies the dimension of the point set (by default 3). |
|
static |
Compute the dot product of two 3D vectors
vA0 | xyz coordinates of vA's origin |
vA1 | xyz coordinates of vA's destination |
vB0 | xyz coordinates of vB's origin |
vB1 | xyz coordinates of vB's destination |
|
static |
Compute the dot product of two 3D vectors
vA0 | xyz coordinates of vA vector |
vB0 | xyz coordinates of vB vector |
|
static |
Compute the bounding box of a point set.
points | Vector of points. Each entry is a vector whose size is equal to the dimension of the space embedding the points. |
bBox | Output bounding box. The number of entries in this vector is equal to the dimension of the space embedding the points. |
|
static |
Check if the point p
is inside the triangle (p0
, p1
, p2
).
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
p | xyz coordinates of the queried point |
p
is in the triangle, false otherwise.
|
static |
Check if the point p
is inside the triangle (p0
, p1
, p2
).
p0 | xyz coordinates of the first vertex of the triangle |
p1 | xyz coordinates of the second vertex of the triangle |
p2 | xyz coordinates of the third vertex of the triangle |
p | xyz coordinates of the queried point |
p
is in the triangle, false otherwise.
|
static |
Check if a 2D point xy
lies on a 2D segment AB
.
x | x coordinate of the input point. |
y | y coordinate of the input point. |
xA | x coordinate of the first vertex of the segment [AB] |
yA | y coordinate of the first vertex of the segment [AB] |
xB | x coordinate of the second vertex of the segment [AB] |
yB | y coordinate of the second vertex of the segment [AB] |
|
static |
Check if a point p
lies on a segment AB
.
p | xyz coordinates of the input point. |
pA | xyz coordinates of the first vertex of the segment [AB] |
pB | xyz coordinate of the second vertex of the segment [AB] |
dimension | Optional parameter that specifies the dimension of the point set (by default 3). |
|
static |
Check if all the edges of a triangle are colinear.
p0 | xyz coordinates of the first vertex of the triangle. |
p1 | xyz coordinates of the second vertex of the triangle. |
p2 | xyz coordinates of the third vertex of the triangle. |
|
static |
Compute the magnitude of a 3D vector v
.
v | xyz coordinates of the input vector. |
|
static |
Compute the magnitude of a 3D vector.
o | xyz coordinates of the vector's origin |
d | xyz coordinates of the vector's destination |