Skip to content
Christopher Nikkel edited this page Dec 22, 2018 · 6 revisions

Area

Definition

type Area =
    {
        Width : Length;
        Height : Length;
    }

Description

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.

Constants

Constant Type Description
Area.full Area the full area of the coordinate space

Functions

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

Usage

Example

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

Output

area1 = "20,30"
area2 = "25,10.4"
area3 = "10,15"

Table of Contents

Getting Started

Fundamentals

Basic SVG Elements

Advanced Elements

Experimental

Clone this wiki locally