module V2:sig..end
typet =Gg.v2
val dim : int
typem =Gg.m2
val v : float -> float -> Gg.v2v x y is the vector (x y).val comp : int -> Gg.v2 -> float
val x : Gg.v2 -> floatx v is the x component of v.val y : Gg.v2 -> floaty v is the y component of v.val ox : Gg.v2ox is the unit vector (1. 0.).val oy : Gg.v2oy is the unit vector (0. 1.).val zero : Gg.v2
val infinity : Gg.v2infinity is the vector whose components are infinity.val neg_infinity : Gg.v2neg_infinity is the vector whose components are neg_infinity.val basis : int -> Gg.v2basis i is the ith vector of an
orthonormal basis
of the vector space Gg.V2.t with inner product Gg.V2.dot.Invalid_argument if i is not in [0;Gg.V2.dim[.val of_tuple : float * float -> Gg.v2of_tuple (x, y) is V2.v x y.val to_tuple : Gg.v2 -> float * floatof_tuple v is (V2.x v, V2.y v).val of_polar : Gg.v2 -> Gg.v2of_polar pv is a vector whose cartesian coordinates (x, y)
correspond to the radial and angular
polar
coordinates (r, theta) given by (V2.x pv, V2.y pv).val to_polar : Gg.v2 -> Gg.v2to_polar v is a vector whose coordinates (r, theta) are the
radial and angular
polar
coordinates of v. theta is in [-pi;pi].val of_v3 : Gg.v3 -> Gg.v2of_v3 u is v (V3.x u) (V3.y u).val of_v4 : Gg.v4 -> Gg.v2of_v4 u is v (V4.x u) (V4.y u).val neg : Gg.v2 -> Gg.v2neg v is the inverse vector -v.val add : Gg.v2 -> Gg.v2 -> Gg.v2add u v is the vector addition u + v.val sub : Gg.v2 -> Gg.v2 -> Gg.v2sub u v is the vector subtraction u - v.val mul : Gg.v2 -> Gg.v2 -> Gg.v2mul u v is the component wise multiplication u * v.val div : Gg.v2 -> Gg.v2 -> Gg.v2div u v is the component wise division u / v.val smul : float -> Gg.v2 -> Gg.v2smul s v is the scalar multiplication sv.val half : Gg.v2 -> Gg.v2half v is the half vector smul 0.5 v.val dot : Gg.v2 -> Gg.v2 -> float
val norm : Gg.v2 -> floatnorm v is the norm |v| = sqrt v.v.val norm2 : Gg.v2 -> floatnorm2 v is the squared norm |v|2 .val unit : Gg.v2 -> Gg.v2unit v is the unit vector v/|v|.val polar : float -> float -> Gg.v2polar r theta is V2.of_polar (V2.v r theta).val angle : Gg.v2 -> float
val ortho : Gg.v2 -> Gg.v2ortho v is v rotated by pi / 2.val homogene : Gg.v2 -> Gg.v2homogene v is the vector v/vy if vy <> 0 and v
otherwise.val mix : Gg.v2 -> Gg.v2 -> float -> Gg.v2mix u v t is the linear interpolation u + t(v - u).val ltr : Gg.m2 -> Gg.v2 -> Gg.v2
val tr : Gg.m3 -> Gg.v2 -> Gg.v2tr m v is the
affine
transform in
homogenous 2D 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 Gg.P2.tr to
transform finite points.
Pervasives operatorsval (+) : Gg.v2 -> Gg.v2 -> Gg.v2u + v is add u v.val (-) : Gg.v2 -> Gg.v2 -> Gg.v2u - v is sub u v.val ( * ) : float -> Gg.v2 -> Gg.v2t * v is smul t v.val (/) : Gg.v2 -> float -> Gg.v2v / t is smul (1. /. t) v.val map : (float -> float) -> Gg.v2 -> Gg.v2map f v is the component wise application of f to v.val mapi : (int -> float -> float) -> Gg.v2 -> Gg.v2
val fold : ('a -> float -> 'a) -> 'a -> Gg.v2 -> 'afold f acc v is f (...(f (f acc v0) v1)...).val foldi : ('a -> int -> float -> 'a) -> 'a -> Gg.v2 -> 'afoldi f acc v is f (...(f (f acc 0 v0) 1 v1)...).val iter : (float -> unit) -> Gg.v2 -> unititer f v is f v0; f v1; ...val iteri : (int -> float -> unit) -> Gg.v2 -> unititeri f v is f 0 v0; f 1 v1; ...val for_all : (float -> bool) -> Gg.v2 -> boolfor_all p v is p v0 && p v1 && ...val exists : (float -> bool) -> Gg.v2 -> boolexists p v is p v0 || p v1 || ...val equal : Gg.v2 -> Gg.v2 -> boolequal u v is u = v.val equal_f : (float -> float -> bool) -> Gg.v2 -> Gg.v2 -> bool
val compare : Gg.v2 -> Gg.v2 -> intcompare u v is Pervasives.compare u v.val compare_f : (float -> float -> int) -> Gg.v2 -> Gg.v2 -> intcompare_f cmp u v compares u and v like Gg.V2.compare
but uses cmp to compare floating point values.val to_string : Gg.v2 -> stringto_string v is a textual representation of v.val pp : Format.formatter -> Gg.v2 -> unitpp ppf v prints a textual representation of v on ppf.val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Gg.v2 -> unit