in reply to Better Logic?
#assuming nw,ne,se,sw are convex and clockwise sub c{ my($x0,$y0,$x1,$y1,$x2,$y2) = @_; $x0 -= $x2; $x1 -= $x2; $y0 -= $y2; $y1 -= $y2; return $x1*$y0 > $x0*$y1; } unless( c(@nw,@ne,@find) && c(@ne,@se,@find) && c(@se,@sw,@find) && c(@sw,@nw,@find) ){ die "data is outside of the quadrant\n"; }
|
---|