Dart Documentationbox2dMassData

MassData class

class MassData {
 /** The mass of the shape, usually in kilograms. */
 num mass;

 /** The position of the shape's centroid relative to the shape's origin. */
 vec2 center;

 /** The rotational inertia of the shape about the local origin. */
 num inertia;

 /**
  * Constructs a blank mass data.
  */
 MassData() :
   mass = 0,
   inertia = 0,
   center = new vec2.zero() { }

 /**
  * Copies from the given mass data.
  */
 MassData.copy(MassData md) :
   mass = md.mass,
   inertia = md.inertia,
   center = new vec2.copy(md.center) { }

 /**
  * Sets this mass data equal to the given mass data.
  */
 void setFrom(MassData md) {
   mass = md.mass;
   inertia = md.inertia;
   center.copyFrom(md.center);
 }
}

Constructors

new MassData() #

Constructs a blank mass data.

MassData() :
 mass = 0,
 inertia = 0,
 center = new vec2.zero() { }

new MassData.copy(MassData md) #

Copies from the given mass data.

MassData.copy(MassData md) :
 mass = md.mass,
 inertia = md.inertia,
 center = new vec2.copy(md.center) { }

Properties

vec2 center #

The position of the shape's centroid relative to the shape's origin.

vec2 center

num inertia #

The rotational inertia of the shape about the local origin.

num inertia

num mass #

The mass of the shape, usually in kilograms.

num mass

Methods

void setFrom(MassData md) #

Sets this mass data equal to the given mass data.

void setFrom(MassData md) {
 mass = md.mass;
 inertia = md.inertia;
 center.copyFrom(md.center);
}