Ejemplo n.º 1
0
 private static ManipulationVelocities ConvertVelocities(ManipulationVelocities2D velocities)
 {
     return(new ManipulationVelocities(
                new Vector(velocities.LinearVelocityX, velocities.LinearVelocityY),
                AngleUtil.RadiansToDegrees(velocities.AngularVelocity),
                new Vector(velocities.ExpansionVelocityX, velocities.ExpansionVelocityY)));
 }
        internal static void ApplyParameters(InertiaRotationBehavior behavior, InertiaProcessor2D processor, double initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaRotationBehavior2D behavior2D = new InertiaRotationBehavior2D();

                if (behavior._isInitialVelocitySet)
                {
                    behavior2D.InitialVelocity = (float)AngleUtil.DegreesToRadians(behavior._initialVelocity);
                }
                else
                {
                    behavior2D.InitialVelocity = (float)AngleUtil.DegreesToRadians(initialVelocity);
                }
                if (behavior._isDesiredDecelerationSet)
                {
                    behavior2D.DesiredDeceleration = (float)AngleUtil.DegreesToRadians(behavior._desiredDeceleration);
                }
                if (behavior._isDesiredRotationSet)
                {
                    behavior2D.DesiredRotation = (float)AngleUtil.DegreesToRadians(behavior._desiredRotation);
                }

                processor.RotationBehavior = behavior2D;
            }
        }
Ejemplo n.º 3
0
 private static ManipulationDelta ConvertDelta(ManipulationDelta2D delta, ManipulationDelta add)
 {
     if (add != null)
     {
         return(new ManipulationDelta(
                    new Vector(delta.TranslationX + add.Translation.X, delta.TranslationY + add.Translation.Y),
                    AngleUtil.RadiansToDegrees(delta.Rotation) + add.Rotation,
                    new Vector(delta.ScaleX * add.Scale.X, delta.ScaleY * add.Scale.Y),
                    new Vector(delta.ExpansionX + add.Expansion.X, delta.ExpansionY + add.Expansion.Y)));
     }
     else
     {
         return(new ManipulationDelta(
                    new Vector(delta.TranslationX, delta.TranslationY),
                    AngleUtil.RadiansToDegrees(delta.Rotation),
                    new Vector(delta.ScaleX, delta.ScaleY),
                    new Vector(delta.ExpansionX, delta.ExpansionY)));
     }
 }