I've been stuck on this one for a while. If you scroll down to the while loop there is some code that calculates the angle of a triangle created by two circles colliding. The problem is, The angle between the hypotenuse / x axis, and the angel between the hypotenuse / y axis never go above 65 degrees and i have no clue why, please help!

import java.awt.Color; import java.awt.Graphics; import java.util.Random; import javax.swing.JComponent; import javax.swing.JFrame; public class MainTest extends JFrame { public rectt g = new rectt(); public static void main( String[] args ) throws InterruptedException { MainTest t = new MainTest(); int particles = 2; int radius =100; Random number = new Random(); t.setSize( 1800, 1000 ); t.setVisible( true ); t.getContentPane().add( t.g ); t.setDefaultCloseOperation(EXIT_ON_CLOSE); int xVelocity[] = new int[particles+1]; int yVelocity[] = new int[particles+1]; int mass[] = new int[particles+1]; for(int z=1;z<particles+1;z++){ xVelocity[z]= (20-number.nextInt(40)); yVelocity[z]= (20-number.nextInt(40)); mass[z]=5; } while ( true ) { for(int z=1;z<particles+1;z++){ if (t.g.x[z] <=0 + radius/2|| t.g.x[z]>=1600-radius/2){ xVelocity[z] = xVelocity[z]*-1; } if (t.g.y[z] <=0 || t.g.y[z]>=900){ yVelocity[z] = yVelocity[z]*-1; } if (t.g.y[z]>=900){ yVelocity[z]= yVelocity[z]-1; } for (int c=1;c<particles+1;c++){ String temp1 = Integer.toString(t.g.x[c]); String temp2 = Integer.toString(t.g.x[z]); String temp3 = Integer.toString(t.g.y[c]); String temp4 = Integer.toString(t.g.y[z]); Double temp11 = Double.parseDouble(temp1); Double temp22 = Double.parseDouble(temp2); Double temp33 = Double.parseDouble(temp3); Double temp44 = Double.parseDouble(temp4); if (Math.sqrt(Math.pow(temp11-temp22,2)+Math.pow(temp33-temp44,2))<radius && Math.sqrt(Math.pow(temp11-temp22,2)+Math.pow(temp33-temp44,2)) !=0 && (temp11-temp22) !=0 && (temp33-temp44) !=0){ double hypotenuse = Math.sqrt(Math.pow(temp11-temp22,2)+Math.pow(temp33-temp44,2)); double x = (temp11-temp22); double y = (temp33-temp44); double hypx = Math.asin(((Math.sin(90)/hypotenuse)*y)); //double hypx = Math.acos((Math.pow(hypotenuse,2)-Math.pow(x,2)-Math.pow(y,2))/-2*x*y); double hypy = Math.asin(((Math.sin(90))/hypotenuse)*x); //System.out.println(Math.abs(Math.toDegrees(hypx))+90+Math.abs(Math.toDegrees(hypy))); System.out.println(Math.toDegrees(hypx)); try { Thread.sleep(100); } catch ( InterruptedException e ) { } } } yVelocity[z]= yVelocity[z]+1; t.g.x[z] = t.g.x[z] + xVelocity[z]; t.g.y[z] = t.g.y[z] + yVelocity[z]; t.repaint(); } try { Thread.sleep( 10); } catch ( InterruptedException e ) { } } } public void paintComponent( Graphics g ) { //g.clearRect( 0, 0, 0, 0 ); } } class rectt extends JComponent { public static final long serialVersionUID = 1L; public int particles =2; public int radius =100; public int x[] = new int[particles+1]; public int y[] = new int[particles+1]; public int width[] = new int[particles+1]; public int height[] = new int[particles+1]; int done=0; public void paintComponent( Graphics g ) { g.setColor( Color.black ); if (done==0){ for(int z=1;z<particles+1;z++){ x[z]=800; y[z]=500; width[z]=radius; height[z]=radius; done=1; } } for(int z=1;z<particles+1;z++){ g.fillOval(x[z]-radius/2, y[z]-radius/2, width[z], height[z]);; g.drawLine(1600, 0, 1600, 1000); g.drawLine(x[z], y[z], x[z-1], y[z-1]); } } }