- Home /
How do I extrapolate a path point?
Hi :)
I have a 2D path made up of three points B, C and D. I would like to extrapolate the position of A. The angle on the path at point B must equal to angle at point C and the distance between C and B must be the same as the distance between B and A.
I can work it out using trigonometry in specific situations but when I give my function arbitrary point I get all sorts of anomalies. I can't figure out a solution that works 100% of the time.
Is their an elegant solution for this type of problem? Yes I've tried google but I haven't found anything helpful.
Thanks for reading :)
I had to write something similar. $$anonymous$$y solution was to first calculate 'A' as if it was a straight projection from 'C' to 'B'. Then I constructed a Quaternion using AngleAxis() with the axis through 'B' and multiplied it by the vector from 'B' to 'A'.
Answer by Owen-Reynolds · Feb 10, 2013 at 04:39 AM
For the angle, Vector3.Angle is directionless -- could be left or right (or up.) So, as Robertbu mentions, quaternions are the way to go.(not tested):
Quaternion DCBbend = Quaternion.FromToRotation(C-D, B-C);
Vector3 BAseg = DBCbend * (B-C);
Vector3 A = B+BAseg;
Your answer
![](https://koobas.hobune.stream/wayback/20220613092431im_/https://answers.unity.com/themes/thub/images/avi.jpg)