Dart Documentationbox2dShape

Shape abstract class

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

 /** Shape radius. */
 double radius;

 /**
  * Constructs a new shape of unknown type.
  */
 Shape([int type = ShapeType.UNKNOWN, double radius = 0.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, Vector2 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, double radius = 0.0]) #

Constructs a new shape of unknown type.

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

Properties

double radius #

Shape radius.

double radius

int type #

The type of shape. Either circle or polygon.

int 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, Vector2 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.