[英]Draw circles around main circle in JavaScript with draw2d
In my application, I can draw circles with draw2d.js I'd like to know how I can draw circles around a main circle (here is lightblue). 在我的应用程序中,我可以使用draw2d.js绘制圆,我想知道如何围绕主圆(这里是淡蓝色)绘制圆。
I'd like to make it dynamically, because I could have more than 200 circles, so I need to calculate coords compared to the main circle. 我想动态制作它,因为我可以有200多个圆,因此我需要计算与主圆相比的坐标。
But I need to avoid the red zone, I don't want to draw circles at 360° 但是我需要避开红色区域,我不想在360°上画圆
Example below: 下面的例子:
Let p be the center of the small circle, c the center of the main circle. 设p为小圆圈的中心,c为主圆圈的中心。 Then a possible solution could look like
然后可能的解决方案看起来像
p.x = c.x + R * Cos(Fi)
p.y = c.y + R * Sin(Fi)
Here R is distance, Fi is angle in allowed interval (for example -3*Pi/4..3*Pi/4
) 这里R是距离,Fi是允许间隔中的角度(例如
-3*Pi/4..3*Pi/4
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.