PolygonShape class
A convex polygon shape. Polygons have a maximum number of vertices equal to _maxPolygonVertices. In most cases you should not need many vertices for a convex polygon.
Constructors
Properties
 centroid → Vector2

Local position of the shape centroid in parent body frame.
final
 childCount → int

Get the number of child primitives
no setteroverride
 hashCode → int

The hash code for this object.
no setterinherited

normals
→ List<
Vector2> 
The normals of the shape. Note: use vertexCount, not _normals.length, to
get number of active normals.
final
 radius ↔ double

getter/setter pairinherited
 runtimeType → Type

A representation of the runtime type of the object.
no setterinherited
 shapeType → ShapeType

finalinherited

vertices
→ List<
Vector2> 
The vertices of the shape. Note: use vertexCount, not _vertices.length,
to get number of active vertices.
final
Methods

applyToCentroid(
Transform xf) → Vector2  Get the centroid and apply the supplied transform.

clone(
) → Shape 
override

computeAABB(
AABB aabb, Transform xf, int childIndex) → void 
Given a transform, compute the associated axis aligned bounding box for a
child shape.
override

computeCentroid(
List< Vector2> vs, int count) → void 
computeDistanceToOut(
Transform xf, Vector2 p, int childIndex, Vector2 normalOut) → double 
Compute the distance from the current shape to the specified point.
This only works for convex shapes.
override

computeMass(
MassData massData, double density) → void 
Compute the mass properties of this shape using its dimensions and
density. The inertia tensor is computed about the local origin.
density
should be in kilograms per meter squared.override 
noSuchMethod(
Invocation invocation) → dynamic 
Invoked when a nonexistent method or property is accessed.
inherited

raycast(
RayCastOutput output, RayCastInput input, Transform xf, int childIndex) → bool 
Cast a ray against a child shape.
override

set(
List< Vector2> updatedVertices) → void 
Create a convex hull from the given array of points. The length of the
list must be in the range
3, Settings.maxPolygonVertices
. Warning: the points may be reordered, even if they form a convex polygon. Warning: collinear points are removed. 
setAsBox(
double halfWidth, double halfHeight, Vector2 center, double angle) → void 
Build vertices to represent an oriented box.
center
andangle
should be in local coordinates. 
setAsBoxXY(
double halfWidth, double halfHeight) → void  Build vertices to represent an axisaligned box.

setAsEdge(
Vector2 v1, Vector2 v2) → void  Set this as a single edge.

testPoint(
Transform xf, Vector2 p) → bool 
Test a point for containment in this shape. This only works for convex
shapes.
override

toString(
) → String 
A string representation of this object.
inherited

validate(
) → bool  Validate convexity. This is a very time consuming operation.
Operators

operator ==(
Object other) → bool 
The equality operator.
inherited