|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Line2D
java.awt.geom.Line2D.Double
nl.tudelft.simulation.language.d2.DirectionalLine
public class DirectionalLine
A directional line with normal vector. Based on the BSPLine-example from the book Developing games in Java from David Brackeen. DirectionalLine.java
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl/language
License of use: Lesser
General Public License (LGPL) , no warranty
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Line2D |
---|
Line2D.Double, Line2D.Float |
Field Summary | |
---|---|
static int |
BACKSIDE
point at the back of the line |
static int |
COLLINEAR
point collinear with the line |
static int |
FRONTSIDE
point in front of the line |
static int |
SPANNING
other line is spanning this line |
Fields inherited from class java.awt.geom.Line2D.Double |
---|
x1, x2, y1, y2 |
Constructor Summary | |
---|---|
DirectionalLine(double x1,
double y1,
double x2,
double y2)
Creates a new DirectionalLine based on the specified coordinates. |
Method Summary | |
---|---|
void |
calcNormal()
Calculates the normal to this line. |
boolean |
equalsCoordinates(DirectionalLine line)
Returns true if the endpoints of this line match the endpoints of the specified line. |
boolean |
equalsCoordinatesIgnoreOrder(DirectionalLine line)
Returns true if the endpoints of this line match the endpoints of the specified line, ignoring endpoint order (if the first point of this line is equal to the second point of the specified line, and vice versa, returns true). |
void |
flip()
Flips this line so that the end points are reversed (in other words, (x1,y1) becomes (x2,y2) and vice versa) and the normal is changed to point the opposite direction. |
double |
getIntersection(Line2D.Double line)
Returns the fraction of intersection along this line. |
Point2D.Double |
getIntersectionPoint(Line2D.Double line)
Returns the interection point of this line with the specified line. |
double |
getLineThickness()
Gets the thickness of the line. |
double |
getNormalx()
|
double |
getNormaly()
|
int |
getSide(Line2D.Double line)
Gets the side of this line that the specified line segment is on. |
int |
getSideThick(double x,
double y)
Gets the side of this line the specified point is on. |
int |
getSideThin(double x,
double y)
Gets the side of this line the specified point is on. |
void |
normalize()
Normalizes the normal of this line (make the normal's length 1). |
void |
setLine(double x1,
double y1,
double x2,
double y2)
|
void |
setLine(float x1,
float y1,
float x2,
float y2)
Set the line using floats. |
void |
setLineThickness(double lineThickness)
Sets the tickness of the line. |
String |
toString()
|
Methods inherited from class java.awt.geom.Line2D.Double |
---|
getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2 |
Methods inherited from class java.awt.geom.Line2D |
---|
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int BACKSIDE
public static final int COLLINEAR
public static final int FRONTSIDE
public static final int SPANNING
Constructor Detail |
---|
public DirectionalLine(double x1, double y1, double x2, double y2)
x1
- Coordinate x1y1
- Coordinate y1x2
- Coordinate x2y2
- Coordinate y2Method Detail |
---|
public void calcNormal()
public void normalize()
public void setLine(float x1, float y1, float x2, float y2)
x1
- x1 coordinatey1
- y1 coodinatex2
- x2 coordinatey2
- y2 coordinatepublic void setLine(double x1, double y1, double x2, double y2)
setLine
in class Line2D.Double
Line2D.setLine(double, double, double, double)
public void flip()
public boolean equalsCoordinates(DirectionalLine line)
line
- another line
public boolean equalsCoordinatesIgnoreOrder(DirectionalLine line)
line
- another line
public String toString()
toString
in class Object
Object.toString()
public int getSideThick(double x, double y)
x
- coordinate xy
- coordinate y
public int getSideThin(double x, double y)
x
- coordinate xy
- coordinate y
public int getSide(Line2D.Double line)
line
- line segment
public double getIntersection(Line2D.Double line)
line
- a line
public Point2D.Double getIntersectionPoint(Line2D.Double line)
line
- a line
public double getLineThickness()
public void setLineThickness(double lineThickness)
lineThickness
- the lineThickness to setpublic double getNormalx()
public double getNormaly()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |