Marine systems simulation
RigidElement.h
1#pragma once
2#include "eigen_matrix_defs.h"
3
4namespace CoRiBoDynamics
5{
6 class ConstraintSolver;
7
16 friend class ConstraintSolver;
17public:
18
20 virtual ~RigidElement(){}
21
27 virtual void Setup(double T, const double * const X);
28 virtual const mat6& InertialMatrix() = 0;
29 virtual const vec6& Forces() = 0;
30
31 inline const vec3& P(){return m_P;}
32 inline const Quat& Q(){return m_Q;}
33 inline const vec3& V(){return m_V;}
34 inline const vec3& W(){return m_W;}
35
36 inline const vec3 P(const double* const X){return vec3(m_ix_P+X);}
37 inline const Quat Q(const double* const X){return ptrQ(m_ix_Q+X);}
38 inline const vec3 V(const double* const X){return vec3(m_ix_V+X);}
39 inline const vec3 W(const double* const X){return vec3(m_ix_W+X);}
40
41 inline int ix_P(){return m_ix_P;}
42 inline int ix_Q(){return m_ix_Q;}
43 inline int ix_V(){return m_ix_V;}
44 inline int ix_W(){return m_ix_W;}
45 inline int ix_N(){return m_ix_N;}
46
47 inline const mat3& RotationMatrix(){return m_RotationMatrix;}
48
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
50protected:
51 void set_element_index(int N){
52 m_ix_N = N;
53 }
54
55 int m_ix_N;
56 int m_ix_P;
57 int m_ix_Q;
58 int m_ix_V;
59 int m_ix_W;
60
61 vec3 m_P;
62 Quat m_Q;
63 vec3 m_V;
64 vec3 m_W;
65
66 mat3 m_RotationMatrix;
67};
68
69
78public:
79 StandardRigidElement(const vec6& DiagonalInertialMatrix, int ix_P, int ix_Q, int ix_V, int ix_W);
80 virtual ~StandardRigidElement(){}
81 virtual void Setup( double T, const double * const X );
82 virtual const mat6& InertialMatrix();
83 virtual const vec6& Forces();
84
85 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
86protected:
87 vec6 m_Inertia;
88 mat6 m_FullInertiaMatrix;
89 vec6 m_CoriolisForce;
90};
91
92}
Definition: ConstraintSolver.h:31
Definition: RigidElement.h:15
const vec3 & P()
Coriolis forces and other.
Definition: RigidElement.h:31
int ix_Q()
index of Position state
Definition: RigidElement.h:42
const Quat Q(const double *const X)
Position.
Definition: RigidElement.h:37
void set_element_index(int N)
Orientation in 3x3 matrix form.
Definition: RigidElement.h:51
const vec3 P(const double *const X)
Angular velocity.
Definition: RigidElement.h:36
const vec3 & W()
Orientation.
Definition: RigidElement.h:34
int ix_W()
index of Velocity state
Definition: RigidElement.h:44
int ix_N()
index of Angular velocity state
Definition: RigidElement.h:45
const vec3 & V()
Velocity.
Definition: RigidElement.h:33
int ix_V()
index of Orientation state
Definition: RigidElement.h:43
virtual const vec6 & Forces()=0
full 6x6 Inertia Matrix
const Quat & Q()
Position.
Definition: RigidElement.h:32
const mat3 & RotationMatrix()
CoRiBoDynamics element index.
Definition: RigidElement.h:47
const vec3 W(const double *const X)
Orientation.
Definition: RigidElement.h:39
const vec3 V(const double *const X)
Velocity.
Definition: RigidElement.h:38
virtual void Setup(double T, const double *const X)
int ix_P()
Angular velocity.
Definition: RigidElement.h:41
Definition: RigidElement.h:77
virtual const vec6 & Forces()
full 6x6 Inertia Matrix
virtual void Setup(double T, const double *const X)
Definition: CollisionManager.h:6