CellModules
MecaCell Namespace Reference

this file contains various miscellanious utility functions & helpers * More...

Classes

struct  Basis
 
struct  Config
 
class  ConnectableCell
 Basis for every cell a user might want to use. More...
 
struct  ContactSurface
 
class  ContactSurfaceBody
 
struct  DBG
 
class  ElasticBody
 
struct  ElasticConnection
 An Elastic Connection is a connection between two cells. More...
 
struct  ERR
 
struct  Euler
 
struct  GenericConnectionBodyPlugin
 
struct  GhostCenter
 
class  Grid
 Infinite grid of fixed cell size for space partitioning. More...
 
struct  INF
 
struct  Joint
 
struct  make_void
 
struct  Matrix4x4
 
class  Movable
 
struct  Obj3D
 3D object representation: contains the vertices, UV coordinates, normals and faces More...
 
struct  ordered_hash_map
 
struct  ordered_pair
 
class  Orientable
 
struct  OrientedParticle
 
struct  Quaternion
 
struct  Rotation
 
struct  Scene3D
 Class allowing to load a 3D scene from an obj file. It contains one or several Obj3D as well as various helper method. More...
 
struct  Spring
 
class  SpringBody
 
struct  SpringConnection
 A Spring Connection is a connection between two cells that aims to models both attractive (for adhesion) and repulsive (for collision) forces. It can be seen as composed of 4 dynamically updated mass-spring-damper systems (which can also be seen as a simplified Euler-Bernouilli beam system): More...
 
struct  SUC
 
class  Vector3D
 general purpose 3D vector/point class. More...
 
struct  Verlet
 
class  VolumeMembrane
 
struct  WARN
 
class  World
 Where "everything" happens. More...
 

Typedefs

template<typename... Ts>
using void_t = typename make_void< Ts... >::type
 
using Vec = Vector3D
 alias for Vector3D More...
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &out, const Basis< T > &b)
 
std::pair< bool, VecrayInTriangle (const Vec &v0, const Vec &v1, const Vec &v2, const Vec &o, const Vec &r, const double tolerance=0)
 test if a ray hits a triangle More...
 
std::pair< bool, VecprojectionIntriangle (const Vec &v0, const Vec &v1, const Vec &v2, const Vec &p, const double tolerance=0)
 tests if the projection of a point along the normal of a triangle is inside said triangle More...
 
double closestDistToTriangleEdge (const Vec &v0, const Vec &v1, const Vec &v2, const Vec &p)
 computes the smallest distance to a triangle edge from a given point More...
 
ostream & operator<< (ostream &out, const Matrix4x4 &M)
 
bool operator== (const Vector3D &v1, const Vector3D &v2)
 
bool operator!= (const Vector3D &v1, const Vector3D &v2)
 
Vector3D operator+ (const Vector3D &v1, const Vector3D &v2)
 
Vector3D operator+ (const double f, const Vector3D &v)
 
Vector3D operator+ (const Vector3D &v, const double f)
 
Vector3D operator- (const Vector3D &v1, const Vector3D &v2)
 
Vector3D operator* (const Vector3D &v1, const Vector3D &v2)
 
Vector3D operator* (const double f, const Vector3D &v)
 
Vector3D operator* (const Vector3D &v, const double f)
 
Vector3D operator- (const double f, const Vector3D &v)
 
Vector3D operator- (const Vector3D &v, const double f)
 
Vector3D operator- (const Vector3D &v)
 
Vector3D operator/ (const Vector3D &v, const double f)
 
ostream & operator<< (ostream &out, const Vector3D &v)
 
template<typename T >
std::string sublogger (T &&t)
 
template<typename T , typename... Args>
std::string sublogger (T &&t, Args &&... args)
 
template<typename Type , typename... Args>
void logger (Args &&... args)
 
template<typename T >
ordered_pair< T * > make_ordered_cell_pair (T *a, T *b)
 
template<typename T >
ordered_pair< T > make_ordered_pair (const T &a, const T &b)
 
template<typename T >
T * ptr (T &obj)
 returns a pointer (transforms reference into pointer) More...
 
template<typename T >
T * ptr (T *obj)
 returns a pointer (transforms reference into pointer) More...
 
template<typename T >
constexpr T lerp (const T &a, const T &b, const double &c)
 linear interpolation More...
 
template<typename T >
bool fuzzyEqual (const T &a, const T &b, double eps=1e-6)
 
template<typename T >
bool isInVector (const T &elem, const std::vector< T > &vec)
 
template<typename T >
void eraseFromVector (const T &elem, std::deque< T > &vec)
 
template<typename T >
void eraseFromVector (const T &elem, std::vector< T > &vec)
 
std::vector< std::string > splitStr (const std::string &s, char delim)
 String spliting. More...
 
std::array< double, 3 > hsvToRgb (double h, double s, double v)
 transform hsv color space to rgb More...
 
template<typename T >
constexpr T constpow (const T base, unsigned const exponent)
 
template<typename T >
constexpr size_t eToUI (const T &t)
 
double dampingFromRatio (const double r, const double m, const double k)
 

Variables

static double GRIDSIZE = 120
 Embedded plugin that will handle the collision detection routines. Parallel code. More...
 
const static constexpr char RESET [] = ""
 
const static constexpr char BLACK [] = ""
 
const static constexpr char RED [] = ""
 
const static constexpr char GREEN [] = ""
 
const static constexpr char YELLOW [] = ""
 
const static constexpr char BLUE [] = ""
 
const static constexpr char MAGENTA [] = ""
 
const static constexpr char CYAN [] = ""
 
const static constexpr char WHITE [] = ""
 
const static constexpr char BOLDBLACK [] = ""
 
const static constexpr char BOLDRED [] = ""
 
const static constexpr char BOLDGREEN [] = ""
 
const static constexpr char BOLDYELLOW [] = ""
 
const static constexpr char BOLDBLUE [] = ""
 
const static constexpr char BOLDMAGENTA [] = ""
 
const static constexpr char BOLDCYAN [] = ""
 
const static constexpr char BOLDWHITE [] = ""
 

Detailed Description

this file contains various miscellanious utility functions & helpers *

Typedef Documentation

◆ Vec

using MecaCell::Vec = typedef Vector3D

alias for Vector3D

Definition at line 22 of file utils.hpp.

◆ void_t

template<typename... Ts>
using MecaCell::void_t = typedef typename make_void<Ts...>::type

Definition at line 12 of file introspect.hpp.

Function Documentation

◆ closestDistToTriangleEdge()

double MecaCell::closestDistToTriangleEdge ( const Vec v0,
const Vec v1,
const Vec v2,
const Vec p 
)
inline

computes the smallest distance to a triangle edge from a given point

Parameters
v0triangle vertex 0
v1triangle vertex 1
v2triangle vertex 2
pconsidered point
Returns
the smallest distance to an edge

Definition at line 79 of file geometry.hpp.

◆ constpow()

template<typename T >
constexpr T MecaCell::constpow ( const T  base,
unsigned const  exponent 
)
inlineconstexpr

Definition at line 125 of file utils.hpp.

◆ dampingFromRatio()

double MecaCell::dampingFromRatio ( const double  r,
const double  m,
const double  k 
)
inline

Definition at line 133 of file utils.hpp.

◆ eraseFromVector() [1/2]

template<typename T >
void MecaCell::eraseFromVector ( const T &  elem,
std::deque< T > &  vec 
)
inline

Definition at line 65 of file utils.hpp.

◆ eraseFromVector() [2/2]

template<typename T >
void MecaCell::eraseFromVector ( const T &  elem,
std::vector< T > &  vec 
)
inline

Definition at line 68 of file utils.hpp.

◆ eToUI()

template<typename T >
constexpr size_t MecaCell::eToUI ( const T &  t)
constexpr

Definition at line 129 of file utils.hpp.

◆ fuzzyEqual()

template<typename T >
bool MecaCell::fuzzyEqual ( const T &  a,
const T &  b,
double  eps = 1e-6 
)
inline

Definition at line 57 of file utils.hpp.

◆ hsvToRgb()

std::array< double, 3 > MecaCell::hsvToRgb ( double  h,
double  s,
double  v 
)
inline

transform hsv color space to rgb

Parameters
h
s
v
Returns

Definition at line 97 of file utils.hpp.

◆ isInVector()

template<typename T >
bool MecaCell::isInVector ( const T &  elem,
const std::vector< T > &  vec 
)
inline

Definition at line 62 of file utils.hpp.

◆ lerp()

template<typename T >
constexpr T MecaCell::lerp ( const T &  a,
const T &  b,
const double &  c 
)
constexpr

linear interpolation

Template Parameters
T
Parameters
a
b
ccoef (0.0 -> 1.0)
Returns

Definition at line 53 of file utils.hpp.

◆ logger()

template<typename Type , typename... Args>
void MecaCell::logger ( Args &&...  args)

Definition at line 129 of file logger.hpp.

◆ make_ordered_cell_pair()

template<typename T >
ordered_pair< T * > MecaCell::make_ordered_cell_pair ( T *  a,
T *  b 
)
inline

Definition at line 18 of file ordered_pair.hpp.

◆ make_ordered_pair()

template<typename T >
ordered_pair< T > MecaCell::make_ordered_pair ( const T &  a,
const T &  b 
)
inline

Definition at line 22 of file ordered_pair.hpp.

◆ operator!=()

bool MecaCell::operator!= ( const Vector3D v1,
const Vector3D v2 
)
inline

Definition at line 541 of file vector3D.h.

◆ operator*() [1/3]

Vector3D MecaCell::operator* ( const double  f,
const Vector3D v 
)
inline

Definition at line 566 of file vector3D.h.

◆ operator*() [2/3]

Vector3D MecaCell::operator* ( const Vector3D v,
const double  f 
)
inline

Definition at line 569 of file vector3D.h.

◆ operator*() [3/3]

Vector3D MecaCell::operator* ( const Vector3D v1,
const Vector3D v2 
)
inline

Definition at line 561 of file vector3D.h.

◆ operator+() [1/3]

Vector3D MecaCell::operator+ ( const double  f,
const Vector3D v 
)
inline

Definition at line 550 of file vector3D.h.

◆ operator+() [2/3]

Vector3D MecaCell::operator+ ( const Vector3D v,
const double  f 
)
inline

Definition at line 553 of file vector3D.h.

◆ operator+() [3/3]

Vector3D MecaCell::operator+ ( const Vector3D v1,
const Vector3D v2 
)
inline

Definition at line 546 of file vector3D.h.

◆ operator-() [1/4]

Vector3D MecaCell::operator- ( const double  f,
const Vector3D v 
)
inline

Definition at line 573 of file vector3D.h.

◆ operator-() [2/4]

Vector3D MecaCell::operator- ( const Vector3D v)
inline

Definition at line 580 of file vector3D.h.

◆ operator-() [3/4]

Vector3D MecaCell::operator- ( const Vector3D v,
const double  f 
)
inline

Definition at line 576 of file vector3D.h.

◆ operator-() [4/4]

Vector3D MecaCell::operator- ( const Vector3D v1,
const Vector3D v2 
)
inline

Definition at line 557 of file vector3D.h.

◆ operator/()

Vector3D MecaCell::operator/ ( const Vector3D v,
const double  f 
)
inline

Definition at line 584 of file vector3D.h.

◆ operator<<() [1/3]

ostream & MecaCell::operator<< ( ostream &  out,
const Matrix4x4 M 
)
inline

Definition at line 116 of file matrix4x4.h.

◆ operator<<() [2/3]

ostream & MecaCell::operator<< ( ostream &  out,
const Vector3D v 
)
inline

Definition at line 587 of file vector3D.h.

◆ operator<<() [3/3]

template<typename T >
std::ostream & MecaCell::operator<< ( std::ostream &  out,
const Basis< T > &  b 
)
inline

Definition at line 38 of file basis.hpp.

◆ operator==()

bool MecaCell::operator== ( const Vector3D v1,
const Vector3D v2 
)
inline

Definition at line 537 of file vector3D.h.

◆ projectionIntriangle()

std::pair< bool, Vec > MecaCell::projectionIntriangle ( const Vec v0,
const Vec v1,
const Vec v2,
const Vec p,
const double  tolerance = 0 
)
inline

tests if the projection of a point along the normal of a triangle is inside said triangle

Parameters
v0triangle vertex 0
v1triangle vertex 1
v2triangle vertex 2
ppoint to be projected
tolerance
Returns
a pair containing a boolean (true if the projection is inside the triangle) and the projection position

Definition at line 53 of file geometry.hpp.

◆ ptr() [1/2]

template<typename T >
T * MecaCell::ptr ( T &  obj)
inline

returns a pointer (transforms reference into pointer)

Template Parameters
T
Parameters
obj
Returns

Definition at line 32 of file utils.hpp.

◆ ptr() [2/2]

template<typename T >
T * MecaCell::ptr ( T *  obj)
inline

returns a pointer (transforms reference into pointer)

Template Parameters
T
Parameters
obj
Returns

Definition at line 41 of file utils.hpp.

◆ rayInTriangle()

std::pair< bool, Vec > MecaCell::rayInTriangle ( const Vec v0,
const Vec v1,
const Vec v2,
const Vec o,
const Vec r,
const double  tolerance = 0 
)
inline

test if a ray hits a triangle

Parameters
v0triangle vertex 0
v1triangle vertex 1
v2triangle vertex 2
oorigin of ray
rdirection of ray
tolerance
Returns
a pair containing a boolean (true if the triangle was hit) and the hit position

Definition at line 19 of file geometry.hpp.

◆ splitStr()

std::vector< std::string > MecaCell::splitStr ( const std::string &  s,
char  delim 
)
inline

String spliting.

Parameters
sthe string to split
delimthe delimiter character
Returns
a vector of substrings

Definition at line 80 of file utils.hpp.

◆ sublogger() [1/2]

template<typename T >
std::string MecaCell::sublogger ( T &&  t)

Definition at line 71 of file logger.hpp.

◆ sublogger() [2/2]

template<typename T , typename... Args>
std::string MecaCell::sublogger ( T &&  t,
Args &&...  args 
)

Definition at line 77 of file logger.hpp.

Variable Documentation

◆ BLACK

const static constexpr char MecaCell::BLACK[] = ""
staticconstexpr

Definition at line 41 of file logger.hpp.

◆ BLUE

const static constexpr char MecaCell::BLUE[] = ""
staticconstexpr

Definition at line 45 of file logger.hpp.

◆ BOLDBLACK

const static constexpr char MecaCell::BOLDBLACK[] = ""
staticconstexpr

Definition at line 49 of file logger.hpp.

◆ BOLDBLUE

const static constexpr char MecaCell::BOLDBLUE[] = ""
staticconstexpr

Definition at line 53 of file logger.hpp.

◆ BOLDCYAN

const static constexpr char MecaCell::BOLDCYAN[] = ""
staticconstexpr

Definition at line 55 of file logger.hpp.

◆ BOLDGREEN

const static constexpr char MecaCell::BOLDGREEN[] = ""
staticconstexpr

Definition at line 51 of file logger.hpp.

◆ BOLDMAGENTA

const static constexpr char MecaCell::BOLDMAGENTA[] = ""
staticconstexpr

Definition at line 54 of file logger.hpp.

◆ BOLDRED

const static constexpr char MecaCell::BOLDRED[] = ""
staticconstexpr

Definition at line 50 of file logger.hpp.

◆ BOLDWHITE

const static constexpr char MecaCell::BOLDWHITE[] = ""
staticconstexpr

Definition at line 56 of file logger.hpp.

◆ BOLDYELLOW

const static constexpr char MecaCell::BOLDYELLOW[] = ""
staticconstexpr

Definition at line 52 of file logger.hpp.

◆ CYAN

const static constexpr char MecaCell::CYAN[] = ""
staticconstexpr

Definition at line 47 of file logger.hpp.

◆ GREEN

const static constexpr char MecaCell::GREEN[] = ""
staticconstexpr

Definition at line 43 of file logger.hpp.

◆ GRIDSIZE

double MecaCell::GRIDSIZE = 120
static

Embedded plugin that will handle the collision detection routines. Parallel code.

Definition at line 17 of file genericconnectionplugin.hpp.

◆ MAGENTA

const static constexpr char MecaCell::MAGENTA[] = ""
staticconstexpr

Definition at line 46 of file logger.hpp.

◆ RED

const static constexpr char MecaCell::RED[] = ""
staticconstexpr

Definition at line 42 of file logger.hpp.

◆ RESET

const static constexpr char MecaCell::RESET[] = ""
staticconstexpr

Definition at line 40 of file logger.hpp.

◆ WHITE

const static constexpr char MecaCell::WHITE[] = ""
staticconstexpr

Definition at line 48 of file logger.hpp.

◆ YELLOW

const static constexpr char MecaCell::YELLOW[] = ""
staticconstexpr

Definition at line 44 of file logger.hpp.