Shape subtype representing a Circle

Constructor

@:value({ filter : null, material : null, localCOM : null })new(radius:Float, ?localCOM:Vec2, ?material:Material, ?filter:InteractionFilter)

Construct a new Circle

Parameters:

radius

The radius of the circle, this value must be positive.

localCOM

The local offset for the circle. (default (0,0))

material

The material for this circle. (default new Material())

filter

The interaction filter for this circle. (default new InteractionFilter())

Returns:

The constructed Circle

Throws:

#

If radius is not strictly positive

#

If localCOM is non-null, but has been disposed of.

Variables

@:value(null)zpp_inner_zn:ZPP_Circle = null

@private

radius:Float

Radius of circle

This value must be strictly positive, and attempting to set this value whilst this Circle is part of a static Body inside a Space will result in a debug time error.

Inherited Variables

Defined by Shape

@:value(null)zpp_inner:ZPP_Shape = null

@private

read onlytype:ShapeType

Type of shape.

body:Null<Body>

Body this Shape is assigned to.

This value can be set to add Shape to the given Body, and set to null to remove it from its present Body.

read onlycastCircle:Null<Circle>

Faster equivalent to casting this to Circle type

read onlycastPolygon:Null<Polygon>

Faster equivalent to casting this to Polygon type

read onlyworldCOM:Vec2

World space centre of mass of this Shape.

This value can be accessed even if Shape is not in a Body, but attempting to query the values of it will return an error in debug builds unless the Shape is in a Body.

This Vec2 is immutable.

localCOM:Vec2

Local space centre of mass of this Shape.

This Vec2 can be set and is equivalent to performing the necessary translation of the Shape in local coordinates, and also equivalent to this.localCOM.set(value).
Setting this value whilst this shape is part of a static Body that is part of a Space is not permitted.

read onlyarea:Float

Area of the Hhape.

read onlyinertia:Float

Non-mass weighted moment of inertia for Shape.

read onlyangDrag:Float

Coeffecient of angular fluid drag for this Shape.

material:Material

Material used by this shape.

filter:InteractionFilter

InteractionFilter used by this shape.

fluidProperties:FluidProperties

FluidProperties used by this shape.

This object provides information for buoyancy and fluid drag computations when this shape is interacting as a fluid.

fluidEnabled:Bool

Whether this shape is able to interact as a fluid.

Unless this field is true, this Shape can never interact as a fluid.

Just because this field is true however, does not mean this shape will always interact as a fluid, the final result is down to the combination of InteractionFilters on the pairing of shapes and sensory interaction takes higher priority.

sensorEnabled:Bool

Whether this shape is able to interact as sensor.

Unless this field is true, this Shape can never interact as a sensor.

Just because this field is true however, does not mean this shape will always interact as a sensor, the final result is down to the combination of InteractionFilters on the pairing of shapes. Sensor interaction has highest priority.

read onlybounds:AABB

World space bounding box for this shape.

This value can be accessed even if the Shape is not part of a Body, however attempting to query its values would result in an error in debug builds.

This AABB is immutable.

Defined by Interactor

@:value(null)zpp_inner_i:ZPP_Interactor = null

@private

read onlyid:Int

Unique id of this Interactor.

read onlyuserData:Dynamic<Dynamic>

Dynamic object for user to store additional data.

This object cannot be set, only its dynamically created properties may be set. In AS3 the type of this property is &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

read onlycastShape:Null<Shape>

Fast equivalent to cast(interactor, Shape)

read onlycastBody:Null<Body>

Fast equivalent to cast(interactor, Body)

read onlycastCompound:Null<Compound>

Fast equivalent to cast(interactor, Compound)

group:Null<InteractionGroup>

InteractionGroup assigned to this Interactor.

read onlycbTypes:CbTypeList

Set of CbType's assigned to this Interactor.

Inherited Methods

Defined by Shape

inlineisCircle():Bool

Faster equivalent to type == ShapeType.CIRCLE

Returns:

True if shape is a Circle type.

inlineisPolygon():Bool

Faster equivalent to type == ShapeType.POLYGON

Returns:

True if shape is a Polygon type.

translate(translation:Vec2):Shape

Translate this shape in its local coordinate system.

This is equivalent to: shape.localCOM.addeq(displacement)

Parameters:

translation

The local translation to apply to Shape.

Returns:

A reference to 'this' Shape.

Throws:

#

If translation is null or has been disposed of.

#

If this shape is part of a static body that is inside of a Space.

scale(scalex:Float, scaley:Float):Shape

Scale this shape in its local coordinate system.

For Circle shapes, scalex and scaley must be exactly equal.

Parameters:

scalex

The x-coordinate scaling to apply to Shape.

scaley

The y-coordinate scaling to apply to Shape.

Returns:

A reference to 'this' Shape.

Throws:

#

If this shape is part of a static body that is inside of a Space.

#

If scalex or scaley is 0. Negative values 'are' permitted.

rotate(angle:Float):Shape

Rotate this shape in its local coordinate system.

Parameters:

angle

The number of radians to rotate this Shape by in a clockwise direction.

Returns:

A reference to 'this' Shape.

Throws:

#

If this shape is part of a static body that is inside of a Space.

transform(matrix:Mat23):Shape

Apply local transformation matrix to Shape.

For Circle shapes, the matrix must be equiorthogonal.

Parameters:

matrix

The matrix to transform Shape by.

Returns:

A reference to 'this' Shape.

Throws:

#

If matrix is null or singular.

#

If shape is a Circle, and matrix is not equiorthogonal.

#

If this shape is part of a static body that is inside of a Space.

contains(point:Vec2):Bool

Test containment of world-space coordinate in Shape.

This Shape must be part of a Body so that world coordinates are defined.

Parameters:

point

The point to check for containment.

Returns:

True if point is contained within the Shape.

Throws:

If

point is null or disposed of.

If

this shape is not part of a Body.

copy():Shape

Produce an exact copy of this Shape.

The copied shape will be identical with the copied Shape's userData object being assigned the same fields as 'this' Shape with the same values copied over by reference for object types.

Returns:

A copy of this shape.

@:keeptoString():String

@private

Defined by Interactor

inlineisShape():Bool

Fast equivalent to Std.isOfType(interactor, Shape)

Returns:

true if this Interactor is a Shape.

inlineisBody():Bool

Fast equivalent to Std.isOfType(interactor, Body)

Returns:

true if this Interactor is a Body.

inlineisCompound():Bool

Fast equivalent to Std.isOfType(interactor, Compound)

Returns:

true if this Interactor is a Compound.