FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   math problem - 3d slope?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: math problem - 3d slope?  (Read 464 times)
Ethan

thanton3 WWW
math problem - 3d slope?
« on: Nov 18th, 2004, 11:47pm »

How do you express a slope in 3d? In 2d it's y2-y1/x2-x1, right?
 
But let me describe the actual problem I have:  
Basically I need a function that takes four arguments:
- a distance to travel
the trajectory expressed as:
- change in x
- change in y
- change in z
 
I would like the function to give me back the change in x, y and z that would be required to move the given distance along the given trajectory....
 
Does that make sense? I'm sure it's possible, I just can't figure out how to actually code it.
 
Many thanks...
 
Ethan

thanton3 WWW
Re: math problem - 3d slope?
« Reply #1 on: Nov 20th, 2004, 1:06am »

Haven't quite figured it out.  
 
For the benefit of anyone else wondering about this kind of stuff:  
I think it's a question of understanding vectors. Here's a tutorial in the basics: http://chortle.ccsu.edu/VectorLessons/vectorIndex.html
 
bsr

WWW Email
Re: math problem - 3d slope?
« Reply #2 on: Nov 20th, 2004, 1:44am »

that's a fantastic resource, thanks for the link.
 

http://hippocamp.net
Ethan

thanton3 WWW
Re: math problem - 3d slope?
« Reply #3 on: Nov 20th, 2004, 11:56pm »

Sure.. n/p (hippocamp.net is a great site as well)
 
 
I finally got it.  
What I was calling a 'trajectory' should be a normalized vector: http://chortle.ccsu.edu/VectorLessons/vch06/vch06_10.html
That's a vector that's scaled so that it's length = 1. Then I just need to multiply the distance I want to travel, by each coord of my normalized vector... and that's it.
 
hope my little monologue helps a few ppl
« Last Edit: Nov 21st, 2004, 12:02am by Ethan »  
Pages: 1 

« Previous topic | Next topic »