Circle
public class Circle
extension Circle: SVGDrawable
extension Circle: CGDrawable
extension Circle: RayTracable
extension Circle: Hashable
extension Circle: Polygon
A circle, with an origin and a radius
-
Radius of the circle
Declaration
Swift
public var radius: Double
-
Center point of the circle
Declaration
Swift
public var center: Vector
-
The diameter of the circle
Declaration
Swift
public var diameter: Double { get }
-
Instantiate a new
Circle
Declaration
Swift
public init(center: Vector, radius: Double)
Parameters
center
Center of the circle
radius
Radius of the circle
-
Instantiate a new
Circle
Declaration
Swift
public convenience init(x: Double, y: Double, radius: Double)
Parameters
x
Center X coordinate
y
Center Y coordinate
radius
Radius of the circle
-
A Rectangle that contains the receiver
Declaration
Swift
public var boundingBox: Rectangle { get }
-
Generate a cubic Bézier representing an arc around a circle.
Adapted from Joe Cridge
Note
Bézier approximations of circles only work up to ~90ºDeclaration
Swift
public func acuteArc(start: Radians, size: Radians) -> BezierPath
Parameters
start
Starting angle of the arc, in radians
size
Size of the arc, in radians
circle
Circle to make the arc on
-
Calculate points of intersection with another shape.
Declaration
Swift
func intersections(with otherShape: Intersectable) -> [Vector]
Parameters
otherShape
The shape with which to find intersection points
Return Value
An array of Vectors
-
Calculate points of intersection with a
Circle
Declaration
Swift
func intersection(with otherShape: Circle) -> [Vector]
Parameters
otherShape
The shape with which to find intersection points
Return Value
An array of Vectors
-
Create a Bézier arc of the circle between the two points.
Declaration
Swift
public func bezierCurve(start: Radians, end: Radians) -> [BezierPath]
Parameters
start
Starting angle
end
Ending Angle
Return Value
An array of
BezierPath
which draw the shape -
Create a
XMLElement
representing the receiverDeclaration
Swift
public func svgElement() -> XMLElement
-
Draw the receiver in the specified context
Declaration
Swift
public func draw(in context: CGContext)
Parameters
context
Context in which to draw
-
Draw a representation of the receiver meant for debugging the shape in the specified context
Declaration
Swift
public func debugDraw(in context: CGContext)
Parameters
context
Context in which to draw
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.
Declaration
Swift
public static func == (lhs: Circle, rhs: Circle) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Determine whether teh specified point is inside the circle
This method compares the distance between the center and point to the radius of the circle.
Declaration
Swift
public func contains(_ point: Vector) -> Bool
Parameters
point
Whether the point is inside the circle