Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StarSystemGent::Vector Class Reference

Public Member Functions

 Vector ()
 
template<class vec >
 Vector (const vec &in)
 
 Vector (const Vector &in)
 
 Vector (float x, float y, float z)
 
 Vector (float x, float y, float z, float s, float t)
 
float Mag ()
 
Vector Cross (const Vector &v) const
 
void Yaw (float rad)
 
void Roll (float rad)
 
void Pitch (float rad)
 

Public Attributes

float i
 
float j
 
float k
 
float s
 
float t
 

Detailed Description

Definition at line 115 of file galaxy_gen.cpp.

Constructor & Destructor Documentation

StarSystemGent::Vector::Vector ( )
inline

Definition at line 123 of file galaxy_gen.cpp.

References i, j, and k.

124  {
125  i = j = k = 0;
126  }
template<class vec >
StarSystemGent::Vector::Vector ( const vec &  in)
inline

Definition at line 127 of file galaxy_gen.cpp.

References VsnetOSS::memcpy().

128  {
129  memcpy( this, &in, sizeof (*this) );
130  }
StarSystemGent::Vector::Vector ( const Vector in)
inline

Definition at line 131 of file galaxy_gen.cpp.

References VsnetOSS::memcpy().

132  {
133  memcpy( this, &in, sizeof (*this) );
134  }
StarSystemGent::Vector::Vector ( float  x,
float  y,
float  z 
)
inline

Definition at line 135 of file galaxy_gen.cpp.

References i, j, k, x, and y.

136  {
137  i = x;
138  j = y;
139  k = z;
140  }
StarSystemGent::Vector::Vector ( float  x,
float  y,
float  z,
float  s,
float  t 
)
inline

Definition at line 141 of file galaxy_gen.cpp.

References i, j, k, x, and y.

142  {
143  i = x;
144  j = y;
145  k = z;
146  this->s = s;
147  this->t = t;
148  }

Member Function Documentation

Vector StarSystemGent::Vector::Cross ( const Vector v) const
inline

Definition at line 153 of file galaxy_gen.cpp.

References i, j, j, k, and Vector.

Referenced by StarSystemGent::makeRS().

154  {
155  return Vector( this->j*v.k-this->k*v.j,
156  this->k*v.i-this->i*v.k,
157  this->i*v.j-this->j*v.i );
158  }
float StarSystemGent::Vector::Mag ( )
inline

Definition at line 149 of file galaxy_gen.cpp.

References i, j, and k.

Referenced by StarSystemGent::LengthOfYear(), StarSystemGent::MakeJump(), StarSystemGent::MakePlanet(), and StarSystemGent::makeRS().

150  {
151  return sqrtf( i*i+j*j+k*k );
152  }
void Vector::Pitch ( float  rad)
inline

Definition at line 193 of file galaxy_gen.cpp.

References UniverseUtil::atan(), float, j, k, and M_PI.

194  {
195  float theta = 0;
196  float m = Mag();
197  if (k > 0)
198  theta = (float) atan( j/k );
199  else if (k < 0)
200  theta = M_PI+(float) atan( j/k );
201  else if (j <= 0 && k == 0)
202  theta = -M_PI/2;
203  else if (j > 0 && k == 0)
204  theta = M_PI/2;
205  theta += rad;
206  k = m*cosf( theta );
207  j = m*sinf( theta );
208  }
void Vector::Roll ( float  rad)
inline

Definition at line 176 of file galaxy_gen.cpp.

References UniverseUtil::atan(), float, i, j, and M_PI.

177  {
178  float theta = 0;
179  float m = Mag();
180  if (i > 0)
181  theta = (float) atan( j/i );
182  else if (i < 0)
183  theta = M_PI+(float) atan( j/i );
184  else if (j <= 0 && i == 0)
185  theta = -M_PI/2;
186  else if (j > 0 && i == 0)
187  theta = M_PI/2;
188  theta += rad;
189  i = m*cosf( theta );
190  j = m*sinf( theta );
191  }
void Vector::Yaw ( float  rad)
inline

Definition at line 159 of file galaxy_gen.cpp.

References UniverseUtil::atan(), float, i, k, and M_PI.

160  {
161  float theta = 0;
162  float m = Mag();
163  if (i > 0)
164  theta = (float) atan( k/i );
165  else if (i < 0)
166  theta = M_PI+(float) atan( k/i );
167  else if (k <= 0 && i == 0)
168  theta = -M_PI/2;
169  else if (k > 0 && i == 0)
170  theta = M_PI/2;
171  theta += rad;
172  i = m*cosf( theta );
173  k = m*sinf( theta );
174  }

Member Data Documentation

float StarSystemGent::Vector::s

Definition at line 121 of file galaxy_gen.cpp.

float StarSystemGent::Vector::t

Definition at line 122 of file galaxy_gen.cpp.


The documentation for this class was generated from the following files: