GLUS
Functions
glus_vector.c File Reference
#include "GL/glus.h"

Functions

GLUSvoid GLUSAPIENTRY glusVector3Copyf (GLUSfloat result[3], const GLUSfloat vector[3])
 Copies a 3D Vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector2Copyf (GLUSfloat result[2], const GLUSfloat vector[2])
 Copies a 2D Vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector3AddVector3f (GLUSfloat result[3], const GLUSfloat vector0[3], const GLUSfloat vector1[3])
 Adds a 3D Vector to another. More...
 
GLUSvoid GLUSAPIENTRY glusVector2AddVector2f (GLUSfloat result[2], const GLUSfloat vector0[2], const GLUSfloat vector1[2])
 Adds a 2D Vector to another. More...
 
GLUSvoid GLUSAPIENTRY glusVector3SubtractVector3f (GLUSfloat result[3], const GLUSfloat vector0[3], const GLUSfloat vector1[3])
 Subtracts a 3D Vector from another. More...
 
GLUSvoid GLUSAPIENTRY glusVector2SubtractVector2f (GLUSfloat result[2], const GLUSfloat vector0[2], const GLUSfloat vector1[2])
 Subtracts a 2D Vector from another. More...
 
GLUSvoid GLUSAPIENTRY glusVector3MultiplyScalarf (GLUSfloat result[3], const GLUSfloat vector[3], const GLUSfloat scalar)
 Multiplies a 3D Vector by a scalar. More...
 
GLUSvoid GLUSAPIENTRY glusVector2MultiplyScalarf (GLUSfloat result[2], const GLUSfloat vector[2], const GLUSfloat scalar)
 Multiplies a 2D Vector by a scalar. More...
 
GLUSfloat GLUSAPIENTRY glusVector3Lengthf (const GLUSfloat vector[3])
 Calculates the length of a 3D Vector. More...
 
GLUSfloat GLUSAPIENTRY glusVector2Lengthf (const GLUSfloat vector[2])
 Calculates the length of a 2D Vector. More...
 
GLUSboolean GLUSAPIENTRY glusVector3Normalizef (GLUSfloat vector[3])
 Normalizes the given 3D Vector. More...
 
GLUSboolean GLUSAPIENTRY glusVector2Normalizef (GLUSfloat vector[2])
 Normalizes the given 2D Vector. More...
 
GLUSfloat GLUSAPIENTRY glusVector3Dotf (const GLUSfloat vector0[3], const GLUSfloat vector1[3])
 Calculates the dot product of two 3D vectors. More...
 
GLUSfloat GLUSAPIENTRY glusVector2Dotf (const GLUSfloat vector0[2], const GLUSfloat vector1[2])
 Calculates the dot product of two 2D vectors. More...
 
GLUSvoid GLUSAPIENTRY glusVector3Crossf (GLUSfloat result[3], const GLUSfloat vector0[3], const GLUSfloat vector1[3])
 Calculates the cross product of two 3D vectors: vector0 x vector1. More...
 
GLUSvoid GLUSAPIENTRY glusVector3GetQuaternionf (GLUSfloat result[4], const GLUSfloat vector[3])
 Creates a quaternion out of a 3D vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector3GetPoint4f (GLUSfloat result[4], const GLUSfloat vector[3])
 Creates a 3D point, given as homogeneous coordinates, out of a 3D vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector2GetPoint3f (GLUSfloat result[3], const GLUSfloat vector[2])
 Creates a 2D point, given as homogeneous coordinates, out of a 2D vector. More...
 
GLUSboolean GLUSAPIENTRY glusVector3GramSchmidtOrthof (GLUSfloat result[3], const GLUSfloat u[3], const GLUSfloat v[3])
 Creates a 3D vector orthogonal to u on the u/v plane. More...
 
GLUSboolean GLUSAPIENTRY glusVector2GramSchmidtOrthof (GLUSfloat result[2], const GLUSfloat u[2], const GLUSfloat v[2])
 Creates a 2D vector orthogonal to u. More...
 
GLUSvoid GLUSAPIENTRY glusVector3Reflectf (GLUSfloat result[3], const GLUSfloat incident[3], const GLUSfloat normal[3])
 Calculate the reflection direction for an incident vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector2Reflectf (GLUSfloat result[2], const GLUSfloat incident[2], const GLUSfloat normal[2])
 Calculate the reflection direction for an incident vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector3Refractf (GLUSfloat result[3], const GLUSfloat incident[3], const GLUSfloat normal[3], const float eta)
 Calculate the refraction direction for an incident vector. More...
 
GLUSvoid GLUSAPIENTRY glusVector2Refractf (GLUSfloat result[2], const GLUSfloat incident[2], const GLUSfloat normal[2], const float eta)
 Calculate the refraction direction for an incident vector. More...
 
GLUSfloat GLUSAPIENTRY glusVector3Fresnelf (const GLUSfloat incident[3], const GLUSfloat normal[3], const GLUSfloat R0)
 Calculate the specular reflection coefficient, based on Schlick's approximation for the Fresnel term. More...
 
GLUSfloat GLUSAPIENTRY glusVector2Fresnelf (const GLUSfloat incident[2], const GLUSfloat normal[2], const GLUSfloat R0)
 Calculate the specular reflection coefficient, based on Schlick's approximation for the Fresnel term. More...
 
GLUSvoid GLUSAPIENTRY glusVectorNCopyc (GLUScomplex *result, const GLUScomplex *vector, const GLUSint n)
 Copies a Vector with N elements. More...
 
GLUSvoid GLUSAPIENTRY glusVectorNComplexToFloatc (GLUSfloat *result, const GLUScomplex *vector, const GLUSint n)
 Converts a complex number Vector with N elements to a float Vector. More...
 
GLUSvoid GLUSAPIENTRY glusVectorNFloatToComplexc (GLUScomplex *result, const GLUSfloat *vector, const GLUSint n)
 Converts a float Vector with N elements to a complex Vector. More...
 
GLUSvoid GLUSAPIENTRY glusVectorNMultiplyScalarc (GLUScomplex *result, const GLUScomplex *vector, const GLUSint n, const GLUSfloat scalar)
 Multiplies a Vector with N elements by a scalar. More...
 
GLUSvoid GLUSAPIENTRY glusVectorNConjugatec (GLUScomplex *result, const GLUScomplex *vector, const GLUSint n)
 Calculates the complex conjugate of a Vector with N elements. More...
 

Function Documentation

GLUSvoid GLUSAPIENTRY glusVector2AddVector2f ( GLUSfloat  result[2],
const GLUSfloat  vector0[2],
const GLUSfloat  vector1[2] 
)

Adds a 2D Vector to another.

Parameters
resultThe final vector.
vector0The first vector.
vector1The second vector.
GLUSvoid GLUSAPIENTRY glusVector2Copyf ( GLUSfloat  result[2],
const GLUSfloat  vector[2] 
)

Copies a 2D Vector.

Parameters
resultThe destination vector.
vectorThe source vector.
GLUSfloat GLUSAPIENTRY glusVector2Dotf ( const GLUSfloat  vector0[2],
const GLUSfloat  vector1[2] 
)

Calculates the dot product of two 2D vectors.

Parameters
vector0The first vector.
vector1The second vector.
Returns
The dot product.
GLUSfloat GLUSAPIENTRY glusVector2Fresnelf ( const GLUSfloat  incident[2],
const GLUSfloat  normal[2],
const GLUSfloat  R0 
)

Calculate the specular reflection coefficient, based on Schlick's approximation for the Fresnel term.

Parameters
incidentThe incident vector.
normalThe normal vector.
R0The reflection coefficient for light incoming parallel to the normal.
Returns
Specular reflection coefficient.
GLUSvoid GLUSAPIENTRY glusVector2GetPoint3f ( GLUSfloat  result[3],
const GLUSfloat  vector[2] 
)

Creates a 2D point, given as homogeneous coordinates, out of a 2D vector.

Parameters
resultThe resulting point.
vectorThe used vector.
GLUSboolean GLUSAPIENTRY glusVector2GramSchmidtOrthof ( GLUSfloat  result[2],
const GLUSfloat  u[2],
const GLUSfloat  v[2] 
)

Creates a 2D vector orthogonal to u.

Parameters
resultThe resulting vector.
uThe vector to calculate a orthogonal vector to.
vThe vector, which is projected to the orthogonal line of u.
Returns
GLUS_TRUE, if a vector could be calculated.
GLUSfloat GLUSAPIENTRY glusVector2Lengthf ( const GLUSfloat  vector[2])

Calculates the length of a 2D Vector.

Parameters
vectorThe used vector.
Returns
The length of the vector.
GLUSvoid GLUSAPIENTRY glusVector2MultiplyScalarf ( GLUSfloat  result[2],
const GLUSfloat  vector[2],
const GLUSfloat  scalar 
)

Multiplies a 2D Vector by a scalar.

Parameters
resultThe final vector.
vectorThe used vector for multiplication.
scalarThe scalar.
GLUSboolean GLUSAPIENTRY glusVector2Normalizef ( GLUSfloat  vector[2])

Normalizes the given 2D Vector.

Parameters
vectorThe vector to normalize.
Returns
GLUS_TRUE, if normalization succeeded.
GLUSvoid GLUSAPIENTRY glusVector2Reflectf ( GLUSfloat  result[2],
const GLUSfloat  incident[2],
const GLUSfloat  normal[2] 
)

Calculate the reflection direction for an incident vector.

Parameters
resultThe reflection vector.
incidentThe incident vector.
normalThe normal vector.
GLUSvoid GLUSAPIENTRY glusVector2Refractf ( GLUSfloat  result[2],
const GLUSfloat  incident[2],
const GLUSfloat  normal[2],
const float  eta 
)

Calculate the refraction direction for an incident vector.

Parameters
resultThe refraction vector.
incidentThe incident vector.
normalThe normal vector.
etaThe ratio of indices of refraction.
GLUSvoid GLUSAPIENTRY glusVector2SubtractVector2f ( GLUSfloat  result[2],
const GLUSfloat  vector0[2],
const GLUSfloat  vector1[2] 
)

Subtracts a 2D Vector from another.

Parameters
resultThe final vector.
vector0The vector subtracted by vector1.
vector1The vector subtracted from vector0.
GLUSvoid GLUSAPIENTRY glusVector3AddVector3f ( GLUSfloat  result[3],
const GLUSfloat  vector0[3],
const GLUSfloat  vector1[3] 
)

Adds a 3D Vector to another.

Parameters
resultThe final vector.
vector0The first vector.
vector1The second vector.
GLUSvoid GLUSAPIENTRY glusVector3Copyf ( GLUSfloat  result[3],
const GLUSfloat  vector[3] 
)

Copies a 3D Vector.

Parameters
resultThe destination vector.
vectorThe source vector.
GLUSvoid GLUSAPIENTRY glusVector3Crossf ( GLUSfloat  result[3],
const GLUSfloat  vector0[3],
const GLUSfloat  vector1[3] 
)

Calculates the cross product of two 3D vectors: vector0 x vector1.

Parameters
resultThe resulting vector from the cross product.
vector0The first vector.
vector1The second vector.
GLUSfloat GLUSAPIENTRY glusVector3Dotf ( const GLUSfloat  vector0[3],
const GLUSfloat  vector1[3] 
)

Calculates the dot product of two 3D vectors.

Parameters
vector0The first vector.
vector1The second vector.
Returns
The dot product.
GLUSfloat GLUSAPIENTRY glusVector3Fresnelf ( const GLUSfloat  incident[3],
const GLUSfloat  normal[3],
const GLUSfloat  R0 
)

Calculate the specular reflection coefficient, based on Schlick's approximation for the Fresnel term.

Parameters
incidentThe incident vector.
normalThe normal vector.
R0The reflection coefficient for light incoming parallel to the normal.
Returns
Specular reflection coefficient.
GLUSvoid GLUSAPIENTRY glusVector3GetPoint4f ( GLUSfloat  result[4],
const GLUSfloat  vector[3] 
)

Creates a 3D point, given as homogeneous coordinates, out of a 3D vector.

Parameters
resultThe resulting point.
vectorThe used vector.
GLUSvoid GLUSAPIENTRY glusVector3GetQuaternionf ( GLUSfloat  result[4],
const GLUSfloat  vector[3] 
)

Creates a quaternion out of a 3D vector.

Parameters
resultThe resulting quaternion.
vectorThe used vector.
GLUSboolean GLUSAPIENTRY glusVector3GramSchmidtOrthof ( GLUSfloat  result[3],
const GLUSfloat  u[3],
const GLUSfloat  v[3] 
)

Creates a 3D vector orthogonal to u on the u/v plane.

Parameters
resultThe resulting vector.
uThe vector to calculate a orthogonal vector to.
vThe vector, which is projected to the orthogonal line of u.
Returns
GLUS_TRUE, if a vector could be calculated.
GLUSfloat GLUSAPIENTRY glusVector3Lengthf ( const GLUSfloat  vector[3])

Calculates the length of a 3D Vector.

Parameters
vectorThe used vector.
Returns
The length of the vector.
GLUSvoid GLUSAPIENTRY glusVector3MultiplyScalarf ( GLUSfloat  result[3],
const GLUSfloat  vector[3],
const GLUSfloat  scalar 
)

Multiplies a 3D Vector by a scalar.

Parameters
resultThe final vector.
vectorThe used vector for multiplication.
scalarThe scalar.
GLUSboolean GLUSAPIENTRY glusVector3Normalizef ( GLUSfloat  vector[3])

Normalizes the given 3D Vector.

Parameters
vectorThe vector to normalize.
Returns
GLUS_TRUE, if normalization succeeded.
GLUSvoid GLUSAPIENTRY glusVector3Reflectf ( GLUSfloat  result[3],
const GLUSfloat  incident[3],
const GLUSfloat  normal[3] 
)

Calculate the reflection direction for an incident vector.

Parameters
resultThe reflection vector.
incidentThe incident vector.
normalThe normal vector.
GLUSvoid GLUSAPIENTRY glusVector3Refractf ( GLUSfloat  result[3],
const GLUSfloat  incident[3],
const GLUSfloat  normal[3],
const float  eta 
)

Calculate the refraction direction for an incident vector.

Parameters
resultThe refraction vector.
incidentThe incident vector.
normalThe normal vector.
etaThe ratio of indices of refraction.
GLUSvoid GLUSAPIENTRY glusVector3SubtractVector3f ( GLUSfloat  result[3],
const GLUSfloat  vector0[3],
const GLUSfloat  vector1[3] 
)

Subtracts a 3D Vector from another.

Parameters
resultThe final vector.
vector0The vector subtracted by vector1.
vector1The vector subtracted from vector0.
GLUSvoid GLUSAPIENTRY glusVectorNComplexToFloatc ( GLUSfloat result,
const GLUScomplex vector,
const GLUSint  n 
)

Converts a complex number Vector with N elements to a float Vector.

Parameters
resultThe destination vector.
vectorThe source vector.
nThe number of elements.
GLUSvoid GLUSAPIENTRY glusVectorNConjugatec ( GLUScomplex result,
const GLUScomplex vector,
const GLUSint  n 
)

Calculates the complex conjugate of a Vector with N elements.

Parameters
resultThe vector, containing the complex conjugate.
vectorThe source vector.
nThe number of elements.
GLUSvoid GLUSAPIENTRY glusVectorNCopyc ( GLUScomplex result,
const GLUScomplex vector,
const GLUSint  n 
)

Copies a Vector with N elements.

Parameters
resultThe destination vector.
vectorThe source vector.
nThe number of elements.
GLUSvoid GLUSAPIENTRY glusVectorNFloatToComplexc ( GLUScomplex result,
const GLUSfloat vector,
const GLUSint  n 
)

Converts a float Vector with N elements to a complex Vector.

Parameters
resultThe destination vector.
vectorThe source vector.
nThe number of elements.
GLUSvoid GLUSAPIENTRY glusVectorNMultiplyScalarc ( GLUScomplex result,
const GLUScomplex vector,
const GLUSint  n,
const GLUSfloat  scalar 
)

Multiplies a Vector with N elements by a scalar.

Parameters
resultThe final vector.
vectorThe used vector for multiplication.
nThe number of elements.
scalarThe scalar.