Marine systems simulation
CVisualArrow.h
1/*
2* Class CVisualArrow (SimObject)
3* Author: Biao Su
4
5* This class enables visualization of a deformable body with triangular mesh.
6*/
7
12#ifndef CVisualArrow_H
13#define CVisualArrow_H
14
15#include <string>
16#include <Eigen/Eigen>
17#include <iostream>
18#include <iomanip>
19#include <fstream>
20#include <algorithm>
21#include <vector>
22#include <valarray>
23
24#include "SimObject.h"
25
26#include "sfh/text.h"
27#include "sfh/math/math.h"
28#include "sfh/sim/kinematics.h"
29#include "sfh/constants.h"
30
31#ifdef FH_VISUALIZATION
32#include "sfh/ogre/C3DArrow.h"
33#endif
34
35namespace Visualization {
36
37typedef Eigen::Matrix<double, 3, 1> vec3;
38typedef Eigen::Matrix<int, 3, 1> vec3i;
39typedef Eigen::Matrix<int, 2, 1> vec2i;
40typedef Eigen::Quaternion<double> quat;
41
42class CVisualArrow : public SimObject
43{
44public:
45 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
46
47 // Constructor
48 CVisualArrow(std::string sSimObjectName, ISimObjectCreator* pCreator);
49 virtual ~CVisualArrow();
51 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep) {};
52
53#ifdef FH_VISUALIZATION
54 // Initial specification of the simObject geometry for rendering.
55 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const pCreator);
56
57 // Updating the simObject for rendering the next frame.
58 virtual void RenderUpdate(const double dT, const double* const adX);
59#endif
60
61protected:
62 // Parameters
63 bool m_NorScale;
64 bool m_DirScale;
65
66 // Input ports
67 ISignalPort* m_InPos;
68 ISignalPort* m_InVector;
69 ISignalPort* m_InScale;
70
71 ISignalPort* m_InVecNor;
72 ISignalPort* m_InDir;
73
74#ifdef FH_VISUALIZATION
75 Ogre::SceneManager* m_SceneMgr;
76 double m_Color[4];
77 C3DArrow* m_Arrow;
78#endif
79
80};
81
82};
83
84#endif
Definition: CVisualArrow.h:43
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculate the state derivatives.
Definition: CVisualArrow.h:51