SPYSpheres
ZRGameInternal.h File Reference
#include "Constants.h"
#include "ZeroRoboticsGameBaseImpl.hpp"
#include "comm.h"

Go to the source code of this file.

Classes

class  ZeroRoboticsGameImpl
 This class defines the hidden game implementation. More...
struct  ZeroRoboticsGameImpl::PlayerInfo
 (Required) Runs initialization fo the ZR game at the start of a test. More...
struct  ZeroRoboticsGameImpl::OtherInfo
struct  ZeroRoboticsGameImpl::Light
struct  ZeroRoboticsGameImpl::Picture
struct  ZeroRoboticsGameImpl::Camera
struct  ZeroRoboticsGameImpl::ChallengeInfo

Functions

ZeroRoboticsGameImplgetGameImpl ()
void overrideTarget2D (float target[13])
void swingTwistDecomposition (float q[4], float q_sw[4], float q_tw[4], float sw_vec[3])
void quatToPositive (float q[4])

Function Documentation

Definition at line 60 of file ZRGameInternal.cpp.

void overrideTarget2D ( float  target[13])
void quatToPositive ( float  q[4])

Definition at line 223 of file ZRGameInternal.cpp.

                                   {
    if (quat[3] < 0) {
      for (int i = 0; i < 4; i++) {
        quat[4] *= -1;
      }
    }
}
void swingTwistDecomposition ( float  q[4],
float  q_sw[4],
float  q_tw[4],
float  sw_vec[3] 
)

Definition at line 201 of file ZRGameInternal.cpp.

                                   {
  
  // p = dot(q[0:2], tw_axis) * tw_axis
  // q_tw = [p[0], p[1], p[2], q[3]]
  float c = mathVecInner(q, tw_axis, 3);
  for (int i = 0; i < 3; i++) {
    q_tw[i]= tw_axis[i] * c;    
  }
  q_tw[3] = q[3];
  mathVecNormalize(q_tw, 4);
  
  // invert twist quaternion
  float q_tw_inv[4];
  memcpy(q_tw_inv, q_tw, 4*sizeof(float));  
  for (int i = 0; i < 3; i++) {
    q_tw_inv[i] *= -1.0f;
  }
    
  quatMult(q_sw, q_tw_inv, q);
}