Dart Documentationbox2dShape

Shape abstract class

abstract class Shape {
 /** The type of shape. Either circle or polygon. */
 int type;

 /** Shape radius. */
 num radius;

 /**
  * Constructs a new shape of unknown type.
  */
 Shape([int type = ShapeType.UNKNOWN, num radius = 0]) :
   type = type,
   radius = radius { }

 /**
  * Test a point for containment in this shape. This only works for convex
  * shapes.
  * transform:  the shape world transform.
  * point: a point in world coordinates.
  */
 bool testPoint(Transform transform, vec2 point);

 /**
  * Computes the associated axis aligned bounding box for a child shape
  * given a transform. Returns through the given out paramater.
  */
 void computeAxisAlignedBox(AxisAlignedBox box, Transform transform);

 /**
  * Computes (and returns through the given out parameter massData) the mass
  * properties of this shape using its dimensions and the
  * given density. The inertia tensor is computed about the local origin.
  */
 void computeMass(MassData massData, num density);

 /** Returns a clone of this shape. */
 Shape clone();
}

Subclasses

CircleShape, PolygonShape

Constructors

new Shape([int type = ShapeType.UNKNOWN, num radius = 0]) #

Constructs a new shape of unknown type.

Shape([int type = ShapeType.UNKNOWN, num radius = 0]) :
 type = type,
 radius = radius { }

Properties

num radius #

radius

int type #

type

Methods

abstract Shape clone() #

Returns a clone of this shape.

abstract void computeAxisAlignedBox(AxisAlignedBox box, Transform transform) #

Computes the associated axis aligned bounding box for a child shape given a transform. Returns through the given out paramater.

abstract void computeMass(MassData massData, num density) #

Computes (and returns through the given out parameter massData) the mass properties of this shape using its dimensions and the given density. The inertia tensor is computed about the local origin.

abstract bool testPoint(Transform transform, vec2 point) #

Test a point for containment in this shape. This only works for convex shapes. transform: the shape world transform. point: a point in world coordinates.