public class Line2DInt extends Object
| Modifier and Type | Field and Description |
|---|---|
Point2DInt |
p1 |
Point2DInt |
p2 |
| Constructor and Description |
|---|
Line2DInt(Line2DInt copy)
Constructor.
|
Line2DInt(Point2DInt point1,
Point2DInt point2)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Point2DInt point,
int tolerance)
return true if the point is on the line.
|
boolean |
containsAbsolute(Point2DInt point,
int tolerance)
return true if the point is on the line considering the line as infinite.
|
Point2DInt |
getAbsoluteIntersection(Line2DInt line)
return the intersection point of the lines considering the lines as infinite, or null if they are on the same alignement.
|
double[] |
getEquation()
Returns array with 3 numbers in it, which are the coefficients of the
generalized line equation of the line corresponding to this line segment
a*x+b*y=c is the equation => result[0]=a, result[1]=b, result[2]=c.
|
Point2DInt |
getIntersection(Line2DInt line)
return the intersection point between this line and the given one, or null if there is no intersection or they are the same.
|
Point2DInt[] |
getIntersection(Rectangle2DInt r)
return the intersection points between this line and the given rectangle: it may returns 0 to 2 points,
or null if the line is on a rectangle border.
|
double |
getLength() |
Rectangle2DInt |
getRectangle()
return the rectangle defined by the 2 points of this line.
|
boolean |
isHorizontal() |
boolean |
isOn(Line2DInt line)
return true if this line is on the given line.
|
boolean |
isOnAbsolute(Line2DInt line)
return true if this line is on the given line considering the two lines as infinite.
|
boolean |
isVertical() |
String |
toString() |
public Point2DInt p1
public Point2DInt p2
public Line2DInt(Point2DInt point1, Point2DInt point2)
public Line2DInt(Line2DInt copy)
public Rectangle2DInt getRectangle()
public boolean contains(Point2DInt point, int tolerance)
public boolean containsAbsolute(Point2DInt point, int tolerance)
public Point2DInt getAbsoluteIntersection(Line2DInt line)
public boolean isHorizontal()
public boolean isVertical()
public boolean isOn(Line2DInt line)
public boolean isOnAbsolute(Line2DInt line)
public double[] getEquation()
public double getLength()
public Point2DInt getIntersection(Line2DInt line)
public Point2DInt[] getIntersection(Rectangle2DInt r)
Copyright © 2017. All rights reserved.