|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.jgamegrid.GGLine
public class GGLine
Class representing a line segment. Start and endpoint are given by a GGVector.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
GGLine |
clone()
Returns a new GGLine with same start and end vector. |
static java.awt.Point |
getDividingPoint(java.awt.Point pt1,
java.awt.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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 vertexMethod Detail |
---|
public 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 line
public 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 comparism
public boolean isIntersecting(GGCircle circle)
circle
- the circle to be checked for intersection with the current line
public 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
public static java.awt.Point getDividingPoint(java.awt.Point pt1, java.awt.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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |