public class GGLine
extends java.lang.Object
Constructor and Description |
---|
GGLine(GGLine line)
Creates a new GGLine from given GGLine.
|
GGLine(GGVector[] vertexes)
Creates a new GGLine from given start and end point vertexes.
|
GGLine(GGVector startVector,
GGVector endVector)
Creates a new GGLine from given start and end point.
|
Modifier and Type | Method and Description |
---|---|
GGLine |
clone()
Returns a new GGLine with same start and end vector.
|
java.awt.Point |
getEndPoint()
Returns the end point (GGVector components casted to int).
|
GGVector |
getEndVector()
Returns the end vector.
|
java.awt.Point |
getStartPoint()
Returns the start point (GGVector components casted to int).
|
GGVector |
getStartVector()
Returns the start vector.
|
GGVector[] |
getVertexes()
Returns the vertexes of the line (startVector, endVector).
|
boolean |
isIntersecting(GGCircle circle)
Returns true if the current line intersects with the given circle.
|
boolean |
isIntersecting(GGLine line)
Returns true if the current line segment intersects with the given line segment.
|
boolean |
isIntersecting(GGVector v,
double error)
Returns true if the given point is part of the line segment.
|
boolean |
isIntersecting(GGVector imageCenter,
double imageDirection,
java.awt.image.BufferedImage image,
boolean isRotatable)
Returns true, if at least one point of the line segment (casted to int values)
points to a non-transparant pixel of the given image.
|
java.lang.String |
toString()
Returns a string that enumerates start and end vector.
|
void |
translate(GGVector v)
Performs a translation by the given vector.
|
public GGLine(GGLine line)
line
- the line from where the values of start and end point are copiedpublic GGLine(GGVector startVector, GGVector endVector)
startVector
- the vector to the start of the lineendVector
- the vector to the end of the linepublic GGLine(GGVector[] vertexes)
vertexes
- an array of the start and end point vertexpublic GGVector getStartVector()
public GGVector getEndVector()
public java.awt.Point getStartPoint()
public java.awt.Point getEndPoint()
public GGVector[] getVertexes()
public void translate(GGVector v)
v
- the translation vectorpublic GGLine clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isIntersecting(GGLine line)
line
- the line to be checked for intersection with the current linepublic boolean isIntersecting(GGVector v, double error)
v
- the vector to be checked if its end-point lays on line segmenterror
- the error interval for the floating point comparismpublic boolean isIntersecting(GGCircle circle)
circle
- the circle to be checked for intersection with the current linepublic boolean isIntersecting(GGVector imageCenter, double imageDirection, java.awt.image.BufferedImage image, boolean isRotatable)
imageCenter
- the vector to the center of the imageimageDirection
- the direction of the image (angle of edge ulx --> uly
with respect to the positive x-direction (0..2*pi))image
- the buffered imageisRotatable
- if true, the imageDirection is considered; otherwise
imageDirection = 0 is assumed