示例#1
0
文件: Leaf.cs 项目: tbeaupre/Leaf
        void UpdateAcceleration()               // Calculates the current acceleration of the leaf
        {
            PhysicsVector gPerp   = new PhysicsVector((Math.PI / 2) + angle.val, gravity.magnitude * Math.Cos(angle.val));
            PhysicsVector tension = new PhysicsVector(gPerp.direction + Math.PI, gPerp.magnitude + (Math.Pow(vel.magnitude, 2) / radius));             // Tension counters the perpendicular vector of gravity

            acc = tension + gravity;
        }
示例#2
0
文件: Leaf.cs 项目: tbeaupre/Leaf
        void RadiusCheck()              // Checks to see if the leaf is at the correct radius for the arc.
        {
            double checkRadius = CartesianVector.Distance(pos, anchor);
            double tol         = .1;

            while (checkRadius > radius + tol)
            {
                PhysicsVector move = new PhysicsVector(angle + Math.PI / 2, -0.1);
                pos        += move.ConvertToCartesian();
                checkRadius = CartesianVector.Distance(pos, anchor);
            }
            while (checkRadius < radius - tol)
            {
                PhysicsVector move = new PhysicsVector(angle + Math.PI / 2, 0.1);
                pos        += move.ConvertToCartesian();
                checkRadius = CartesianVector.Distance(pos, anchor);
            }
        }
示例#3
0
文件: Game1.cs 项目: tbeaupre/Leaf
 public void DrawVector(PhysicsVector vec, Color color, Leaf leaf)
 {
     //spriteBatch.Draw(vectorTexture, new Rectangle(leaf.pos.x, leaf.pos.y, (int)(vec.magnitude * 20), vectorTexture.Height/2), null, color, (float)vec.direction.val, new Vector2(0, 0), SpriteEffects.None, 0);
 }