public class GGCircle
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
GGVector |
center
The public vector to the center of the circle.
|
double |
radius
The public radius of the circle.
|
Constructor and Description |
---|
GGCircle()
Constructs a circle at (0, 0) with radius = 0.
|
GGCircle(double radius)
Constructs a circle at (0, 0) with given radius.
|
GGCircle(GGCircle circle)
Constructs a new circle with the same center and radius as the given circle.
|
GGCircle(GGVector center,
double radius)
Constructs a circle with given center and radius.
|
Modifier and Type | Method and Description |
---|---|
GGCircle |
clone()
Returns a new circle with the same center and radius as the current circle.
|
GGVector |
getCenter()
Returns a copy of the center of the circle.
|
double |
getRadius()
Returns the radius of the circle.
|
boolean |
isEqual(GGCircle circle)
Returns true, if the current circle is identical to the given circle.
|
boolean |
isIntersecting(GGCircle circle)
Returns true if the current circle intersects with the given circle.
|
boolean |
isIntersecting(GGRectangle rect)
Returns true if the current circle intersects with the given rectangle.
|
boolean |
isIntersecting(GGVector vector)
Returns true if the given points is part of the circle area.
|
boolean |
isIntersecting(GGVector imageCenter,
double imageDirection,
java.awt.image.BufferedImage image,
boolean isRotatable)
Returns true, if area of the current circle intersects the
non-transparant area of the given image.
|
boolean |
isIntersecting(java.awt.Rectangle rect)
Returns true if the current circle intersects with the given java.awt.Rectangle.
|
java.lang.String |
toString()
Returns a string that enumerates center and radius.
|
void |
translate(GGVector v)
Performs a translation by the given vector.
|
public GGVector center
public double radius
public GGCircle(GGVector center, double radius)
center
- the vector to the centerradius
- the radius of the circlepublic GGCircle(double radius)
radius
- the radius of the circlepublic GGCircle()
public GGCircle(GGCircle circle)
circle
- the circle from where center and radius are copied.public double getRadius()
public GGVector getCenter()
public GGCircle clone()
clone
in class java.lang.Object
public void translate(GGVector v)
v
- the translation vectorpublic boolean isIntersecting(GGCircle circle)
circle
- the circle to be checked for intersection with the current circlepublic boolean isIntersecting(GGRectangle rect)
rect
- the rectangle to be checked for intersection with the current circlepublic boolean isIntersecting(java.awt.Rectangle rect)
rect
- the rectangle to be checked for intersection with the current circlepublic boolean isIntersecting(GGVector vector)
vector
- the vector to be checked for intersectionpublic 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 assumedpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isEqual(GGCircle circle)
circle
- the cirle to compare