Archived

This topic is now archived and is closed to further replies.

parrallel vector lines (how to get!)

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

hi, I just read the other post on this forum "Line Vector Routine" which has solved 50% of my problem before someone accuses me of not doing any research (I did read other stuff as well), like last time Anyway, I know the equation r=u+tv is the equation for a vector line. BUT what is the equation for a line parallel to this? My problem is this. I have a line segment defined as pA->pB (2D points) and I need to create lines on BOTH sides of this at a given distance (so that I get a column/tube/rectangle appearing. All I know is the two points of the center line, and the distance at which the other two lines should be.... Can Anyone help? I was trying to use perpendicular vector lines and trig earlier, but I got in a right muddle with that :o (as in, it didn''t work, not as in I dont know how to do that)... Many thanks in advance. Jack;

Share this post


Link to post
Share on other sites
There is a quick-and-dirty way to create parallel lines. You can create a line parallel to the given line by just adding a constant vector to the original line. For example, if your original line is:

r = u + t*v

then

r2 = u + t*v + offset

where offset is a constant vector such as (0,0,1).

The tricky part is exactly what do you set offset to? If you want your two offset lines to be the parallel edges of an arbitrary rectangle/tube/column then the offset vector must be perpendicular to v.

So the trick in your case is to find the perpendicular vector...which is what you were in a muddle with, . Once you fix that, you should be in good shape.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
As grhodes writes you just need to add a perpendicular vector. To calculate this do the following.

Work out a normal vector parallel to the line. This may be vector v if it is a unit vector. If not normalise it, by dividing by it''s length/magnitude, to get a unit vector.

Then rotate this through a quarter turn like this: if the unit vector is (a, b) then a vector perpendicular to it in 2D is (-b, a). Draw it on graph paper to see why this works.

Multiply/scale this by your distance to get a new vector, with the correct length and at right angles to the original direction. Add this to u to get the starting point of one of the lines.

To get the line on the other side do the same but instead of (-b, a) use (b, -a). Or add and subtract the vector from u to get the starting points of the two lines.

Share this post


Link to post
Share on other sites
thanks people, much appreciated... johnb - that''s what I started off trying todo :o make a perpendicular vector, but I forgot it was that easy... darn! so now I got that sorted then it''ll be okay! cheers...

Jack;

Share this post


Link to post
Share on other sites
quote:
Original post by johnb
As grhodes writes you just need to add a perpendicular vector. To calculate this do the following.



You don''t need to add a perpendicular vector; you can add any vector to get a parallel line.

Keep in mind that two lines are parallel if they move in the same direction. Any line of the form:

r = u + tv

is moving in direction v. So if I have

r'' = u'' + tv

it also moves in direction v and so r and r'' are parallel, no matter what u'' is. If:

u'' = u + x

x can be anything; it need not be parallel.

HOWEVER, what you might gain from keeping x perpendicular to v is that all points on those lines where t=0 will start in the same plane. If that''s important to you, keep x perpendicular.

---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!

Share this post


Link to post
Share on other sites