Beispiel #1
0
        public AbstractParticle(float x, float y, bool isFixed, float mass, float elasticity, float friction)
            : base()
        {
            interval = new Interval(0, 0);

            curr = new Vector(x, y);
            prev = new Vector(x, y);
            samp = new Vector(0, 0);
            temp = new Vector(0, 0);
            this.Fixed = isFixed;

            forces = new Vector(0, 0);
            _collision_vn = new Vector(0, 0);
            _collision_vt = new Vector(0, 0);
            collision = new Collision(_collision_vn, _collision_vt);
            this.Collidable = true;

            this.Mass = mass;
            this.Elasticity = elasticity;
            this.Friction = friction;

            //setStyle();

            _center = new Vector(0, 0);
            _multisample = 0;
        }
Beispiel #2
0
        private static float testIntervals(Interval intervalA, Interval intervalB)
        {
            if (intervalA.max < intervalB.min) return 0;
            if (intervalB.max < intervalA.min) return 0;

            float lenA = intervalB.max - intervalA.min;
            float lenB = intervalB.min - intervalA.max;

            return (Math.Abs(lenA) < Math.Abs(lenB)) ? lenA : lenB;
        }