Calculating a vertex along a line of known length

Started by
0 comments, last by erissian 16 years, 11 months ago
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.
Advertisement
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;
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)

This topic is closed to new replies.

Advertisement