Module Bezier

module Bezier: sig .. end

Bezier contains the Bezier.t type, which stores information about a cubic Bezier curve, and functions for creating and manipulating Bezier curves.


type t = Math.vector * Math.vector * Math.vector * Math.vector 

(a1, c1, c2, a2) is the Bezier curve with anchor points a1 and a2 and control points c1 and c2.

Bezier Creation

val create : Math.vector -> Math.vector -> Math.vector -> Math.vector -> t

create a1 c1 c2 a2 is (a1, c1, c2, a2).

Bezier Helper Functions

val anchor1 : t -> Math.vector

anchor1 bez is the first anchor point of bez.

val control1 : t -> Math.vector

control1 bez is the first control point of bez.

val control2 : t -> Math.vector

control2 bez is the second control point of bez.

val anchor2 : t -> Math.vector

anchor2 bez is the second anchor point of bez.

Bezier Manipulation

val interpolate : t -> float -> Math.vector

interpolate bez time is the point at time along bez, where time is in [0, 1].

val tangent : t -> float -> Math.vector

tangent bez time is the vector tanget to bez at time, where time is in [0, 1].