de.tbosch.utilities.trigonometry
Class Circle

java.lang.Object
  extended by de.tbosch.utilities.trigonometry.Circle

public class Circle
extends java.lang.Object

A normal circle representation with middle point and radius.

Author:
Thomas Bosch (tbosch@gmx.de)

Constructor Summary
Circle(java.awt.Point middlePoint, float radius)
          Constructs the circle.
 
Method Summary
 java.awt.Point[] getCirclePoints()
          Gets the points that build a circle.
 java.awt.Point[][] getInnerTangentPoints(Circle circle)
          Gets the tangent points of the inner common tangent lines of two circles.
 java.awt.Point getMiddlePoint()
           
 java.awt.Point[][] getOuterTangentPoints(Circle circle)
          Gets the tangent points of the outer common tangent lines of two circles.
 float getRadius()
           
 java.awt.Point[][] getTangentPoints(Circle circle)
          Gets the tangent points of the common inner and outer tangent lines.
 java.awt.Point[] getTangentPoints(java.awt.Point point)
          Gets the two tangent points.
 java.lang.String toString()
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Circle

public Circle(java.awt.Point middlePoint,
              float radius)
Constructs the circle.

Parameters:
middlePoint - The middle point of the circle
radius - The radius of the circle
Method Detail

getCirclePoints

public java.awt.Point[] getCirclePoints()
Gets the points that build a circle.

Returns:
All 360 points (each single full degree)

getTangentPoints

public java.awt.Point[] getTangentPoints(java.awt.Point point)
Gets the two tangent points. Round up or down to the next integer point coordinate.

Parameters:
point - The point laying outside the circle
Returns:
The tangent points
Throws:
IntersectionException - If the point is inside the circle

getOuterTangentPoints

public java.awt.Point[][] getOuterTangentPoints(Circle circle)
Gets the tangent points of the outer common tangent lines of two circles.

Parameters:
circle - The second circle
Returns:
The tangent points of the common tangent lines. The first dimension are tangent lines and the second dimension are the points that build each tangent line.
Throws:
IntersectionException - If the given circle is fully inside this circle

getInnerTangentPoints

public java.awt.Point[][] getInnerTangentPoints(Circle circle)
Gets the tangent points of the inner common tangent lines of two circles. The result is a two dimensional array with the tangent lines in the first dimension and the points of each tangent line.

Parameters:
circle - The second circle
Returns:
The tangent points of the common tangent lines. The first dimension are tangent lines and the second dimension are the points that build each tangent line.
Throws:
IntersectionException - If the given circle intersects this circle

getTangentPoints

public java.awt.Point[][] getTangentPoints(Circle circle)
Gets the tangent points of the common inner and outer tangent lines.

Parameters:
circle - The second circle
Returns:
The tangent points array - first the outer tangent lines then the inner ones.
Throws:
IntersectionException - If the given circle is fully inside this circle.

getMiddlePoint

public java.awt.Point getMiddlePoint()
Returns:
The middle point of the circle

getRadius

public float getRadius()
Returns:
The circle radius

toString

public java.lang.String toString()
(non-Javadoc)

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2012. All Rights Reserved.