SFML community forums
Help => General => Topic started by: aaranaf on August 03, 2013, 01:23:52 am
-
So here's what I want to do. I want to find the point in 2d-space for C.
I have the point A and B and the distance from B to C.
I know C is perpendicular to B. If someone could point me in the right direction on this it would be greatly appreciated.
(http://imageshack.us/a/img849/6741/0lpj.png)
-
Go to google and put in "find point perpendicular to line"
-
We need to know the data you have recorded inorder to know the data we need to find.
-
(direction from A to B)
V = B - A
V' = normalize(V)
(vector orthogonal to V' - perpendicular)
O = (-V'y, V'x)
(finally find point C by going from B in the orthogonal direction)
C = B + O * distance
I am a little fuzzy right now but if something is wrong here ill get back to you
-
May I add that knowing the distance and that it's perpendicular gives your two points, one for each side.
for a vector defined by (a,b) an orthogonal vector would be (-b, a) (so I do agree with Grimshaw, just to say it a bit differently)