Iosevka/support/point.ptl
2020-03-23 22:59:20 -07:00

63 lines
1.5 KiB
Text

export all : class Point
public [new x y on cubic subdivided] : begin
this.x = x
this.y = y
this.on = on || false
this.cubic = cubic || false
this.subdivided = subdivided || false
public [add z2] : new Point
this.x + z2.x
this.y + z2.y
* this.on
* this.cubic
* this.subdivided
public [addScale scale z2] : new Point
this.x + scale * z2.x
this.y + scale * z2.y
* this.on
* this.cubic
* this.subdivided
public [mix scale z2] : new Point
this.x + scale * (z2.x - this.x)
this.y + scale * (z2.y - this.y)
* this.on
* this.cubic
* this.subdivided
public [scale t] : new Point
t * this.x
t * this.y
* this.on
* this.cubic
* this.subdivided
public [round d] : new Point
[Math.round (this.x * d)] / d
[Math.round (this.y * d)] / d
* this.on
* this.cubic
* this.subdivided
static [from z on cubic subdivided] : new Point
* z.x
* z.y
* on
* cubic
* subdivided
static [cornerFrom z] : new Point z.x z.y true false false
static [offFrom z] : new Point z.x z.y false false false
static [cubicOffFrom z] : new Point z.x z.y false true false
static [cornerFromXY x y] : new Point x y true false false
static [offFromXY x y] : new Point x y false false false
static [cubicOffFromXY x y] : new Point x y false true false
static [transformed tfm x y on cubic subdivided] : new Point
* x * tfm.xx + y * tfm.yx + tfm.x
* x * tfm.xy + y * tfm.yy + tfm.y
* on
* cubic
* subdivided