Run prettier
This commit is contained in:
@ -165,14 +165,20 @@ export class Circle {
|
||||
let rw = rect.size.w;
|
||||
let rh = rect.size.h;
|
||||
|
||||
if (cx < rx) { testX = rx; }
|
||||
else if (cx > rx + rw) { testX = rx + rw; }
|
||||
if (cy < ry) { testY = ry; }
|
||||
else if (cy > ry + rh) { testY = ry + rh; }
|
||||
if (cx < rx) {
|
||||
testX = rx;
|
||||
} else if (cx > rx + rw) {
|
||||
testX = rx + rw;
|
||||
}
|
||||
if (cy < ry) {
|
||||
testY = ry;
|
||||
} else if (cy > ry + rh) {
|
||||
testY = ry + rh;
|
||||
}
|
||||
|
||||
let distX = cx - testX;
|
||||
let distY = cy - testY;
|
||||
let sqDistance = (distX * distX) + (distY * distY);
|
||||
let sqDistance = distX * distX + distY * distY;
|
||||
|
||||
if (sqDistance <= this.radius * this.radius) {
|
||||
return new Point(testX, testY);
|
||||
@ -183,7 +189,7 @@ export class Circle {
|
||||
overlappedCells(size: Size): Rect[] {
|
||||
let meAsRect = new Rect(
|
||||
this.center.offset(new Point(-this.radius, -this.radius)),
|
||||
new Size(this.radius * 2, this.radius * 2)
|
||||
new Size(this.radius * 2, this.radius * 2),
|
||||
);
|
||||
let all: Rect[] = [];
|
||||
for (let cell of meAsRect.overlappedCells(size).values()) {
|
||||
|
Reference in New Issue
Block a user