Constructor and Description |
---|
Line2D(double x,
double y,
double dx,
double dy)
Create a new line segment.
|
Line2D(Point2D origin,
Point2D end)
Create a new line segment.
|
Line2D(Point2D origin,
Vector2D direction)
Create a new line segment.
|
Modifier and Type | Method and Description |
---|---|
Region |
getBoundingRegion()
Get the bounding region of this object.
|
Vector2D |
getDirection()
Get the direction of this line segment.
|
Point2D |
getEndPoint()
Get the endpoint of this line segment.
|
double |
getIntersection(Line2D other)
Find out how far along this line the intersection point with another line is.
|
Point2D |
getOrigin()
Get the origin of this line segment.
|
Point2D |
getPoint(double t)
Get a point along this line.
|
void |
setEnd(Point2D end2) |
void |
setOrigin(Point2D origin) |
java.lang.String |
toString() |
public Line2D(Point2D origin, Vector2D direction)
origin
- The origin of the line.direction
- The direction of the line.public Line2D(Point2D origin, Point2D end)
origin
- The origin of the line.end
- The end of the line.public Line2D(double x, double y, double dx, double dy)
x
- The x coordinate of the origin.y
- The y coordinate of the origin.dx
- The x component of the direction.dy
- The y component of the direction.public Point2D getPoint(double t)
t
- The distance along the direction vector to create the point.public Point2D getOrigin()
public Point2D getEndPoint()
public Vector2D getDirection()
public java.lang.String toString()
toString
in class java.lang.Object
public double getIntersection(Line2D other)
other
- The other line.public Region getBoundingRegion()
Indexable
getBoundingRegion
in interface Indexable
public void setEnd(Point2D end2)
public void setOrigin(Point2D origin)