Changeset 15 in flair-src for trunk/lib/FlairSimulator/src/Simulator.cpp


Ignore:
Timestamp:
04/08/16 15:40:57 (7 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSimulator/src/Simulator.cpp

    r10 r15  
    2727using namespace flair::core;
    2828
    29 namespace
    30 {
    31     flair::simulator::Simulator* simu=NULL;
     29namespace {
     30flair::simulator::Simulator *simu = NULL;
    3231}
    3332
    34 namespace flair
    35 {
    36 namespace simulator
    37 {
     33namespace flair {
     34namespace simulator {
    3835
    39 Simulator* getSimulator(void) {
    40     return simu;
     36Simulator *getSimulator(void) { return simu; }
     37
     38Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg)
     39    : FrameworkManager(name) {
     40  if (simu != NULL)
     41    Err("Simulator should be instanced only one time\n");
     42
     43  pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg);
     44  simu = this;
    4145}
    4246
    43 Simulator::Simulator(string name,int optitrack_mstime,float yaw_deg): FrameworkManager(name)
    44 {
    45     if(simu!=NULL) Err("Simulator should be instanced only one time\n");
    46 
    47     pimpl_=new Simulator_impl(this,optitrack_mstime,yaw_deg);
    48     simu=this;
    49 }
    50 
    51 Simulator::~Simulator()
    52 {
    53     delete pimpl_;
    54 }
     47Simulator::~Simulator() { delete pimpl_; }
    5548
    5649Quaternion Simulator::ToVRPNReference(Quaternion quat_in) {
    57     Quaternion yaw_rot_quat;
    58     Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
    59     yaw_rot_euler.ToQuaternion(yaw_rot_quat);
     50  Quaternion yaw_rot_quat;
     51  Euler yaw_rot_euler(
     52      0, 0, -pimpl_->yaw_rad); // yaw_rad is vrpn rotation in earth reference
     53  yaw_rot_euler.ToQuaternion(yaw_rot_quat);
    6054
    61     return yaw_rot_quat*quat_in;
     55  return yaw_rot_quat * quat_in;
    6256}
    6357
    6458Vector3D Simulator::ToVRPNReference(Vector3D point_in) {
    65     Quaternion yaw_rot_quat;
    66     Euler yaw_rot_euler(0,0,-pimpl_->yaw_rad);//yaw_rad is vrpn rotation in earth reference
    67     yaw_rot_euler.ToQuaternion(yaw_rot_quat);
    68     point_in.Rotate(yaw_rot_quat);
     59  Quaternion yaw_rot_quat;
     60  Euler yaw_rot_euler(
     61      0, 0, -pimpl_->yaw_rad); // yaw_rad is vrpn rotation in earth reference
     62  yaw_rot_euler.ToQuaternion(yaw_rot_quat);
     63  point_in.Rotate(yaw_rot_quat);
    6964
    70     return point_in;
     65  return point_in;
    7166}
    7267
    73 float Simulator::Yaw(void) const
    74 {
    75     return pimpl_->yaw_rad;
    76 }
     68float Simulator::Yaw(void) const { return pimpl_->yaw_rad; }
    7769
    78 void Simulator::RunSimu(void)
    79 {
    80     pimpl_->RunSimu();
    81 }
     70void Simulator::RunSimu(void) { pimpl_->RunSimu(); }
    8271
    8372} // end namespace simulator
Note: See TracChangeset for help on using the changeset viewer.