如何判断一个圆是否在另一个圆内?我以为我已经使用 isInside 方法弄清楚了。
注意:此代码将在 http://sketch.paperjs.org
上运行var circle1 = new Path.Circle(new Point(100, 100), 100);
var circle2 = new Path.Circle(new Point(100, 100), 50);
circle1.strokeWidth = 2;
circle1.strokeColor = "black";
circle1.fillColor = "blue";
circle2.strokeWidth = 2;
circle2.strokeColor = "black";
circle2.fillColor = "green";
console.log(circle1.isInside(circle2));
console.log(circle2.isInside(circle1));
假假
从文档中isInside需要将矩形对象作为参数传入,而不是路径。
var circle1 = new Path.Circle(new Point(100, 100), 100);
var circle2 = new Path.Circle(new Point(100, 100), 50);
circle1.strokeWidth = 2;
circle1.strokeColor = "black";
circle1.fillColor = "blue";
circle2.strokeWidth = 2;
circle2.strokeColor = "black";
circle2.fillColor = "green";
console.log(circle1.isInside(circle2.bounds));
console.log(circle2.isInside(circle1.bounds));
假真