How do you find the slope of a 3D line?
Started by Mar 05 2002 08:44 AM
,
4 replies to this topic
#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.
#5 Members  Reputation: 1377
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.