Hi
I have a program where you drag and drop circles on a scene using JavaFX. I don't want circles to collide to each other so I added a collision algorithm to check that, which now works. What puzzles me is what I want to do afterwards.
If two circles overlap I want to make a vector between the middle of the two and transform the moved circle in the direction of the vector until they no longer overlap.
            for (Stone stn:getCurrentScenario().getStones()) {
                if (stn.circle == circle) continue;
                double x1 = stn.circle.getTranslateX();
                double y1 = stn.circle.getTranslateY();
                double r1 = stn.circle.getRadius()+stn.circle.getStrokeWidth();
                double x2 = circle.getTranslateX();
                double y2 = circle.getTranslateY();
                double r2 = circle.getRadius();
                double distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
                double radSumSq = (r1 + r2) * (r1 + r2);
                if (!(distSq != radSumSq && distSq > radSumSq)) {
                    System.out.println("Collision.");
                    // Transform "circle".
                }
            }


