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
CircleDeclaration
Swift
public init(center: Vector, radius: Double)Parameters
centerCenter of the circle
radiusRadius of the circle
-
Instantiate a new
CircleDeclaration
Swift
public convenience init(x: Double, y: Double, radius: Double)Parameters
xCenter X coordinate
yCenter Y coordinate
radiusRadius 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) -> BezierPathParameters
startStarting angle of the arc, in radians
sizeSize of the arc, in radians
circleCircle to make the arc on
-
Calculate points of intersection with another shape.
Declaration
Swift
func intersections(with otherShape: Intersectable) -> [Vector]Parameters
otherShapeThe shape with which to find intersection points
Return Value
An array of Vectors
-
Calculate points of intersection with a
CircleDeclaration
Swift
func intersection(with otherShape: Circle) -> [Vector]Parameters
otherShapeThe 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
startStarting angle
endEnding Angle
Return Value
An array of
BezierPathwhich draw the shape -
Create a
XMLElementrepresenting the receiverDeclaration
Swift
public func svgElement() -> XMLElement -
Draw the receiver in the specified context
Declaration
Swift
public func draw(in context: CGContext)Parameters
contextContext 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
contextContext 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) -> BoolParameters
pointWhether the point is inside the circle
View on GitHub
Circle Class Reference