Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / How do I divide a segment into equal parts in cartesian space?

Author
Message
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 25th Jan 2005 04:07
I have the coordinates of two points, which can be considered the extremes of a segment. What formula can I use to divide this segment into X equal parts (X is decided at will) and get the coordinates of their ends?
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jan 2005 11:07
cartestian is just your normal 3d space, so nothing special there.

Make vectors from the 2 points. (A and B)

//make a vector from A and B
R = B - A

//multiply vector by the scalar T
//T is in [0,1]
//S is a vector
S = R*t

Just interpolate along T to get a new segment.


"eureka" - Archimedes
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 28th Jan 2005 21:03
*cough* Forum check

Avatar - white cat in a snowstorm. Look closely.

Login to post a reply

Server time is: 2025-05-24 03:32:52
Your offset time is: 2025-05-24 03:32:52