Nudge Physics
A single file, header-only 3D physics library
Loading...
Searching...
No Matches
nudge::Transform Struct Reference

The Transform struct. More...

#include <nudge.h>

Public Attributes

union { 
 
   float   position [3] 
 
   float   p [3] 
 
   struct { 
 
      float   x 
 
      float   y 
 
      float   z 
 
   }   vector 
 
   struct { 
 
      float   px 
 
      float   py 
 
      float   pz 
 
   }  
 
};  
 
union { 
 
   uint32_t   body 
 
   float   time 
 
};  
 
union { 
 
   float   rotation [4] 
 
   float   r [4] 
 
   float   q [4] 
 
   struct { 
 
      float   x 
 
      float   y 
 
      float   z 
 
      float   w 
 
   }   quaternion 
 
   struct { 
 
      float   rx 
 
      float   ry 
 
      float   rz 
 
      float   rw 
 
   }  
 
   struct { 
 
      float   qx 
 
      float   qy 
 
      float   qz 
 
      float   qw 
 
   }  
 
};  
 

Detailed Description

The Transform struct.

Note
This struct has been rearranged to use anomymous unions for improved flexibility, but now initializations must be done with and additional pair of curly parenthesis, otherwise some compiler can issue a warning; for example: Transform T = { {{0,0,0}} , {0} , {{0,0,0,1}} };
The 'vector' and 'quaternion' fields have been added only to allow partial assignments like: T2.quaternion = T1.quaternion;
By default this struct contains nested anonymous structs that allow to use {.px,.px,.pz} and {.rx,.rx,.rz,.rw}/{.qx,.qx,.qz,.qw} fields: this requires the C++11 standard (but in my tests g++ and clang++ with -std=c++98 is enough)
There is a definition named NUDGE_NO_ANONYMOUS_STRUCTS that can be used to remove anonymous structs, that usually require -std=c++11 (even if g++ and clang++ seem to work just fine with -std=c++98 in my tests)

Member Data Documentation

◆ position

float nudge::Transform::position[3]

position applied before rotation

◆ p

float nudge::Transform::p[3]

◆ x

float nudge::Transform::x

◆ y

float nudge::Transform::y

◆ z

float nudge::Transform::z

◆ [struct]

struct { ... } nudge::Transform::vector

◆ px

float nudge::Transform::px

◆ py

float nudge::Transform::py

◆ pz

float nudge::Transform::pz

◆ [union]

union { ... } nudge::Transform

◆ body

uint32_t nudge::Transform::body

the body index (used mainly inside colliders to retrieve the body)

◆ time

float nudge::Transform::time

only used inside KinematicData key frames

◆ [union]

union { ... } nudge::Transform

◆ rotation

float nudge::Transform::rotation[4]

the orientation in quaternion form

◆ r

float nudge::Transform::r[4]

◆ q

float nudge::Transform::q[4]

◆ w

float nudge::Transform::w

◆ [struct]

struct { ... } nudge::Transform::quaternion

◆ rx

float nudge::Transform::rx

◆ ry

float nudge::Transform::ry

◆ rz

float nudge::Transform::rz

◆ rw

float nudge::Transform::rw

◆ qx

float nudge::Transform::qx

◆ qy

float nudge::Transform::qy

◆ qz

float nudge::Transform::qz

◆ qw

float nudge::Transform::qw

◆ [union]

union { ... } nudge::Transform

The documentation for this struct was generated from the following file: