28#ifndef SAF_GEOMETRY_H_INCLUDED
29#define SAF_GEOMETRY_H_INCLUDED
36typedef struct _quaternion_data {
62typedef struct _voronoi_data{
144 int rollPitchYawFLAG,
159 int anglesInDegreesFLAG,
174 int anglesInDegreesFLAG,
189 int anglesInDegreesFLAG,
204 int anglesInDegreesFLAG,
242float L2_norm(
float* v,
int lenV);
245float Frob_norm(
float* M,
int lenX,
int lenY);
293 const float* vertices,
366 const float* dirs_deg,
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 quaternion2rotationMatrix(quaternion_data *Q, float R[3][3])
Constructs a 3x3 rotation matrix based on a quaternion.
EULER_ROTATION_CONVENTIONS
Available euler2rotationMatrix() conventions.
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 sphVoronoiAreas(voronoi_data *voronoi, float *areas)
Computes the areas of a Voronoi diagram on the unit sphere [sum(areas)=4pi].
void euler2Quaternion(float alpha, float beta, float gamma, int degreesFlag, EULER_ROTATION_CONVENTIONS convention, quaternion_data *Q)
Converts Euler angles to a quaternion.
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 diagra...
void quaternion2euler(quaternion_data *Q, int degreesFlag, EULER_ROTATION_CONVENTIONS convention, float *alpha, float *beta, float *gamma)
Converts a quaternion to Euler angles.
void sphIncl2Elev(float *dirsIncl, int nDirs, int degreesFlag, float *dirsElev)
Converts spherical coordinates of unit length from inclination to elevation.
void crossProduct3(float a[3], float b[3], float c[3])
Cross product between two 3-element floating point vectors (c = a x b)
void sph2cart(float *sph, int nDirs, int anglesInDegreesFLAG, float *cart)
Converts spherical coordinates to Cartesian coordinates.
void rotationMatrix2quaternion(float R[3][3], quaternion_data *Q)
Calculates the quaternion corresponding to a 3x3 rotation matrix.
void sphElev2incl(float *dirsElev, int nDirs, int degreesFlag, float *dirsIncl)
Converts spherical coordinates of unit length from elevation to inclination.
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 Frob_norm(float *M, int lenX, int lenY)
Returns the Frobenius Norm of a matrix M, of dimensions: lenX x lenY.
void sphVoronoi(int *faces, int nFaces, float *vertices, int nDirs, voronoi_data *voronoi)
Computes the Voronoi diagram for a spherical arrangement of points.
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 sphDelaunay(const float *dirs_deg, const int nDirs, int **faces, int *nFaces, float *vertices)
Delaunay triangulation of a spherical arrangement of points.
float getDistBetween2Points(float point_a[3], float point_b[3])
Returns the distance between "point_a" and "point_b".
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 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 cart2sph(float *cart, int nDirs, int anglesInDegreesFLAG, float *sph)
Converts Cartesian coordinates to spherical coordinates.
float L2_norm(float *v, int lenV)
Returns the L2 (Euclidean) norm of an arbitrary length vector.
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.
float L2_norm3(float v[3])
Returns the L2 (Euclidean) norm of a 3-element vector.
@ EULER_ROTATION_YAW_PITCH_ROLL
yaw-pitch-roll, 'zyx'
@ EULER_ROTATION_ROLL_PITCH_YAW
roll-pitch-yaw, 'xyz'
@ EULER_ROTATION_X_CONVENTION
x-convention, 'zxz'
@ EULER_ROTATION_Y_CONVENTION
y-convention, 'zyz'
Quaternion data structure.
float x
X value of the quaternion [-1..1].
float z
Z value of the quaternion [-1..1].
float y
Y value of the quaternion [-1..1].
float w
W value of the quaternion [-1..1].
Data structure for Voronoi diagrams.
float ** vert
Vertices; nVert x 3.
int ** faces
faces; nFaces x nPointsPerFace[i]
int nFaces
Number of faces/polygons.
int * nPointsPerFace
Number of points for each face; nFaces x 1.
int nVert
Number of vertices.