- 1.7
- 1.6
- 1.5
- Beta
- Examples (for 1.6a)
- Misc
Standard mathematical functions.
Syntax:
double cos( | angle); |
double | angle; |
Returns the cosine of angle (which should be given in degrees).
Syntax:
double dotproduct( | u, | |
v); |
vector | u; |
vector | v; |
Calculate and return the dot product of the two vectors u and v.
Syntax:
double normalise( | v); |
vector | v; |
Normalises the vector v, returning the magnitude of the vector before the normalisation was performed.
For example:
vector v = { 1, 2, 3 };
double mag = normalise(v);
printf("Normalised vector is { %f, %f, %f }, old magnitude was %f\n", v.x, v.y, v.z, mag);prints the following:
Normalised vector is { 0.267261, 0.534522, 0.801784 }, old magnitude was 3.741657
