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 vec2 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 vec2 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 vec2.zero(), localPoint = new vec2.zero(), 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 vec2.copy(other.localNormal), localPoint = new vec2.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.copyFrom(other.localNormal); localPoint.copyFrom(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 vec2.zero(), localPoint = new vec2.zero(), 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 vec2.copy(other.localNormal), localPoint = new vec2.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]); }
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.copyFrom(other.localNormal); localPoint.copyFrom(other.localPoint); pointCount = other.pointCount; }