Boost logo

Boost :

From: Suto, Gyuszi (gyuszi.suto_at_[hidden])
Date: 2007-10-08 17:41:07


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk