简体   繁体   中英

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).

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.

But I need to avoid the red zone, I don't want to draw circles at 360°

Example below:

在此处输入图片说明

Let p be the center of the small circle, c the center of the main circle. 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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM