Constructor
new Circle(pc, r)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pc |
Point
|
circle center point |
r |
number
|
circle radius |
Classes
Members
Methods
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
toArc(counterclockwise) → {Arc}
Transform circle to closed arc
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
counterclockwise |
boolean
|
true |
Returns:
- Type:
-
Arc
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>
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)
toJSON() → {Object}
This method returns an object that defines how data will be
serialized when called JSON.stringify() method
- Source:
Returns:
- Type:
-
Object
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,
like "stroke", "strokeWidth", "fill" Defaults are stroke:"black", strokeWidth:"1", fill:"none" |
Returns:
- Type:
-
string