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.
|
static android.graphics.Point |
getDividingPoint(android.graphics.Point pt1,
android.graphics.Point pt2,
double ratio)
Returns the point on the line through the point pt1 and the point
pt2 that is in distance ratio times the length from pt1 to pt2 from
pt1.
|
android.graphics.Point |
getEndPoint()
Returns the end point (GGVector components casted to int).
|
GGVector |
getEndVector()
Returns the end vector.
|
android.graphics.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,
android.graphics.Bitmap 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 android.graphics.Point getStartPoint()
public android.graphics.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, android.graphics.Bitmap 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 image bitmapisRotatable
- if true, the imageDirection is considered; otherwise
imageDirection = 0 is assumedpublic static android.graphics.Point getDividingPoint(android.graphics.Point pt1, android.graphics.Point pt2, double ratio)
pt1
- the start point of the line sectionpt2
- the end point of the line sectionratio
- the distance ratio (any negative or positive double value)