TTK
Loading...
Searching...
No Matches
Classes | Functions
ttk::Geometry Namespace Reference

Classes

struct  ProjectionInput
 Stores the findProjection() input. More...
 
struct  ProjectionResult
 Stores the findProjection() result. More...
 

Functions

template<typename T >
angle (const T *vA0, const T *vA1, const T *vB0, const T *vB1)
 
template<typename T >
angle2D (const T *vA0, const T *vA1, const T *vB0, const T *vB1)
 
template<typename T >
double angle2DUndirected (const T *vA, const T *vB, const T *vC)
 
template<typename T >
bool areVectorsColinear (const T *vA0, const T *vA1, const T *vB0, const T *vB1, std::array< T, 3 > *coefficients=nullptr, const T *tolerance=NULL)
 
template<typename T >
bool isTriangleColinear2D (const T *pptA, const T *pptB, const T *pptC, const T tolerance)
 
template<typename T >
int computeBarycentricCoordinates (const T *p0, const T *p1, const T *p, std::array< T, 2 > &baryCentrics, const int &dimension=3)
 
template<typename T >
int computeBarycentricCoordinates (const T *p0, const T *p1, const T *p2, const T *p, std::array< T, 3 > &baryCentrics)
 
template<typename T >
bool computeSegmentIntersection (const T &xA, const T &yA, const T &xB, const T &yB, const T &xC, const T &yC, const T &xD, const T &yD, T &x, T &y)
 
template<typename T >
int computeTriangleAngles (const T *p0, const T *p1, const T *p2, std::array< T, 3 > &angles)
 
template<typename T >
int computeTriangleAngleFromSides (const T s0, const T s1, const T s2, T &angle)
 
template<typename T >
int computeTriangleArea (const T *p0, const T *p1, const T *p2, T &area)
 
template<typename T >
int computeTriangleAreaFromSides (const T s0, const T s1, const T s2, T &area)
 
template<typename T >
int crossProduct (const T *vA0, const T *vA1, const T *vB0, const T *vB1, std::array< T, 3 > &crossProduct)
 
template<typename T >
int crossProduct (const T *vA, const T *vB, T *crossProduct)
 
template<typename T >
distance (const T *p0, const T *p1, const int &dimension=3)
 
template<typename T >
distance (const std::vector< T > &p0, const std::vector< T > &p1)
 
template<typename T >
distance2D (const T *p0, const T *p1)
 
template<typename T >
distanceFlatten (const std::vector< std::vector< T > > &p0, const std::vector< std::vector< T > > &p1)
 
template<typename T >
dotProduct (const T *vA0, const T *vA1, const T *vB0, const T *vB1)
 
template<typename T >
dotProduct (const T *vA, const T *vB, const int &dimension=3)
 
template<typename T >
dotProduct (const std::vector< T > &vA, const std::vector< T > &vB)
 
template<typename T >
dotProductFlatten (const std::vector< std::vector< T > > &vA, const std::vector< std::vector< T > > &vB)
 
template<typename T , typename Container , size_t dim>
int getBoundingBox (const Container &points, std::array< std::pair< T, T >, dim > &bBox)
 
template<typename T >
bool isPointInTriangle (const T *p0, const T *p1, const T *p2, const T *p)
 
template<typename T >
bool isPointOnSegment (const T &x, const T &y, const T &xA, const T &yA, const T &xB, const T &yB)
 
template<typename T >
bool isPointOnSegment (const T *p, const T *pA, const T *pB, const int &dimension=3)
 
template<typename T >
bool isTriangleColinear (const T *p0, const T *p1, const T *p2, const T *tolerance=nullptr)
 
template<typename T >
magnitude (const T *v, const int &dimension=3)
 
template<typename T >
magnitude (const std::vector< T > &v)
 
template<typename T >
magnitudeFlatten (const std::vector< std::vector< T > > &v)
 
template<typename T >
magnitude (const T *o, const T *d)
 
template<typename T >
powInt (const T val, const int n)
 
template<typename T = double>
powIntTen (const int n)
 Compute the nth power of ten.
 
template<typename T1 , typename T2 >
T1 pow (const T1 val, const T2 n)
 
template<typename T >
void projectOnTrianglePlane (const T *p, const T *a, const T *normTri, T *out)
 Compute euclidean projection in a triangle plane.
 
template<typename T >
void projectOnEdge (const T *p, const T *a, const T *b, T *out)
 Compute euclidean projection on a 3D segment.
 
template<typename T >
void computeTriangleNormal (const T *a, const T *b, const T *c, T *out)
 Compute normal vector to triangle.
 
template<typename T , typename triangulationType >
SimplexId getNearestSurfaceVertex (const T *pa, std::vector< T > &dists, const triangulationType &triangulation)
 Find nearest vertex on the surface.
 
template<typename T >
int subtractVectors (const T *a, const T *b, T *out, const int &dimension=3)
 
template<typename T >
int subtractVectors (const std::vector< T > &a, const std::vector< T > &b, std::vector< T > &out)
 
template<typename T >
int addVectors (const T *a, const T *b, T *out, const int &dimension=3)
 
template<typename T >
int addVectors (const std::vector< T > &a, const std::vector< T > &b, std::vector< T > &out)
 
template<typename T >
int multiAddVectors (const std::vector< std::vector< T > > &a, const std::vector< std::vector< T > > &b, std::vector< std::vector< T > > &out)
 
template<typename T >
int multiAddVectorsFlatten (const std::vector< std::vector< std::vector< T > > > &a, const std::vector< std::vector< std::vector< T > > > &b, std::vector< std::vector< T > > &out)
 
template<typename T >
int scaleVector (const T *a, const T factor, T *out, const int &dimension=3)
 
template<typename T >
int scaleVector (const std::vector< T > &a, const T factor, std::vector< T > &out)
 
template<typename T >
int vectorProjection (const T *a, const T *b, T *out, const int &dimension=3)
 
template<typename T >
int vectorProjection (const std::vector< T > &a, const std::vector< T > &b, std::vector< T > &out)
 
template<typename T >
void addVectorsProjection (const std::vector< T > &a, const std::vector< T > &b, std::vector< T > &a_out, std::vector< T > &b_out)
 
template<typename T >
void gramSchmidt (const std::vector< std::vector< T > > &a, std::vector< std::vector< T > > &out)
 
template<typename T >
bool isVectorUniform (const std::vector< T > &a)
 
template<typename T >
bool isVectorNull (const std::vector< T > &a)
 
template<typename T >
bool isVectorNullFlatten (const std::vector< std::vector< T > > &a)
 
template<typename T >
int flattenMultiDimensionalVector (const std::vector< std::vector< T > > &a, std::vector< T > &out)
 
template<typename T >
int multiFlattenMultiDimensionalVector (const std::vector< std::vector< std::vector< T > > > &a, std::vector< std::vector< T > > &out)
 
template<typename T >
int unflattenMultiDimensionalVector (const std::vector< T > &a, std::vector< std::vector< T > > &out, const int &no_columns=2)
 
template<typename T >
void matrixMultiplication (const std::vector< std::vector< T > > &a, const std::vector< std::vector< T > > &b, std::vector< std::vector< T > > &out)
 
template<typename T >
void subtractMatrices (const std::vector< std::vector< T > > &a, const std::vector< std::vector< T > > &b, std::vector< std::vector< T > > &out)
 
template<typename T >
void addMatrices (const std::vector< std::vector< T > > &a, const std::vector< std::vector< T > > &b, std::vector< std::vector< T > > &out)
 
template<typename T >
void scaleMatrix (const std::vector< std::vector< T > > &a, const T factor, std::vector< std::vector< T > > &out)
 
template<typename T >
void transposeMatrix (const std::vector< std::vector< T > > &a, std::vector< std::vector< T > > &out)
 
template<typename triangulationType >
std::array< float, 3 > computeSurfaceNormalAtPoint (const SimplexId a, const triangulationType &triangulation)
 Compute (mean) surface normal at given surface vertex.
 
template<typename triangulationType0 , typename triangulationType1 >
ProjectionResult findProjection (const ProjectionInput &pi, VisitedMask &trianglesTested, std::vector< float > &dists, std::stack< SimplexId > &trianglesToTest, const bool reverseProjection, const triangulationType0 &triangulationToSmooth, const triangulationType1 &triangulation)
 

Function Documentation

◆ addMatrices()

template<typename T >
void ttk::Geometry::addMatrices ( const std::vector< std::vector< T > > &  a,
const std::vector< std::vector< T > > &  b,
std::vector< std::vector< T > > &  out 
)

Computes the element wise addition of two matrices

Parameters
athe first matrix
bthe second matrix
outthe resulting matrix

Definition at line 798 of file Geometry.cpp.

◆ addVectors() [1/2]

template<typename T >
int ttk::Geometry::addVectors ( const std::vector< T > &  a,
const std::vector< T > &  b,
std::vector< T > &  out 
)

Computes the addition of two vectors.

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe addition between the two vectors
Returns
Returns 0 for success, negative otherwise.

Definition at line 617 of file Geometry.cpp.

◆ addVectors() [2/2]

template<typename T >
int ttk::Geometry::addVectors ( const T *  a,
const T *  b,
T *  out,
const int &  dimension = 3 
)

Computes the addition of two vectors.

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe addition between the two vectors
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns 0 for success, negative otherwise.

Definition at line 610 of file Geometry.cpp.

◆ addVectorsProjection()

template<typename T >
void ttk::Geometry::addVectorsProjection ( const std::vector< T > &  a,
const std::vector< T > &  b,
std::vector< T > &  a_out,
std::vector< T > &  b_out 
)

Adds two vectors and project them into it

Parameters
acoordinates of the first vector
bcoordinates of the second vector
a_outthe projection of a
b_outthe projection of b

Definition at line 690 of file Geometry.cpp.

◆ angle()

template<typename T >
T ttk::Geometry::angle ( const T *  vA0,
const T *  vA1,
const T *  vB0,
const T *  vB1 
)

Compute the angle between two std::vectors

Parameters
vA0xyz coordinates of vA's origin
vA1xyz coordinates of vA's destination
vB0xyz coordinates of vB's origin
vB1xyz coordinates of vB's destination

Definition at line 13 of file Geometry.cpp.

◆ angle2D()

template<typename T >
T ttk::Geometry::angle2D ( const T *  vA0,
const T *  vA1,
const T *  vB0,
const T *  vB1 
)

Definition at line 20 of file Geometry.cpp.

◆ angle2DUndirected()

template<typename T >
double ttk::Geometry::angle2DUndirected ( const T *  vA,
const T *  vB,
const T *  vC 
)
inline

Definition at line 33 of file Geometry.h.

◆ areVectorsColinear()

template<typename T >
bool ttk::Geometry::areVectorsColinear ( const T *  vA0,
const T *  vA1,
const T *  vB0,
const T *  vB1,
std::array< T, 3 > *  coefficients = nullptr,
const T *  tolerance = NULL 
)

Check if two 3D std::vectors vA and vB are colinear.

Parameters
vA0xyz coordinates of vA's origin
vA1xyz coordinates of vA's destination
vB0xyz coordinates of vB's origin
vB1xyz coordinates of vB's destination
coefficientsOptional output std::array of colinearity coefficients.
toleranceOptional tolerance value (default: PREC_FLT)
Returns
Returns true if the std::vectors are colinear, false otherwise.

Definition at line 27 of file Geometry.cpp.

◆ computeBarycentricCoordinates() [1/2]

template<typename T >
int ttk::Geometry::computeBarycentricCoordinates ( const T *  p0,
const T *  p1,
const T *  p,
std::array< T, 2 > &  baryCentrics,
const int &  dimension = 3 
)

Compute the barycentric coordinates of point p with regard to the edge defined by the 3D points p0 and p1.

Parameters
p0xyz coordinates of the first vertex of the edge
p1xyz coordinates of the second vertex of the edge
pxyz coordinates of the queried point
baryCentricsOutput barycentric coordinates (all in [0, 1] if p belongs to the edge).
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 142 of file Geometry.cpp.

◆ computeBarycentricCoordinates() [2/2]

template<typename T >
int ttk::Geometry::computeBarycentricCoordinates ( const T *  p0,
const T *  p1,
const T *  p2,
const T *  p,
std::array< T, 3 > &  baryCentrics 
)

Compute the barycentric coordinates of point p with regard to the triangle defined by the 3D points p0, p1, and p2.

Parameters
p0xyz coordinates of the first vertex of the triangle
p1xyz coordinates of the second vertex of the triangle
p2xyz coordinates of the third vertex of the triangle
pxyz coordinates of the queried point
baryCentricsOutput barycentric coordinates (all in [0, 1] if p belongs to the triangle).
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 190 of file Geometry.cpp.

◆ computeSegmentIntersection()

template<typename T >
bool ttk::Geometry::computeSegmentIntersection ( const T &  xA,
const T &  yA,
const T &  xB,
const T &  yB,
const T &  xC,
const T &  yC,
const T &  xD,
const T &  yD,
T &  x,
T &  y 
)

Compute the intersection between two 2D segments AB and CD.

Parameters
xAx coordinate of the first vertex of the first segment (AB)
yAy coordinate of the first vertex of the first segment (AB)
xBx coordinate of the second vertex of the first segment (AB)
yBy coordinate of the second vertex of the first segment (AB)
xCx coordinate of the first vertex of the second segment (CD)
yCy coordinate of the first vertex of the second segment (CD)
xDx coordinate of the second vertex of the second segment (CD)
yDy coordinate of the second vertex of the second segment (CD)
xx coordinate of the output intersection (if any).
yy coordinate of the output intersection (if any).
Returns
Returns true if the segments intersect (false otherwise).

Definition at line 248 of file Geometry.cpp.

◆ computeSurfaceNormalAtPoint()

template<typename triangulationType >
std::array< float, 3 > ttk::Geometry::computeSurfaceNormalAtPoint ( const SimplexId  a,
const triangulationType &  triangulation 
)

Compute (mean) surface normal at given surface vertex.

Parameters
[in]aSurface vertex id
[in]triangulationMesh
Returns
Mean of surface normals in star of a

Definition at line 754 of file Geometry.h.

◆ computeTriangleAngleFromSides()

template<typename T >
int ttk::Geometry::computeTriangleAngleFromSides ( const T  s0,
const T  s1,
const T  s2,
T &  angle 
)
Parameters
s0length of the first side of the triangle
s1length of the second side of the triangle
s2length of the third side of the triangle
angleAngle opposite to edge s2
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 321 of file Geometry.cpp.

◆ computeTriangleAngles()

template<typename T >
int ttk::Geometry::computeTriangleAngles ( const T *  p0,
const T *  p1,
const T *  p2,
std::array< T, 3 > &  angles 
)

Compute the angles of a triangle

Parameters
p0xyz coordinates of the first vertex of the triangle
p1xyz coordinates of the second vertex of the triangle
p2xyz coordinates of the third vertex of the triangle
anglesAngles (p0p1, p1p2) (p1p2, p2p0) (p2p0, p0p1)

Definition at line 308 of file Geometry.cpp.

◆ computeTriangleArea()

template<typename T >
int ttk::Geometry::computeTriangleArea ( const T *  p0,
const T *  p1,
const T *  p2,
T &  area 
)

Compute the area of a 3D triangle.

Parameters
p0xyz coordinates of the first vertex of the triangle
p1xyz coordinates of the second vertex of the triangle
p2xyz coordinates of the third vertex of the triangle
areaOutput area.
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 281 of file Geometry.cpp.

◆ computeTriangleAreaFromSides()

template<typename T >
int ttk::Geometry::computeTriangleAreaFromSides ( const T  s0,
const T  s1,
const T  s2,
T &  area 
)

Compute the area of a triangle given length of its sides

Parameters
s0length of the first side of the triangle
s1length of the second side of the triangle
s2length of the third side of the triangle
areaOutput area.
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 296 of file Geometry.cpp.

◆ computeTriangleNormal()

template<typename T >
void ttk::Geometry::computeTriangleNormal ( const T *  a,
const T *  b,
const T *  c,
T *  out 
)

Compute normal vector to triangle.

Parameters
[in]aFirst triangle vertex coordinates
[in]bSecond triangle vertex coordinates
[in]cThird triangle vertex coordinates
[out]outResult
Returns
Triangle unitary normal

Definition at line 564 of file Geometry.cpp.

◆ crossProduct() [1/2]

template<typename T >
int ttk::Geometry::crossProduct ( const T *  vA,
const T *  vB,
T *  crossProduct 
)

Compute the cross product of two 3D std::vectors

Parameters
vAxyz coordinates of vA std::vector
vBxyz coordinates of vB std::vector
crossProductOutput cross product.
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 354 of file Geometry.cpp.

◆ crossProduct() [2/2]

template<typename T >
int ttk::Geometry::crossProduct ( const T *  vA0,
const T *  vA1,
const T *  vB0,
const T *  vB1,
std::array< T, 3 > &  crossProduct 
)

Compute the cross product of two 3D std::vectors

Parameters
vA0xyz coordinates of vA's origin
vA1xyz coordinates of vA's destination
vB0xyz coordinates of vB's origin
vB1xyz coordinates of vB's destination
crossProductOutput cross product.
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 332 of file Geometry.cpp.

◆ distance() [1/2]

template<typename T >
T ttk::Geometry::distance ( const std::vector< T > &  p0,
const std::vector< T > &  p1 
)

Compute the Euclidean distance between two points

Parameters
p0xyz coordinates of the first input point.
p1xyz coordinates of the second input point.

Definition at line 374 of file Geometry.cpp.

◆ distance() [2/2]

template<typename T >
T ttk::Geometry::distance ( const T *  p0,
const T *  p1,
const int &  dimension = 3 
)

Compute the Euclidean distance between two points

Parameters
p0xyz coordinates of the first input point.
p1xyz coordinates of the second input point.
dimensionOptional parameter that specifies the dimension of the point set (by default 3).

Definition at line 362 of file Geometry.cpp.

◆ distance2D()

template<typename T >
T ttk::Geometry::distance2D ( const T *  p0,
const T *  p1 
)
inline

Definition at line 200 of file Geometry.h.

◆ distanceFlatten()

template<typename T >
T ttk::Geometry::distanceFlatten ( const std::vector< std::vector< T > > &  p0,
const std::vector< std::vector< T > > &  p1 
)

Compute the Euclidean distance between two vectors by first flattening them

Parameters
p0xyz coordinates of the first input point.
p1xyz coordinates of the second input point.

Definition at line 379 of file Geometry.cpp.

◆ dotProduct() [1/3]

template<typename T >
T ttk::Geometry::dotProduct ( const std::vector< T > &  vA,
const std::vector< T > &  vB 
)

Compute the dot product of two std::vectors

Parameters
vAcoordinates of vA std::vector
vBcoordinates of vB std::vector
Returns
Returns Output dot product

Definition at line 407 of file Geometry.cpp.

◆ dotProduct() [2/3]

template<typename T >
T ttk::Geometry::dotProduct ( const T *  vA,
const T *  vB,
const int &  dimension = 3 
)

Compute the dot product of two std::vectors

Parameters
vAcoordinates of vA std::vector
vBcoordinates of vB std::vector
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns Output dot product

Definition at line 399 of file Geometry.cpp.

◆ dotProduct() [3/3]

template<typename T >
T ttk::Geometry::dotProduct ( const T *  vA0,
const T *  vA1,
const T *  vB0,
const T *  vB1 
)

Compute the dot product of two 3D std::vectors

Parameters
vA0xyz coordinates of vA's origin
vA1xyz coordinates of vA's destination
vB0xyz coordinates of vB's origin
vB1xyz coordinates of vB's destination
Returns
Returns Output dot product

Definition at line 388 of file Geometry.cpp.

◆ dotProductFlatten()

template<typename T >
T ttk::Geometry::dotProductFlatten ( const std::vector< std::vector< T > > &  vA,
const std::vector< std::vector< T > > &  vB 
)

Compute the dot product of two multi dimensional std::vectors by first flattening them

Parameters
vAcoordinates of vA std::vector
vBcoordinates of vB std::vector
Returns
Returns Output dot product

Definition at line 412 of file Geometry.cpp.

◆ findProjection()

template<typename triangulationType0 , typename triangulationType1 >
ProjectionResult ttk::Geometry::findProjection ( const ProjectionInput pi,
VisitedMask trianglesTested,
std::vector< float > &  dists,
std::stack< SimplexId > &  trianglesToTest,
const bool  reverseProjection,
const triangulationType0 &  triangulationToSmooth,
const triangulationType1 &  triangulation 
)

Definition at line 891 of file Geometry.h.

◆ flattenMultiDimensionalVector()

template<typename T >
int ttk::Geometry::flattenMultiDimensionalVector ( const std::vector< std::vector< T > > &  a,
std::vector< T > &  out 
)

Flatten a multi dimensional vector (representing a rectangular/square matrix)

Parameters
amulti dimensional vector
outflattened vector
Returns
Returns 0 for success, negative otherwise

Definition at line 742 of file Geometry.cpp.

◆ getBoundingBox()

template<typename T , typename Container , size_t dim>
int ttk::Geometry::getBoundingBox ( const Container &  points,
std::array< std::pair< T, T >, dim > &  bBox 
)

Compute the bounding box of a point set.

Parameters
pointsVector of points. Each entry is a std::array<float, dim> whose size is equal to the dimension of the space embedding the points.
bBoxOutput bounding box. The number of entries in this std::array is equal to the dimension of the space embedding the points.
Returns
Returns 0 upon success, negative values otherwise.

Definition at line 273 of file Geometry.h.

◆ getNearestSurfaceVertex()

template<typename T , typename triangulationType >
SimplexId ttk::Geometry::getNearestSurfaceVertex ( const T *  pa,
std::vector< T > &  dists,
const triangulationType &  triangulation 
)

Find nearest vertex on the surface.

Parameters
[in]paInput point
[in]distsPre-allocated distances vector
[in]triangulationSurface triangulation
Returns
Nearest vertex id on the surface

Definition at line 517 of file Geometry.h.

◆ gramSchmidt()

template<typename T >
void ttk::Geometry::gramSchmidt ( const std::vector< std::vector< T > > &  a,
std::vector< std::vector< T > > &  out 
)

Computes the Gram-Schmidt orthogonalization process. That is, given a set of vectors, it returns a set (of same size) of orthogonal vectors spanning the same subspace.

Parameters
athe set of vectors to orthogonalize
outthe orthogonalized vectors

Definition at line 701 of file Geometry.cpp.

◆ isPointInTriangle()

template<typename T >
bool ttk::Geometry::isPointInTriangle ( const T *  p0,
const T *  p1,
const T *  p2,
const T *  p 
)

Check if the point p is inside the triangle (p0, p1, p2).

Parameters
p0xyz coordinates of the first vertex of the triangle
p1xyz coordinates of the second vertex of the triangle
p2xyz coordinates of the third vertex of the triangle
pxyz coordinates of the queried point
Returns
Returns true if p is in the triangle, false otherwise.

Definition at line 421 of file Geometry.cpp.

◆ isPointOnSegment() [1/2]

template<typename T >
bool ttk::Geometry::isPointOnSegment ( const T &  x,
const T &  y,
const T &  xA,
const T &  yA,
const T &  xB,
const T &  yB 
)

Check if a 2D point xy lies on a 2D segment AB.

Parameters
xx coordinate of the input point.
yy coordinate of the input point.
xAx coordinate of the first vertex of the segment [AB]
yAy coordinate of the first vertex of the segment [AB]
xBx coordinate of the second vertex of the segment [AB]
yBy coordinate of the second vertex of the segment [AB]
Returns
Returns true if the point lies on the segment, false otherwise.

Definition at line 443 of file Geometry.cpp.

◆ isPointOnSegment() [2/2]

template<typename T >
bool ttk::Geometry::isPointOnSegment ( const T *  p,
const T *  pA,
const T *  pB,
const int &  dimension = 3 
)

Check if a point p lies on a segment AB.

Parameters
pxyz coordinates of the input point.
pAxyz coordinates of the first vertex of the segment [AB]
pBxyz coordinate of the second vertex of the segment [AB]
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns true if the point lies on the segment, false otherwise.

Definition at line 451 of file Geometry.cpp.

◆ isTriangleColinear()

template<typename T >
bool ttk::Geometry::isTriangleColinear ( const T *  p0,
const T *  p1,
const T *  p2,
const T *  tolerance = nullptr 
)

Check if all the edges of a triangle are colinear.

Parameters
p0xyz coordinates of the first vertex of the triangle.
p1xyz coordinates of the second vertex of the triangle.
p2xyz coordinates of the third vertex of the triangle.
toleranceOptional tolerance value (default: PREC_FLT)
Returns
Returns true if all the edges are colinear (false otherwise).

Definition at line 466 of file Geometry.cpp.

◆ isTriangleColinear2D()

template<typename T >
bool ttk::Geometry::isTriangleColinear2D ( const T *  pptA,
const T *  pptB,
const T *  pptC,
const T  tolerance 
)

Definition at line 130 of file Geometry.cpp.

◆ isVectorNull()

template<typename T >
bool ttk::Geometry::isVectorNull ( const std::vector< T > &  a)

Test if the vector is null (have all values almost equal to 0)

Parameters
acoordinates of the vector.
Returns
Returns true if the vector is null, false otherwise

Definition at line 727 of file Geometry.cpp.

◆ isVectorNullFlatten()

template<typename T >
bool ttk::Geometry::isVectorNullFlatten ( const std::vector< std::vector< T > > &  a)

Test if the vector is null (have all values almost equal to 0) after flattening it

Parameters
acoordinates of the vector.
Returns
Returns true if the vector is null, false otherwise

Definition at line 735 of file Geometry.cpp.

◆ isVectorUniform()

template<typename T >
bool ttk::Geometry::isVectorUniform ( const std::vector< T > &  a)

Test if the vector have uniform values

Parameters
acoordinates of the vector.
Returns
Returns true if the vector have uniform values, false otherwise

Definition at line 719 of file Geometry.cpp.

◆ magnitude() [1/3]

template<typename T >
T ttk::Geometry::magnitude ( const std::vector< T > &  v)

Compute the magnitude of a std::vector v.

Parameters
vcoordinates of the input std::vector.
Returns
Returns the magnitude upon success, negative values otherwise.

Definition at line 514 of file Geometry.cpp.

◆ magnitude() [2/3]

template<typename T >
T ttk::Geometry::magnitude ( const T *  o,
const T *  d 
)

Compute the magnitude of a 3D std::vector.

Parameters
oxyz coordinates of the std::vector's origin
dxyz coordinates of the std::vector's destination

Definition at line 526 of file Geometry.cpp.

◆ magnitude() [3/3]

template<typename T >
T ttk::Geometry::magnitude ( const T *  v,
const int &  dimension = 3 
)

Compute the magnitude of a std::vector v.

Parameters
vcoordinates of the input std::vector.
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns the magnitude upon success, negative values otherwise.

Definition at line 509 of file Geometry.cpp.

◆ magnitudeFlatten()

template<typename T >
T ttk::Geometry::magnitudeFlatten ( const std::vector< std::vector< T > > &  v)

Compute the magnitude of a multi dimensional std::vector v by first flattening it

Parameters
vcoordinates of the input std::vector.
Returns
Returns the magnitude upon success, negative values otherwise.

Definition at line 519 of file Geometry.cpp.

◆ matrixMultiplication()

template<typename T >
void ttk::Geometry::matrixMultiplication ( const std::vector< std::vector< T > > &  a,
const std::vector< std::vector< T > > &  b,
std::vector< std::vector< T > > &  out 
)

Computes the matrix multiplication between two matrixes

Parameters
athe first matrix
bthe second matrix
outthe resulting matrix

Definition at line 777 of file Geometry.cpp.

◆ multiAddVectors()

template<typename T >
int ttk::Geometry::multiAddVectors ( const std::vector< std::vector< T > > &  a,
const std::vector< std::vector< T > > &  b,
std::vector< std::vector< T > > &  out 
)

Computes the pairwise addition of pairs of two vectors.

Parameters
acoordinates of the first vectors
bcoordinates of the second vectors
outthe pairwise addition between the vectors

Definition at line 625 of file Geometry.cpp.

◆ multiAddVectorsFlatten()

template<typename T >
int ttk::Geometry::multiAddVectorsFlatten ( const std::vector< std::vector< std::vector< T > > > &  a,
const std::vector< std::vector< std::vector< T > > > &  b,
std::vector< std::vector< T > > &  out 
)

Computes the pairwise addition of pairs of two vectors by first flattening them.

Parameters
acoordinates of the first vectors
bcoordinates of the second vectors
outthe pairwise addition between the vectors

Definition at line 635 of file Geometry.cpp.

◆ multiFlattenMultiDimensionalVector()

template<typename T >
int ttk::Geometry::multiFlattenMultiDimensionalVector ( const std::vector< std::vector< std::vector< T > > > &  a,
std::vector< std::vector< T > > &  out 
)

Flatten an ensemble of multi dimensional vector (representing a rectangular/square matrix)

Parameters
amulti dimensional vector
outflattened vector

Definition at line 752 of file Geometry.cpp.

◆ pow()

template<typename T1 , typename T2 >
T1 ttk::Geometry::pow ( const T1  val,
const T2  n 
)
inline

Compute the power of an arithmetic value (redirect to std::pow with a floating-point exponent and to Geometry::powInt with an integer exponent)

Definition at line 456 of file Geometry.h.

◆ powInt()

template<typename T >
T ttk::Geometry::powInt ( const T  val,
const int  n 
)
inline

Compute the integer power of a floating-point value (std::pow is optimised for floating-point exponents)

Definition at line 383 of file Geometry.h.

◆ powIntTen()

template<typename T = double>
T ttk::Geometry::powIntTen ( const int  n)
inline

Compute the nth power of ten.

Definition at line 405 of file Geometry.h.

◆ projectOnEdge()

template<typename T >
void ttk::Geometry::projectOnEdge ( const T *  p,
const T *  a,
const T *  b,
T *  out 
)

Compute euclidean projection on a 3D segment.

Parameters
[in]pPoint to be projected
[in]aFirst segment vertex coordinates
[in]bSecond segment vertex coordinates
[out]outResult
Returns
Projection coordinates

Definition at line 550 of file Geometry.cpp.

◆ projectOnTrianglePlane()

template<typename T >
void ttk::Geometry::projectOnTrianglePlane ( const T *  p,
const T *  a,
const T *  normTri,
T *  out 
)

Compute euclidean projection in a triangle plane.

Parameters
[in]pPoint to be projected
[in]aTriangle vertex coordinates
[in]normTriTriangle normal vector
[out]outResult
Returns
Projection coordinates

Definition at line 538 of file Geometry.cpp.

◆ scaleMatrix()

template<typename T >
void ttk::Geometry::scaleMatrix ( const std::vector< std::vector< T > > &  a,
const T  factor,
std::vector< std::vector< T > > &  out 
)

Scale a matrix by a scalar value

Parameters
athe input matrix
factorscale factor
outthe resulting matrix

Definition at line 808 of file Geometry.cpp.

◆ scaleVector() [1/2]

template<typename T >
int ttk::Geometry::scaleVector ( const std::vector< T > &  a,
const T  factor,
std::vector< T > &  out 
)

Scale a vector by a scalar value.

Parameters
acoordinates of the first vector
factorscale factor
outthe scaled vector
Returns
Returns 0 for success, negative otherwise.

Definition at line 657 of file Geometry.cpp.

◆ scaleVector() [2/2]

template<typename T >
int ttk::Geometry::scaleVector ( const T *  a,
const T  factor,
T *  out,
const int &  dimension = 3 
)

Scale a vector by a scalar value.

Parameters
acoordinates of the first vector
factorscale factor
outthe scaled vector
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns 0 for success, negative otherwise.

Definition at line 647 of file Geometry.cpp.

◆ subtractMatrices()

template<typename T >
void ttk::Geometry::subtractMatrices ( const std::vector< std::vector< T > > &  a,
const std::vector< std::vector< T > > &  b,
std::vector< std::vector< T > > &  out 
)

Computes the element wise subtraction of two matrices (b subtracted by a)

Parameters
athe first matrix
bthe second matrix
outthe resulting matrix

Definition at line 788 of file Geometry.cpp.

◆ subtractVectors() [1/2]

template<typename T >
int ttk::Geometry::subtractVectors ( const std::vector< T > &  a,
const std::vector< T > &  b,
std::vector< T > &  out 
)

Computes the difference between two vectors (b subtracted by a).

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe difference between the two vectors
Returns
Returns 0 for success, negative otherwise.

Definition at line 602 of file Geometry.cpp.

◆ subtractVectors() [2/2]

template<typename T >
int ttk::Geometry::subtractVectors ( const T *  a,
const T *  b,
T *  out,
const int &  dimension = 3 
)

Computes the difference between two vectors (b subtracted by a).

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe difference between the two vectors
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns 0 for success, negative otherwise.

Definition at line 592 of file Geometry.cpp.

◆ transposeMatrix()

template<typename T >
void ttk::Geometry::transposeMatrix ( const std::vector< std::vector< T > > &  a,
std::vector< std::vector< T > > &  out 
)

Transpose a matrix

Parameters
athe input matrix
outthe resulting matrix

Definition at line 818 of file Geometry.cpp.

◆ unflattenMultiDimensionalVector()

template<typename T >
int ttk::Geometry::unflattenMultiDimensionalVector ( const std::vector< T > &  a,
std::vector< std::vector< T > > &  out,
const int &  no_columns = 2 
)

Unflatten a vector to a multi dimensional vector (representing a rectangular/square matrix)

Parameters
avector
outmulti dimensional vector
no_columnsnumber of columns of the output multi dimensional vector
Returns
Returns 0 for success, negative otherwise

Definition at line 762 of file Geometry.cpp.

◆ vectorProjection() [1/2]

template<typename T >
int ttk::Geometry::vectorProjection ( const std::vector< T > &  a,
const std::vector< T > &  b,
std::vector< T > &  out 
)

Computes the projection of vector a onto the vector b

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe projected vector
Returns
Returns 0 for success, negative otherwise.

Definition at line 682 of file Geometry.cpp.

◆ vectorProjection() [2/2]

template<typename T >
int ttk::Geometry::vectorProjection ( const T *  a,
const T *  b,
T *  out,
const int &  dimension = 3 
)

Computes the projection of vector a onto the vector b

Parameters
acoordinates of the first vector
bcoordinates of the second vector
outthe projected vector
dimensionOptional parameter that specifies the dimension of the point set (by default 3).
Returns
Returns 0 for success, negative otherwise.

Definition at line 665 of file Geometry.cpp.