Cocos3D  2.0.1
Public Attributes | List of all members
CC3Vector4 Struct Reference

#include <CC3Foundation.h>

Public Attributes

GLfloat w
 
CC3Vector v
 
GLfloat x
 
GLfloat y
 
GLfloat z
 

Detailed Description

A 4D vector, such as a homogeneous vector in 4D graphics matrix space, or a quaternion.

This structure can be referenced as containing 4 individual XYZW axes components, or containing a 3D XYZ vector, plus a W component.

Although CC3Vector4 and CC3Quaternion have the same internal structure as GLKVector4 and GLKQuaternion, the structures may have different byte alignment requirements. Avoid casting directly between GLKVector4 and CC3Vector4, or GLKQuaternion and CC3Quaternion, as this is not guaranteed to work reliably. Instead, use the functions CC3Vector4FromGLKVector4, GLKVector4FromCC3Vector4, CC3QuaternionFromGLKQuaternion, and GLKQuaternionFromCC3Quaternion to convert between the two structures.

You can, however, reliably copy an array of GLKVector4s or GLKQuaternions to an array of CC3Vector4s or CC3Quaternions, and vice-versa, by simply using memcpy, or equivalent memory copying function. This is also true of single CC3Vector4, CC3Quaternion, GLKVector4 and GLKQuaterion structures. Copying is successful because the array or pointer declarations will ensure the respective byte-alignment requirements, and since the internal structures are identical, the contents of the copy will be identical.

Member Data Documentation

CC3Vector CC3Vector4::v

The X, Y & Z components as a 3D vector.

GLfloat CC3Vector4::w

The homogeneous ratio factor or the real part of a quaternion.

GLfloat CC3Vector4::x

The X-componenent of the vector or quaternion.

GLfloat CC3Vector4::y

The Y-componenent of the vector or quaternion.

GLfloat CC3Vector4::z

The Z-componenent of the vector or quaternion.


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