Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Classes | Namespaces | Macros | Typedefs | Functions
mathlib.h File Reference

Math library. More...

#include <cassert>
#include <math.h>
#include <stdlib.h>
#include <float.h>
#include <vector>
#include <boost/foreach.hpp>
#include "3d.h"
Include dependency graph for mathlib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

 core_mathlib
 Math functions.
 

Macros

#define EPSILON_4   (decimal)0.0001
 
#define EPSILON_15   (decimal)0.000000000000001
 
#define M_PIDIV2   (decimal)1.570796326794896619231321691639
 
#define M_4PI   (decimal)12.566370614359172953850573533118
 
#define M_PI2   (decimal)9.869604401089358618834490999876
 
#define M_PIDIV180   (decimal)0.01745329251994329576923690768488
 
#define M_180DIVPI   (decimal)57.295779513082320876798154814105
 
#define DegToRad(a)   a*=M_PIDIV180
 
#define RadToDeg(a)   a*=M_180DIVPI
 
#define RADIANS(a)   a*M_PIDIV180
 
#define DEGRES(a)   a*M_180DIVPI
 
#define ABS(x)   (fabs(x))
 
#define SIGN(x)   ((x) > 0 ? 1 : -1)
 

Typedefs

typedef float core_mathlib::decimal
 
typedef unsigned int core_mathlib::bitSet
 
typedef base_vec3< decimalcore_mathlib::vec3
 
typedef base_vec3< double > core_mathlib::dvec3
 

Functions

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

Detailed Description

Math library.

The vector type is declared here, and operations with this type.

Author
Projet_Tympan

Definition in file mathlib.h.

Macro Definition Documentation

◆ ABS

#define ABS (   x)    (fabs(x))

Definition at line 84 of file mathlib.h.

◆ DEGRES

#define DEGRES (   a)    a*M_180DIVPI

Definition at line 83 of file mathlib.h.

◆ DegToRad

#define DegToRad (   a)    a*=M_PIDIV180

Definition at line 80 of file mathlib.h.

◆ EPSILON_15

#define EPSILON_15   (decimal)0.000000000000001

Definition at line 59 of file mathlib.h.

◆ EPSILON_4

#define EPSILON_4   (decimal)0.0001

Definition at line 51 of file mathlib.h.

◆ M_180DIVPI

#define M_180DIVPI   (decimal)57.295779513082320876798154814105

180 / PI

Definition at line 78 of file mathlib.h.

◆ M_4PI

#define M_4PI   (decimal)12.566370614359172953850573533118

4 * PI

Definition at line 73 of file mathlib.h.

◆ M_PI2

#define M_PI2   (decimal)9.869604401089358618834490999876

PI * PI

Definition at line 76 of file mathlib.h.

◆ M_PIDIV180

#define M_PIDIV180   (decimal)0.01745329251994329576923690768488

PI / 180

Definition at line 77 of file mathlib.h.

◆ M_PIDIV2

#define M_PIDIV2   (decimal)1.570796326794896619231321691639

PI / 2

Definition at line 66 of file mathlib.h.

◆ RADIANS

#define RADIANS (   a)    a*M_PIDIV180

Definition at line 82 of file mathlib.h.

◆ RadToDeg

#define RadToDeg (   a)    a*=M_180DIVPI

Definition at line 81 of file mathlib.h.

◆ SIGN

#define SIGN (   x)    ((x) > 0 ? 1 : -1)

Definition at line 87 of file mathlib.h.