Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

vec3 Struct Reference

List of all members.

Detailed Description

A 3d float point.


Operations on vectors.

vec3 abs ()
 Get the absolute vector.

float absMaxAxis ()
 Get the absolute maximum axis.

float angularDifferenceDeg (vec3 b)
 Get the angular difference between these vectors in degrees.

float angularDifferenceRad (vec3 b)
 Get the angular difference between these vectors in radians.

vec3 ceil ()
 Return the nearest integer that is equal to or greater than a.

vec3 clamp (vec3 minVal, vec3 maxVal)
 Return min (max (a, minVal), maxVal).

vec3 clamp (float minVal, float maxVal)
 Return min (max (a, minVal), maxVal).

bit cmpge (vec3 b)
 Return whether this vector is greater than or equal to b in each axis.

bit cmpg (vec3 b)
 Return whether this vector is greater than b in each axis.

bit cmpl (vec3 b)
 Return whether this vector is less than b in each axis.

bit cmple (vec3 b)
 Return whether this vector is less than or equal to b in each axis.

vec3 cross (vec3 b)
 Get the cross product.

float distance (vec3 o)
 Distance to the other vector.

float dot (vec3 o)
 Get the dot product.

vec3 floor ()
 Return the nearest integer that is equal to or less than a.

vec3 fract ()
 Return a - a.floor ().

float magnitude ()
 Get the magnitude.

vec3 max (vec3 b)
 Select the maximum of either's axis.

float maxAxis ()
 Get the maximum axis.

vec3 min (vec3 b)
 Select the minimum of either's axis.

float minAxis ()
 Return the value of the minimum signed axis.

int minAbsAxisIndex ()
 Return the index of the minimum absolute axis.

vec3 mix (vec3 b, float t)
 Return the linear blend of this and b (this * (1 - t) + b * t).

vec3 normalize ()
 Get the unit vector.

vec3 refract (vec3 eye, vec3 normal, float refractIndex)
 Refract the vector.

vec3 sign ()
 Return 1.0 if a >= 0, else -1.0.

float squaredDistance (vec3 o)
 Squared distance to the other vector.

float squaredMagnitude ()
 Get the squared magnitude.

void print ()
 Print out.

char[] toString ()
 Convert to string.

bit colinear (vec3 a, vec3 b, vec3 c, float tolerance)
 Return whether these three points define a straight line within a certain tolerance.

bit colinear (vec3 a, vec3 b, vec3 c)
 Return whether these three points define a straight line within a tolerance of 0.02.


Public Member Functions

Basic operations.
float[] array ()
 Get this vector as an array.

float index (int i)
 Index a parameter.

void index (int i, float v)
 Set a parameter.

bit isnan ()
 Return whether any parameter is nan.

void set (float v)
 Set all parameters to a single value.

void set (float x, float y)
 Set the parameters and z to zero.

void set (float x, float y, float z)
 Set the parameters.

vec2 swizzle (int a, int b)
 Swizzle and return a 2d vector.

vec3 swizzle (int a, int b, int c)
 Swizzle and return a 3d vector.

Operator overloading.
vec3 add (float v)
 Add scalar.

vec3 add (vec2 b)
 Add zero-extended vector.

vec3 add (vec3 b)
 Add vector.

vec3 addass (float v)
 Add scalar and assign.

vec3 addass (vec2 b)
 Add zero-extended vector and assign.

vec3 addass (vec3 b)
 Add vector and assign.

float cmp (float b)
 Compare to scalar.

int cmp (vec2 b)
 Compare zero-extended vector.

float cmp (vec3 b)
 Compare vectors.

vec3 div (float value)
 Divide scalar.

vec3 div (vec2 b)
 Divide zero-extended vector.

vec3 div (vec3 b)
 Divide vector.

vec3 div_r (float value)
 Divide scalar by vector.

vec3 div_r (vec2 b)
 Divide zero-extended vector by this.

vec3 divass (float v)
 Divide scalar and assign.

vec3 divass (vec2 b)
 Divide zero-extended vector and assign.

vec3 divass (vec3 b)
 Divide vector and assign.

bit eq (float v)
 Return equality with scalar.

bit eq (vec2 b)
 Return equality with zero-extended vector.

bit eq (vec3 b)
 Return equality with vector.

vec3 mod (float v)
 Modulus scalar.

vec3 mod (vec2 b)
 Modulus zero-extended vector.

vec3 mod (vec3 b)
 Modulus vector.

vec3 mod_r (float v)
 Modulus scalar by this.

vec3 mod_r (vec2 b)
 Modulus zero-extended vector by this.

vec3 modass (float v)
 Divide scalar and assign.

vec3 modass (vec2 b)
 Modulus zero-extended vector and assign.

vec3 modass (vec3 b)
 Modulus vector and assign.

vec3 mul (float v)
 Multiply scalar.

vec3 mul (vec2 b)
 Multiply zero-extended vector.

vec3 mul (vec3 b)
 Multiply vector.

vec3 mulass (float v)
 Multiply scalar and assign.

vec3 mulass (vec2 b)
 Multiply zero-extended vector and assign.

vec3 mulass (vec3 b)
 Multiply vector and assign.

vec3 neg ()
 Negate each axis.

vec3 sub (float v)
 Subtract scalar.

vec3 sub (vec2 b)
 Subtract zero-extended vector.

vec3 sub (vec3 b)
 Subtract vector.

vec3 sub_r (float v)
 Subtract scalar by this.

vec3 sub_r (vec2 b)
 Subtract zero-extended vector by this.

vec3 subass (float v)
 Subtract scalar and assign.

vec3 subass (vec2 b)
 Subtract zero-extended vector.

vec3 subass (vec3 b)
 Subtract vector and assign.


Static Public Member Functions

vec3 create (float x, float y)
 Create a vector.

vec3 create (float x, float y, float z)
 Create a vector.

vec3 lerp (vec3 a, vec3 b, float t)
 Linear interpolation between two vectors.


Public Attributes

float x
 X coordinate.

float y
 Y coordinate.

float z
 Z coordinate.

const vec3 nan = { float.nan, float.nan, float.nan }
 A completely NAN vector.


Related Functions

(Note that these are not member functions.)

vec3 avec3 (float x, float y)
 Create a three-dimensional vector.

vec3 avec3 (float x, float y, float z)
 Create a three-dimensional vector.

vec3 avec3 (vec2 vector)
 Expand a two-dimensional vector with a z of zero.

vec3 avec3 (vec4 vector)
 Create a three-dimensional vector by removing the w axis.


Member Function Documentation

vec3 vec3.lerp vec3  a,
vec3  b,
float  t
[static]
 

Linear interpolation between two vectors.

Parameters:
a The vector to return when #t is 0.
b The vector to return when #t is 1.
t The amount to interpolate between #a and #b, from 0 (returns #a) to 1 (returns #b). Out-of-range values are clamped.
Returns:
The interpolated vector.

vec3 vec3.refract vec3  eye,
vec3  normal,
float  refractIndex
 

Refract the vector.

This vector is the surface point. eye is the location of the eye; normal is the normal of this surface (must be normalized). refractIndex is the degree and angle of refraction.


The documentation for this struct was generated from the following file:
Generated on Thu Sep 4 13:12:53 2003 for dig by doxygen 1.3.2