Javascript 使用圆半径查找坐标以创建形状

Javascript 使用圆半径查找坐标以创建形状,javascript,coordinates,kineticjs,geometry,shapes,Javascript,Coordinates,Kineticjs,Geometry,Shapes,我使用脚本来创建形状,通常可以使用图像贴图来绘制坐标,但这个脚本使用的是圆半径的坐标 是否有工具根据圆半径绘制坐标,或者有更好的方法绘制坐标,例如: 这适用于多边形/星形形状,很难使形状对称。 我将制作其他更复杂的形状 circles.push(new Circle(width / 2 - 70, height / 2 - 120, circleRadius)); circles.push(new Circle(width / 2 - 0, height / 2 - 250, circleRad

我使用脚本来创建形状,通常可以使用图像贴图来绘制坐标,但这个脚本使用的是圆半径的坐标

是否有工具根据圆半径绘制坐标,或者有更好的方法绘制坐标,例如:

这适用于多边形/星形形状,很难使形状对称。 我将制作其他更复杂的形状

circles.push(new Circle(width / 2 - 70, height / 2 - 120, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 - 250, circleRadius));
circles.push(new Circle(width / 2 + 70, height / 2 - 120, circleRadius));
circles.push(new Circle(width / 2 + 220, height / 2 - 120, circleRadius));
circles.push(new Circle(width / 2 + 120, height / 2 - 0, circleRadius));
circles.push(new Circle(width / 2 + 180, height / 2 + 180, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 + 120, circleRadius));
circles.push(new Circle(width / 2 - 180, height / 2 + 180, circleRadius));
circles.push(new Circle(width / 2 - 120, height / 2 - 0, circleRadius));
circles.push(new Circle(width / 2 - 220, height / 2 - 120, circleRadius));

你为什么不试着使用一个与你需要的形状相同的背景图像,这将帮助你获得完全符合你需要的形状

对于多边形,如您所说,尝试使用这些坐标,这将为您提供更好的形状

circles.push(new Circle(width / 2 - 60, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 - 250, circleRadius));
circles.push(new Circle(width / 2 + 60, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 + 260, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 + 100, height / 2 + 60, circleRadius));
circles.push(new Circle(width / 2 + 160, height / 2 + 250, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 + 130, circleRadius));
circles.push(new Circle(width / 2 - 160, height / 2 + 250, circleRadius));
circles.push(new Circle(width / 2 - 100, height / 2 + 60, circleRadius));
circles.push(new Circle(width / 2 - 260, height / 2 - 60, circleRadius));

你为什么不试着使用一个与你需要的形状相同的背景图像,这将帮助你获得完全符合你需要的形状

对于多边形,如您所说,尝试使用这些坐标,这将为您提供更好的形状

circles.push(new Circle(width / 2 - 60, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 - 250, circleRadius));
circles.push(new Circle(width / 2 + 60, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 + 260, height / 2 - 60, circleRadius));
circles.push(new Circle(width / 2 + 100, height / 2 + 60, circleRadius));
circles.push(new Circle(width / 2 + 160, height / 2 + 250, circleRadius));
circles.push(new Circle(width / 2 - 0, height / 2 + 130, circleRadius));
circles.push(new Circle(width / 2 - 160, height / 2 + 250, circleRadius));
circles.push(new Circle(width / 2 - 100, height / 2 + 60, circleRadius));
circles.push(new Circle(width / 2 - 260, height / 2 - 60, circleRadius));