FarseerPhysics.Dynamics.Contacts.ContactSolver.WorldManifold.initialize C# (CSharp) Method

initialize() public static method

Evaluate the manifold with supplied transforms. This assumes modest motion from the original state. This does not change the point count, impulses, etc. The radii must come from the Shapes that generated the manifold.
public static initialize ( Manifold &manifold, Transform &xfA, float radiusA, Transform &xfB, float radiusB, Vector2 &normal, FixedArray2 &points ) : void
manifold FarseerPhysics.Collision.Manifold The manifold.
xfA Transform The transform for A.
radiusA float The radius for A.
xfB Transform The transform for B.
radiusB float The radius for B.
normal Vector2 World vector pointing from A to B
points FixedArray2 Torld contact point (point of intersection).
return void
			public static void initialize( ref Manifold manifold, ref Transform xfA, float radiusA, ref Transform xfB, float radiusB, out Vector2 normal, out FixedArray2<Vector2> points )
			{
				normal = Vector2.Zero;
				points = new FixedArray2<Vector2>();

				if( manifold.pointCount == 0 )
					return;

				switch( manifold.type )
				{
					case ManifoldType.Circles:
						{
							normal = new Vector2( 1.0f, 0.0f );
							var pointA = MathUtils.mul( ref xfA, manifold.localPoint );
							var pointB = MathUtils.mul( ref xfB, manifold.points[0].localPoint );
							if( Vector2.DistanceSquared( pointA, pointB ) > Settings.epsilon * Settings.epsilon )
							{
								normal = pointB - pointA;
								normal.Normalize();
							}

							var cA = pointA + radiusA * normal;
							var cB = pointB - radiusB * normal;
							points[0] = 0.5f * ( cA + cB );
							break;
						}


					case ManifoldType.FaceA:
						{
							normal = MathUtils.mul( xfA.q, manifold.localNormal );
							var planePoint = MathUtils.mul( ref xfA, manifold.localPoint );

							for( int i = 0; i < manifold.pointCount; ++i )
							{
								var clipPoint = MathUtils.mul( ref xfB, manifold.points[i].localPoint );
								var cA = clipPoint + ( radiusA - Vector2.Dot( clipPoint - planePoint, normal ) ) * normal;
								var cB = clipPoint - radiusB * normal;
								points[i] = 0.5f * ( cA + cB );
							}
							break;
						}

					case ManifoldType.FaceB:
						{
							normal = MathUtils.mul( xfB.q, manifold.localNormal );
							var planePoint = MathUtils.mul( ref xfB, manifold.localPoint );

							for( int i = 0; i < manifold.pointCount; ++i )
							{
								var clipPoint = MathUtils.mul( ref xfA, manifold.points[i].localPoint );
								var cB = clipPoint + ( radiusB - Vector2.Dot( clipPoint - planePoint, normal ) ) * normal;
								var cA = clipPoint - radiusA * normal;
								points[i] = 0.5f * ( cA + cB );
							}

							// Ensure normal points from A to B.
							normal = -normal;
							break;
						}
				}
			}
		}
ContactSolver.WorldManifold