Calculating the 2D edge normals of a triangle

Posted by Kazade on Game Development See other posts from Game Development or by Kazade
Published on 2012-04-07T08:40:33Z Indexed on 2012/04/07 17:49 UTC
Read the original article Hit count: 294

Filed under:
|
|

What's a reliable way to calculate a 2D normal vector for each edge of a triangle, so that each normal is pointing outwards from the triangle?

To clarify, given any triangle - for each edge (e.g p2-p1), I need to calculate a 2D normal vector pointing away from the triangle at right angles to the edge (for simplicity we can assume that the points are being specified in an anti-clockwise direction).

I've coded a couple of hacky attempts, but I'm sure I'm overlooking some simple method and Google isn't being that helpful today - that and I haven't had my daily caffeine yet!

© Game Development or respective owner

Related posts about 2d

Related posts about vector