Class: Circle
Circle(center, radius)
new Circle(center, radius)
Create a new circle with given center point and radius.
Parameters:
Name | Type | Description |
---|---|---|
center |
Vertex | The center point of the circle. |
radius |
number | The radius of the circle. |
Methods
circleIntersection(circle) → {Line|null}
Calculate the intersection points (if exists) with the given circle.
Parameters:
Name | Type | Description |
---|---|---|
circle |
Circle |
Returns:
The intersection points (as a line) or null if the two circles do not intersect.
- Type
- Line | null
lineDistance(line) → {number}
Calculate the distance from this circle to the given line.
* If the line does not intersect this ciecle then the returned
value will be the minimal distance.
* If the line goes through this circle then the returned value
will be max inner distance and it will be negative.
Parameters:
Name | Type | Description |
---|---|---|
line |
Line | The line to measure the distance to. |
Returns:
The minimal distance from the outline of this circle to the given line.
- Type
- number
tangentAt(angle) → {Line}
Get a tangent line of this circle for a given angle.
Point a of the returned line is located on the circle, the length equals the radius.
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | The angle (in radians) to use. |
Returns:
The tangent line.
- Type
- Line
toSVGString(optionsopt) → {string}
Create an SVG representation of this circle.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
object |
<optional> |
An optional set of options, like 'className'. |
Returns:
A string representing the SVG code for this vertex.
- Type
- string
vertAt(angle) → {Vertex}
Get the vertex on the this circle for the given angle.
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | The angle (in radians) to use. |
Returns:
The vertex (point) at the given angle.
- Type
- Vertex