Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Classes | Typedefs | Functions
core_mathlib Namespace Reference

Math functions. More...

Classes

class  base_vec3
 3D vector Vector defined with 3 float numbers More...
 
class  vec2
 2D Vector Vector defined with 2 float numbers More...
 
class  vec4
 4D Vector Vector defined with 4 float numbers More...
 
class  ivec2
 2D Vector Vector defined with 2 integers More...
 
class  ivec3
 3D Vector Vector defined with 3 integers More...
 
class  ivec4
 4D Vector Vector defined with 4 integers More...
 

Typedefs

typedef float decimal
 
typedef unsigned int bitSet
 
typedef base_vec3< decimalvec3
 
typedef base_vec3< double > dvec3
 

Functions

std::vector< vec3operator* (const std::vector< vec3 > &_v, const decimal &_a)
 
std::vector< vec3operator+ (const std::vector< vec3 > &_u, const std::vector< vec3 > &_v)
 
std::vector< dvec3operator* (const std::vector< dvec3 > &_v, const decimal &_a)
 
std::vector< dvec3operator+ (const std::vector< dvec3 > &_u, const std::vector< dvec3 > &_v)
 
OPoint3D vec3toOPoint3D (const vec3 &_v)
 Converts a vec3 to OPoint3D. More...
 
vec3 OPoint3Dtovec3 (const OPoint3D &_p)
 Converts a OPoint3D to vec3. More...
 
OVector3D vec3toOVector3D (const vec3 &_v)
 Converts a vec3 to OVector3D. More...
 
vec3 OVector3Dtovec3 (const OVector3D &_v)
 Converts a OVector3D to vec3. More...
 
decimal area (const vec2 &A, const vec2 &B, const vec2 &C)
 
void Cross (const vec3 &v1, const vec3 &v2, vec3 &vout)
 
vec3 Cross_r (const vec3 &v1, const vec3 &v2)
 
void Vector (const vec3 &vp1, const vec3 &vp2, vec3 &vout)
 
vec3 Vector_r (const vec3 &vp1, const vec3 &vp2)
 
decimal Determinant (const vec3 &vp1, const vec3 &vp2, const vec3 &vp3)
 
vec3 FaceNormal (const vec3 &vp1, const vec3 &vp2, const vec3 &vp3)
 
decimal Determinant (const vec4 &vp1, const vec4 &vp2, const vec4 &vp3, const vec4 &vp4)
 
decimal Determinant (const vec3 &vp1, const vec3 &vp2, const vec3 &vp3, const vec3 &vp4)
 
bool colinear (const vec3 &A, const vec3 &B, const vec3 &C, const decimal &aproximation)
 
decimal CalcTetraVolume (vec3 A, vec3 B, vec3 C, vec3 D)
 
vec3 GetGTriangle (const vec3 &A, const vec3 &B, const vec3 &C)
 
vec3 GetGTetra (const vec3 &A, const vec3 &B, const vec3 &C, const vec3 &D)
 
decimal GetAireTriangle (const vec3 &a, const vec3 &b, const vec3 &c)
 
float Clamp (float val, float low, float high)
 
int Clamp (int val, int low, int high)
 
int Floor2Int (float val)
 
int Round2Int (float val)
 
bool LineLineIntersect (const vec3 &p1, const vec3 &p2, const vec3 &p3, const vec3 &p4, vec3 *pa, vec3 *pb, decimal *mua, decimal *mub)
 Calculate the segment between the lines (p1,p2) and (p3,p4) More...
 
bool pointInPolygone (const vec2 &p, const std::vector< vec2 > &points)
 
decimal ClosestDistanceBetweenDotAndTriangle (const vec3 &va, const vec3 &vb, const vec3 &vc, const vec3 &P, decimal *pfSParam, decimal *pfTParam)
 
unsigned int buildBitSet (const unsigned short &length)
 
unsigned int buildComplementaryBitSet (const unsigned int &length, const unsigned int &bitSet)
 

Detailed Description

Math functions.

Typedef Documentation

◆ bitSet

typedef unsigned int core_mathlib::bitSet

used to manage set of elements

Definition at line 47 of file mathlib.h.

◆ decimal

typedef float core_mathlib::decimal

Definition at line 45 of file mathlib.h.

◆ dvec3

typedef base_vec3<double> core_mathlib::dvec3

Definition at line 382 of file mathlib.h.

◆ vec3

Definition at line 381 of file mathlib.h.

Function Documentation

◆ area()

decimal core_mathlib::area ( const vec2 A,
const vec2 B,
const vec2 C 
)
inline

Definition at line 659 of file mathlib.h.

◆ buildBitSet()

unsigned int core_mathlib::buildBitSet ( const unsigned short &  length)
inline

Definition at line 1831 of file mathlib.h.

Here is the caller graph for this function:

◆ buildComplementaryBitSet()

unsigned int core_mathlib::buildComplementaryBitSet ( const unsigned int &  length,
const unsigned int &  bitSet 
)
inline

Definition at line 1845 of file mathlib.h.

Here is the call graph for this function:

◆ CalcTetraVolume()

decimal core_mathlib::CalcTetraVolume ( vec3  A,
vec3  B,
vec3  C,
vec3  D 
)
inline

Definition at line 1337 of file mathlib.h.

Here is the call graph for this function:

◆ Clamp() [1/2]

float core_mathlib::Clamp ( float  val,
float  low,
float  high 
)
inline

Definition at line 1367 of file mathlib.h.

Here is the caller graph for this function:

◆ Clamp() [2/2]

int core_mathlib::Clamp ( int  val,
int  low,
int  high 
)
inline

Definition at line 1383 of file mathlib.h.

◆ ClosestDistanceBetweenDotAndTriangle()

decimal core_mathlib::ClosestDistanceBetweenDotAndTriangle ( const vec3 va,
const vec3 vb,
const vec3 vc,
const vec3 P,
decimal pfSParam,
decimal pfTParam 
)
inline

Closest distance between a point and a triangle.

Parameters
vaVertex A of the triangle
vbVertex B of the triangle
vcVertex C of the triangle
PPoint
pfSParamBarycentric coordinate of triangle at point closest to p (u)
pfTParamBarycentric coordinate of triangle at point closest to p (v)
Returns
Shortest distance squared.

The third Barycentric coordinate is implicit, ie. w = 1.0 - u - v

Taken from: geometrictools.com

See also
http://www.geometrictools.com/LibFoundation/Distance/Distance.html

Definition at line 1577 of file mathlib.h.

◆ colinear()

bool core_mathlib::colinear ( const vec3 A,
const vec3 B,
const vec3 C,
const decimal aproximation 
)
inline

Definition at line 902 of file mathlib.h.

Here is the call graph for this function:

◆ Cross()

void core_mathlib::Cross ( const vec3 v1,
const vec3 v2,
vec3 vout 
)
inline

Definition at line 664 of file mathlib.h.

◆ Cross_r()

vec3 core_mathlib::Cross_r ( const vec3 v1,
const vec3 v2 
)
inline

Definition at line 670 of file mathlib.h.

Here is the caller graph for this function:

◆ Determinant() [1/3]

decimal core_mathlib::Determinant ( const vec3 vp1,
const vec3 vp2,
const vec3 vp3 
)
inline

This calculates determinant 3*3

Definition at line 699 of file mathlib.h.

◆ Determinant() [2/3]

decimal core_mathlib::Determinant ( const vec3 vp1,
const vec3 vp2,
const vec3 vp3,
const vec3 vp4 
)
inline

Calculate the determinant

|x1 y1 z1 1| |x2 y2 z2 1| |x3 y3 z3 1| |x4 y4 z4 1|

Definition at line 878 of file mathlib.h.

◆ Determinant() [3/3]

decimal core_mathlib::Determinant ( const vec4 vp1,
const vec4 vp2,
const vec4 vp3,
const vec4 vp4 
)
inline

Calculate the determinant

|x1 y1 z1 w1| |x2 y2 z2 w2| |x3 y3 z3 w3| |x4 y4 z4 w4|

Definition at line 859 of file mathlib.h.

◆ FaceNormal()

vec3 core_mathlib::FaceNormal ( const vec3 vp1,
const vec3 vp2,
const vec3 vp3 
)
inline

Definition at line 711 of file mathlib.h.

Here is the call graph for this function:

◆ Floor2Int()

int core_mathlib::Floor2Int ( float  val)
inline

Definition at line 1399 of file mathlib.h.

Here is the caller graph for this function:

◆ GetAireTriangle()

decimal core_mathlib::GetAireTriangle ( const vec3 a,
const vec3 b,
const vec3 c 
)
inline

Definition at line 1357 of file mathlib.h.

Here is the call graph for this function:

◆ GetGTetra()

vec3 core_mathlib::GetGTetra ( const vec3 A,
const vec3 B,
const vec3 C,
const vec3 D 
)
inline

Definition at line 1353 of file mathlib.h.

◆ GetGTriangle()

vec3 core_mathlib::GetGTriangle ( const vec3 A,
const vec3 B,
const vec3 C 
)
inline
Returns
Return the central point of a triangle

Definition at line 1347 of file mathlib.h.

◆ LineLineIntersect()

bool core_mathlib::LineLineIntersect ( const vec3 p1,
const vec3 p2,
const vec3 p3,
const vec3 p4,
vec3 pa,
vec3 pb,
decimal mua,
decimal mub 
)
inline

Calculate the segment between the lines (p1,p2) and (p3,p4)

Parameters
p1first point of the first segment
p2second point of the first segment
p3first point of the second segment
p4second point of the second segment
papoint of the first line (p1p2) that belongs to the shortest segment between the two lines
pbpoint of the second line (p3p4) that belongs to the shortest segment between the two lines
muaposition of a along the first line (p1p2)
mubposition of b along the second line (p3p4)
Returns
False if no solution is found

Definition at line 1460 of file mathlib.h.

Here is the caller graph for this function:

◆ operator*() [1/2]

std::vector<dvec3> core_mathlib::operator* ( const std::vector< dvec3 > &  _v,
const decimal _a 
)
inline

Definition at line 406 of file mathlib.h.

◆ operator*() [2/2]

std::vector<vec3> core_mathlib::operator* ( const std::vector< vec3 > &  _v,
const decimal _a 
)
inline

Definition at line 384 of file mathlib.h.

◆ operator+() [1/2]

std::vector<dvec3> core_mathlib::operator+ ( const std::vector< dvec3 > &  _u,
const std::vector< dvec3 > &  _v 
)
inline

Definition at line 416 of file mathlib.h.

◆ operator+() [2/2]

std::vector<vec3> core_mathlib::operator+ ( const std::vector< vec3 > &  _u,
const std::vector< vec3 > &  _v 
)
inline

Definition at line 394 of file mathlib.h.

◆ OPoint3Dtovec3()

vec3 core_mathlib::OPoint3Dtovec3 ( const OPoint3D _p)
inline

Converts a OPoint3D to vec3.

Definition at line 440 of file mathlib.h.

Here is the caller graph for this function:

◆ OVector3Dtovec3()

vec3 core_mathlib::OVector3Dtovec3 ( const OVector3D _v)
inline

Converts a OVector3D to vec3.

Definition at line 458 of file mathlib.h.

◆ pointInPolygone()

bool core_mathlib::pointInPolygone ( const vec2 p,
const std::vector< vec2 > &  points 
)
inline

Definition at line 1541 of file mathlib.h.

◆ Round2Int()

int core_mathlib::Round2Int ( float  val)
inline

Definition at line 1404 of file mathlib.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vec3toOPoint3D()

OPoint3D core_mathlib::vec3toOPoint3D ( const vec3 _v)
inline

Converts a vec3 to OPoint3D.

Definition at line 431 of file mathlib.h.

◆ vec3toOVector3D()

OVector3D core_mathlib::vec3toOVector3D ( const vec3 _v)
inline

Converts a vec3 to OVector3D.

Definition at line 449 of file mathlib.h.

◆ Vector()

void core_mathlib::Vector ( const vec3 vp1,
const vec3 vp2,
vec3 vout 
)
inline

Definition at line 685 of file mathlib.h.

Here is the caller graph for this function:

◆ Vector_r()

vec3 core_mathlib::Vector_r ( const vec3 vp1,
const vec3 vp2 
)
inline

Definition at line 692 of file mathlib.h.

Here is the caller graph for this function: