-
Notifications
You must be signed in to change notification settings - Fork 8
Area
Christopher Nikkel edited this page Dec 22, 2018
·
6 revisions
type Area =
{
Width : Length;
Height : Length;
}
Area
is used to described a size in coordinate space. It uses Length to describe its size and also has helper functions for creating areas in user space.
Constant | Type | Description |
---|---|---|
Area.full |
Area | the full area of the coordinate space |
Function | Signature | Description |
---|---|---|
Area.create |
Length -> Length -> Area |
creates an area at a specified location |
Area.ofFloats |
float * float -> Area |
creates an area in user space from a pair of floats |
Area.ofInts |
int * int -> Area |
creates an area in user space from a pair of ints |
Area.fromPoints |
Point -> Point -> Area |
converts a pair of Points to an area |
Area.toFloats |
Area -> float * float |
unboxes the float values |
Area.toString |
Area -> string |
converts an area to a string |
let area1 = Area.ofInts (20, 30)
let area2 = Area.ofFloats (25.0, 10.4)
let point1, point2 = Point.ofInts (10, 10), Point.ofInts(20, 25)
let area3 = Area.fromPoints point1 point2
printfn "area1 = %s" <| Area.toString area1
printfn "area2 = %s" <| Area.toString area2
printfn "area3 = %s" <| Area.toString area3
area1 = "20,30"
area2 = "25,10.4"
area3 = "10,15"