packageDocumentation module import { Point } from "../utils/Point" ; internal export class Line { public p1 : Point ; public p2 : Point ; constructor ( p1 ? , p2 ? ) { this . p1 = p1 || new Point ( ) ; this . p2 = p2 || new Point ( ) ; } /** checks for equality with the components of this, and line parameter */ public equals = ( line ) => this . p1 . equals ( line . p1 ) && this . p2 . equals ( line . p2 ) ; } internal export class Circle { public center : Point ; public radius : number ; constructor ( center ? , radius ? ) { this . center = center || new Point ( ) ; this . radius = radius || 0 ; } } internal export class Annulus { public center : Point ; public inner : Circle ; public outer : Circle ; constructor ( center ? , innerRadius ? , outerRadius ? ) { this . center = center || new Point ( ) ; this . inner = new Circle ( center , innerRadius ) ; this . outer = new Circle ( center , outerRadius ) ; } } internal export class AnnularSector { public parent : Annulus ; public startAngle : number ; public endAngle : number ; public path : string ; public innerStart : Point ; public outerStart : Point ; public start : Line ; public innerEnd : Point ; public outerEnd : Point ; public end : Line ; param parent param startAngle param endAngle constructor ( parent , startAngle , endAngle ) { this . parent = parent ; this . startAngle = startAngle ; this . endAngle = endAngle ; const { x : cx , y : cy } = parent . center ; const inner = parent . inner . radius ; const outer = parent . outer . radius ; this . innerStart = new Point ( cx + inner * Math . cos ( startAngle ) , cy + inner * Math . sin ( startAngle ) ) ; this . outerStart = new Point ( cx + outer * Math . cos ( startAngle ) , cy + outer * Math . sin ( startAngle ) ) ; this . start = new Line ( this . innerStart , this . outerStart ) ; this . outerEnd = new Point ( cx + outer * Math . cos ( endAngle ) , cy + outer * Math . sin ( endAngle ) ) ; this . innerEnd = new Point ( cx + inner * Math . cos ( endAngle ) , cy + inner * Math . sin ( endAngle ) ) ; this . end = new Line ( this . outerEnd , this . innerEnd ) ; const angleDiff = endAngle - startAngle ; const largeArc = ( angleDiff % ( Math . PI * 2 ) ) > Math . PI ? 1 : 0 ; const sectorCommands = [ ] ; sectorCommands . push ( `M${ this . innerStart . x },${ this . innerStart . y }` ) ; sectorCommands . push ( `L${ this . outerStart . x },${ this . outerStart . y }` ) ; sectorCommands . push ( `A${ outer },${ outer } 0 ${ largeArc } 1 ${ this . outerEnd . x },${ this . outerEnd . y }` ) ; sectorCommands . push ( `L${ this . innerEnd . x },${ this . innerEnd . y }` ) ; sectorCommands . push ( `A${ inner },${ inner } 0 ${ largeArc } 0 ${ this . innerStart . x },${ this . innerStart . y }` ) ; sectorCommands . push ( `z` ) ; this . path = sectorCommands . join ( " " ) ; } }