Move two points by their respective directional vectors to a fixed offset distance from a line?

The goal is to get the points, p1’ and p2’ (green), from the initial points, p1 and p2 and their respective directional vectors, v1 and v2, which are unit vectors.

Multiplying v1 and v2 by the offset distance d won’t work (cf. example). The distance d is measured perpendicular to the line l. Both vectors are not perpendicular to l, which means that there magnitude must be bigger or smaller than d, depending on their angles to the line l!

Above you can see the scaled vector v1’ with a magnitude of d. It doesn’t reach p1’!

OK I understand yes line l` is not the same length as line l and/or it is offset longitudinally as well as laterally?

The line length of line l and l’ shouldn’t be relevant here, but yes, both lines have only the same size if both vectors v1 and v2 are perpendicular to line l and thus l’!
Line l’ is the line between the points p1’ and p2’, which I want to find in the first place.

So the distance is 1/ cosine of the angle between the line marked d and the vector v1 / v2 ?

1 Like

No, unfortunately that doesn’t seem to work either.

Here’s the file with your proposition: (17.3 KB)

@Dancergraham, thanks for the suggestions so far!

1 Like

Should be easy - but I can’t quite figure it out !!!

Don’t worry! Maybe somebody else can propose a solution? (9.7 KB)
This is just a small concept…

Waiting until the seventh post in this thread before sharing your code/geometry is a very poor way to ask a question here: (12.2 KB)

Hey dude, you are a prime example of why this forum needs an ignore function. Bye-bye.

This forum heavily relies on other peoples good will. Even if Joseph hasn’t been asked you should appreciate his effort.

This one is a way using Right Trigonometry, but not as simple as you might think…

Offset through Vector (15.0 KB)


I absolutely agree!

I would have appreciated @Joseph_Oster’s input, as I did @maje90’s suggestion, even though it also is what I specifically didn’t ask for, if he hadn’t started by throwing around false accusations that instantly debunked him as a hater (at least of this discussion).
And after my reply, calling out for censorship in the forum and simply manifesting that he now ignores me, seems like another piss-poor, childish approach. Be a man and face your mistakes!

Thanks @HS_KIm, I’m going to check it out. Looks promising! :slight_smile:

@HS_Kim, the offset line doesn’t seems to be parallel to the initial line. Do you think this might be possible too with your method?

I didn’t check it much but you can compare the results with regular Offset.

It seems it won’t work in some cases. I’ll look into it.

1 Like

@HS_Kim, thanks. :slight_smile:
It seems like there is also something wrong with the offset distance. You can see it by comparing both lines (same distance):

If I understand the question correctly, you are looking for the scalar multiplier for each vector which takes that end point to a line at some distance d from, and parallel to, your original line l
You can use dot product to get the length of the projection of one vector onto one perpendicular to l, then divide by this, like so: (12.6 KB)

I think this kind of thing is covered in Rajaa’s guide:


@DanielPiker seems to have already offered a better solution, but check this if it helps. Better one but not perfect.

Offset through Vector (14.6 KB)

1 Like

Thanks for your solution, @HS_Kim! Much appreciated! :slight_smile:

@DanielPiker, thank you for great link!