
8 Oct
2007
8 Oct
'07
9:41 p.m.
Fernando Cacciola wrote:
But using basic algebra that becomes:
convex += ( cross_product((b-a),(c-a)) > 0 ) ; [...]
But we don't want to perpetuate this blasfemy here in boost :) So, the correct "orientation test" is to use the determinant of a matrix formed with those two vectors (which works in 3D too). So I shoud have wrote that as:
( determinant((b-a),(c-a)) > 0 )
The following line (admittedly is rectinilear specific) concave += (a.towards(b).left() == b.towards(c)); translates into just a handful of assembly instructions. We did use cross product in the past but it couldn't compete on runtime Gyuszi