Gg.V33D vectors.
type t = v3The type for 3D vectors.
dim is the dimension of vectors of type v3.
type m = m3The type for matrices representing linear transformations of 3D space.
val v : float -> float -> float -> v3v x y z is the vector (x y z).
val comp : int -> v3 -> floatcomp i v is vi, the ith component of v.
Raises Invalid_argument if i is not in [0;dim[.
val x : v3 -> floatx v is the x component of v.
val y : v3 -> floaty v is the y component of v.
val z : v3 -> floatz v is the z component of v.
val ox : v3ox is the unit vector (1. 0. 0.).
val oy : v3oy is the unit vector (0. 1. 0.).
val oz : v3oz is the unit vector (0. 0. 1.).
val infinity : v3infinity is the vector whose components are infinity.
val neg_infinity : v3neg_infinity is the vector whose components are neg_infinity.
val basis : int -> v3basis i is the ith vector of an orthonormal basis of the vector space t with inner product dot.
Raises Invalid_argument if i is not in [0;dim[.
val of_tuple : (float * float * float) -> v3of_tuple (x, y, z) is v x y z.
val to_tuple : v3 -> float * float * floatto_tuple v is (x v, y v, z v).
of_spherical sv is the vector whose cartesian coordinates (x, y, z) correspond to the radial, azimuth angle and zenith angle spherical coordinates (r, theta, phi) given by (V3.x sv, V2.y sv, V3.z sv).
to_spherical v is the vector whose coordinate (r, theta,
phi) are the radial, azimuth angle and zenith angle spherical coordinates of v. theta is in [-pi;pi] and phi in [0;pi].
cross u v is the cross product u x v.
dot u v is the dot product u.v.
val norm : v3 -> floatnorm v is the norm |v| = sqrt v.v.
val norm2 : v3 -> floatnorm2 v is the squared norm |v|2 .
val spherical : float -> float -> float -> v3spherical r theta phi is of_spherical (V3.v r theta phi).
val azimuth : v3 -> floatazimuth v is the azimuth angle spherical coordinates of v. The result is in [-pi;pi].
val zenith : v3 -> floatzenith v is the zenith angle spherical coordinates of v. The result is in [0;pi].
ltr m v is the linear transform mv.
tr m v is the affine transform in homogenous 3D space of the vector v by m.
Note. Since m is supposed to be affine the function ignores the last row of m. v is treated as a vector (infinite point, its last coordinate in homogenous space is 0) and is thus translationally invariant. Use P3.tr to transform finite points.
Stdlib operatorsmapi f v is like map but the component index is also given.
val fold : ('a -> float -> 'a) -> 'a -> v3 -> 'afold f acc v is f (...(f (f acc v0) v1)...).
val foldi : ('a -> int -> float -> 'a) -> 'a -> v3 -> 'afoldi f acc v is f (...(f (f acc 0 v0) 1 v1)...).
val iter : (float -> unit) -> v3 -> unititer f v is f v0; f v1; ...
val iteri : (int -> float -> unit) -> v3 -> unititeri f v is f 0 v0; f 1 v1; ...
val for_all : (float -> bool) -> v3 -> boolfor_all p v is p v0 && p v1 && ...
val exists : (float -> bool) -> v3 -> boolexists p v is p v0 || p v1 || ...
equal_f eq u v tests u and v like equal but uses eq to test floating point values.
compare_f cmp u v compares u and v like compare but uses cmp to compare floating point values.
val pp : Stdlib.Format.formatter -> v3 -> unitpp ppf v prints a textual representation of v on ppf.