Class representing a circle

Hierarchy (view full)

Constructors

  • Parameters

    • Rest...args: [Point] | [Point, number] | [number]

      Arc may be constructed [pc, r] or [pc] or [r]

    Returns Circle

Properties

pc: Point = ...

Circle center

r: number = 1

Circle radius

Accessors

  • get box(): Box
  • Circle bounding box

    Returns Box

    bounding box

  • get center(): Point
  • Circle center

    Returns Point

    center point

  • get name(): string
  • Shape name

    Returns string

    name of the shape

Methods

  • Return new cloned instance of circle

    Returns Circle

    cloned circle

  • Return true if circle contains shape: no point of shape lies outside of the circle

    Parameters

    • shape: Shape<any>

      test shape

    Returns boolean

  • Calculate distance and shortest segment from circle to shape and return array [distance, shortest segment]

    Parameters

    • shape: Shape<any> | Polygon

      Shape of the one of supported types Point, Line, Circle, Segment, Arc, Polygon or Planar Set

    Returns [number, Segment]

    distance from circle to shape and shortest segment between circle and shape (started at circle, ended at shape)

  • Returns array of intersection points between circle and other shape

    Parameters

    • shape: Shape<any>

      Shape of the one of supported types

    Returns Point[]

  • Rotate shape by given angle around given center point. If center point is omitted, rotates around zero point (0,0). Positive value of angle defines rotation in counterclockwise direction, negative angle defines rotation in clockwise direction

    Parameters

    • angle: number

      angle in radians

    • center: SimplePoint = ...

      center of rotation

    Returns Circle

    new rotated shape

  • Method scale is supported only for uniform scaling of the circle with (0,0) center

    Parameters

    • sx: number
    • sy: number

    Returns Circle

    scaled Circle

  • Transform circle to closed arc

    Parameters

    • counterclockwise: boolean = true

    Returns Arc

    transformed arc

  • Get transformed circle using affine transformation matrix

    Parameters

    • matrix: Matrix = ...

      affine transformation matrix

    Returns Circle

    transformed circle

  • Translated shape by given vector. Translation vector may be also defined by a pair of numbers.

    Parameters

    • Rest...args: [number, number] | [Vector]

      Translation vector or translation by x and y or tuple of numbers

    Returns Circle

    new translated shape