Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Hello i have two points (Vector3) A and B. And have a radius r

enter image description here

How can i find a coords of point P in a circle by angle?

share|improve this question
    
add point you need to find and angle to picture –  nikoliazekter Jul 13 at 11:32
    
done. New point P on the picture with angle=130 –  GLeBaTi Jul 13 at 11:46

1 Answer 1

up vote 2 down vote accepted

Solution for 2D vectors:

Vector2 AB = B - A;  // Vector from A to B

Vector2 A0 = r * AB.normalized;  // Vector from A to 0°
Vector2 A90 = new Vector2(A0.y, -A0.x);  // Vector from A to 90°

Vector2 P = A + Sin(alpha) * A90 + Cos(alpha) * A0;  // Coordinate of arbitrary point on a circle

For arbitrary 3D vectors A and B in 3D space you need coordinates of at least one more point on the same plane (but not located on the A-B line).

share|improve this answer
    
Thank you very much! –  GLeBaTi Jul 13 at 14:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.