SyntaxFix
Write A Post
Hire A Developer
Questions
If we define dx = x2 - x1 and dy = y2 - y1, then the normals are (-dy, dx) and (dy, -dx).
dx = x2 - x1
dy = y2 - y1
(-dy, dx)
(dy, -dx)
Note that no division is required, and so you're not risking dividing by zero.