package ocaml-canvas

  1. Overview
  2. Docs

Module V1.VectorSource

Vector manipulation functions

Sourcetype t = float * float

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

Sourceval zero : t

zero is the zero/null vector

Sourceval unit : t

unit is the unit vector

Sourceval add : t -> t -> t

add v1 v2 returns the sum of vectors v1 and v2

Sourceval sub : t -> t -> t

sub v1 v2 returns the difference of vectors v1 and v2

Sourceval mul : t -> float -> t

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

Sourceval dot : t -> t -> float

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

Sourceval norm : t -> float

norm v computes the norm of vector v