Changeset 167 in flair-src for trunk/lib/FlairSimulator
- Timestamp:
- Apr 12, 2017, 1:59:38 PM (8 years ago)
- Location:
- trunk/lib/FlairSimulator/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/FixedCamera.cpp
r120 r167 35 35 namespace simulator { 36 36 37 FixedCamera::FixedCamera(std::string name,core::Vector3D position,core::Vector3Dlookat,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name) {37 FixedCamera::FixedCamera(std::string name,core::Vector3Df position,core::Vector3Df lookat,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name) { 38 38 Rotating = false; 39 39 rotateSpeed=inRotateSpeed; … … 62 62 63 63 //normal between target and up vector 64 cameraAxeY=target.crossProduct( irr::core::vector3df(0,0,1));64 cameraAxeY=target.crossProduct(vector3df(0,0,1)); 65 65 cameraAxeY.normalize(); 66 66 … … 81 81 82 82 //check angle 83 irr::core::vector3df newTarget(q3.X,q3.Y,q3.Z);84 float angle=acos(newTarget.dotProduct( irr::core::vector3df(0,0,1))/newTarget.getLength());85 irr::core::vector3df cross = newTarget.crossProduct(irr::core::vector3df(0,0,1));83 vector3df newTarget(q3.X,q3.Y,q3.Z); 84 float angle=acos(newTarget.dotProduct(vector3df(0,0,1))/newTarget.getLength()); 85 vector3df cross = newTarget.crossProduct(vector3df(0,0,1)); 86 86 if (cross.dotProduct(cameraAxeY) > 0) { 87 87 newTarget += camera->getAbsolutePosition(); -
trunk/lib/FlairSimulator/src/FixedCamera.h
r120 r167 26 26 class FixedCamera : public VisualizationCamera { 27 27 public: 28 FixedCamera(std::string name,core::Vector3D position,core::Vector3D lookat=core::Vector3D(0,0,0),float rotateSpeed = -3.0f, float zoomSpeed = .05f);28 FixedCamera(std::string name,core::Vector3Df position,core::Vector3Df lookat=core::Vector3Df(0,0,0),float rotateSpeed = -3.0f, float zoomSpeed = .05f); 29 29 ~FixedCamera(); 30 30 -
trunk/lib/FlairSimulator/src/Gui.cpp
r158 r167 109 109 } 110 110 111 vector3df ToIrrlichtCoordinates(Vector3Dvect) {111 template<typename T> vector3df ToIrrlichtCoordinates(Vector3D<T> vect) { 112 112 return ToIrrlichtScale(1) * vector3df(vect.x, vect.y, -vect.z); 113 113 } 114 114 115 Vector3D ToSimulatorCoordinates(vector3df vect) {116 return ToSimulatorScale(1) * Vector3D (vect.X, vect.Y, -vect.Z);115 Vector3Df ToSimulatorCoordinates(vector3df vect) { 116 return ToSimulatorScale(1) * Vector3Df(vect.X, vect.Y, -vect.Z); 117 117 } 118 118 … … 132 132 return Quaternion(quat.q0, -quat.q1, -quat.q2, quat.q3); 133 133 } 134 135 136 template irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D<double>); 137 template irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D<float>); 134 138 135 139 Gui::Gui(std::string name, int app_width, -
trunk/lib/FlairSimulator/src/Gui.h
r158 r167 19 19 20 20 #include <Object.h> 21 #include <Vector3D.h> 21 22 #include <EDriverTypes.h> 22 23 #include <vector3d.h> … … 36 37 namespace core { 37 38 class Object; 38 class Vector3D;39 39 class Euler; 40 40 class Quaternion; … … 125 125 * \return vector in irrlicht coordinates 126 126 */ 127 irr::core::vector3df ToIrrlichtCoordinates(core::Vector3Dvect);127 template<typename T> irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D<T> vect); 128 128 129 129 /*! … … 136 136 * \return vector in simulator coordinates 137 137 */ 138 core::Vector3D ToSimulatorCoordinates(irr::core::vector3df vect);138 core::Vector3Df ToSimulatorCoordinates(irr::core::vector3df vect); 139 139 140 140 /*! -
trunk/lib/FlairSimulator/src/Man.cpp
r158 r167 73 73 state[0].Quat.Normalize(); 74 74 75 Vector3D dir = state[0].Vel;75 Vector3D<double> dir = state[0].Vel; 76 76 dir.Rotate(state[0].Quat); 77 77 state[0].Pos = state[-1].Pos + dT() * dir; -
trunk/lib/FlairSimulator/src/Model.cpp
r158 r167 69 69 TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; } 70 70 71 floatModel::dT(void) const { return pimpl_->dT->Value(); }71 double Model::dT(void) const { return pimpl_->dT->Value(); } 72 72 73 73 int Model::GetId(void) const { -
trunk/lib/FlairSimulator/src/Model.h
r158 r167 69 69 typedef struct simu_state { 70 70 core::Quaternion Quat; 71 core::Vector3D W;72 core::Vector3D Pos;73 core::Vector3D Vel;71 core::Vector3Df W; 72 core::Vector3D<double> Pos; 73 core::Vector3D<double> Vel; 74 74 } simu_state_t; 75 75 … … 96 96 protected: 97 97 DiscreteTimeVariable<simu_state_t, 3> state; 98 floatdT(void) const;98 double dT(void) const; 99 99 virtual void CalcModel(void) = 0; 100 100 #ifdef GL -
trunk/lib/FlairSimulator/src/Model_impl.cpp
r163 r167 160 160 states_mutex->GetMutex(); 161 161 Quaternion quat = getSimulator()->ToVRPNReference(self->state[0].Quat); 162 Vector3D position = getSimulator()->ToVRPNReference(self->state[0].Pos);162 Vector3D<double> position = getSimulator()->ToVRPNReference(self->state[0].Pos); 163 163 states_mutex->ReleaseMutex(); 164 164 -
trunk/lib/FlairSimulator/src/Parser.cpp
r158 r167 210 210 } 211 211 212 Vector3D Parser::getMeshVector3D(xmlNode *mesh_node, xmlChar *param) {212 Vector3Df Parser::getMeshVector3D(xmlNode *mesh_node, xmlChar *param) { 213 213 xmlNode *cur_node = NULL; 214 214 for (cur_node = mesh_node; cur_node; cur_node = cur_node->next) { 215 215 if (xmlStrEqual(cur_node->name, param)) { 216 return Vector3D (atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")),216 return Vector3Df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")), 217 217 atof((char *)xmlGetProp(cur_node, (xmlChar *)"y")), 218 218 atof((char *)xmlGetProp(cur_node, (xmlChar *)"z"))); 219 219 } 220 220 } 221 return Vector3D (0, 0, 0);221 return Vector3Df(0, 0, 0); 222 222 } 223 223 -
trunk/lib/FlairSimulator/src/Parser.h
r158 r167 19 19 20 20 #include <Gui.h> 21 #include <Vector3D.h> 21 22 #include <libxml/parser.h> 22 23 #include <libxml/tree.h> 23 24 #include <SColor.h> 24 25 namespace flair {26 namespace core {27 class Vector3D;28 }29 }30 25 31 26 namespace flair { … … 53 48 irr::core::vector3df getSceneVect(xmlNode *mesh_node, xmlChar *param, 54 49 bool isScale = false); 55 core::Vector3D getMeshVector3D(xmlNode *mesh_node, xmlChar *param);50 core::Vector3Df getMeshVector3D(xmlNode *mesh_node, xmlChar *param); 56 51 }; 57 52 } -
trunk/lib/FlairSimulator/src/SimuUsGL.cpp
r158 r167 43 43 position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01); 44 44 direction = new Vector3DSpinBox(setup_tab->NewRow(), "direction", -2, 2, .01); 45 range = new DoubleSpinBox(setup_tab->NewRow(), "range:", 0, 6, 1);45 range = new DoubleSpinBox(setup_tab->NewRow(), "range:", 0, 1000, 1,0,6.); 46 46 } 47 47 -
trunk/lib/FlairSimulator/src/Simulator.cpp
r15 r167 56 56 } 57 57 58 Vector3D Simulator::ToVRPNReference(Vector3Dpoint_in) {58 Vector3D<double> Simulator::ToVRPNReference(Vector3D<double> point_in) { 59 59 Quaternion yaw_rot_quat; 60 60 Euler yaw_rot_euler( -
trunk/lib/FlairSimulator/src/Simulator.h
r158 r167 19 19 20 20 #include <FrameworkManager.h> 21 #include <Vector3D.h> 21 22 #include <stdint.h> 22 23 … … 27 28 namespace core { 28 29 class Quaternion; 29 class Vector3D;30 30 } 31 31 } … … 53 53 // coordinate, around z axis 54 54 core::Quaternion ToVRPNReference(core::Quaternion quat_in); 55 core::Vector3D ToVRPNReference(core::Vector3Dpoint_in);55 core::Vector3D<double> ToVRPNReference(core::Vector3D<double> point_in); 56 56 57 57 private: -
trunk/lib/FlairSimulator/src/X4.cpp
r158 r167 282 282 u_thrust = k_mot->Value() * (fl_speed * fl_speed + fr_speed * fr_speed + 283 283 rl_speed * rl_speed + rr_speed * rr_speed); 284 Vector3D vect(0, 0, -u_thrust);284 Vector3D<double> vect(0, 0, -u_thrust); 285 285 vect.Rotate(state[0].Quat); 286 286 … … 291 291 ** =================================================================== 292 292 */ 293 293 294 state[0].Pos.x = 294 295 (dT() * dT() / m->Value()) * 295 (vect.x - 296 f_air_lat->Value() * (state[-1].Pos.x - state[-2].Pos.x) / dT()) + 296 (vect.x - f_air_lat->Value() * (state[-1].Pos.x - state[-2].Pos.x) / dT()) + 297 297 2 * state[-1].Pos.x - state[-2].Pos.x; 298 298 state[0].Vel.x = (state[0].Pos.x - state[-1].Pos.x) / dT(); 299 299 300 300 /* 301 301 ** =================================================================== -
trunk/lib/FlairSimulator/src/X8.cpp
r158 r167 339 339 sigma->Value() * trr_speed * trr_speed + bfl_speed * bfl_speed + 340 340 bfr_speed * bfr_speed + brl_speed * brl_speed + brr_speed * brr_speed); 341 Vector3D vect(0, 0, -u_thrust);341 Vector3D<double> vect(0, 0, -u_thrust); 342 342 vect.Rotate(state[0].Quat); 343 343 -
trunk/lib/FlairSimulator/src/unexported/Model_impl.h
r158 r167 120 120 flair::core::Mutex *collision_mutex; 121 121 bool collision_occured; 122 flair::core::Vector3D collision_point;122 flair::core::Vector3D<double> collision_point; 123 123 #endif 124 124 };
Note:
See TracChangeset
for help on using the changeset viewer.