Clean up Line#getSide.

This commit is contained in:
Jonathan Puckey 2011-05-31 16:13:42 +02:00
parent 7a4c44ec7b
commit 97c8a7cb83

View file

@ -96,14 +96,14 @@ var Line = this.Line = Base.extend({
var v1 = this.vector,
v2 = point.subtract(this.point),
ccw = v2.cross(v1);
if (ccw == 0.0) {
if (ccw == 0) {
ccw = v2.dot(v1);
if (ccw > 0.0) {
if (ccw > 0) {
ccw = (v2 - v1).dot(v1);
if (ccw < 0.0)
ccw = 0.0;
if (ccw < 0)
ccw = 0;
}
}
return ccw < 0.0 ? -1 : ccw > 0.0 ? 1 : 0;
return ccw < 0 ? -1 : ccw > 0 ? 1 : 0;
}
});