I have two points that form 1 line. I want to find a point that creates a perpendicular line.
How do I find the red point to form a perpendicular line?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
when a given line with certain equation is give. it has slope of m. so the line that is perpendicular to it has slope of -1/m
check this link: https://www.mathsisfun.com/algebra/line-parallel-perpendicular.html
you have one point and find out the wanted slope so you can build equation of new line
There is not a specific answer to this question as stated. (Assuming that this is in 3d space, as the coordinates list three values.) Technically, there are infinite perpendicular lines rotated around the black line.
If you have a third point, you can use the Cross Product to get a perpendicular vector, like:
i = B - A; j = C - A; p = (i.y * j.z - i.z * j.y, i.z * j.x - i.x * j.y, i.x * j.y - i.y * j.x); N = A + p;
Where A, B, and C are the points, and i and j are vectors representing their relationship. The vector p will point in the direction perpendicular to the three points and N will be the point relative to the original, as in the picture.
Given that in your question the y coordinate is 0 for both points, it seems you may be interested in an answer in 2d space. In 2d space, there are two possible answers. Given two points A and B:
v = B - A; p0 = (v.y, -v.x); p1 = (-v.y, v.x);
You can find more info in this answer
For the coordinates you specified, this would work if you ignore the y coordinate and use z in its place.
There is one LINE that solves this problem if this is a 2D question (supported because the known points in the image have '0's for y-coordinates, so your line will be entirely in XZ-plane). However, as a line is a set of infinitely many points, any point that is on the solution line will be a solution point.
You need a line through (-1.75, 0, -2.32), perpendicular to a line through (-1.75, 0, -2.32) and (0,0,0).
Considering only X and Z coordinates, slope of known line is the difference in Z-coordinates divided by difference in X-coordinates: m = (0-(-2.32))/(0-(-1.75)) = 232/175.
The perpendocular slope is
m_perp = -1/m = -175/232.
To get the slope of the line ne in the XZ-plane perpendicular to this one, through (-1.75, 0, -2.32), use the perpendicular slope and the XZ coordinates of that point in the point-slope equation:
Z-Z0 = m_perp(X-X0) Z - (-2.32) = (-175/232)*(X - (-1.75)).
Solve for Z:
Z = -175X/232 - (175^2)/232 + 2.32
(I'm on a phone and don't want to break that down rn)
Now, ANY X coordinate you plug into this will return a valid Z coordinate, giving you a point (X,Z) on the line.