19#include "CEnvironment.h"
23typedef Eigen::Matrix<double,6,6> mat6;
24typedef Eigen::Matrix<double,6,1> vec6;
25typedef Eigen::Matrix<double,3,3> mat3;
26typedef Eigen::Matrix<double,3,1> vec3;
27typedef Eigen::Matrix<double,13,1> vec13;
28typedef Eigen::Quaternion<double> quat;
33 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35 CIceFloe(std::string sSimObjectName, ISimObjectCreator* pCreator);
36 virtual void FinalSetup(
const double dT,
const double*
const adX, ISimObjectCreator*
const pCreator);
39#ifdef FH_VISUALIZATION
41 virtual void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
44 virtual void RenderUpdate(
const double dT,
const double*
const adX);
47 void DrawBody(Ogre::SceneNode* renderNode, Ogre::SceneManager* sceneMgr);
54 m_PolyplateSpec(
int nPolyPoints,
double* xPoints,
double* yPoints,
double thickness_,
double density_,
const string& material);
81 minloc(0) = minloc(1) = minloc(2) = std::numeric_limits<double>::max();
82 maxloc(0) = maxloc(1) = maxloc(2) = -std::numeric_limits<double>::max();
92 void add(
const vec3 &v) {
93 if (v(0) < minloc(0)) minloc(0) = v(0);
94 if (v(1) < minloc(1)) minloc(1) = v(1);
95 if (v(2) < minloc(2)) minloc(2) = v(2);
96 if (v(0) > maxloc(0)) maxloc(0) = v(0);
97 if (v(1) > maxloc(1)) maxloc(1) = v(1);
98 if (v(2) > maxloc(2)) maxloc(2) = v(2);
102 minloc(0) = minloc(1) = minloc(2) = std::numeric_limits<double>::max();
103 maxloc(0) = maxloc(1) = maxloc(2) = -std::numeric_limits<double>::max();
106 int overlap(
const AABB &aabb)
108 if(maxloc(0) < aabb.minloc(0) || minloc(0) > aabb.maxloc(0))
return 0;
109 if(maxloc(1) < aabb.minloc(1) || minloc(1) > aabb.maxloc(1))
return 0;
110 if(maxloc(2) < aabb.minloc(2) || minloc(2) > aabb.maxloc(2))
return 0;
143 virtual void OdeFcn(
const double dT,
const double*
const adX,
double*
const adXDot,
const bool bIsMajorTimeStep);
149 virtual vec6 GetInternalForces(
const vec6& dX,
const vec3& r,
const quat& q,
CEnvironment* environment,
double time,
const double* states);
152 virtual mat6 GetInertiaMatrix(
const vec3& r,
const quat& q,
const double dT,
const double*
const adX);
155 virtual vec13 GetSecondDerivative(
const vec3& r,
const quat& q,
const vec3& v,
const vec3 w,
const vec6& externalForces,
CEnvironment* environment,
double time,
const double* states);
158 static vec6 GetCoriolisForce(
const vec6& dX,
const mat6& Inertia);
160 virtual vec6 CalcHydroforcesPolyplate(
const vec6& dX,
const vec3& r,
const quat& q,
CEnvironment* environment,
double time,
const double* states);
162 virtual vec6 CalContactForce(
const vec3& r,
const quat& q,
const double dT,
const double*
const adX);
165 virtual int rayTri(
const vec3 &V1,
const vec3 &V2,
const vec3 &V3,
const vec3 &O,
const vec3 &D,
double &out);
169 virtual double GaussianFun(
double &x,
double &muix,
double &sigmax,
double &y,
double &muiy,
double &sigmay);
170 virtual double PolyVal(
int* &polyxy,
double* &gassxy,
double* &par,
double &parx,
double &pary);
180 virtual const double* Position(
const double dT,
const double*
const adX);
181 virtual const double* Velocity(
const double dT,
const double*
const adX);
182 virtual const double* Quater(
const double dT,
const double*
const adX);
183 virtual const double* LocalVel(
const double dT,
const double*
const adX);
184 virtual const double* AngVel(
const double dT,
const double*
const adX);
185 virtual const double* ContactForce(
const double dT,
const double*
const adX);
187 virtual const double* Test(
const double dT,
const double*
const adX);
247 double m_itsPoints[1000][3];
288#ifdef FH_VISUALIZATION
290 vector<Ogre::SceneNode*> m_RenderNodes;
291 Ogre::SceneManager* m_SceneMgr;
292 vector<Ogre::ManualObject*> m_Manual;
294 Ogre::SceneNode* m_RenderNode;
298 static mat3 MakeDyadic(
const vec3& vector);
299 static mat3 GetRotation(
const vec3& angle);
300 static mat6 GetRotation6(
const vec3& angle);
Definition: CEnvironment.h:10
Definition: CIceFloe.h:78
Definition: CIceFloe.h:31
m_PolyplateSpec m_spec0
The specification of the ice floe.
Definition: CIceFloe.h:196
double m_adVelGlobal[3]
The global velocity.
Definition: CIceFloe.h:197
double m_ContactForce[3]
Pointer to DeepSeaGravityWaves -> CEnvironment.
Definition: CIceFloe.h:201
vec6 m_Acc
Global to local Quaternion.
Definition: CIceFloe.h:206
int m_IStateOmega
Index of the local angular velocity in the state vector.
Definition: CIceFloe.h:193
mat6 m_AddedMass
Damping matrix.
Definition: CIceFloe.h:203
ISignalPort * m_pInForce
A pointer to the input force.
Definition: CIceFloe.h:177
double m_dragz
The drag coefficient z.
Definition: CIceFloe.h:199
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
int m_IStatePos
Index of the global position in the state vector.
Definition: CIceFloe.h:190
double m_rA33
Acceleration.
Definition: CIceFloe.h:207
mat6 m_DampMatrix
The contact force.
Definition: CIceFloe.h:202
double m_dragxy
The drag coefficient xy.
Definition: CIceFloe.h:198
int m_IStateLocalVel
Index of the local velocity in the state vector.
Definition: CIceFloe.h:192
static mat6 ReorientInertiaTranslateRotate(const mat6 &Inertia, const vec6 &orientation)
Testing parameters.
int m_tmesh
Mesh size to thickness ratio.
Definition: CIceFloe.h:212
double m_A33
Added mass matrix.
Definition: CIceFloe.h:204
ISignalPort * m_pInMoment
A pointer to the input moment.
Definition: CIceFloe.h:176
int m_IStateQuater
Index of the quaternions in the state vector.
Definition: CIceFloe.h:191
Definition: CIceFloe.h:120
int * indexE
Number of triangles in object.
Definition: CIceFloe.h:124
int numT
Number of edges in object.
Definition: CIceFloe.h:122
int * indexT
Index of edges in AABB.
Definition: CIceFloe.h:125
Definition: CIceFloe.h:130
double * normT
Index of triangles in object.
Definition: CIceFloe.h:136
int * indexT
Coordinate of points in object.
Definition: CIceFloe.h:135
int numT
Number of points in object.
Definition: CIceFloe.h:132
double * xyzP
Number of triangles in object.
Definition: CIceFloe.h:134
Definition: CIceFloe.h:51
Definition: CIceFloe.h:253