Sign in to follow this  

Calculating a vertex along a line of known length

This topic is 3867 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

Hopefully this should be a simple problem to solve! I have two verticies v1 & v2 which define a 3D line (a line-of-sight). I want the length of the line be constant; so when (for example) the vertex v1 changes, I want to adjust v2 so that the lines length is back to its default value. I can think of a couple of ways of doing this (using the delta value of the line-slope to move the a vertex along it`s length, etc), but this seems very in-elegant, and I`m sure that there is a much better (& simpler!) way of achieving this. I`m sure that I`ll be kicking myself when someone points out the solution, (and folly!), but hey, what are forums for, eh?! Thanks in advance, BenE.

Share this post


Link to post
Share on other sites
Just update v2 by the same quantity you update v1 by.

if v2-v1 = R then (v2+A)-(v1+A)=v2-v1+A-A=v2-v1=R

So:
v1 += some_vector;
v2 += some_vector;

Share this post


Link to post
Share on other sites

This topic is 3867 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this