package ocaml-canvas

  1. Overview
  2. Docs

Vector manipulation functions

type t = float * float

A vector is a pair of floats of the form (x, y)

val zero : t

zero is the zero/null vector

val unit : t

unit is the unit vector

val add : t -> t -> t

add v1 v2 returns the sum of vectors v1 and v2

val sub : t -> t -> t

sub v1 v2 returns the difference of vectors v1 and v2

val mul : t -> float -> t

mul v k returns the product of vector v by the scalar k

val dot : t -> t -> float

dot v1 v2 returns the dot product of vectors v1 and v2

val norm : t -> float

norm v computes the norm of vector v


Innovation. Community. Security.