To calculate a point at a distance perpendicular to a vector offset
First the point on the vector at the required offset needs to be calculated. This easy to do:
The vector to move the point P’ on is perpendicular to . This vector can be calculated using a 90 degree rotation matrix:
The matrix shows in the the first row and the second row shows
You can safely ignore the stuff above if you are only interested in getting the job done. The final formula is:
We will call the vector () vector .
Vector needs to be normalized (divided by it’s length / magnitude).
The resulting formula becomes:
A positive distance will get the point above the vector, a negative below the vector.