PeriDyno 1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RigidBody.h
Go to the documentation of this file.
1#pragma once
3
4#include "Quat.h"
5
6namespace dyno
7{
14 template<typename TDataType>
15 class RigidBody : public ParametricModel<TDataType>
16 {
17 DECLARE_TCLASS(RigidBody, TDataType)
18 public:
19 typedef typename TDataType::Real Real;
20 typedef typename TDataType::Coord Coord;
21 typedef typename TDataType::Matrix Matrix;
22 typedef typename dyno::Quat<Real> Quat;
23
24 RigidBody();
25 ~RigidBody() override;
26
27 std::string getNodeType() override { return "Rigid Bodies"; }
28
29 public:
30 DEF_VAR(Coord, Gravity, Coord(0.0, -9.8, 0.0), "Gravity");
31
32 public:
36 DEF_VAR_STATE(Real, Mass, Real(1), "Mass of the rigid body");
37
41 DEF_VAR_STATE(Coord, Center, Coord(0), "Center of the rigid body");
42
46 DEF_VAR_STATE(Coord, Velocity, Coord(0), "Velocity of rigid bodies");
47
51 DEF_VAR_STATE(Coord, AngularVelocity, Coord(0), "Angular velocity of of the rigid body");
52
56 DEF_VAR_STATE(Matrix, RotationMatrix, Matrix::identityMatrix(), "Rotation matrix of of the rigid body");
57
58 DEF_VAR_STATE(Matrix, Inertia, Matrix::identityMatrix(), "Inertia matrix");
59
60 DEF_VAR_STATE(Quat, Quaternion, Quat(0, 0, 0), "Quaternion");
61
62 DEF_VAR_STATE(Matrix, InitialInertia, Matrix::identityMatrix(), "Initial inertia matrix");
63
64 protected:
65 void updateStates() override;
66 };
67}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
Implementation of quaternion.
~RigidBody() override
Definition RigidBody.cpp:17
DEF_VAR_STATE(Coord, AngularVelocity, Coord(0), "Angular velocity of of the rigid body")
Rigid body angular velocity.
TDataType::Coord Coord
Definition RigidBody.h:20
std::string getNodeType() override
Definition RigidBody.h:27
DEF_VAR_STATE(Matrix, Inertia, Matrix::identityMatrix(), "Inertia matrix")
DEF_VAR_STATE(Matrix, RotationMatrix, Matrix::identityMatrix(), "Rotation matrix of of the rigid body")
Particle position.
DEF_VAR_STATE(Matrix, InitialInertia, Matrix::identityMatrix(), "Initial inertia matrix")
DEF_VAR_STATE(Coord, Velocity, Coord(0), "Velocity of rigid bodies")
Rigid body velocity.
DEF_VAR_STATE(Real, Mass, Real(1), "Mass of the rigid body")
Rigid body mass.
TDataType::Matrix Matrix
Definition RigidBody.h:21
TDataType::Real Real
Definition RigidBody.h:19
DEF_VAR_STATE(Quat, Quaternion, Quat(0, 0, 0), "Quaternion")
DEF_VAR_STATE(Coord, Center, Coord(0), "Center of the rigid body")
Rigid body center.
dyno::Quat< Real > Quat
Definition RigidBody.h:22
void updateStates() override
Definition RigidBody.cpp:22
DEF_VAR(Coord, Gravity, Coord(0.0, -9.8, 0.0), "Gravity")
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25