## Libraries.Game.Collision.Shapes.Circle Documentation

This class extends the CollisionShape2D by rewritting specific actions that are blueprint actions in CollisionShape2D for the shape of a circle. This class records all of the properties of a circle should have. To display the circle with the properties that you've set, you have to use "use Libraries.Game.Graphics.Drawable".

*Inherits from: *Libraries.Game.Collision.Shapes.CollisionShape2D, Libraries.Language.Object

## Summary

### Actions Summary Table

Actions | Description |
---|---|

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

ComputeArea() | This action calculates the area of the circle. |

ComputeBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox, Libraries.Game.Collision.PhysicsPosition2D transform, integer childIndex) | returns the distance of the point relative to the outside edges of the circ |

ComputeDistance(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point, integer childIndex, Libraries.Compute.Vector2 normalOut) | if the length( |

ComputeMass(Libraries.Game.Physics.Mass2D mass, number density) | This action calculates the mass of the circle. |

Copy() | This action creates a copy of another circle shape using the properties of the current circle properties. |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

GetChildCount() | Because a circle is a primitive shape, therefore, it is its own child (think of it as a circle makes up a circle). |

GetHashCode() | This action gets the hash code for an object. |

GetRadius() | This action returns the radius of the shape. |

GetSupportVertex() | This action returns the centroid of the circle relative to the circle's local coordinates. |

GetType() | This action gets the type of the shape that is used to collide with another 2D shape. |

GetVertex(integer index) | This action returns the centroid of the circle relative to the circle's local coordinates. |

GetVertexCount() | This action returns 1 for a circle. |

Scale(number scaleX, number scaleY) | Because we don't want to change a circle into an oval shape, so this action will use the first number that you passed in to change the size of the circle so that the circle will still be a circle after the change. |

SetRadius(number radius) | This action sets the radius of the shape. |

SetType(integer type) | This action sets the type of the shape that will be used to collide with another 2D shape. |

TestPoint(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point) | This action tests if a point of interest is inside the circular shape. |

## Actions Documentation

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

**Example Code**

```
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### ComputeArea()

This action calculates the area of the circle.

#### Return

number:

### ComputeBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox, Libraries.Game.Collision.PhysicsPosition2D transform, integer childIndex)

returns the distance of the point relative to the outside edges of the circ

#### Parameters

### ComputeDistance(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point, integer childIndex, Libraries.Compute.Vector2 normalOut)

if the length(

#### Parameters

#### Return

number:

### ComputeMass(Libraries.Game.Physics.Mass2D mass, number density)

This action calculates the mass of the circle. The action assumes that the density of the circle is constant at every point on the circle, therefore, the center of mass of the circle is just at the center of the circle.

#### Parameters

### Copy()

This action creates a copy of another circle shape using the properties of the current circle properties.

#### Return

Libraries.Game.Collision.Shapes.CollisionShape2D:

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

**Example Code**

```
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### GetChildCount()

Because a circle is a primitive shape, therefore, it is its own child (think of it as a circle makes up a circle).

#### Return

integer:

### GetHashCode()

This action gets the hash code for an object.

**Example Code**

```
Object o
integer hash = o:GetHashCode()
```

#### Return

integer: The integer hash code of the object.

### GetRadius()

This action returns the radius of the shape.

#### Return

number:

### GetSupportVertex()

This action returns the centroid of the circle relative to the circle's local coordinates.

#### Return

### GetType()

This action gets the type of the shape that is used to collide with another 2D shape.

#### Return

integer:

### GetVertex(integer index)

This action returns the centroid of the circle relative to the circle's local coordinates.

#### Parameters

#### Return

### GetVertexCount()

This action returns 1 for a circle.

#### Return

integer:

### Scale(number scaleX, number scaleY)

Because we don't want to change a circle into an oval shape, so this action will use the first number that you passed in to change the size of the circle so that the circle will still be a circle after the change.

#### Parameters

### SetRadius(number radius)

This action sets the radius of the shape.

#### Parameters

### SetType(integer type)

This action sets the type of the shape that will be used to collide with another 2D shape.

#### Parameters

### TestPoint(Libraries.Game.Collision.PhysicsPosition2D transform, Libraries.Compute.Vector2 point)

This action tests if a point of interest is inside the circular shape.

#### Parameters

- Libraries.Game.Collision.PhysicsPosition2D: The position and the tilt of the circulat shape relative to the global coordinates.
- Libraries.Compute.Vector2: The point of interest written in global coordinates.

#### Return

boolean: