# Circle Functions # Circle Functions Support

The Fractal Science Kit fractal generator Circle functions are associated with the Circle object:

Object Circle {
IsLine
Center|Point
}

The Circle object can, in fact, represent either a line or a circle. IsLine is a Boolean that is True if the object represents a line and False if the object represents a circle. If the object represents a circle, Center and Radius are the circle's center and radius, respectively. If the object represents a line, Point is a point on the line and Angle is the angle between the line and the X axis in radians.

The following example illustrates how you would define a Circle object using the object's constructor:

Circle c = Circle(False, Center, Radius)
Circle l = Circle(True, Point, Angle)

This example assigns a circle and a line to the variables c and l. The circle is defined by the arguments: Center and Radius, passed to the constructor. The line is defined by the arguments: Point and Angle, passed to the constructor. The first argument to each constructor determines if the object is a line or circle.

Circle CircleL(point, angle)

These 2 functions are alternate constructors for a Circle object. CircleC creates a circle from the given center and radius. CircleL creates a line from the given point and angle, where point is a point on the line and angle is the angle between the line and the X axis in radians.

Circle Circle.Create(z1, z2, z3)
Circle Circle.CreateLine(z1, z2)

Circle.Create returns a Circle given 3 points (z1, z2, and z3) on the circle. Circle.CreateLine returns a line (as a Circle object) given 2 points (z1 and z2) on the line.

Circle Circle.OrthogonalToUnitCircle(z0, z1)
Circle Circle.OrthogonalToCircle(Circle c, z0, z1)

Circle.OrthogonalToUnitCircle returns the circle that is orthogonal to the unit circle and passes through the 2 points z0 and z1 which must be on or within the unit circle. Circle.OrthogonalToCircle returns the circle that is orthogonal to the circle c and passes through the 2 points z0 and z1 which must be on or within circle c. c can be a line as well.

Complex Circle.DistanceTo(Circle c, z)
Complex Circle.InsideDistance(Circle c, z)
Complex Circle.PassesThru(Circle c, z)
Complex Circle.IsInside(Circle c, z)
Complex Circle.Equals(Circle c0, Circle c1)

Circle.DistanceTo returns the closest point on c to the point z. Circle.InsideDistance returns the distance from center of circle c to z as a percent of the circle's radius. If c is in fact a line, then 0.25 is returned if z is to the left of the line and 1e32 is returned if z is to the right. Circle.PassesThru returns True if z is on the circle c. Circle.IsInside returns True if z is inside c. If c is in fact a line, then True is returned if the point is to the left of the line and False is returned if z is to the right. Circle.Equals returns True is c0 is equal to c1. The above functions handle the case where c, c0 or c1 are a circle or a line.

Complex Circle.ReflectPoint(Circle c, z)
Circle Circle.ReflectCircle(Circle c, Circle k)

Circle.ReflectPoint reflects the point z in the circle/line c and returns the resulting point. Circle.ReflectCircle reflects circle/line c in circle/line k and returns the resulting circle/line.

'
' ReflectCircles takes as input an array of circles
' and reflects each circle in each of the others
' to generate additional circles. This process
' is performed 0, 1, or 2 times resulting in an
' array of circles.
'
' The arguments to ReflectCircles are:
'
' - c[count] is an input array of count circles.
' - count is the number of input circles in c[].
' - steps is the number of times to perform the
'   inversion. steps should be 0, 1, or 2.
'   steps=0 simply returns the input array.
' - radiusMin causes the method to reject any
'   circle whose radius is < radiusMin.
' - result[total] is the resulting array of circles.
' - index[total] is an array of index values where
'   index[i] indicates the index in c[] corresponding
'   to the circle associated with result[i].
' - level[total] is an array of levels where level[i]
'   indicates the step associated with result[i].
' - total is the number of circles in result[].
'
void Circle.ReflectCircles( \
Circle c[], \
count, \
steps, \