Circle

Circle

Class representing a circle

Constructor

new Circle(pc, r)

Source:
Parameters:
Name Type Description
pc Point circle center point
r number circle radius

Classes

Circle

Members

box

Circle bounding box
Source:

center

Circle center
Source:

pc :Point

Circle center
Source:
Type:

r :number

Circle radius
Source:
Type:
  • number

Methods

clone() → {Circle}

Return new cloned instance of circle
Source:
Returns:
Type:
Circle

contains(shape) → {boolean}

Return true if circle contains shape: no point of shape lies outside of the circle
Source:
Parameters:
Name Type Description
shape Shape test shape
Returns:
Type:
boolean

distanceTo(shape) → {number|Segment}

Calculate distance and shortest segment from circle to shape and return array [distance, shortest segment]
Source:
Parameters:
Name Type Description
shape Shape Shape of the one of supported types Point, Line, Circle, Segment, Arc, Polygon or Planar Set
Returns:
  • Type:
    number
    distance from circle to shape
  • Type:
    Segment
    shortest segment between circle and shape (started at circle, ended at shape)

intersect(shape) → {Array.<Point>}

Returns array of intersection points between circle and other shape
Source:
Parameters:
Name Type Description
shape Shape Shape of the one of supported types
Returns:
Type:
Array.<Point>

scale(sx, sy) → {Circle}

Method scale is supported only for uniform scaling of the circle with (0,0) center
Source:
Parameters:
Name Type Description
sx number
sy number
Returns:
Type:
Circle

svg(attrs) → {string}

Return string to draw circle in svg
Source:
Parameters:
Name Type Description
attrs Object an object with attributes of svg circle element
Returns:
Type:
string

toArc(counterclockwise) → {Arc}

Transform circle to closed arc
Source:
Parameters:
Name Type Default Description
counterclockwise boolean true
Returns:
Type:
Arc

transform(matrix) → {Circle}

Return new circle transformed using affine transformation matrix
Source:
Parameters:
Name Type Description
matrix Matrix affine transformation matrix
Returns:
Type:
Circle