Documentation 6b54b78464
Loading...
Searching...
No Matches

Common geometry operations. More...

Collaboration diagram for Geometry toolbox:

Functions

template<class T , class U , typename Int >
T GeometryToolbox::SquaredDistance (Int nDim, const T *a, const U *b)
 
template<class T , class U , typename Int >
T GeometryToolbox::Distance (Int nDim, const T *a, const U *b)
 
template<class T , typename Int >
void GeometryToolbox::Distance (Int nDim, const T *a, const T *b, T *d)
 d = a-b
 
template<class T , typename Int >
void GeometryToolbox::PointPointReflect (Int nDim, const T *a, const T *b, T *d)
 Reflect a at b: c = 2*b - a.
 
template<class T , typename Int >
T GeometryToolbox::DotProduct (Int nDim, const T *a, const T *b)
 
template<class T , typename Int >
T GeometryToolbox::SquaredNorm (Int nDim, const T *a)
 
template<class T , typename Int >
T GeometryToolbox::Norm (Int nDim, const T *a)
 
template<class T , typename Int >
T GeometryToolbox::NormalDistance (Int nDim, const T *n, const T *a, const T *b)
 dn = max(abs(n.(a-b)), 0.05 * ||a-b||
 
template<class T >
void GeometryToolbox::CrossProduct (const T *a, const T *b, T *c)
 c = a x b
 
template<class T , int nDim>
T GeometryToolbox::LinePlaneIntersection (const T *l0, const T *d, const T *p0, const T *n, T *c)
 Compute the coordinate (c) where the line defined by coordinate l0 and direction d intersects the plane defined by point p0 and normal n.
 
template<class T , int nDim>
T GeometryToolbox::PointPlaneProjection (const T *p1, const T *p0, const T *n, T *c)
 Compute the coordinate (c) where point p1 intersects the plane defined by point p0 and normal n if projected perpendicular to it.
 
template<class T , class U >
void GeometryToolbox::LineNormal (const T &coords, U *normal)
 Set U as the normal to a 2D line defined by coords[iPoint][iDim].
 
template<class T , class U >
void GeometryToolbox::TriangleNormal (const T &coords, U *normal)
 Normal vector of a triangle, cross product of two sides.
 
template<class T , class U >
void GeometryToolbox::QuadrilateralNormal (const T &coords, U *normal)
 Normal vector of a quadrilateral, cross product of the two diagonals.
 
template<class T , class U >
U GeometryToolbox::PointToPlaneDistance (const T &coords, const U *point)
 Signed distance from a point to a plane defined by 3 coordinates.
 
template<class Scalar , class Matrix >
void GeometryToolbox::RotationMatrix (Scalar theta, Scalar phi, Scalar psi, Matrix &mat)
 Compute a 3D rotation matrix.
 
template<class Scalar , class Matrix >
void GeometryToolbox::RotationMatrix (Scalar psi, Matrix &mat)
 Compute a 2D rotation matrix.
 
template<class Scalar , int nDim>
void GeometryToolbox::Rotate (const Scalar R[][nDim], const Scalar *O, const Scalar *d, Scalar *c)
 Apply a rotation matrix (R) about origin (O) to a point at distance (d) from it to obtain new coordinate (c).
 
template<class Scalar >
bool GeometryToolbox::HasRotation (const Scalar *angles)
 
template<class Scalar , int nDim>
void GeometryToolbox::RotateBox (const Scalar R[][nDim], Scalar *vMin, Scalar *vMax)
 Rotate component bounds in place, enclosing the rotated box.
 
template<class Mat , class Scalar , class Int >
void GeometryToolbox::TangentProjection (Int nDim, const Mat &tensor, const Scalar *vector, Scalar *proj)
 Tangent projection

 

Detailed Description

Common geometry operations.

Function Documentation

◆ CrossProduct()

template<class T >
void GeometryToolbox::CrossProduct ( const T *  a,
const T *  b,
T *  c 
)
inline

c = a x b

◆ Distance() [1/2]

template<class T , typename Int >
void GeometryToolbox::Distance ( Int  nDim,
const T *  a,
const T *  b,
T *  d 
)
inline

d = a-b

◆ Distance() [2/2]

template<class T , class U , typename Int >
T GeometryToolbox::Distance ( Int  nDim,
const T *  a,
const U *  b 
)
inline
Returns
||a-b||

◆ DotProduct()

template<class T , typename Int >
T GeometryToolbox::DotProduct ( Int  nDim,
const T *  a,
const T *  b 
)
inline
Returns
a.b

◆ HasRotation()

template<class Scalar >
bool GeometryToolbox::HasRotation ( const Scalar *  angles)
inline
Returns
Whether any of the three supplied rotation angles is nonzero.

◆ LineNormal()

template<class T , class U >
void GeometryToolbox::LineNormal ( const T &  coords,
U *  normal 
)
inline

Set U as the normal to a 2D line defined by coords[iPoint][iDim].

◆ LinePlaneIntersection()

template<class T , int nDim>
T GeometryToolbox::LinePlaneIntersection ( const T *  l0,
const T *  d,
const T *  p0,
const T *  n,
T *  c 
)
inline

Compute the coordinate (c) where the line defined by coordinate l0 and direction d intersects the plane defined by point p0 and normal n.

Returns
The intersection distance.

◆ Norm()

template<class T , typename Int >
T GeometryToolbox::Norm ( Int  nDim,
const T *  a 
)
inline
Returns
||a||

◆ NormalDistance()

template<class T , typename Int >
T GeometryToolbox::NormalDistance ( Int  nDim,
const T *  n,
const T *  a,
const T *  b 
)
inline

dn = max(abs(n.(a-b)), 0.05 * ||a-b||

◆ PointPlaneProjection()

template<class T , int nDim>
T GeometryToolbox::PointPlaneProjection ( const T *  p1,
const T *  p0,
const T *  n,
T *  c 
)
inline

Compute the coordinate (c) where point p1 intersects the plane defined by point p0 and normal n if projected perpendicular to it.

Returns
The normal distance.

◆ PointPointReflect()

template<class T , typename Int >
void GeometryToolbox::PointPointReflect ( Int  nDim,
const T *  a,
const T *  b,
T *  d 
)
inline

Reflect a at b: c = 2*b - a.

◆ PointToPlaneDistance()

template<class T , class U >
U GeometryToolbox::PointToPlaneDistance ( const T &  coords,
const U *  point 
)
inline

Signed distance from a point to a plane defined by 3 coordinates.

◆ QuadrilateralNormal()

template<class T , class U >
void GeometryToolbox::QuadrilateralNormal ( const T &  coords,
U *  normal 
)
inline

Normal vector of a quadrilateral, cross product of the two diagonals.

◆ Rotate()

template<class Scalar , int nDim>
void GeometryToolbox::Rotate ( const Scalar  R[][nDim],
const Scalar *  O,
const Scalar *  d,
Scalar *  c 
)
inline

Apply a rotation matrix (R) about origin (O) to a point at distance (d) from it to obtain new coordinate (c).

◆ RotateBox()

template<class Scalar , int nDim>
void GeometryToolbox::RotateBox ( const Scalar  R[][nDim],
Scalar *  vMin,
Scalar *  vMax 
)
inline

Rotate component bounds in place, enclosing the rotated box.

◆ RotationMatrix() [1/2]

template<class Scalar , class Matrix >
void GeometryToolbox::RotationMatrix ( Scalar  psi,
Matrix &  mat 
)
inline

Compute a 2D rotation matrix.

◆ RotationMatrix() [2/2]

template<class Scalar , class Matrix >
void GeometryToolbox::RotationMatrix ( Scalar  theta,
Scalar  phi,
Scalar  psi,
Matrix &  mat 
)
inline

Compute a 3D rotation matrix.

Note
The implicit ordering is rotation about the x, y, and then z axis.

◆ SquaredDistance()

template<class T , class U , typename Int >
T GeometryToolbox::SquaredDistance ( Int  nDim,
const T *  a,
const U *  b 
)
inline
Returns
||a-b||^2

◆ SquaredNorm()

template<class T , typename Int >
T GeometryToolbox::SquaredNorm ( Int  nDim,
const T *  a 
)
inline
Returns
||a||^2

◆ TangentProjection()

template<class Mat , class Scalar , class Int >
void GeometryToolbox::TangentProjection ( Int  nDim,
const Mat &  tensor,
const Scalar *  vector,
Scalar *  proj 
)
inline

Tangent projection

◆ TriangleNormal()

template<class T , class U >
void GeometryToolbox::TriangleNormal ( const T &  coords,
U *  normal 
)
inline

Normal vector of a triangle, cross product of two sides.