Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

A script for finding the intersection points of two or multiple circles (the 'radical lines').

Based on the C++ implementation by Robert King https://stackoverflow.com/questions/3349125/circle-circle-intersection-points and the 'Circles and spheres' article by Paul Bourke. http://paulbourke.net/geometry/circlesphere/

requires

arrayFill

requires

matrixFill

requires

Circle

requires

IndexPair

requires

Matrix

requires

Interval

requires

Line

requires

CirularIntervalSet

Hierarchy

  • CircleIntersections

Index

Methods

Static buildRadicalLineMatrix

  • Build the n*n intersection matrix: contains the radical line at (i,j) if circle i and circle j do intersect; conatins null at (i,j) otherwise.

    Note that this matrix is symmetrical: if circles (i,j) intersect with line (A,B), then also circles (j,i) intersect with line (B,A).

    The returned two-dimensional matrix (array) has exactly as many entries as the passed circle array.

    method

    buildRadicalLineMatrix

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    Returns Matrix<Line>

    A 2d-matrix containing the radical lines where circles intersect.

Static Private findAdjacentInterval

  • Find the next adjacent circle interval for the given interval. starts the detection with any random section.

    method

    randomUnusedInterval

    static
    memberof

    CircleIntersections

    Parameters

    Returns { i: number; j: number }

    • i: number
    • j: number

Static findInnerCircles

  • findInnerCircles(circles: Array<Circle>): Array<number>
  • Find all circles (indices) which are completely located inside another circle.

    The returned array conatins the array indices.

    method

    findInnerCircles

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    Returns Array<number>

Static findOuterCircleIntervals

  • Calculate all outer circle intervals (sections that belong to the outermost line), dermined by the given circles and their radical lines.

    The returned array contains IntervalSets - one for each circle - indicating the remaining circle sections.

    method

    findOuterCircleIntervals

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    • intersectionMatrix: Matrix<Line>

    Returns Array<CircularIntervalSet>

Static findOuterPartition

  • Calculate the next connected partition from the given set of circles and outer path intervals. The function will pick a random unused circle interval and detect all adjacent intervals until a closed partition was found.

    If an interval (circle section) was already visited will be stored in the usedIntervalSetRecords matrix (thus is must be large enough to map all sections).

    The returned array contains IndexPairs (i,j) - one for each circle i - indicating the used circle section j.

    method

    findOuterPartition

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    • intervalSets: Array<CircularIntervalSet>

      The circle intervals that form the intersection outline.

    • usedIntervals: Matrix<boolean>

      A matrix for remembering which circle intervals were always used.

    Returns Array<IndexPair> | null

    The next partition or null if no more can be found.

Static findOuterPartitions

  • Find all connected outer path partitions.

    method

    findOuterPartitions

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    • intervalSets: Array<CircularIntervalSet>

      The determined interval sets (see findOuterCircleIntervals).

    Returns Array<Array<IndexPair>>

    An array of paths, each defined by a sequence of IndexPairs adressing circle i and interval j.

Static findOuterPartitionsAsSectors

  • Find all connected outer path partitions (as CircleSectors).

    method

    findOuterPartitionsAsSectors

    static
    memberof

    CircleIntersections

    Parameters

    • circles: Array<Circle>

      The circles to find intersections for.

    • intervalSets: Array<CircularIntervalSet>

      The determined interval sets (see findOuterCircleIntervals).

    Returns Array<Array<CircleSector>>

    An array of paths, each defined by a sequence of SircleSectors.

Static Private handleCircleInterval

  • This is a helper fuction used by findOuterCircleIntervals.

    It applies the passed radical line by intersecting the remaining circle sections with the new section.

    method

    handleCircleInterval

    static
    memberof

    CircleIntersections

    Parameters

    • circle: Circle

      The circles to find intersections for.

    • radicalLine: Line

      The radical line to apply.

    • intervalSet: CircularIntervalSet

      The CircularIntervalSet to use (must have left and right border: 0 and 2*PI).

    Returns void

Static Private radicalLineToInterval

  • Convert a radical line (belonging to a circle) into an interval: start angle and end angle.

    method

    radicalLineToInterval

    static
    memberof

    CircleIntersections

    Parameters

    • circle: Circle

      The circle itself.

    • radicalLine: Line

    Returns Interval

    The interval [startAngle,endAngle] determined by the radical line.

Static Private randomUnusedInterval

  • Pick a random unused circle interval. This function is used by the findOuterPartition function, which starts the detection with any random section.

    method

    randomUnusedInterval

    static
    memberof

    CircleIntersections

    Parameters

    • intervalSets: Array<CircularIntervalSet>

      An array of all available interval sets/intervals.

    • usedIntervals: Matrix<boolean>

      A matrix indicating which intervals have already been used/visited by the algorithm

    Returns IndexPair | null

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc