Beispiel #1
0
        public void ApplyImpulse_DynamicToFrozen(LsmBody applyBody, Particle applyParticle, LsmBody otherBody, double timeCoefficientPrediction, ref List<CollisionSubframeBuffer> collisionBuffer)
        {
            Debug.Assert(!applyBody.Equals(otherBody)); // don't allow self-collision here
            Debug.Assert(!applyBody.Frozen && otherBody.Frozen);

            foreach (Particle bodyt in otherBody.particles)
            {
                if (bodyt.xPos != null)
                {
                    CheckParticleEdge_D2F(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.xPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.xPos), bodyt.v, bodyt.xPos.v, 0.0)
                    );
                }
                if (bodyt.yPos != null)
                {
                    CheckParticleEdge_D2F(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.yPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.yPos), bodyt.v, bodyt.yPos.v, 0.0)
                    );
                }
            }
        }
Beispiel #2
0
        public void ApplyImpulse_FrozenToDynamic(LsmBody otherBody, Particle otherParticle, LsmBody applyBody, double timeCoefficientPrediction, ref List <CollisionSubframeBuffer> collisionBuffer)
        {
            Debug.Assert(!applyBody.Equals(otherBody)); // don't allow self-collision here
            Debug.Assert(applyBody.Frozen && !otherBody.Frozen);

            foreach (Particle applyParticle in applyBody.particles)
            {
                if (otherParticle.xPos != null)
                {
                    CheckParticleEdge_F2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, otherParticle, otherParticle.xPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(otherParticle, otherParticle.xPos), otherParticle.v, otherParticle.xPos.v, 0.0)
                        );
                }
                if (otherParticle.yPos != null)
                {
                    CheckParticleEdge_F2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, otherParticle, otherParticle.yPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(otherParticle, otherParticle.yPos), otherParticle.v, otherParticle.yPos.v, 0.0)
                        );
                }
            }
        }
Beispiel #3
0
        public void ApplyImpulse(
            LsmBody applyBody, Particle applyParticle, LsmBody otherBody, // HACK // TODO: try to don't use such information for collisions or formilize this ussage
            double timeCoefficientPrediction, ref List<CollisionSubframeBuffer> collisionBuffer // HACK // TODO: remove ref List<>
            )
        {
            Debug.Assert(!applyBody.Equals(otherBody)); // don't allow self-collision here
            Debug.Assert(!applyBody.Frozen && !otherBody.Frozen);

            // iterate all possible edges of body and test them with current subframed point
            foreach (Particle bodyt in otherBody.particles)
            {
                if (bodyt.xPos != null)
                {
                    CheckParticleEdge_D2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.xPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.xPos), bodyt.v, bodyt.xPos.v, 0.0)
                    );
                }
                if (bodyt.yPos != null)
                {
                    CheckParticleEdge_D2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.yPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.yPos), bodyt.v, bodyt.yPos.v, 0.0)
                    );
                }
            }
        }
Beispiel #4
0
        public void ApplyImpulse(
            LsmBody applyBody, Particle applyParticle, LsmBody otherBody,                        // HACK // TODO: try to don't use such information for collisions or formilize this ussage
            double timeCoefficientPrediction, ref List <CollisionSubframeBuffer> collisionBuffer // HACK // TODO: remove ref List<>
            )
        {
            Debug.Assert(!applyBody.Equals(otherBody)); // don't allow self-collision here
            Debug.Assert(!applyBody.Frozen && !otherBody.Frozen);

            // iterate all possible edges of body and test them with current subframed point
            foreach (Particle bodyt in otherBody.particles)
            {
                if (bodyt.xPos != null)
                {
                    CheckParticleEdge_D2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.xPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.xPos), bodyt.v, bodyt.xPos.v, 0.0)
                        );
                }
                if (bodyt.yPos != null)
                {
                    CheckParticleEdge_D2D(
                        ref applyParticle.ccdDebugInfos, applyParticle, bodyt, bodyt.yPos,
                        ref collisionBuffer, timeCoefficientPrediction,
                        new CollisionSubframeBuffer(applyParticle, applyParticle.v, new Edge(bodyt, bodyt.yPos), bodyt.v, bodyt.yPos.v, 0.0)
                        );
                }
            }
        }