updated per recommendation from ray

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4620 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Nathan Curtis
2007-03-07 20:28:43 +00:00
parent 5bed2f84ec
commit d04dd8cfeb
+10 -5
View File
@@ -42,16 +42,21 @@ public class Line
this.stop = stop; this.stop = stop;
} }
public function isIntersected (line :Line) :Boolean
{
return getIntersectionType(line) != DOES_NOT_INTERSECT;
}
/** /**
* Tests if the given line intersects this line. If thats all you need to know, testing for * Tests if the given line intersects this line. This method rotates both lines so that the
* intersects() != DOES_NOT_INTERSECT is enough. This method rotates both lines so that the * start point of this line is on the left, at (0, 0). If the lines do intersect, it then
* start point is on the left. If the lines do intersect, it then returns INTERSECTION_NORTH * returns INTERSECTION_NORTH if the end point of <code>line</code> is north of this line,
* if the end point of <code>line</code> is north of this line, INTERSECTION_SOUTH otherwise. * INTERSECTION_SOUTH otherwise.
* *
* Intersections are inclusive. If one or both points lands on this line, interects will not * Intersections are inclusive. If one or both points lands on this line, interects will not
* return DOES_NOT_INTERSECT. * return DOES_NOT_INTERSECT.
*/ */
public function intersects (line :Line) :int public function getIntersectionType (line :Line) :int
{ {
// rotate so that this line is horizontal, with the start on the left, at (0, 0) // rotate so that this line is horizontal, with the start on the left, at (0, 0)
var trans :Matrix = new Matrix(); var trans :Matrix = new Matrix();