uavsim.datatypes
Class Circle

java.lang.Object
  extended by uavsim.datatypes.Circle

public class Circle
extends java.lang.Object

Defines a circle with an anchor at its center and a size, both in arbitrary units.

Author:
Dan Tappan [23.06.11]

Field Summary
private  CoordinateCartesianAbsolute _center
          the anchor position at the center
private  Radius _radius
          the radius
 
Constructor Summary
Circle(CoordinateCartesianAbsolute center, Radius radius)
          Creates a circle descriptor.
 
Method Summary
 CoordinateCartesianAbsolute[] calculateLineIntercepts(Line line)
          Calculates the two points where a line passing through a circle intercepts the perimeter.
 CoordinateCartesianAbsolute getBoundingBoxBottomRight()
          Determines the bottom-right corner of the box that bounds the circle.
 CoordinateCartesianAbsolute getBoundingBoxTopLeft()
          Determines the top-left corner of the box that bounds the circle.
 CoordinateCartesianAbsolute getCenter()
          Gets the anchor position at the center.
 Radius getRadius()
          Gets the radius.
 boolean isContained(CoordinateCartesianAbsolute point)
          Determines whether a point is contained within the circle.
 boolean isContained(CoordinateCartesianAbsolute point, ArcMathematical arc, boolean isInclusive)
          Determines whether a point is contained within a sector of the circle.
private  void setRadius(Radius radius)
          Sets the radius.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_center

private final CoordinateCartesianAbsolute _center
the anchor position at the center


_radius

private Radius _radius
the radius

Constructor Detail

Circle

public Circle(CoordinateCartesianAbsolute center,
              Radius radius)
Creates a circle descriptor.

Parameters:
center - - the anchor position at the center
radius - - the radius
Method Detail

calculateLineIntercepts

public CoordinateCartesianAbsolute[] calculateLineIntercepts(Line line)
Calculates the two points where a line passing through a circle intercepts the perimeter. The line must intercept.

Parameters:
line - - the line
Returns:
the two intercept points

getBoundingBoxBottomRight

public CoordinateCartesianAbsolute getBoundingBoxBottomRight()
Determines the bottom-right corner of the box that bounds the circle.

Returns:
the coordinate

getBoundingBoxTopLeft

public CoordinateCartesianAbsolute getBoundingBoxTopLeft()
Determines the top-left corner of the box that bounds the circle.

Returns:
the coordinate

getCenter

public CoordinateCartesianAbsolute getCenter()
Gets the anchor position at the center.

Returns:
the coordinate

getRadius

public Radius getRadius()
Gets the radius.

Returns:
the radius

isContained

public boolean isContained(CoordinateCartesianAbsolute point)
Determines whether a point is contained within the circle.

Parameters:
point - - the point
Returns:
the result

isContained

public boolean isContained(CoordinateCartesianAbsolute point,
                           ArcMathematical arc,
                           boolean isInclusive)
Determines whether a point is contained within a sector of the circle.

Parameters:
point - - the point
arc - - the arc defining the sector
isInclusive - - whether to include the end angle as part of the sector
Returns:
the result

setRadius

private void setRadius(Radius radius)
Sets the radius.

Parameters:
radius - - the radius

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object