Shaku

Shaku JS

Back To Table of Content

Circle

Circle

Implement a simple 2d Circle.

Kind: global class

new Circle(center, radius)

Create the Circle.

Param Type Description
center Vector2 Circle center position.
radius Number Circle radius.

circle.clone() ⇒ Circle

Return a clone of this circle.

Kind: instance method of Circle
Returns: Circle - Cloned circle.

circle.containsVector(p) ⇒ Boolean

Check if this circle contains a Vector2.

Kind: instance method of Circle
Returns: Boolean - if point is contained within the circle.

Param Type Description
p Vector2 Point to check.

circle.equals(other) ⇒ Boolean

Check if equal to another circle.

Kind: instance method of Circle
Returns: Boolean - True if circles are equal, false otherwise.

Param Type Description
other Circle Other circle to compare to.

circle.toDict(minimized) ⇒ \*

Convert to dictionary.

Kind: instance method of Circle
Returns: \* - Dictionary with {center, radius}.

Param Type Description
minimized Boolean If true, will not include keys that their values are 0. You can use fromDict on minimized dicts.

Circle.fromDict(data) ⇒ Circle

Create circle from a dictionary.

Kind: static method of Circle
Returns: Circle - Newly created circle.

Param Type Description
data \* Dictionary with {center, radius}.

Circle.lerp(p1, p2, a) ⇒ Circle

Lerp between two circle.

Kind: static method of Circle
Returns: Circle - result circle.

Param Type Description
p1 Circle First circle.
p2 Circle Second circle.
a Number Lerp factor (0.0 - 1.0).