This is in fact equivalent to what's in jQuery.menu-aim.js, eg upperSlope < prevUpperSlope => upperSlope - prevUpperSlope < 0, then inline slope() and multiply through by the denominators.
I'd prefer the code above though, as there's no icky division by zero.
Section: Determining if a point lies on the interior of a polygon http://paulbourke.net/geometry/polygonmesh/