简体   繁体   中英

How to create a circle out of smaller circles in libgdx?

I am creating a ring that will spin made out of circles and I don't want to have to manually place each circle and then spin them all at once. Isn't there some mathematical way to create this circle? Each circle is an object.

It would look like this: http://imgur.com/zgoM2dT

Not sure if I understood it correct,but propably you want something like this

int numOfCircles=40;
float rad=10;
List<Point> points=new ArrayList<Point>();
for(float a=0;a<360;a+=(360/numOfCircles)){
    points.add(new Point(Math.cos((a) * 0.0174532925f) * rad), Math.sin((a) * 0.0174532925f) * rad));
}

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