public class LineSegment
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected Point |
pointA |
protected Point |
pointB |
| Constructor and Description |
|---|
LineSegment(float x1,
float y1,
float x2,
float y2)
Constructs a line segment between point A and point B
|
LineSegment(Point pA,
Point pB)
Constructs a line segment between point A and point B
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(float x,
float y)
Returns if the coordinate x,y is on the line between point A and point B
|
boolean |
equals(java.lang.Object obj) |
Point |
getIntersection(LineSegment lineSegment)
Deprecated.
|
boolean |
getIntersection(LineSegment lineSegment,
Point result)
Returns the point at which this
LineSegment intersects with another |
float |
getLength() |
float |
getMaxX() |
float |
getMaxY() |
float |
getMinX() |
float |
getMinY() |
Point |
getPointA() |
Point |
getPointB() |
int |
hashCode() |
boolean |
intersects(LineSegment lineSegment)
Returns if this
LineSegment intersects another
LineSegment |
boolean |
intersects(Rectangle rectangle)
Returns if a
Rectangle intersects this LineSegment |
boolean |
intersectsLineSegment(float segmentX1,
float segmentY1,
float segmentX2,
float segmentY2) |
void |
set(float x1,
float y1,
float x2,
float y2)
Sets the coordinates of point A and point B
|
void |
setPointA(Point pointA) |
void |
setPointB(Point pointB) |
java.lang.String |
toString() |
public LineSegment(float x1,
float y1,
float x2,
float y2)
x1 - The x coordinate of point Ay1 - The y coordinate of point Ax2 - The x coordinate of point By2 - The y coordinate of point Bpublic void set(float x1,
float y1,
float x2,
float y2)
x1 - The x coordinate of point Ay1 - The y coordinate of point Ax2 - The x coordinate of point By2 - The y coordinate of point Bpublic boolean contains(float x,
float y)
x - The x coordinatey - The y coordinatepublic boolean intersectsLineSegment(float segmentX1,
float segmentY1,
float segmentX2,
float segmentY2)
public boolean intersects(LineSegment lineSegment)
LineSegment intersects another
LineSegmentlineSegment - The LineSegment to check for intersection with@Deprecated public Point getIntersection(LineSegment lineSegment)
LineSegment intersects with
anotherlineSegment - The LineSegment to check for intersection withLineSegments don't intersectpublic boolean getIntersection(LineSegment lineSegment, Point result)
LineSegment intersects with anotherlineSegment - The LineSegment to check for intersection withresult - The Point at which the lines intersectpublic boolean intersects(Rectangle rectangle)
Rectangle intersects this LineSegmentrectangle - The Rectangle to test for intersectionLineSegment does not intersect the
Rectanglepublic Point getPointA()
public void setPointA(Point pointA)
public Point getPointB()
public void setPointB(Point pointB)
public float getMinX()
public float getMinY()
public float getMaxX()
public float getMaxY()
public float getLength()
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object