java - Place elements in a spiral path without overlapping -


this similar question dont have enough rep comment on it, javafx position elements around central point except not know how modify create spiral path ends this.

the example shows fixed radius objects rotating around point need objects not rotate.

this code example have tried modify needs not work well. objects dynmaic in size purpose of hardcoded.

public void start(stage primarystage) {     pane pane = new pane();      double centerx = 300 ;     double centery = 300 ;     double earthradius = 30 ;     double moonradius = 30 ;      circle earth = new circle(centerx, centery, earthradius, color.web("blue", 0.5));     pane.getchildren().add(earth);      int nummoons = 3 ;     double gap = 10 ;     double distance = 100 ;     double angleincrement = 2 * math.asin((2 * moonradius + gap) / (2  * distance) );      (int = 0 ; < nummoons; i++) {          double angle = math.todegrees(angleincrement * i) ;          rectangle object = new rectangle (centerx + distance, centery, moonradius, color.web("blue", 0.5));         rotate rotate = new rotate(angle, centerx, centery);         moon.gettransforms().add(rotate);         pane.getchildren().add(moon);     }      circle orbit = new circle(centerx, centery, distance +20, color.transparent);     orbit.setstroke(color.black);     pane.getchildren().add(orbit);      scene scene = new scene(pane, 600, 600);     primarystage.setscene(scene);     primarystage.show(); } 

is wrong way go it? need use arcto?http://download.java.net/jdk8/jfxdocs/javafx/scene/shape/arcto.html if how create spiral , not circle. thanks


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -