Game Development Reference
In-Depth Information
Every vector specifies a unique position in space, and every position in space has
only one corresponding vector. We can and will use only vectors to represent positions
in space.
We can begin to implement a class to represent vectors. I have called this class Vec-
tor3 to clearly separate it from any other Vector class in your programming language
(seeing the name Vector on its own is particularly confusing for Java programmers).
Excerpt from include/cyclone/precision.h
namespace cyclone {
* Defines a real number precision. Cyclone can be compiled in
* single- or double-precision versions. By default single precision
* is provided.
typedef float real;
Excerpt from include/cyclone/core.h
namespace cyclone {
* Holds a vector in 3 dimensions. Four data members are allocated
* to ensure alignment in an array.
class Vector3
/** Holds the value along the x axis. */
real x;
/** Holds the value along the y axis. */
real y;
/** Holds the value along the z axis. */
real z;
/** Padding to ensure 4-word alignment. */
real pad;
/** The default constructor creates a zero vector. */
Vector3() : x(0), y(0), z(0) {}
Search Nedrilad ::

Custom Search