Documentation 6b54b78464
Loading...
Searching...
No Matches
geometry_toolbox.hpp File Reference

Collection of common lightweight geometry-oriented methods. More...

#include <cmath>
#include <algorithm>

Go to the source code of this file.

Namespaces

namespace  GeometryToolbox
 

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

Collection of common lightweight geometry-oriented methods.

Version
8.5.0 "Harrier"

SU2 Project Website: https://su2code.github.io

The SU2 Project is maintained by the SU2 Foundation (http://su2foundation.org)

Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)

SU2 is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

SU2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with SU2. If not, see http://www.gnu.org/licenses/.