since import { HKT , Kind , Kind2 , Kind3 , URIS , URIS2 , URIS3 } from 'fp-ts/lib/HKT' ; import { Foldable , Foldable1 , Foldable2 , Foldable3 } from 'fp-ts/lib/Foldable' ; import * as RA from 'fp-ts/lib/ReadonlyArray' ; import * as M from 'fp-ts/lib/Monoid' ; category since export interface Degrees { readonly _tag : 'Degrees' ; /**
     * The angle in degrees.
     */ readonly degrees : number ; } category since export interface Radians { readonly _tag : 'Radians' ; /**
     * The angle in radians.
     */ readonly radians : number ; } category since export type Angle = Degrees | Radians ; category since export interface Point { /**
     * The x-axis coordinate.
     */ readonly x : number ; /**
     * The y-axis coordinate.
     */ readonly y : number ; } category since export interface Arc { readonly _tag : 'Arc' ; /**
     * The position of the center of the arc on the x-axis.
     */ readonly x : number ; /**
     * The position of the center of the arc on the y-axis.
     */ readonly y : number ; /**
     * The radius of the arc.
     */ readonly r : number ; /**
     * The starting angle of the arc.
     */ readonly start : number ; /**
     * The ending angle of the arc.
     */ readonly end : number ; /**
     * If `true`, draws the `Arc` in a counter-clockwise direction. Defaults to `false` (clockwise).
     */ readonly anticlockwise : boolean ; } category since export interface Composite { readonly _tag : 'Composite' ; /**
     * The list of shapes that compose the composite shape.
     */ readonly shapes : ReadonlyArray < Shape > ; } category since export interface Ellipse { readonly _tag : 'Ellipse' ; /**
     * The position of the center of the ellipse on the x-axis.
     */ readonly x : number ; /**
     * The position of the center of the ellipse on the y-axis.
     */ readonly y : number ; /**
     * The major-axis radius of the ellipse.
     */ readonly rx : number ; /**
     * The minor-axis radius of the ellipse.
     */ readonly ry : number ; /**
     * The starting angle of the arc.
     */ readonly start : number ; /**
     * The ending angle of the arc.
     */ readonly end : number ; /**
     * The rotation of the ellipse.
     */ readonly rotation : number ; /**
     * If `true`, draws the `Ellipse` in a counter-clockwise direction. Defaults to `false` (clockwise).
     */ readonly anticlockwise : boolean ; } category since export interface Path { readonly _tag : 'Path' ; /**
     * Indicates if the path is closed or open.
     */ readonly closed : boolean ; /**
     * The list of points that make up the path.
     */ readonly points : ReadonlyArray < Point > ; } category since export interface Rect { readonly _tag : 'Rect' ; /**
     * The position of the top-left corner of the rectangle on the x-axis.
     */ readonly x : number ; /**
     * The position of the top-left corner of the rectangle on the x-axis.
     */ readonly y : number ; /**
     * The width of the rectangle.
     */ readonly width : number ; /**
     * The height of the rectangle.
     */ readonly height : number ; } category since export type Shape = Arc | Composite | Ellipse | Path | Rect ; category since export const degrees = ( degrees ) : Degrees => ( { _tag : 'Degrees' , degrees } ) ; category since export const radians = ( radians ) : Radians => ( { _tag : 'Radians' , radians } ) ; category since export const angle = ( angle ) : number => { switch ( angle . _tag ) { case 'Degrees' : return angle . degrees * ( Math . PI / 180 ) ; case 'Radians' : return angle . radians ; } } ; category since export const point = ( x , y ) : Point => ( { x , y } ) ; category since export const arc = ( x , y , r , start , end , anticlockwise = false ) : Arc => ( { _tag : 'Arc' , x , y , r , start : angle ( start ) , end : angle ( end ) , anticlockwise } ) ; category since export const circle = ( x , y , r ) : Arc => ( { _tag : 'Arc' , x , y , r , start : angle ( radians ( 0 ) ) , end : angle ( radians ( Math . PI * 2 ) ) , anticlockwise : false } ) ; category since export const composite = ( shapes ) : Composite => ( { _tag : 'Composite' , shapes } ) ; category since export const ellipse = ( x , y , rx , ry , rotation , start , end , anticlockwise = false ) : Ellipse => ( { _tag : 'Ellipse' , x , y , rx , ry , rotation : angle ( rotation ) , start : angle ( start ) , end : angle ( end ) , anticlockwise } ) ; category since export function closed < F extends URIS3 > ( foldable ) ; export function closed < F extends URIS2 > ( foldable ) ; export function closed < F extends URIS > ( foldable ) ; export function closed < F > ( F ) ; export function closed < F > ( F ) { return ( fa ) => F . reduce ( fa , monoidPath . empty , ( b , a ) => ( { _tag : 'Path' , closed : true , points : RA . snoc ( b . points , a ) } ) ) ; } category since export function path < F extends URIS3 > ( foldable ) ; export function path < F extends URIS2 > ( foldable ) ; export function path < F extends URIS > ( foldable ) ; export function path < F > ( F ) ; export function path < F > ( F ) { return ( fa ) => F . reduce ( fa , monoidPath . empty , ( b , a ) => ( { _tag : 'Path' , closed : false , points : RA . snoc ( b . points , a ) } ) ) ; } category since export const rect = ( x , y , width , height ) : Rect => ( { _tag : 'Rect' , x , y , width , height } ) ; category since export const monoidPath = M . getStructMonoid ( { _tag : { concat : ( ) => 'Path' , empty : 'Path' } , closed : M . monoidAny , points : RA . getMonoid < Point > ( ) } ) ;