Dart Documentationbox2dManifold

Manifold class

class Manifold {
 /** The points of contact. */
 final List<ManifoldPoint> points;

 /**
  * The meaning of the localNormal depends on the type of this manifold. The
  * different meanings (or lack thereof) are outlined below.
  * Circles: not used.
  * faceA: The normal on polygonA.
  * faceB: The normal on polygonB.
  */
 final Vector localNormal;

 /**
  * The meaning of the localPoint depends on the type of this manifold. The
  * different meanings (or lack thereof) are outlined below.
  * Circles: The local center of circleA.
  * faceA: The center of faceA.
  * faceB: The center of faceB.
  */
 final Vector localPoint;

 /** The type of manifold. See [ManifoldType]. */
 int type;

 /** The number of manifold points. */
 int pointCount;

 /**
  * Creates a manifold with 0 points. It's point array should be full of
  * already instantiated ManifoldPoints.
  */
 Manifold() :
     points = new List<ManifoldPoint>(Settings.MAX_MANIFOLD_POINTS),
     localNormal = new Vector(),
     localPoint = new Vector(),
     pointCount = 0 {
   for (int i = 0; i < Settings.MAX_MANIFOLD_POINTS; ++i)
     points[i] = new ManifoldPoint();
 }

 /**
  * Creates a new manifold that is a copy of the given manifold.
  */
 Manifold.copy(Manifold other) :
     points = new List<ManifoldPoint>(Settings.MAX_MANIFOLD_POINTS),
     localNormal = new Vector.copy(other.localNormal),
     localPoint = new Vector.copy(other.localPoint),
     pointCount = other.pointCount,
     type = other.type {
   for (int i = 0; i < Settings.MAX_MANIFOLD_POINTS; ++i)
     points[i] = new ManifoldPoint.copy(other.points[i]);
 }

 /**
  * Sets this manifold to be a copy of the given manifold.
  */
 void setFrom(Manifold other) {
   for (int i = 0; i < other.pointCount; ++i)
     points[i].setFrom(other.points[i]);

   type = other.type;
   localNormal.setFrom(other.localNormal);
   localPoint.setFrom(other.localPoint);
   pointCount = other.pointCount;
 }
}

Constructors

new Manifold() #

Creates a manifold with 0 points. It's point array should be full of already instantiated ManifoldPoints.

Manifold() :
   points = new List<ManifoldPoint>(Settings.MAX_MANIFOLD_POINTS),
   localNormal = new Vector(),
   localPoint = new Vector(),
   pointCount = 0 {
 for (int i = 0; i < Settings.MAX_MANIFOLD_POINTS; ++i)
   points[i] = new ManifoldPoint();
}

new Manifold.copy(Manifold other) #

Creates a new manifold that is a copy of the given manifold.

Manifold.copy(Manifold other) :
   points = new List<ManifoldPoint>(Settings.MAX_MANIFOLD_POINTS),
   localNormal = new Vector.copy(other.localNormal),
   localPoint = new Vector.copy(other.localPoint),
   pointCount = other.pointCount,
   type = other.type {
 for (int i = 0; i < Settings.MAX_MANIFOLD_POINTS; ++i)
   points[i] = new ManifoldPoint.copy(other.points[i]);
}

Properties

final Vector localNormal #

localNormal

final Vector localPoint #

localPoint

int pointCount #

pointCount

final List<ManifoldPoint> points #

points

int type #

type

Methods

void setFrom(Manifold other) #

Sets this manifold to be a copy of the given manifold.

void setFrom(Manifold other) {
 for (int i = 0; i < other.pointCount; ++i)
   points[i].setFrom(other.points[i]);

 type = other.type;
 localNormal.setFrom(other.localNormal);
 localPoint.setFrom(other.localPoint);
 pointCount = other.pointCount;
}