import { Point } from '@pixi/math' ; const SQRT_2 = Math . sqrt ( 2 ) ; public export type LinearFunctional = [ number , number , number ] ; public export class Conic { public k : LinearFunctional ; public l : LinearFunctional ; public m : LinearFunctional ; public controlPoints : [ Point , Point , Point ] ; public _dirtyID : number ; constructor ( ) { /**
         * The chord connecting the points of tangency on _l_ and _m_.
         */ this . k = [ 1 , 0 , 0 ] ; /**
         * A line tangent to the curve.
         */ this . l = [ 0 , 1 , 0 ] ; /**
         * A line tangent to the curve.
         */ this . m = [ 0 , 0 , 1 ] ; /**
         * The control points in design space. The control points allow you to map design space points to the local space
         * points when creating a graphic.
         *
         * By default, the conic is a quadratic bezier curve.
         */ this . controlPoints = [ new Point ( 0 , 0 ) , new Point ( 0.5 , 0 ) , new Point ( 1 , 1 ) , ] ; /**
         * Flags changes in the shape data
         */ this . _dirtyID = 0 ; } param a param b param c setk ( a , b , c ) { this . k [ 0 ] = a ; this . k [ 1 ] = b ; this . k [ 2 ] = c ; this . _dirtyID ++ ; return this ; } param a param b param c setl ( a , b , c ) { this . l [ 0 ] = a ; this . l [ 1 ] = b ; this . l [ 2 ] = c ; this . _dirtyID ++ ; return this ; } param a param b param c setm ( a , b , c ) { this . m [ 0 ] = a ; this . m [ 1 ] = b ; this . m [ 2 ] = c ; this . _dirtyID ++ ; return this ; } param c0 param c1 param c2 setControlPoints ( c0 , c1 , c2 ) { this . controlPoints [ 0 ] = c0 ; this . controlPoints [ 1 ] = c1 ; this . controlPoints [ 2 ] = c2 ; } /**
     * Flag the shape as dirty after you have modified the data directly.
     */ update ( ) { this . _dirtyID ++ ; return this ; } param radius return static createCircle ( radius ) { const conic = new Conic ( ) ; conic . setk ( 1 / SQRT_2 , 1 / SQRT_2 , - radius / SQRT_2 ) ; conic . setl ( 1 , 0 , 0 ) ; conic . setm ( 0 , 1 , 0 ) ; return conic ; } param a param b static createEllipse ( a , b ) { const conic = new Conic ( ) ; conic . setk ( 1 / a , 1 / b , - 1 ) ; conic . setl ( 2 / a , 0 , 0 ) ; conic . setm ( 0 , 1 / b , 0 ) ; return conic ; } param a static createParabola ( a ) { const conic = new Conic ( ) ; conic . setk ( 1 , 0 , 0 ) ; conic . setl ( 0 , 4 * a , 0 ) ; conic . setm ( 0 , 0 , 1 ) ; return conic ; } param a param b static createHyperbola ( a , b ) { const conic = new Conic ( ) ; conic . setk ( 0 , 0 , 1 ) ; conic . setl ( - 1 / a , 1 / b , 0 ) ; conic . setm ( 1 / a , 1 / b , 0 ) ; return conic ; } }