Class representing a circular arc

Hierarchy (view full)

Constructors

  • Parameters

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

      Arc may be constructed [pc, r, startAngle, endAngle, counterClockWise]. pc - arc center r - arc radius startAngle - start angle in radians from 0 to 2PI endAngle - end angle in radians from 0 to 2PI counterClockwise - arc direction, true - clockwise, false - counterclockwise

    Returns Arc

Properties

counterClockwise: boolean = CCW

Arc orientation

endAngle: number = ...

Arc end angle in radians

pc: Point = ...

Arc center

r: number = 1

Arc radius

startAngle: number = 0

Arc start angle in radians

Accessors

  • get box(): Box
  • Get bounding box of the arc

    Returns Box

    bounding box of the arc

  • get center(): Point
  • Get center of arc

    Returns Point

    center of arc

  • get end(): Point
  • Get end point of arc

    Returns Point

    end point of arc

  • get length(): number
  • Get arc length

    Returns number

    arc length

  • get name(): string
  • Shape name

    Returns string

    name of the shape

  • get start(): Point
  • Get start point of arc

    Returns Point

    start point of arc

  • get sweep(): number
  • Get sweep angle in radians. Sweep angle is non-negative number from 0 to 2*PI

    Returns number

    sweep angle in radians

Methods

  • Breaks arc in extreme point 0, pi/2, pi, 3*pi/2 and returns array of sub-arcs

    Returns Arc[]

  • Returns chord height ("sagitta") of the arc

    Returns number

  • Returns number

  • Parameters

    • ymin: number

    Returns number

  • Return new cloned instance of arc

    Returns Arc

    cloned arc

  • Returns true if arc contains point, false otherwise

    Parameters

    Returns boolean

    true if arc contains point, false otherwise

  • Parameters

    • ymin: number = 0

    Returns number

  • Calculate distance and shortest segment from arc 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 arc to shape abd shortest segment between arc and shape (started at arc, ended at shape)

  • Get array of intersection points between arc and other shape

    Parameters

    • shape: Shape<any>

      Shape of the one of supported types

    Returns Point[]

    array of intersection points between arc and other shape

  • Get middle point of the arc

    Returns Point

    middle point of the arc

  • Get point at given length

    Parameters

    • length: number

      The length along the arc

    Returns Point

    point at given length

  • Get reversed arc, arc with swapped start and end angles and reversed direction

    Returns Arc

    reversed arc

  • 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 Arc

    new rotated shape

  • Scale shape with coordinates multiplied by scaling factor

    Parameters

    • sx: number

      x-axis scaling factor

    • sy: number

      y-axis scaling factor

    Returns Arc

    new scaled shape

  • Sort given array of points from arc start to end, assuming all points lay on the arc

    Parameters

    • pts: Point[]

      array of points

    Returns Point[]

    new array sorted

  • When given point belongs to arc, return array of two arcs split by this point. If points is incident to start or end point of the arc, return clone of the arc. If point does not belong to the arcs, return empty array.

    Parameters

    Returns [] | [Arc, Arc] | [Arc]

  • Get tangent unit vector on the end point

    Returns Vector

    tangent unit vector in the end point in the direction from end to start

  • Get tangent unit vector on the start point

    Returns Vector

    tangent unit vector in the start point in the direction from start to end

  • Get new arc transformed using affine transformation matrix

    Parameters

    • matrix: Matrix = ...

      affine transformation matrix

    Returns Arc

    transformed arc

  • 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 Arc

    new translated shape

  • Get new arc with center, start, end points and direction

    Parameters

    • center: Point

      center point

    • start: Point

      start point

    • end: Point

      end point

    • counterClockwise: boolean

      direction

    Returns Arc

    new arc