59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$maths$shapes$Circle = function(global, require, module, exports) {
|
|
var Rectangle = require("module$node_modules$pixi_DOT_js$lib$maths$shapes$Rectangle");
|
|
"use strict";
|
|
class Circle {
|
|
constructor(x = 0, y = 0, radius = 0) {
|
|
this.type = "circle";
|
|
this.x = x;
|
|
this.y = y;
|
|
this.radius = radius;
|
|
}
|
|
clone() {
|
|
return new Circle(this.x, this.y, this.radius);
|
|
}
|
|
contains(x, y) {
|
|
if (0 >= this.radius) {
|
|
return !1;
|
|
}
|
|
x = this.x - x;
|
|
y = this.y - y;
|
|
return x * x + y * y <= this.radius * this.radius;
|
|
}
|
|
strokeContains(x, y, width, alignment = 0.5) {
|
|
if (0 === this.radius) {
|
|
return !1;
|
|
}
|
|
x = this.x - x;
|
|
const dy = this.y - y;
|
|
y = this.radius;
|
|
alignment = (1 - alignment) * width;
|
|
x = Math.sqrt(x * x + dy * dy);
|
|
return x <= y + alignment && x > y - (width - alignment);
|
|
}
|
|
getBounds(out) {
|
|
out || (out = new Rectangle.Rectangle());
|
|
out.x = this.x - this.radius;
|
|
out.y = this.y - this.radius;
|
|
out.width = 2 * this.radius;
|
|
out.height = 2 * this.radius;
|
|
return out;
|
|
}
|
|
copyFrom(circle) {
|
|
this.x = circle.x;
|
|
this.y = circle.y;
|
|
this.radius = circle.radius;
|
|
return this;
|
|
}
|
|
copyTo(circle) {
|
|
circle.copyFrom(this);
|
|
return circle;
|
|
}
|
|
toString() {
|
|
return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;
|
|
}
|
|
}
|
|
exports.Circle = Circle;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$maths$shapes$Circle.js.map
|