# Math stumper

• 11-07-2005
durban
Math stumper
Here's a little math problem for yall. I need to find out how to get a perpenticular line from a given line in 3D Space. So for example: (2x, 0y, 4z) --- (4x, 0y, 4z)...how would you find the line perpendicular to that one at either of those points? What if the line was diagonal? (2x, 0y, 4z) --- (8x, 2y, 3z)?
• 11-07-2005
SlyMaelstrom
I'm not sure how you would get a 3D perpendicular. Would that be a line that somehow creates right angles to the other line from every possible direction from the intersection?

Think of a three demensional plane. Are you considering the X and Y axis to be perpendicular or the Y and Z axis?
• 11-07-2005
SlyMaelstrom
I guess I would say, do it the same way you do a two demensional line. Get the slopes of the three dimensional line and get the negetive reciprocals.

Edit: Here is some interesting stuff I found.
http://mathforum.org/library/drmath/view/53036.html
• 11-07-2005
durban
Ok, think of this... | = plane --> = plane normal X = Position I need to find

|X
|
|------->
|
|X

How would I find X from the plane normal if the normal is thought to be in the direct center of the plane. For this example, adding or subtracting from the y value would be the answer, but what if the plane is diagonal? You would have to add/subtract from x, y, & z to get a correct perpenticular point.
• 11-07-2005
Barnzey
I can tell you how to check if 2 lines are perpendicular:

If line 1 is a, and line 2 is b then to check you need to know the eqn:

a.b =|a||b|cos(theta)

where theta is the angle between them, but if they are perpendicular then theta = 0, so basically a.b = 0 where a.b is the scalar product.
• 11-07-2005
Thantos
At a given point in 3 Space there are infintely many perpendicular lines. So the question becomes which one do you want?

If you just want any perpendicular line then you can use vectors to get one. Just take the vector between your two points [ex: (2x, 0y, 4z) --- (4x, 0y, 4z) gives the vector (2, 0, 0)] and cross it with any other vector [lets go with (1,0,0)]. That'll give you a vector that is orthogonal to both vectors. From that you can derive the equation of the line.

Quote:

Ok, think of this... | = plane --> = plane normal X = Position I need to find

|X
|
|------->
|
|X

How would I find X from the plane normal if the normal is thought to be in the direct center of the plane. For this example, adding or subtracting from the y value would be the answer, but what if the plane is diagonal? You would have to add/subtract from x, y, & z to get a correct perpenticular point.
Ok so we know that Ax + By + Cz + D = 0 is the standard equation for a plane. Given that we know that the vector (A, B, C) is the normal vector for the plane.

However your picture makes little sense when applied to an actual plane since there are infinatly many directions you can go from any point on that plane. So the questioin would be which direction do you want to go?

Of assistance might be the distance formula:
d = sqrt ( x^2 + y^2 + z^2 )
• 11-07-2005
durban
```Vec3 start = (0.0, 0.0, 0.0); end = (5.0, 4.0, 5.0); Vec3 DirUp; if( end >=start )     DirUp = end-start; else     DirUp = start-end; Vec3 theCross = (1.0, 0.0, 0.0);  // Would this always work??? Vec3 Axis1 = CrossProduct(DirUp, theCross);  // Perpendicular to DirUp and theCross..great```