3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Functions
mathfuncs.h File Reference
#include <cmath>
#include <limits>
#include <iostream>
#include <vector>
#include <gsl/gsl_matrix.h>
#include "endianTest.h"
Include dependency graph for mathfuncs.h:
This graph shows which files directly or indirectly include this file:

Classes

class  Point3D
 A 3D point data class storage. More...
 
class  RandNumGen
 
struct  Quaternion
 
struct  Point3f
 
class  LinearFeedbackShiftReg
 

Functions

void quat_rot (Point3D &p, const Point3D &r, float angle)
 
void quat_rot (Point3f *point, const Point3f *rotVec, float angle)
 
void quat_rot_array (Point3f *point, unsigned int n, const Point3f *rotVec, float angle)
 
void quat_rot_array (Point3D *point, unsigned int n, const Point3f *rotVec, float angle)
 
void quat_get_rot_quat (const Point3f *rotVec, float angle, Quaternion *rotQuat)
 
void quat_rot_apply_quat (Point3f *point, const Quaternion *rotQuat)
 
void applyQuaternionRotation (std::vector< Point3D > &pts, const Quaternion &q)
 
double pyramidVol (const Point3D *planarPts, const Point3D &apex)
 
float dotProduct (float a1, float a2, float a3, float b1, float b2, float b3)
 Inline func for calculating a(dot)b. More...
 
unsigned int ilog2 (unsigned int value)
 
void computeRotationMatrix (const Point3D &ur1, const Point3D &ur2, const Point3D &r1, const Point3D &r2, gsl_matrix *m)
 Use the TRIAD algorithm to compute the matrix that transforms orthogonal unit vectors. More...
 
void rotateByMatrix (const std::vector< Point3D > &vpts, const gsl_matrix *m, std::vector< Point3D > &r)
 
float clockwiseAngle (const Point3D &v1, const Point3D &v2, const Point3D &normal)
 
void scatterPointsInPolygon (const std::vector< Point3D > &polygon, const Point3D &normal, float scatterDensity, RandNumGen &rng, std::vector< Point3D > &result)
 
void rotatePointsToXYPlane (std::vector< Point3D > &pts, const Point3D &normal, const Point3D &origin, Quaternion &q)
 

Function Documentation

◆ applyQuaternionRotation()

void applyQuaternionRotation ( std::vector< Point3D > &  pts,
const Quaternion q 
)

◆ clockwiseAngle()

float clockwiseAngle ( const Point3D v1,
const Point3D v2,
const Point3D normal 
)

References Point3D::angle(), Point3D::crossProd(), Point3D::dotProd(), and M_PI.

Referenced by applyQuaternion(), BoundCube::getPlaneIntersectVertices(), and ilog2().

Here is the caller graph for this function:

◆ computeRotationMatrix()

void computeRotationMatrix ( const Point3D ur1,
const Point3D ur2,
const Point3D r1,
const Point3D r2,
gsl_matrix *  m 
)

Use the TRIAD algorithm to compute the matrix that transforms orthogonal unit vectors.

References ASSERT, Point3D::crossProd(), and Point3D::sqrMag().

Referenced by ilog2().

Here is the caller graph for this function:

◆ dotProduct()

float dotProduct ( float  a1,
float  a2,
float  a3,
float  b1,
float  b2,
float  b3 
)
inline

Inline func for calculating a(dot)b.

Referenced by GetReducedHullPts().

Here is the caller graph for this function:

◆ ilog2()

unsigned int ilog2 ( unsigned int  value)
inline

References clockwiseAngle(), computeRotationMatrix(), rotateByMatrix(), rotatePointsToXYPlane(), and scatterPointsInPolygon().

Referenced by testFilterTree().

Here is the caller graph for this function:

◆ pyramidVol()

double pyramidVol ( const Point3D planarPts,
const Point3D apex 
)

References det3by3().

Referenced by GetReducedHullPts(), and LinearFeedbackShiftReg::setState().

Here is the caller graph for this function:

◆ quat_get_rot_quat()

void quat_get_rot_quat ( const Point3f rotVec,
float  angle,
Quaternion rotQuat 
)

◆ quat_rot() [1/2]

void quat_rot ( Point3D p,
const Point3D r,
float  angle 
)

◆ quat_rot() [2/2]

void quat_rot ( Point3f point,
const Point3f rotVec,
float  angle 
)

◆ quat_rot_apply_quat()

void quat_rot_apply_quat ( Point3f point,
const Quaternion rotQuat 
)

◆ quat_rot_array() [1/2]

void quat_rot_array ( Point3f point,
unsigned int  n,
const Point3f rotVec,
float  angle 
)

◆ quat_rot_array() [2/2]

void quat_rot_array ( Point3D point,
unsigned int  n,
const Point3f rotVec,
float  angle 
)

References Point3f::fx, Point3f::fy, Point3f::fz, and quat_rot_array().

Referenced by DrawGLText::getBoundingBox(), and quat_rot_array().

Here is the caller graph for this function:

◆ rotateByMatrix()

void rotateByMatrix ( const std::vector< Point3D > &  vpts,
const gsl_matrix *  m,
std::vector< Point3D > &  r 
)

Referenced by ilog2().

Here is the caller graph for this function:

◆ rotatePointsToXYPlane()

void rotatePointsToXYPlane ( std::vector< Point3D > &  pts,
const Point3D normal,
const Point3D origin,
Quaternion q 
)

◆ scatterPointsInPolygon()

void scatterPointsInPolygon ( const std::vector< Point3D > &  polygon,
const Point3D normal,
float  scatterDensity,
RandNumGen rng,
std::vector< Point3D > &  result 
)