apparently it''s not as simple as i thought, I''ve had alot of trouble finding a formula, and was surprised to find no reference to it even in this forum.
How do you find the slope of a 3D line?
Started by AbsolutDew, Mar 05 2002 08:44 AM
4 replies to this topic
Sponsor:
#2 Members  Reputation: 169
Posted 05 March 2002  08:48 AM
Assuming the line is made up of (x, y, z), and y is up, we need to take the offset along the xz plane and divide it into the vertical offset, y.
so if you have two points, p1 and p2,
offset along xz plane: sqrt((p2z  p1z)^2 + (p2x  p1x)^2)
slope = (p2y  p1y) / offset
Is that right? Anyone? I don't want to send anyone off a cliff here...
 Waverider
Edited by  Waverider on March 5, 2002 3:49:42 PM
so if you have two points, p1 and p2,
offset along xz plane: sqrt((p2z  p1z)^2 + (p2x  p1x)^2)
slope = (p2y  p1y) / offset
Is that right? Anyone? I don't want to send anyone off a cliff here...
 Waverider
Edited by  Waverider on March 5, 2002 3:49:42 PM
#3 Anonymous Poster_Anonymous Poster_* Guests  Reputation:
Posted 05 March 2002  08:56 AM
AFAIK there isn''t really any such thing as "slope" for a 3d line. I guess there is in the sense that there is a deltax, deltay, deltaz, but in 2d the slope would be m=deltay/deltax. Again, AFAIK there isn''t any formula that combines them. I guess you could say that your slope is the vector <deltax,deltay,deltaz>, but thats about it. You pull the deltax, deltay, deltaz out of the parametric form of your equation, for instance:
x=1+5t
y=2+2t
z=33t
the start point would be (1,2,3) (that is, the constant numbers in the equations). the direction vector, or "slope", would be <5,2,3> (the coefficients of t). If you don''t know this stuff, i suggest you pick up a good math book, actually calc books generally have these basics, but others (geom?) may have more in depth basic stuff.
x=1+5t
y=2+2t
z=33t
the start point would be (1,2,3) (that is, the constant numbers in the equations). the direction vector, or "slope", would be <5,2,3> (the coefficients of t). If you don''t know this stuff, i suggest you pick up a good math book, actually calc books generally have these basics, but others (geom?) may have more in depth basic stuff.
#4 Moderators  Reputation: 1411
Posted 05 March 2002  09:01 AM
IIRC the slope of a line is the first order derivative of it''s formula. Offhand looking at AP''s post the only correction I would make is changing the sign of the z coefficient. But it''s been a while since I''ve done any 3d calculus.
#5 Moderators  Reputation: 1361
Posted 05 March 2002  09:05 AM
AP has it right. The term "slope" is really a 2D term. If you''re talking about, say, a 3D terrain, then you can say that you have two different slopes, one in the x direction and one in the y direction, with the slopes being dz/dx and dz/dy. (This assuming the terrain is laid out in the xy plane with height as z.
The parameteric equations based on "t" for which AP gives examples are in my opinion the right way to represent 3D lines. If you take those 3 equations:
and yank out the coefficients of t, and put them in a vector:
then that vector points in the direction of the line. The offset coefficients just represent a coordinate on the line when t = 0. So its really analogous to the 2D "slope" except that you''re using this parameter value t instead of a coordinate x in the equation.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
The parameteric equations based on "t" for which AP gives examples are in my opinion the right way to represent 3D lines. If you take those 3 equations:

and yank out the coefficients of t, and put them in a vector:

then that vector points in the direction of the line. The offset coefficients just represent a coordinate on the line when t = 0. So its really analogous to the 2D "slope" except that you''re using this parameter value t instead of a coordinate x in the equation.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.