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

Point

Definition

type Point =
    {
        X : Length;
        Y : Length;
    }

Description

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.

Constants

Constant Type Description
Point.origin Point the origin of the coordinate space

Functions

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

Usage

Example

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

Output

point1 = "20,30"
point2 = "25,10.4"
point3 = "5.5em,10.3em"

Table of Contents

Getting Started

Fundamentals

Basic SVG Elements

Advanced Elements

Experimental

Clone this wiki locally