# Finding points parallel to a line

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

## Recommended Posts

Say I have a bunch of lines which can be at any angle, how would I plot a parallel line with say 5 pixels distance to that line? (its for tracing the outline of a font to a smaller version) Best regards, Bas

##### Share on other sites
(I assume you mean 2D lines.)

Given a line defined by a point P and a direction vector D:

Find the normal of the line (a vector perpendicular to the line's direction) and normalize it:

  N = (-D.y, D.x) / length(D)

Now your new line's direction is of course also D, as the lines are parallel, and the point you get by shifting P along the normal:
  D' = D  P' = P + x * N

where x is the distance you want between the lines. If P and D are given in pixels, then x=5 means the new line will be 5 pixels away.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 13
• 46