Iosevka/support/point.ptl
2020-06-05 20:08:53 -07:00

65 lines
No EOL
1.7 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 || 0) (z.y || 0) true false false
static [offFrom z] : new Point (z.x || 0) (z.y || 0) false false false
static [cubicOffFrom z] : new Point (z.x || 0) (z.y || 0) false true false
static [cornerFromXY x y] : new Point (x || 0) (y || 0) true false false
static [offFromXY x y] : new Point (x || 0) (y || 0) false false false
static [cubicOffFromXY x y] : new Point (x || 0) (y || 0) 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
static [translated z dx dy] : new Point ((z.x || 0) + dx) ((z.y || 0) + dy) z.on z.cubic z.subdivided