SAF
Loading...
Searching...
No Matches
saf_utility_geometry.h File Reference

A collection of computational geometry related functions. More...

Go to the source code of this file.

Data Structures

struct  quaternion_data
 Quaternion data structure. More...
 
struct  voronoi_data
 Data structure for Voronoi diagrams. More...
 

Enumerations

enum  EULER_ROTATION_CONVENTIONS { EULER_ROTATION_Y_CONVENTION , EULER_ROTATION_X_CONVENTION , EULER_ROTATION_YAW_PITCH_ROLL , EULER_ROTATION_ROLL_PITCH_YAW }
 Available euler2rotationMatrix() conventions. More...
 

Functions

void quaternion2rotationMatrix (quaternion_data *Q, float R[3][3])
 Constructs a 3x3 rotation matrix based on a quaternion.
 
void rotationMatrix2quaternion (float R[3][3], quaternion_data *Q)
 Calculates the quaternion corresponding to a 3x3 rotation matrix.
 
void euler2Quaternion (float alpha, float beta, float gamma, int degreesFlag, EULER_ROTATION_CONVENTIONS convention, quaternion_data *Q)
 Converts Euler angles to a quaternion.
 
void quaternion2euler (quaternion_data *Q, int degreesFlag, EULER_ROTATION_CONVENTIONS convention, float *alpha, float *beta, float *gamma)
 Converts a quaternion to Euler angles.
 
void euler2rotationMatrix (float alpha, float beta, float gamma, int degreesFlag, EULER_ROTATION_CONVENTIONS convention, float R[3][3])
 Constructs a 3x3 rotation matrix from the Euler angles.
 
void yawPitchRoll2Rzyx (float yaw, float pitch, float roll, int rollPitchYawFLAG, float R[3][3])
 Constructs a 3x3 rotation matrix from the Euler angles, using the yaw-pitch-roll (zyx) convention.
 
void sph2cart (float *sph, int nDirs, int anglesInDegreesFLAG, float *cart)
 Converts spherical coordinates to Cartesian coordinates.
 
void cart2sph (float *cart, int nDirs, int anglesInDegreesFLAG, float *sph)
 Converts Cartesian coordinates to spherical coordinates.
 
void unitSph2cart (float *dirs, int nDirs, int anglesInDegreesFLAG, float *dirs_xyz)
 Converts spherical coordinates to Cartesian coordinates of unit length.
 
void unitCart2sph (float *dirs_xyz, int nDirs, int anglesInDegreesFLAG, float *dirs)
 Converts Cartesian coordinates of unit length to spherical coordinates.
 
void sphElev2incl (float *dirsElev, int nDirs, int degreesFlag, float *dirsIncl)
 Converts spherical coordinates of unit length from elevation to inclination.
 
void sphIncl2Elev (float *dirsIncl, int nDirs, int degreesFlag, float *dirsElev)
 Converts spherical coordinates of unit length from inclination to elevation.
 
float L2_norm3 (float v[3])
 Returns the L2 (Euclidean) norm of a 3-element vector.
 
float L2_norm (float *v, int lenV)
 Returns the L2 (Euclidean) norm of an arbitrary length vector.
 
float Frob_norm (float *M, int lenX, int lenY)
 Returns the Frobenius Norm of a matrix M, of dimensions: lenX x lenY.
 
void crossProduct3 (float a[3], float b[3], float c[3])
 Cross product between two 3-element floating point vectors (c = a x b)
 
float getDistBetweenPointAndLine (float point[3], float v1[3], float v2[3])
 Returns the distance between a "point" and an infinite line described by the two points "v1" and "v2".
 
float getDistBetween2Points (float point_a[3], float point_b[3])
 Returns the distance between "point_a" and "point_b".
 
void convhull3d (const float *vertices, const int nVert, int **faces, int *nFaces)
 Builds the convex hull of an arrangement of vertices in 3-dimensional space.
 
void convhullnd (const float *points, const int nPoints, const int nd, int **faces, int *nFaces)
 Builds the convex hull of an arrangement of points in N-dimensional space.
 
void delaunaynd (const float *points, const int nPoints, const int nd, int **DT, int *nDT)
 Computes the Delaunay triangulation of an arrangement of points in N-dimensional space.
 
void sphDelaunay (const float *dirs_deg, const int nDirs, int **faces, int *nFaces, float *vertices)
 Delaunay triangulation of a spherical arrangement of points.
 
void sphVoronoi (int *faces, int nFaces, float *vertices, int nDirs, voronoi_data *voronoi)
 Computes the Voronoi diagram for a spherical arrangement of points.
 
void sphVoronoiAreas (voronoi_data *voronoi, float *areas)
 Computes the areas of a Voronoi diagram on the unit sphere [sum(areas)=4pi].
 
void getVoronoiWeights (float *dirs_deg, int nDirs, int diagFLAG, float *weights)
 Computes the integration weights, based on the areas of each face of the corresponding Voronoi diagram [sum(weights)=4pi].
 

Detailed Description

A collection of computational geometry related functions.

Author
Leo McCormack
Date
03.07.2020
License
ISC

Definition in file saf_utility_geometry.h.