Circle2

public extension Circle2
public extension Circle2 where Vector: VectorMultiplicative, Scalar: Comparable
extension Circle2: Convex2Type where Vector: Vector2FloatingPoint
public extension Circle2 where Vector: Vector2Real
  • Initializes a circle centered at a given point with a given radius.

    Declaration

    Swift

    init(x: Scalar, y: Scalar, radius: Scalar)

Available where Vector: VectorMultiplicative, Scalar: Comparable

  • Returns true if this circle’s area contains a given point.

    Points at the perimeter of the circle (distance to center == radius) are considered as contained within the circle.

    Declaration

    Swift

    func contains(x: Scalar, y: Scalar) -> Bool

Available where Vector: Vector2FloatingPoint

  • Returns the result of the intersection between self and another Circle2.

    If the circles are coincident on the same center, and have the same radius, the result is .noIntersection.

    Declaration

    Swift

    public func intersection(with other: `Self`) -> ClosedShape2Intersection<Vector>

Available where Vector: Vector2Real

  • Returns a point on this circle represented by a given angle.

    Declaration

    Swift

    @inlinable
    func pointOnAngle(_ angle: Angle<Scalar>) -> Vector
  • Generates an arc from this circle.

    Declaration

    Swift

    func arc(startAngle: Angle<Scalar>, sweepAngle: Angle<Scalar>) -> CircleArc2<Vector>
  • Generates an arc from this circle.

    Declaration

    Swift

    func arc(startAngle: Scalar, sweepAngle: Scalar) -> CircleArc2<Vector>
  • Computes the two points that are touching the tangents of this circie starting from point.

    Precondition

    point is at least radius-distance away from self.center.

    Declaration

    Swift

    func tangents(to point: Vector) -> (Vector, Vector)
  • Computes the outer tangents between circles self and other, returning the two tangent lines.

    The two tangents are ordered as the top and bottom, respectively, of a setup where self is aligned exactly to the left of other, with both tangents pointing from self to other.

    Declaration

    Swift

    func outerTangents(to other: `Self`) -> (LineSegment2<Vector>, LineSegment2<Vector>)