• Advertisement
Sign in to follow this  

Line troubles..

This topic is 4494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I need to make a line algorithm that will chew a line down, or make it shorter on both ends in 3D. I was thinking about having a normal that points from point x to point y and from there I could move it along that normal but I have no idea how to get it. Could I multiply the 2 vectors then normalize the result? Am I even on the right track?

Share this post


Link to post
Share on other sites
Advertisement
To find a point along a line you can use Lerp (See: Vector3.Lerp()/D3DXVec3Lerp). For your problem just call it twice with the ends of your lines as the two vector params and two different interpolater values to get two new points for a shorter line. To cut 10% of each end use values like 0.1 and 0.9.

Hope this helps.

Share this post


Link to post
Share on other sites
It does help, exactly what I was looking for. Thanks man.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement