-
Notifications
You must be signed in to change notification settings - Fork 8
Point
Christopher Nikkel edited this page Dec 22, 2018
·
10 revisions
type Point =
{
X : Length;
Y : Length;
}
Point
is used to described a location in coordinate space. It uses Length to describe its location and also has helper functions for creating points in user space.
Constant | Type | Description |
---|---|---|
Point.origin |
Point | the origin of the coordinate space |
Function | Signature | Description |
---|---|---|
Point.create |
Length -> Length -> Point |
creates a point at a specified location |
Point.ofFloats |
float * float -> Point |
creates a point in user space from a pair of floats |
Point.ofInts |
int * int -> Point |
creates a point in user space from a pair of ints |
Point.toFloat |
Point -> float * float |
unboxes the float values |
Point.toString |
Point -> string |
converts a point to a string |
let point1 = Point.ofInts (20, 30)
let point2 = Point.ofFloats (25.0, 10.4)
let length1, length2 = Length.ofEm 5.5, Length.ofEm 10.3
let point3 = Point.create length1 length2
printfn "point1 = %s" <| Point.toString point1
printfn "point2 = %s" <| Point.toString point2
printfn "point3 = %s" <| Point.toString point3
point1 = "20,30"
point2 = "25,10.4"
point3 = "5.5em,10.3em"