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=3-3t
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.
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.
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:
x = 1 + 5t y = 2 + 2t z = 3 - 3t
and yank out the coefficients of t, and put them in a vector:
vector = (5, 2, -3)
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.