Skip to content

Commit

Permalink
Ensure from/toCartesianCoords uses PIXI.Point for rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed Jul 23, 2024
1 parent 0b1a16d commit 1a1eadb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions RegularPolygon/RegularPolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ export class RegularPolygon extends PIXI.Polygon {
fromCartesianCoords(a, outPoint) {
const { x, y } = this.origin;
outPoint ??= new PIXI.Point;
a = PIXI.Point.fromObject(a);

a = PIXI.Point._tmp.copyFrom(a);
a.translate(-x, -y, outPoint).rotate(-this.radians, outPoint);
return outPoint;
}
Expand All @@ -213,8 +212,7 @@ export class RegularPolygon extends PIXI.Polygon {
toCartesianCoords(a, outPoint) {
const { x, y } = this.origin;
outPoint ??= new PIXI.Point;
a = PIXI.Point.fromObject(a);

a = PIXI.Point._tmp.copyFrom(a);
a.rotate(this.radians, outPoint).translate(x, y, outPoint);
return outPoint;
}
Expand Down

0 comments on commit 1a1eadb

Please sign in to comment.