package ocaml-canvas

  1. Overview
  2. Docs

Module V1.PointSource

Point manipulation functions

Sourcetype t = float * float

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

Sourceval of_ints : (int * int) -> t

of_ints (x, y) creates a point from integer coordinates

Sourceval sub : t -> t -> Vector.t

sub p1 p2 returns the difference between points p1 and p2

Sourceval translate : t -> by:Vector.t -> t

translate p ~by translates point p by vector by

Sourceval rotate : t -> around:t -> theta:float -> t

rotate p ~around ~theta rotates point p around a central point around by an angle theta

Sourceval transform : t -> Transform.t -> t

transform p t transforms point p by the given transform t

Sourceval barycenter : float -> t -> float -> t -> t

barycenter a p1 b p2 compute the barycenter of (a, p1) and (b, p2)

Exceptions:

Sourceval distance : t -> t -> float

distance p1 p2 computes the distance between p1 and p2

OCaml

Innovation. Community. Security.