Added a constructor that takes two Points and a direction.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1455 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-06-12 23:33:03 +00:00
parent 4f2ca1dae9
commit 541eb01446
@@ -1,5 +1,5 @@
//
// $Id: LineSegmentPath.java,v 1.23 2002/05/31 03:38:03 mdb Exp $
// $Id: LineSegmentPath.java,v 1.24 2002/06/12 23:33:03 ray Exp $
package com.threerings.media.util;
@@ -30,11 +30,10 @@ public class LineSegmentPath
implements DirectionCodes, Path
{
/**
* Constructs a line segment path.
* Constructs an empty line segment path.
*/
public LineSegmentPath ()
{
_nodes = new ArrayList();
}
/**
@@ -46,13 +45,22 @@ public class LineSegmentPath
*/
public LineSegmentPath (int x1, int y1, int x2, int y2)
{
this();
addNode(x1, y1, NORTH);
Point p1 = new Point(x1, y1), p2 = new Point(x2, y2);
int dir = DirectionUtil.getDirection(p1, p2);
addNode(x2, y2, dir);
}
/**
* Construct a line segment path between the two nodes with the
* specified direction.
*/
public LineSegmentPath (Point p1, Point p2, int dir)
{
addNode(p1.x, p1.y, NORTH);
addNode(p2.x, p2.y, dir);
}
/**
* Constructs a line segment path with the specified list of
* points. An arbitrary direction will be assigned to the
@@ -63,7 +71,6 @@ public class LineSegmentPath
*/
public LineSegmentPath (List points)
{
this();
createPath(points);
}
@@ -324,7 +331,7 @@ public class LineSegmentPath
}
/** The nodes that make up the path. */
protected ArrayList _nodes;
protected ArrayList _nodes = new ArrayList();
/** We use this when moving along this path. */
protected Iterator _niter;