physics
Classes | Macros | Enumerations | Functions | Variables
body.hpp File Reference
#include <stack>
#include <algorithm>
#include "glm/glm.hpp"
#include "glm/gtx/string_cast.hpp"
#include "glm/gtx/norm.hpp"
#include "math_3d.hpp"
#include "collision.hpp"

Go to the source code of this file.

Classes

class  Tri
 Triangle class for managing data for triangle meshes. More...
 
class  TriOctree
 Octree for triangle meshes. More...
 
struct  Face
 Face structure for organising CollisionBody collision data. More...
 
struct  Edge
 Edge structure for organising CollisionBody collision data. More...
 
class  CollisionBody
 CollisionBody structure for organising data to model physics simulations of convex hull collisions. More...
 
class  RigidBody
 RigidBody structure for organising data to model physics simulations of convex hull collisions. More...
 

Macros

#define GLM_ENABLE_EXPERIMENTAL
 

Enumerations

enum  BodyType {
  NONE =-1, TRIANGLE =0, BOX =1, SPHERE =2,
  CYLINDER =3, COMPOSITE =4
}
 

Functions

vector< int > getTriangleSet (TriOctree &octree, CollisionBody &sphereBody, vector< int > &tri_ids)
 Get triangle set in the octree for the positions. More...
 
void createChildren (TriOctree &octree)
 Helper function for spawning child TriOctree. More...
 
void initOctree (TriOctree &octree, int ind, vec3 pos, float hwidth, vector< Tri > tris)
 Initialization function. More...
 
vector< vec4 > getAllNodes ()
 Get a vector of nodes, represented with a 3D position and half-width of the TriOctree. {vec4(x,y,z,hw), ... }. More...
 
int initBox (CollisionBody *body, float w, float h, float b)
 Initializer function for a box CollisionBody; w x h x b. More...
 
int initSphere (CollisionBody *body, float r)
 Initializer function for a sphere CollisionBody. More...
 
int initCylinder (CollisionBody *body, float r1, float r2, float h)
 Initializer function for a cylinder CollisionBody. More...
 
int initTriangle (CollisionBody *body, vector< vec3 > verts)
 Initializer function for a triangle CollisionBody. More...
 
vector< CollisionBodyinitTriangleMesh (vector< vec3 > verts)
 Initializer function for triangle mesh CollisionBody's. More...
 
TriOctreegetOctree ()
 

Variables

const float pi = 3.141592654f
 

Macro Definition Documentation

◆ GLM_ENABLE_EXPERIMENTAL

#define GLM_ENABLE_EXPERIMENTAL

Enumeration Type Documentation

◆ BodyType

enum BodyType
Enumerator
NONE 
TRIANGLE 
BOX 
SPHERE 
CYLINDER 
COMPOSITE 

Function Documentation

◆ createChildren()

void createChildren ( TriOctree octree)

Helper function for spawning child TriOctree.

◆ getAllNodes()

vector<vec4> getAllNodes ( )

Get a vector of nodes, represented with a 3D position and half-width of the TriOctree. {vec4(x,y,z,hw), ... }.

◆ getOctree()

TriOctree* getOctree ( )

◆ getTriangleSet()

vector<int> getTriangleSet ( TriOctree octree,
CollisionBody sphereBody,
vector< int > &  tri_ids 
)

Get triangle set in the octree for the positions.

◆ initBox()

int initBox ( CollisionBody body,
float  w,
float  h,
float  b 
)

Initializer function for a box CollisionBody; w x h x b.

◆ initCylinder()

int initCylinder ( CollisionBody body,
float  r1,
float  r2,
float  h 
)

Initializer function for a cylinder CollisionBody.

◆ initOctree()

void initOctree ( TriOctree octree,
int  ind,
vec3  pos,
float  hwidth,
vector< Tri tris 
)

Initialization function.

Todo:
make it a member.

◆ initSphere()

int initSphere ( CollisionBody body,
float  r 
)

Initializer function for a sphere CollisionBody.

◆ initTriangle()

int initTriangle ( CollisionBody body,
vector< vec3 >  verts 
)

Initializer function for a triangle CollisionBody.

◆ initTriangleMesh()

vector<CollisionBody> initTriangleMesh ( vector< vec3 >  verts)

Initializer function for triangle mesh CollisionBody's.

Variable Documentation

◆ pi

const float pi = 3.141592654f