I have a triangle ABC inscribed in a circle. Point B is located in the centre of the circle, A and C are two points on the circle.

Given
Given AB (length)
Given coords of A and B
Given angle B (angle ABC)
Needed
Find coords of C
What I know
AB = BC, both are radius’s
What I am using this for
I am making a basic 3D java game, for android. This will be used for looking left and right, so if you click on the right part of the screen the objects will move around you by adding one degree to angle B.
The code I tried for finding coords of C
rect.get(index)[5] = (int) ((di * Math.cos(Math.toRadians(angle-90)))+.5);
rect.get(index)[6] = (int) ((di * Math.sin(Math.toRadians(angle-90)))+.5);
rect.get(index)[5] = shapes x coord
rect.get(index)[6] = shapes y coord
di = radius length
angle = angle B
and I added the .5 so that when the coord is truncated it is rounded.
My complete code
double di = distance(playerx, playery, rect.get(index)[5], rect.get(index)[6]);
double side1 = di;
System.out.println("Side1: "+ side1);
double side2 = side1;
System.out.println("Side2: "+ side2);
double side3 = distance(rect.get(index)[5], rect.get(index)[6], playerx, playery+di);
System.out.println("Side3: "+ side3);
double angle = ((side1*side1)+(side2*side2)-(side3*side3));
angle = angle/(2*side1*side2);
angle = Math.acos(angle)*(180/Math.PI);
System.out.println("Angle: "+angle);
if(playerx > rect.get(index)[5]){
if(lookdirection.equals("left")){
angle += 5;
}
if(lookdirection.equals("right")){
angle -= 5;
}
}
else{
if(lookdirection.equals("left")){
angle -= 5;
}
if(lookdirection.equals("right")){
angle += 5;
}
}
System.out.println("Angle: "+angle);
rect.get(index)[5] = -(di * Math.cos(Math.toRadians(angle-90)));
rect.get(index)[6] = -(di * Math.sin(Math.toRadians(angle-90)));
di = distance(playerx, playery, rect.get(index)[5], rect.get(index)[6]);
side1 = di;
System.out.println("Side1: "+ side1);
side2 = side1;
System.out.println("Side2: "+ side2);
side3 = distance(rect.get(index)[5], rect.get(index)[6], playerx, playery+di);
System.out.println("Side3: "+ side3);
angle = ((side1*side1)+(side2*side2)-(side3*side3));
angle = angle/(2*side1*side2);
angle = Math.acos(angle)*(180/Math.PI);
System.out.println("Angle: "+angle);
repaint();
}
The angles are now working but the X and Y coords
but
rect.get(index)[5] = -(di * Math.cos(Math.toRadians(angle-90)));
rect.get(index)[6] = -(di * Math.sin(Math.toRadians(angle-90)));
are getting very large/ small values. They should stay ‘di’ distance away from point B.
UPDATED
It seems that this is a geometry problem!
I haven’t tested your code but I guess what you want is not
but
Try to visualise what you are doing and check the identities under symmetry, shifts, and periodicity here. The image is turning and reflecting along the x axis with what you are doing now. You have to take care of rounding issues as well. If coordinates are close to 0 the image might not move.
My suggestion is to keep your coordinates as doubles and only round them when you are going to render them into a pixel without overwriting their value