import { RIGHT_ANGLE , TAU } from './constants' ; public export type Pixels = number ; public export type Ratio = number ; public export type SizeRatio = Ratio ; public export type Cartesian = number ; internal export type Coordinate = Cartesian ; public export type Radius = Cartesian ; public export type Radian = Cartesian ; public export type Distance = Cartesian ; internal export type Degrees = number ; internal export interface PointObject { x : Coordinate ; y : Coordinate ; } internal export type PointTuple = [ Coordinate , Coordinate ] ; internal export type PointTuples = [ PointTuple , ... PointTuple [ ] ] ; internal export class Circline { x : Coordinate = NaN ; y : Coordinate = NaN ; r : Radius = NaN ; } internal export interface CirclinePredicate extends Circline { inside : boolean ; } internal export interface CirclineArc extends Circline { from : Radian ; to : Radian ; } internal type CirclinePredicateSet = CirclinePredicate [ ] ; internal export type RingSectorConstruction = CirclinePredicateSet ; public export type TimeMs = number ; internal export function wrapToTau ( a ) { if ( 0 <= a && a <= TAU ) return a ; if ( a < 0 ) a -= TAU * Math . floor ( a / TAU ) ; return a > TAU ? a % TAU : a ; } internal export function diffAngle ( a , b ) { return ( ( a - b + Math . PI + TAU ) % TAU ) - Math . PI ; } internal export function meanAngle ( a , b ) { return ( TAU + b + diffAngle ( a , b ) / 2 ) % TAU ; } internal export function trueBearingToStandardPositionAngle ( alphaIn ) { return wrapToTau ( RIGHT_ANGLE - alphaIn ) ; } internal export interface Origin { x0 : number ; y0 : number ; } internal export interface Rectangle extends Origin { x1 : number ; y1 : number ; }