Classes | Defines | Typedefs | Functions | Variables

CC3Foundation.h File Reference

#import "CCArray.h"
#import "CC3Math.h"
#import "CC3Logging.h"
#import "CCNode.h"
#import "CCDirector.h"
#import <AvailabilityMacros.h>

Classes

struct  CC3AngularVector
 Specifies a vector using angular coordinate axes. More...
struct  CC3AttenuationCoefficients
 The coefficients of the equation for an attenuation function: (a + b*r + c*r*r), where r is the radial distance between a the source (light or camera) and the 3D location at which we want to calculate attenuation. More...
struct  CC3BoundingBox
 Defines an axially-aligned-bounding-box (AABB), describing a 3D volume by specifying the minimum and maximum 3D corners. More...
struct  CC3Plane
 The coefficients of the equation for a plane in 3D space (ax + by + cz + d = 0). More...
struct  CC3Ray
 Defines a ray or line in 3D space, by specifying a starting location and direction. More...
struct  CC3Sphere
 Defines a sphere. More...
struct  CC3TexturedVertex
 Defines a simple vertex, containing location, normal, and texture coordinate data. More...
struct  CC3Vector
 A vector in 3D space. More...
struct  CC3Vector4
 A homogeneous vector in 4D graphics matrix space. More...
struct  CC3Viewport
 GL viewport data. More...
class  CCArray(CC3)
 Extension category to support cocos3d functionality. More...
class  CCDirector(CC3)
 Extension category to support cocos3d functionality. More...
class  CCNode(CC3)
 Extension category to support cocos3d functionality. More...
class  NSObject(CC3)
 Extension category to support cocos3d functionality. More...
class  UIColor(CC3)
 Extension category to support cocos3d functionality. More...

Defines

#define cc3v(X, Y, Z)   CC3VectorMake((X),(Y),(Z))
#define ccc4f(R, G, B, A)   CCC4FMake((R),(G),(B),(A))

Typedefs

typedef GLfloat CC3Angle

Functions

static CC3AngularVector CC3AngularVectorDifference (CC3AngularVector minuend, CC3AngularVector subtrahend)
static CC3AngularVector CC3AngularVectorFromVector (CC3Vector aCoord)
static CC3AngularVector CC3AngularVectorMake (GLfloat heading, GLfloat inclination, GLfloat radius)
static CC3AttenuationCoefficients CC3AttenuationCoefficientsMake (GLfloat a, GLfloat b, GLfloat c)
CC3Vector4 CC3AxisAngleFromQuaternion (CC3Vector4 quaternion)
CC3BoundingBox CC3BoundingBoxAddPadding (CC3BoundingBox bb, GLfloat padding)
static CC3Vector CC3BoundingBoxCenter (CC3BoundingBox bb)
CC3BoundingBox CC3BoundingBoxEngulfLocation (CC3BoundingBox bb, CC3Vector aLoc)
static BOOL CC3BoundingBoxesAreEqual (CC3BoundingBox bb1, CC3BoundingBox bb2)
static CC3BoundingBox CC3BoundingBoxFromMinMax (CC3Vector minVtx, CC3Vector maxVtx)
static BOOL CC3BoundingBoxIsNull (CC3BoundingBox bb)
static CC3BoundingBox CC3BoundingBoxMake (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat maxX, GLfloat maxY, GLfloat maxZ)
CC3BoundingBox CC3BoundingBoxUnion (CC3BoundingBox bb1, CC3BoundingBox bb2)
static GLfloat CC3DistanceFromNormalizedPlane (CC3Plane p, CC3Vector v)
static CC3Plane CC3PlaneFromPoints (CC3Vector p1, CC3Vector p2, CC3Vector p3)
static CC3Plane CC3PlaneMake (GLfloat a, GLfloat b, GLfloat c, GLfloat d)
static CC3Vector CC3PlaneNormal (CC3Plane p)
static CC3Plane CC3PlaneNormalize (CC3Plane p)
CC3Vector4 CC3QuaternionFromAxisAngle (CC3Vector4 axisAngle)
static CC3Ray CC3RayFromLocDir (CC3Vector aLocation, CC3Vector aDirection)
CC3Vector4 CC3RayIntersectionWithPlane (CC3Ray ray, CC3Plane plane)
static CC3Ray CC3RayMake (GLfloat locX, GLfloat locY, GLfloat locZ, GLfloat dirX, GLfloat dirY, GLfloat dirZ)
static CC3Sphere CC3SphereMake (CC3Vector center, GLfloat radius)
CC3Sphere CC3SphereUnion (CC3Sphere s1, CC3Sphere s2)
static CC3Vector4 CC3Vector4Add (CC3Vector4 v, CC3Vector4 translation)
static GLfloat CC3Vector4Dot (CC3Vector4 v1, CC3Vector4 v2)
static CC3Vector4 CC3Vector4FromCC3Vector (CC3Vector v, GLfloat w)
static CC3Vector4 CC3Vector4Homogenize (CC3Vector4 v)
static GLfloat CC3Vector4Length (CC3Vector4 v)
static CC3Vector4 CC3Vector4Make (GLfloat x, GLfloat y, GLfloat z, GLfloat w)
static CC3Vector4 CC3Vector4Negate (CC3Vector4 v)
static CC3Vector4 CC3Vector4Normalize (CC3Vector4 v)
static BOOL CC3Vector4sAreEqual (CC3Vector4 v1, CC3Vector4 v2)
static CC3Vector4 CC3Vector4ScaleUniform (CC3Vector4 v, GLfloat scale)
CC3Vector4 CC3Vector4Slerp (CC3Vector4 v1, CC3Vector4 v2, GLfloat blendFactor)
static CC3Vector CC3VectorAdd (CC3Vector v, CC3Vector translation)
static CC3Vector CC3VectorAverage (CC3Vector v1, CC3Vector v2)
static CC3Vector CC3VectorCross (CC3Vector v1, CC3Vector v2)
static CC3Vector CC3VectorDifference (CC3Vector minuend, CC3Vector subtrahend)
static GLfloat CC3VectorDistance (CC3Vector start, CC3Vector end)
static GLfloat CC3VectorDistanceSquared (CC3Vector start, CC3Vector end)
static GLfloat CC3VectorDot (CC3Vector v1, CC3Vector v2)
CC3Vector CC3VectorFromAngularVector (CC3AngularVector av)
static CC3Vector CC3VectorFromHomogenizedCC3Vector4 (CC3Vector4 v)
static CC3Vector CC3VectorFromTruncatedCC3Vector4 (CC3Vector4 v)
static CC3Vector CC3VectorInvert (CC3Vector v)
static GLfloat CC3VectorLength (CC3Vector v)
static GLfloat CC3VectorLengthSquared (CC3Vector v)
static CC3Vector CC3VectorLerp (CC3Vector v1, CC3Vector v2, GLfloat blendFactor)
static CC3Vector CC3VectorMake (GLfloat x, GLfloat y, GLfloat z)
static CC3Vector CC3VectorMaximize (CC3Vector v1, CC3Vector v2)
static CC3Vector CC3VectorMinimize (CC3Vector v1, CC3Vector v2)
static CC3Vector CC3VectorNegate (CC3Vector v)
static CC3Vector CC3VectorNormalize (CC3Vector v)
static CC3Vector CC3VectorRotationalDifference (CC3Vector minuend, CC3Vector subtrahend)
static CC3Vector CC3VectorRotationModulo (CC3Vector aRotation)
static BOOL CC3VectorsAreEqual (CC3Vector v1, CC3Vector v2)
static CC3Vector CC3VectorScale (CC3Vector v, CC3Vector scale)
static CC3Vector CC3VectorScaleUniform (CC3Vector v, GLfloat scale)
static BOOL CC3ViewportContainsPoint (CC3Viewport vp, CGPoint point)
static CC3Viewport CC3ViewportMake (GLint x, GLint y, GLint w, GLint h)
static BOOL CC3ViewportsAreEqual (CC3Viewport vp1, CC3Viewport vp2)
static ccColor3B CCC3BFromCCC4F (ccColor4F floatColor)
static ccColor4B CCC4BFromCCC4F (ccColor4F floatColor)
static ccColor4F CCC4FAdd (ccColor4F rgba, ccColor4F translation)
static BOOL CCC4FAreEqual (ccColor4F c1, ccColor4F c2)
static ccColor4F CCC4FBlend (ccColor4F baseColor, ccColor4F blendColor, GLfloat blendWeight)
static ccColor4F CCC4FDifference (ccColor4F minuend, ccColor4F subtrahend)
static ccColor4F CCC4FFromCCC4B (ccColor4B byteColor)
static ccColor4F CCC4FFromColorAndOpacity (ccColor3B byteColor, GLubyte opacity)
static ccColor4F CCC4FMake (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
static ccColor4F CCC4FUniformScale (ccColor4F rgba, GLfloat scale)
static ccColor4F CCC4FUniformTranslate (ccColor4F rgba, GLfloat offset)
static GLubyte CCColorByteFromFloat (GLfloat colorValue)
static GLfloat CCColorFloatFromByte (GLubyte colorValue)
static CGRect CGRectFromCC3Viewport (CC3Viewport vp)
NSString * NSStringFromBoolean (BOOL value)
static NSString * NSStringFromCC3AngularVector (CC3AngularVector av)
static NSString * NSStringFromCC3AttenuationCoefficients (CC3AttenuationCoefficients coeffs)
static NSString * NSStringFromCC3BoundingBox (CC3BoundingBox bb)
static NSString * NSStringFromCC3Plane (CC3Plane p)
static NSString * NSStringFromCC3Ray (CC3Ray aRay)
static NSString * NSStringFromCC3Spere (CC3Sphere sphere)
static NSString * NSStringFromCC3Vector (CC3Vector v)
static NSString * NSStringFromCC3Vector4 (CC3Vector4 v)
static NSString * NSStringFromCC3Viewport (CC3Viewport vp)
static NSString * NSStringFromCCC4F (ccColor4F rgba)
NSString * NSStringFromTouchType (uint tType)
static ccColor4F RandomCCC4FBetween (ccColor4F min, ccColor4F max)

Variables

static const CC3BoundingBox kCC3BoundingBoxNull = { {INFINITY, INFINITY, INFINITY}, {INFINITY, INFINITY, INFINITY} }
static const CC3BoundingBox kCC3BoundingBoxZero = { {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} }
static const
CC3AttenuationCoefficients 
kCC3ParticleSizeAttenuationNone = {1.0, 0.0, 0.0}
static const CC3Vector4 kCC3Vector4QuaternionIdentity = { 0.0, 0.0, 0.0, 1.0 }
static const CC3Vector4 kCC3Vector4Zero = { 0.0, 0.0, 0.0, 0.0 }
static const CC3Vector kCC3VectorUnitCube = { 1.0, 1.0, 1.0 }
static const GLfloat kCC3VectorUnitCubeLength = M_SQRT3
static const CC3Vector kCC3VectorUnitXNegative = {-1.0, 0.0, 0.0 }
static const CC3Vector kCC3VectorUnitXPositive = { 1.0, 0.0, 0.0 }
static const CC3Vector kCC3VectorUnitYNegative = { 0.0, -1.0, 0.0 }
static const CC3Vector kCC3VectorUnitYPositive = { 0.0, 1.0, 0.0 }
static const CC3Vector kCC3VectorUnitZNegative = { 0.0, 0.0, -1.0 }
static const CC3Vector kCC3VectorUnitZPositive = { 0.0, 0.0, 1.0 }
static const CC3Vector kCC3VectorZero = { 0.0, 0.0, 0.0 }
static const ccColor4F kCCC4FBlack = { 0.0, 0.0, 0.0, 1.0 }
static const ccColor4F kCCC4FBlackTransparent = {0.0, 0.0, 0.0, 0.0}
static const ccColor4F kCCC4FBlue = { 0.0, 0.0, 1.0, 1.0 }
static const ccColor4F kCCC4FCyan = { 0.0, 1.0, 1.0, 1.0 }
static const ccColor4F kCCC4FDarkGray = { (1.0 / 3.0), (1.0 / 3.0), (1.0 / 3.0), 1.0 }
static const ccColor4F kCCC4FGreen = { 0.0, 1.0, 0.0, 1.0 }
static const ccColor4F kCCC4FLightGray = { (2.0 / 3.0), (2.0 / 3.0), (2.0 / 3.0), 1.0 }
static const ccColor4F kCCC4FMagenta = { 1.0, 0.0, 1.0, 1.0 }
static const ccColor4F kCCC4FRed = { 1.0, 0.0, 0.0, 1.0 }
static const ccColor4F kCCC4FWhite = { 1.0, 1.0, 1.0, 1.0 }
static const ccColor4F kCCC4FYellow = { 1.0, 1.0, 0.0, 1.0 }

Detailed Description


Define Documentation

#define cc3v (   X,
  Y,
 
)    CC3VectorMake((X),(Y),(Z))

Convenience alias macro to create CC3Vectors with less keystrokes.

#define ccc4f (   R,
  G,
  B,
 
)    CCC4FMake((R),(G),(B),(A))

Convenience alias macro to create ccColor4F with less keystrokes.


Typedef Documentation

typedef GLfloat CC3Angle

An angle such as a heading or inclination.

Can be measured in degrees or radians and may be positive or negative.


Function Documentation

static CC3AngularVector CC3AngularVectorDifference ( CC3AngularVector  minuend,
CC3AngularVector  subtrahend 
) [inline, static]

Returns the difference between two CC3AngularVectors, by subtracting the corresponding heading, inclination & radial components.

Note that this is NOT true vector arithmetic, which would yield a completely different angular and radial results.

static CC3AngularVector CC3AngularVectorFromVector ( CC3Vector  aCoord ) [inline, static]

Returns an CC3AngularVector providing the heading, inclination & radius of the specified CC3Vector.

Heading is measured in degrees, in the X-Z plane, clockwise from the negative Z-axis. Inclination is measured in degrees, with up being in the positive-Y direction.

static CC3AngularVector CC3AngularVectorMake ( GLfloat  heading,
GLfloat  inclination,
GLfloat  radius 
) [inline, static]

Returns an CC3AngularVector structure constructed from the vector components.

static CC3AttenuationCoefficients CC3AttenuationCoefficientsMake ( GLfloat  a,
GLfloat  b,
GLfloat  c 
) [inline, static]

Returns a CC3AttenuationCoefficients structure constructed from the specified coefficients.

CC3Vector4 CC3AxisAngleFromQuaternion ( CC3Vector4  quaternion )

Converts the specified quaternion to a vector that represents a rotation in axis-angle form.

The X, Y & Z components of the returned vector contain the rotation axis, and the W component specifies the angle, in degrees.

CC3BoundingBox CC3BoundingBoxAddPadding ( CC3BoundingBox  bb,
GLfloat  padding 
)

Returns a bounding box that has the same dimensions as the specified bounding box, but with each corner expanded outward by the specified amount of padding.

The padding value is added to all three components of the maximum vector, and subtracted from all three components of the minimum vector.

static CC3Vector CC3BoundingBoxCenter ( CC3BoundingBox  bb ) [inline, static]

Returns the geometric center of the specified bounding box.

CC3BoundingBox CC3BoundingBoxEngulfLocation ( CC3BoundingBox  bb,
CC3Vector  aLoc 
)

Returns the smallest CC3BoundingBox that contains both the specified bounding box and location.

If the specified bounding box is null, returns a bounding box of zero size at the specified location.

static BOOL CC3BoundingBoxesAreEqual ( CC3BoundingBox  bb1,
CC3BoundingBox  bb2 
) [inline, static]

Returns whether the two bounding boxes are equal by comparing their respective components.

static CC3BoundingBox CC3BoundingBoxFromMinMax ( CC3Vector  minVtx,
CC3Vector  maxVtx 
) [inline, static]

Returns a CC3BoundingBox structure constructed from the min and max vertices.

static BOOL CC3BoundingBoxIsNull ( CC3BoundingBox  bb ) [inline, static]

Returns whether the specified bounding box is equal to the null bounding box, specified by kCC3BoundingBoxNull.

static CC3BoundingBox CC3BoundingBoxMake ( GLfloat  minX,
GLfloat  minY,
GLfloat  minZ,
GLfloat  maxX,
GLfloat  maxY,
GLfloat  maxZ 
) [inline, static]

Returns a CC3BoundingBox structure constructed from the min and max components.

CC3BoundingBox CC3BoundingBoxUnion ( CC3BoundingBox  bb1,
CC3BoundingBox  bb2 
)

Returns the smallest CC3BoundingBox that contains the two specified bounding boxes.

If either bounding box is the null bounding box, simply returns the other bounding box (which may also be the null bounding box).

static GLfloat CC3DistanceFromNormalizedPlane ( CC3Plane  p,
CC3Vector  v 
) [inline, static]

Returns the distance from the point represented by the vector to the specified normalized plane.

static CC3Plane CC3PlaneFromPoints ( CC3Vector  p1,
CC3Vector  p2,
CC3Vector  p3 
) [inline, static]

Returns a CC3Plane structure that contains the specified points.

The direction of the normal of the returned plane is dependent on the winding order of the three points. Winding is done in the order the points are specified (p1 -> p2 -> p3), and the normal will point in the direction that has the three points winding in a counter-clockwise direction, according to a right-handed coordinate system. If the direction of the normal is important, be sure to specify the three points in the appropriate order.

static CC3Plane CC3PlaneMake ( GLfloat  a,
GLfloat  b,
GLfloat  c,
GLfloat  d 
) [inline, static]

Returns a CC3Plane structure constructed from the specified coefficients.

static CC3Vector CC3PlaneNormal ( CC3Plane  p ) [inline, static]

Returns the normal of the plane, which is (a, b, c) from the planar equation.

static CC3Plane CC3PlaneNormalize ( CC3Plane  p ) [inline, static]

Returns a normalized copy of the specified CC3Plane so that the length of its normal (a, b, c) is 1.0.

CC3Vector4 CC3QuaternionFromAxisAngle ( CC3Vector4  axisAngle )

Converts the specified vector that represents an rotation in axis-angle form to the corresponding quaternion.

The X, Y & Z components of the incoming vector contain the rotation axis, and the W component specifies the angle, in degrees.

static CC3Ray CC3RayFromLocDir ( CC3Vector  aLocation,
CC3Vector  aDirection 
) [inline, static]

Returns a CC3Ray structure constructed from the start location and direction vectors.

CC3Vector4 CC3RayIntersectionWithPlane ( CC3Ray  ray,
CC3Plane  plane 
)

Returns the location of the point where the specified ray intersects the specified plane.

The returned result is a 4D vector, where the x, y & z components give the intersection location in 3D space, and the w component gives the distance from the startLocation of the ray to the intersection location, in multiples of the ray direction vector. If this value is negative, the intersection point is in the direction opposite to the direction of the ray.

If the ray is parallel to the plane, no intersection occurs, and the returned 4D vector will be zeroed (equal to kCC3Vector4Zero).

static CC3Ray CC3RayMake ( GLfloat  locX,
GLfloat  locY,
GLfloat  locZ,
GLfloat  dirX,
GLfloat  dirY,
GLfloat  dirZ 
) [inline, static]

Returns a CC3Ray structure constructed from the start location and direction components.

static CC3Sphere CC3SphereMake ( CC3Vector  center,
GLfloat  radius 
) [inline, static]

Returns a CC3Spere constructed from the specified center and radius.

CC3Sphere CC3SphereUnion ( CC3Sphere  s1,
CC3Sphere  s2 
)

Returns the smallest CC3Sphere that contains the two specified spheres.

static CC3Vector4 CC3Vector4Add ( CC3Vector4  v,
CC3Vector4  translation 
) [inline, static]

Returns the result of adding the two specified vectors, by adding the corresponding components of both vectors.

This can also be thought of as a translation of the first vector by the second.

static GLfloat CC3Vector4Dot ( CC3Vector4  v1,
CC3Vector4  v2 
) [inline, static]

Returns the dot-product of the two given vectors (v1 .

v2).

static CC3Vector4 CC3Vector4FromCC3Vector ( CC3Vector  v,
GLfloat  w 
) [inline, static]

Returns a CC3Vector4 structure constructed from a 3D vector and a w component.

static CC3Vector4 CC3Vector4Homogenize ( CC3Vector4  v ) [inline, static]

If the specified homogeneous vector represents a location (w is not zero), returns a homoginized copy of the vector, by dividing each component by the w-component (including the w-component itself, leaving it with a value of one).

If the specified vector is a direction (w is zero), or is already homogenized (w is one) the vector is returned unchanged.

static GLfloat CC3Vector4Length ( CC3Vector4  v ) [inline, static]

Returns the scalar length of the specified vector from the origin, including the w-component This is calculated as sqrt(x*x + y*y + z*z + w*w) and will always be positive.

static CC3Vector4 CC3Vector4Make ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  w 
) [inline, static]

Returns a CC3Vector4 structure constructed from the vector components.

static CC3Vector4 CC3Vector4Negate ( CC3Vector4  v ) [inline, static]

Returns a vector that is the negative of the specified vector in all directions.

static CC3Vector4 CC3Vector4Normalize ( CC3Vector4  v ) [inline, static]

Returns a normalized copy of the specified vector so that its length is 1.0.

The w-component is also normalized.

static BOOL CC3Vector4sAreEqual ( CC3Vector4  v1,
CC3Vector4  v2 
) [inline, static]

Returns whether the two vectors are equal by comparing their respective components.

static CC3Vector4 CC3Vector4ScaleUniform ( CC3Vector4  v,
GLfloat  scale 
) [inline, static]

Returns the result of scaling the original vector by the corresponding scale factor uniformly along all axes.

CC3Vector4 CC3Vector4Slerp ( CC3Vector4  v1,
CC3Vector4  v2,
GLfloat  blendFactor 
)

Returns a spherical linear interpolation between two vectors, based on the blendFactor.

which should be between zero and one inclusive. The returned value is calculated as v1 + (blendFactor * (v2 - v1)). If the blendFactor is either zero or one exactly, this method short-circuits to simply return v1 or v2 respectively.

static CC3Vector CC3VectorAdd ( CC3Vector  v,
CC3Vector  translation 
) [inline, static]

Returns the result of adding the two specified vectors, by adding the corresponding components of both vectors.

This can also be thought of as a translation of the first vector by the second.

static CC3Vector CC3VectorAverage ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns a vector that represents the average of the two specified vectors.

This is calculated by adding the two specified vectors and scaling the resulting sum vector by half.

The returned vector represents the midpoint between a line that joins the endpoints of the two specified vectors.

static CC3Vector CC3VectorCross ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns the cross-product of the two given vectors (v1 x v2).

static CC3Vector CC3VectorDifference ( CC3Vector  minuend,
CC3Vector  subtrahend 
) [inline, static]

Returns the difference between two vectors, by subtracting the subtrahend from the minuend, which is accomplished by subtracting each of the corresponding x,y,z components.

static GLfloat CC3VectorDistance ( CC3Vector  start,
CC3Vector  end 
) [inline, static]

Returns the positive scalar distance between the ends of the two specified vectors.

static GLfloat CC3VectorDistanceSquared ( CC3Vector  start,
CC3Vector  end 
) [inline, static]

Returns the square of the scalar distance between the ends of the two specified vectors.

This function is useful for comparing vector distances without having to run an expensive square-root calculation.

static GLfloat CC3VectorDot ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns the dot-product of the two given vectors (v1 .

v2).

CC3Vector CC3VectorFromAngularVector ( CC3AngularVector  av )

Returns a CC3Vector from the specified CC3AngularVector.

Heading is measured in degrees, in the X-Z plane, clockwise from the negative Z-axis. Inclination is measured in degrees, with up being in the positive-Y direction.

static CC3Vector CC3VectorFromHomogenizedCC3Vector4 ( CC3Vector4  v ) [inline, static]

Returns a CC3Vector structure constructed from a CC3Vector4.

The CC3Vector4 is first homogenized (via CC3Vector4Homogenize), before copying the resulting x, y & z coordinates into the CC3Vector.

static CC3Vector CC3VectorFromTruncatedCC3Vector4 ( CC3Vector4  v ) [inline, static]

Returns a CC3Vector structure constructed from a CC3Vector4, by simply ignoring the w component of the 4D vector.

static CC3Vector CC3VectorInvert ( CC3Vector  v ) [inline, static]

Returns a CC3Vector that is the inverse of the specified vector in all directions, such that scaling the original by the inverse using CC3VectorScale will result in a vector of unit dimension in each direction (1.0, 1.0, 1.0).

The result of this function is effectively calculated by dividing each component of the original vector into 1.0 (1.0/x, 1.0/y, 1.0/z). It is the responsibility of the caller to ensure that none of the components of the original is zero.

static GLfloat CC3VectorLength ( CC3Vector  v ) [inline, static]

Returns the scalar length of the specified CC3Vector from the origin.

This is calculated as sqrt(x*x + y*y + z*z) and will always be positive.

static GLfloat CC3VectorLengthSquared ( CC3Vector  v ) [inline, static]

Returns the square of the scalar length of the specified CC3Vector from the origin.

This is calculated as (x*x + y*y + z*z) and will always be positive.

This function is useful for comparing vector sizes without having to run an expensive square-root calculation.

static CC3Vector CC3VectorLerp ( CC3Vector  v1,
CC3Vector  v2,
GLfloat  blendFactor 
) [inline, static]

Returns a linear interpolation between two vectors, based on the blendFactor.

which should be between zero and one inclusive. The returned value is calculated as v1 + (blendFactor * (v2 - v1)). If the blendFactor is either zero or one exactly, this method short-circuits to simply return v1 or v2 respectively.

static CC3Vector CC3VectorMake ( GLfloat  x,
GLfloat  y,
GLfloat  z 
) [inline, static]

Returns a CC3Vector structure constructed from the vector components.

static CC3Vector CC3VectorMaximize ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns a vector whose components comprise the maximum value of each of the respective components of the two specfied vectors.

In general, do not expect this method to return one of the specified vectors, but a new vector, each of the components of which is the maximum value for that component between the two vectors.

static CC3Vector CC3VectorMinimize ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns a vector whose components comprise the minimum value of each of the respective components of the two specfied vectors.

In general, do not expect this method to return one of the specified vectors, but a new vector, each of the components of which is the minimum value for that component between the two vectors.

static CC3Vector CC3VectorNegate ( CC3Vector  v ) [inline, static]

Returns a vector that is the negative of the specified vector in all directions.

For vectors that represent directions, the returned vector points in the direction opposite to the original.

static CC3Vector CC3VectorNormalize ( CC3Vector  v ) [inline, static]

Returns a normalized copy of the specified CC3Vector so that its length is 1.0.

If the length is zero, the original vector (a zero vector) is returned.

static CC3Vector CC3VectorRotationalDifference ( CC3Vector  minuend,
CC3Vector  subtrahend 
) [inline, static]

Returns the difference between two rotation vectors, in terms of the minimal degrees, along each axis, required to travel between the two roations, given that rotations are cyclical with a period of 360 degrees.

The result may be positive or negative, but will always be between (+/-180 degrees).

For example, the difference between 350 and 10 will yield -20 (ie- the smallest change from 10 degrees to 350 degrees is -20 degrees) rather than +340 (from simple subtraction). Similarly, the difference between 10 and 350 will yield +20 (ie- the smallest change from 350 degrees to 10 degrees is +20 degrees) rather than -340 (from simple subtraction).

static CC3Vector CC3VectorRotationModulo ( CC3Vector  aRotation ) [inline, static]

Returns a modulo version of the specifed rotation, so that each component is between (+/-360 degrees).

static BOOL CC3VectorsAreEqual ( CC3Vector  v1,
CC3Vector  v2 
) [inline, static]

Returns whether the two vectors are equal by comparing their respective components.

static CC3Vector CC3VectorScale ( CC3Vector  v,
CC3Vector  scale 
) [inline, static]

Returns the result of scaling the original vector by the corresponding scale vector.

Scaling can be different for each axis. This has the effect of multiplying each component of the vector by the corresponding component in the scale vector.

static CC3Vector CC3VectorScaleUniform ( CC3Vector  v,
GLfloat  scale 
) [inline, static]

Returns the result of scaling the original vector by the corresponding scale factor uniformly along all axes.

static BOOL CC3ViewportContainsPoint ( CC3Viewport  vp,
CGPoint  point 
) [inline, static]

Returns whether the specified point lies within the specified viewport.

A point is considered inside the viewport if its coordinates lie inside the viewport or on the minimum X or minimum Y edge.

static CC3Viewport CC3ViewportMake ( GLint  x,
GLint  y,
GLint  w,
GLint  h 
) [inline, static]

Returns a CC3Viewport structure constructed from the specified components.

static BOOL CC3ViewportsAreEqual ( CC3Viewport  vp1,
CC3Viewport  vp2 
) [inline, static]

Returns whether the two viewports are equal by comparing their respective components.

static ccColor3B CCC3BFromCCC4F ( ccColor4F  floatColor ) [inline, static]

Returns a ccColor3B structure constructed from the specified ccColor4F.

static ccColor4B CCC4BFromCCC4F ( ccColor4F  floatColor ) [inline, static]

Returns a ccColor4B structure constructed from the specified ccColor4F.

static ccColor4F CCC4FAdd ( ccColor4F  rgba,
ccColor4F  translation 
) [inline, static]

Returns the result of adding the two specified colors, by adding the corresponding components.

Each of the resulting color components is clamped to be between 0.0 and 1.0. This can also be thought of as a translation of the first color by the second.

static BOOL CCC4FAreEqual ( ccColor4F  c1,
ccColor4F  c2 
) [inline, static]

Returns whether the two colors are equal by comparing their respective components.

static ccColor4F CCC4FBlend ( ccColor4F  baseColor,
ccColor4F  blendColor,
GLfloat  blendWeight 
) [inline, static]

Returns an ccColor4F structure whose values are a weighted average of the specified base color and the blend color.

The parameter blendWeight should be between zero and one. A value of zero will leave the base color unchanged. A value of one will result in the blend being the same as the blend color.

static ccColor4F CCC4FDifference ( ccColor4F  minuend,
ccColor4F  subtrahend 
) [inline, static]

Returns the difference between two colors, by subtracting the subtrahend from the minuend, which is accomplished by subtracting each of the corresponding r,g, b, a components.

Each of the resulting color components is clamped to be between 0.0 and 1.0.

static ccColor4F CCC4FFromCCC4B ( ccColor4B  byteColor ) [inline, static]

Returns a ccColor4F structure constructed from the specified ccColor4B.

static ccColor4F CCC4FFromColorAndOpacity ( ccColor3B  byteColor,
GLubyte  opacity 
) [inline, static]

Returns a ccColor4F structure constructed from the specified ccColor3B and opacity.

static ccColor4F CCC4FMake ( GLfloat  red,
GLfloat  green,
GLfloat  blue,
GLfloat  alpha 
) [inline, static]

Returns a ccColor4F structure constructed from the specified components.

static ccColor4F CCC4FUniformScale ( ccColor4F  rgba,
GLfloat  scale 
) [inline, static]

Returns a ccColor4F structure whose values are those of the specified original color, multiplied by the specified scaling factor.

Each of the resulting color components is clamped to be between 0.0 and 1.0.

static ccColor4F CCC4FUniformTranslate ( ccColor4F  rgba,
GLfloat  offset 
) [inline, static]

Returns a ccColor4F structure whose values are those of the specified original color, where each color component has been translated by the specified offset.

Each of the resulting color components is clamped to be between 0.0 and 1.0.

static GLubyte CCColorByteFromFloat ( GLfloat  colorValue ) [inline, static]

Returns a GLubyte between 0 and 255 converted from the specified GLfloat value between 0 and 1.

static GLfloat CCColorFloatFromByte ( GLubyte  colorValue ) [inline, static]

Returns a GLfloat between 0 and 1 converted from the specified GLubyte value between 0 and 255.

static CGRect CGRectFromCC3Viewport ( CC3Viewport  vp ) [inline, static]

Returns the dimensions of the specified viewport as a rectangle.

NSString* NSStringFromBoolean ( BOOL  value )

Returns the string YES or NO, depending on the specified boolean value.

static NSString* NSStringFromCC3AngularVector ( CC3AngularVector  av ) [inline, static]

Returns a string description of the specified CC3AngularVector struct in the form "(heading, inclination, radius)".

static NSString* NSStringFromCC3AttenuationCoefficients ( CC3AttenuationCoefficients  coeffs ) [inline, static]

Returns a string description of the specified CC3AttenuationCoefficients struct in the form "(a, b, c)".

static NSString* NSStringFromCC3BoundingBox ( CC3BoundingBox  bb ) [inline, static]

Returns a string description of the specified CC3BoundingBox struct.

static NSString* NSStringFromCC3Plane ( CC3Plane  p ) [inline, static]

Returns a string description of the specified CC3Plane struct in the form "(a, b, c, d)".

static NSString* NSStringFromCC3Ray ( CC3Ray  aRay ) [inline, static]

Returns a string description of the specified CC3Ray struct.

static NSString* NSStringFromCC3Spere ( CC3Sphere  sphere ) [inline, static]

Returns a string description of the specified sphere.

static NSString* NSStringFromCC3Vector ( CC3Vector  v ) [inline, static]

Returns a string description of the specified CC3Vector struct in the form "(x, y, z)".

static NSString* NSStringFromCC3Vector4 ( CC3Vector4  v ) [inline, static]

Returns a string description of the specified CC3Vector4 struct in the form "(x, y, z, w)".

static NSString* NSStringFromCC3Viewport ( CC3Viewport  vp ) [inline, static]

Returns a string description of the specified CC3Viewport struct in the form "(x, y, w, h)".

static NSString* NSStringFromCCC4F ( ccColor4F  rgba ) [inline, static]

Returns a string description of the specified ccColor4F in the form "(r, g, b, a)".

NSString* NSStringFromTouchType ( uint  tType )

Returns the name of the specified touch type.

static ccColor4F RandomCCC4FBetween ( ccColor4F  min,
ccColor4F  max 
) [inline, static]

Returns a random ccColor4F where each component value between the specified min inclusive and the specified max exclusive.

This can be useful when creating particle systems.


Variable Documentation

const CC3BoundingBox kCC3BoundingBoxNull = { {INFINITY, INFINITY, INFINITY}, {INFINITY, INFINITY, INFINITY} } [static]

The null bounding box.

It cannot be drawn, but is useful for marking an uninitialized bounding box.

const CC3BoundingBox kCC3BoundingBoxZero = { {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} } [static]

A CC3BoundingBox of zero origin and dimensions.

Point size attenuation coefficients corresponding to no attenuation with distance (constant size).

const CC3Vector4 kCC3Vector4QuaternionIdentity = { 0.0, 0.0, 0.0, 1.0 } [static]

A CC3Vector4 that represents the identity quaternion.

const CC3Vector4 kCC3Vector4Zero = { 0.0, 0.0, 0.0, 0.0 } [static]

A CC3Vector4 of zero length at the origin.

const CC3Vector kCC3VectorUnitCube = { 1.0, 1.0, 1.0 } [static]

A CC3Vector with each component equal to one, representing the diagonal of a unit cube.

const GLfloat kCC3VectorUnitCubeLength = M_SQRT3 [static]

The diagonal length of a unit cube.

const CC3Vector kCC3VectorUnitXNegative = {-1.0, 0.0, 0.0 } [static]

Unit vector pointing in the same direction as the negative X-axis.

const CC3Vector kCC3VectorUnitXPositive = { 1.0, 0.0, 0.0 } [static]

Unit vector pointing in the same direction as the positive X-axis.

const CC3Vector kCC3VectorUnitYNegative = { 0.0, -1.0, 0.0 } [static]

Unit vector pointing in the same direction as the negative Y-axis.

const CC3Vector kCC3VectorUnitYPositive = { 0.0, 1.0, 0.0 } [static]

Unit vector pointing in the same direction as the positive Y-axis.

const CC3Vector kCC3VectorUnitZNegative = { 0.0, 0.0, -1.0 } [static]

Unit vector pointing in the same direction as the negative Z-axis.

const CC3Vector kCC3VectorUnitZPositive = { 0.0, 0.0, 1.0 } [static]

Unit vector pointing in the same direction as the positive Z-axis.

const CC3Vector kCC3VectorZero = { 0.0, 0.0, 0.0 } [static]

A CC3Vector of zero length at the origin.

const ccColor4F kCCC4FBlack = { 0.0, 0.0, 0.0, 1.0 } [static]

Opaque Black.

const ccColor4F kCCC4FBlackTransparent = {0.0, 0.0, 0.0, 0.0} [static]

Transparent Black.

const ccColor4F kCCC4FBlue = { 0.0, 0.0, 1.0, 1.0 } [static]

Opaque Blue.

const ccColor4F kCCC4FCyan = { 0.0, 1.0, 1.0, 1.0 } [static]

Opaque Cyan.

const ccColor4F kCCC4FDarkGray = { (1.0 / 3.0), (1.0 / 3.0), (1.0 / 3.0), 1.0 } [static]

Opaque Dark Gray.

const ccColor4F kCCC4FGreen = { 0.0, 1.0, 0.0, 1.0 } [static]

Opaque Green.

const ccColor4F kCCC4FLightGray = { (2.0 / 3.0), (2.0 / 3.0), (2.0 / 3.0), 1.0 } [static]

Opaque Light Gray.

const ccColor4F kCCC4FMagenta = { 1.0, 0.0, 1.0, 1.0 } [static]

Opaque Magenta.

const ccColor4F kCCC4FRed = { 1.0, 0.0, 0.0, 1.0 } [static]

Opaque Red.

const ccColor4F kCCC4FWhite = { 1.0, 1.0, 1.0, 1.0 } [static]

Opaque White.

const ccColor4F kCCC4FYellow = { 1.0, 1.0, 0.0, 1.0 } [static]

Opaque Yellow.