org.starhope.appius.geometry
Class Circle

java.lang.Object
  extended by org.starhope.appius.geometry.Circle
All Implemented Interfaces:
PolygonPrimitive<Circle>

public class Circle
extends Object
implements PolygonPrimitive<Circle>

WRITEME: Document this type.

Author:
ewinkelman

Field Summary
protected  Coord2D center
          WRITEME: Document this brpocock@star-hope.org
protected  double radius
          WRITEME: Document this brpocock@star-hope.org
 
Constructor Summary
Circle(Coord2D center0, double radius0)
          Constructs a basic circle
Circle(double x, double y, double radius0)
          Constructs a basic circle
 
Method Summary
 boolean contains(Coord2D coord2d)
          Determines if the polygon contains that point
 boolean contains(double x, double y)
          Determines if the polygon contains that point
private  double getA(Coord2D point1, Coord2D point2)
          WRITEME: Document this method brpocock@star-hope.org
private  double getB(Coord2D point1, Coord2D point2, Coord2D cntr)
          WRITEME: Document this method brpocock@star-hope.org
private  double getC(Coord2D point1, Coord2D cntr, double radius0)
          WRITEME: Document this method brpocock@star-hope.org
 Coord2D getCenter()
           
private  Coord2D getIntPoint(Coord2D point1, Coord2D point2, double u)
          WRITEME: Document this method brpocock@star-hope.org
 double getRadius()
           
private  double insideRoot(double a, double b, double c)
          Finds the inside of the quadratic for intersecting a line and a circle
 Coord2D[] intersection(LineSeg2D lsSeg2d)
          Finds the intersection points for the polygon with the line segment
 boolean intersects(LineSeg2D segment)
          Determines if the polygon intersects the line segment
 boolean intersects(PolygonPrimitive<?> polygon)
          Determines if this polygon intersects with another one XXX: There has to be a better way than this
 boolean intersectsCircle(Circle circle)
          Determines if this circle intersects with another circle
 boolean intersectsPoly(Polygon polygon)
          Determines if the polygon intersects a polygon
 boolean intersectsRect(Rectangle rectangle)
          Tests to see if this rectangle intersects the circles
 Circle scale(double sizeScalar)
          WRITEME: Document this method brpocock@star-hope.org
 String toString()
           
 Circle translate(Coord2D coord2d)
          WRITEME: Document this method brpocock@star-hope.org
 Circle translate(double x, double y)
          Translates the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

center

protected final Coord2D center
WRITEME: Document this brpocock@star-hope.org


radius

protected final double radius
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

Circle

public Circle(Coord2D center0,
              double radius0)
Constructs a basic circle

Parameters:
center0 - Coordinates of the center point
radius0 - Radius of the circle

Circle

public Circle(double x,
              double y,
              double radius0)
Constructs a basic circle

Parameters:
x - X coordinate of the center point
y - Y coordinate of the center point
radius0 - Radius of the circle
Method Detail

contains

public boolean contains(Coord2D coord2d)
Description copied from interface: PolygonPrimitive
Determines if the polygon contains that point

Specified by:
contains in interface PolygonPrimitive<Circle>
Parameters:
coord2d - WRITEME
Returns:
WRITEME
See Also:
PolygonPrimitive.contains(org.starhope.appius.geometry.Coord2D)

contains

public boolean contains(double x,
                        double y)
Description copied from interface: PolygonPrimitive
Determines if the polygon contains that point

Specified by:
contains in interface PolygonPrimitive<Circle>
Parameters:
x - WRITEME
y - WRITEME
Returns:
WRITEME
See Also:
PolygonPrimitive.contains(double, double)

getA

private double getA(Coord2D point1,
                    Coord2D point2)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
point1 - WRITEME
point2 - WRITEME
Returns:
WRITEME

getB

private double getB(Coord2D point1,
                    Coord2D point2,
                    Coord2D cntr)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
point1 - WRITEME
point2 - WRITEME
cntr - WRITEME
Returns:
WRITEME

getC

private double getC(Coord2D point1,
                    Coord2D cntr,
                    double radius0)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
point1 - WRITEME
cntr - WRITEME
radius0 - WRITEME
Returns:
WRITEME

getCenter

public Coord2D getCenter()
Specified by:
getCenter in interface PolygonPrimitive<Circle>
Returns:
the center of the circle

getIntPoint

private Coord2D getIntPoint(Coord2D point1,
                            Coord2D point2,
                            double u)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
point1 - WRITEME
point2 - WRITEME
u - WRITEME
Returns:
WRITEME

getRadius

public double getRadius()
Returns:
the radius

insideRoot

private double insideRoot(double a,
                          double b,
                          double c)
Finds the inside of the quadratic for intersecting a line and a circle

Parameters:
a - where a is a of au^2 + bu + c
b - where b is b of au^2 + bu + c
c - where c is c of au^2 + bu + c
Returns:
WRITEME

intersection

public Coord2D[] intersection(LineSeg2D lsSeg2d)
Description copied from interface: PolygonPrimitive
Finds the intersection points for the polygon with the line segment

Specified by:
intersection in interface PolygonPrimitive<Circle>
Parameters:
lsSeg2d - WRITEME
Returns:
WRITEME
See Also:
FIXME: This is returning grossly implausible values…

intersects

public boolean intersects(LineSeg2D segment)
Description copied from interface: PolygonPrimitive
Determines if the polygon intersects the line segment

Specified by:
intersects in interface PolygonPrimitive<Circle>
Parameters:
segment - WRITEME
Returns:
WRITEME
See Also:
PolygonPrimitive.intersects(org.starhope.appius.geometry.LineSeg2D)

intersects

public boolean intersects(PolygonPrimitive<?> polygon)
Determines if this polygon intersects with another one XXX: There has to be a better way than this

Specified by:
intersects in interface PolygonPrimitive<Circle>
Parameters:
polygon - WRITEME
Returns:
WRITEME

intersectsCircle

public boolean intersectsCircle(Circle circle)
Determines if this circle intersects with another circle

Specified by:
intersectsCircle in interface PolygonPrimitive<Circle>
Parameters:
circle - The circle to test intersection with
Returns:
WRITEME

intersectsPoly

public boolean intersectsPoly(Polygon polygon)
Description copied from interface: PolygonPrimitive
Determines if the polygon intersects a polygon

Specified by:
intersectsPoly in interface PolygonPrimitive<Circle>
Parameters:
polygon - WRITEME
Returns:
WRITEME
See Also:
PolygonPrimitive.intersectsPoly(org.starhope.appius.geometry.Polygon)

intersectsRect

public boolean intersectsRect(Rectangle rectangle)
Tests to see if this rectangle intersects the circles

Specified by:
intersectsRect in interface PolygonPrimitive<Circle>
Parameters:
rectangle - WRITEME
Returns:
WRITEME

scale

public Circle scale(double sizeScalar)
Description copied from interface: PolygonPrimitive
WRITEME: Document this method brpocock@star-hope.org

Specified by:
scale in interface PolygonPrimitive<Circle>
Parameters:
sizeScalar - WRITEME
Returns:
WRITEME

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

translate

public Circle translate(Coord2D coord2d)
WRITEME: Document this method brpocock@star-hope.org

Specified by:
translate in interface PolygonPrimitive<Circle>
Parameters:
coord2d - WRITEME
Returns:
WRITEME

translate

public Circle translate(double x,
                        double y)
Description copied from interface: PolygonPrimitive
Translates the object

Specified by:
translate in interface PolygonPrimitive<Circle>
Parameters:
x - The amount to move on the x-axis
y - The amount to move on the y-axis
Returns:
WRITEME
See Also:
PolygonPrimitive.translate(double, double)