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

Functions

template<typename T >
angle (const T *vA0, const T *vA1, const T *vB0, const T *vB1)
 
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 >
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 >
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 >
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)
 

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 726 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 545 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 538 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 618 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.

◆ 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 20 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 124 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 172 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 230 of file Geometry.cpp.

◆ 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 303 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 290 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 263 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 278 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 336 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 314 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 356 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 344 of file Geometry.cpp.

◆ 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 361 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 389 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 381 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 370 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 394 of file Geometry.cpp.

◆ 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 670 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 228 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 629 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 403 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 425 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 433 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 448 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 655 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 663 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 647 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 496 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 508 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 491 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 501 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 705 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 553 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 563 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 680 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 411 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 338 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 360 of file Geometry.h.

◆ 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 736 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 585 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 575 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 716 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 530 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 520 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 746 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 690 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 610 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 593 of file Geometry.cpp.