// copied from http://www.developer.nokia.com/Community/Wiki/Real-time_rotation_of_the_Windows_Phone_8_Map_Control
 public static double angleBetween2Lines(PinchContactPoints line1, PinchContactPoints line2)
 {
     if (line1 != null && line2 != null)
     {
         double angle1 = Math.Atan2(line1.PrimaryContact.Y - line1.SecondaryContact.Y,
                                    line1.PrimaryContact.X - line1.SecondaryContact.X);
         double angle2 = Math.Atan2(line2.PrimaryContact.Y - line2.SecondaryContact.Y,
                                    line2.PrimaryContact.X - line2.SecondaryContact.X);
         return (angle1 - angle2) * 180 / Math.PI;
     }
     else { return 0.0; }
 }
예제 #2
0
        private double AngleOf(PinchContactPoints points)
        {
            var vec = new Point(points.SecondaryContact.X - points.PrimaryContact.X, points.SecondaryContact.Y - points.PrimaryContact.Y);

            double angle = Math.Atan2(vec.Y, vec.X);

            if (angle < 0)
            {
                angle += 2 * Math.PI;
            }

            return(angle * 180 / Math.PI);
        }
예제 #3
0
 // copied from http://www.developer.nokia.com/Community/Wiki/Real-time_rotation_of_the_Windows_Phone_8_Map_Control
 public static double angleBetween2Lines(PinchContactPoints line1, PinchContactPoints line2)
 {
     if (line1 != null && line2 != null)
     {
         double angle1 = Math.Atan2(line1.PrimaryContact.Y - line1.SecondaryContact.Y,
                                    line1.PrimaryContact.X - line1.SecondaryContact.X);
         double angle2 = Math.Atan2(line2.PrimaryContact.Y - line2.SecondaryContact.Y,
                                    line2.PrimaryContact.X - line2.SecondaryContact.X);
         return((angle1 - angle2) * 180 / Math.PI);
     }
     else
     {
         return(0.0);
     }
 }
예제 #4
0
        private double GetAngle(PinchContactPoints points)
        {
            Point directionVector = new Point(points.SecondaryContact.X - points.PrimaryContact.X, points.SecondaryContact.Y - points.PrimaryContact.Y);

            return(GetAngle(directionVector.X, directionVector.Y));
        }
예제 #5
0
        private double AngleOf(PinchContactPoints points)
        {
            var vec = new Point(points.SecondaryContact.X - points.PrimaryContact.X, points.SecondaryContact.Y - points.PrimaryContact.Y);

            double angle = Math.Atan2(vec.Y, vec.X);

            if (angle < 0)
            {
                angle += 2 * Math.PI;
            }

            return angle * 180 / Math.PI;
        }
예제 #6
0
 private double GetAngle(PinchContactPoints points)
 {
     Point directionVector = new Point(points.SecondaryContact.X - points.PrimaryContact.X, points.SecondaryContact.Y - points.PrimaryContact.Y);
     return GetAngle(directionVector.X, directionVector.Y);
 }
예제 #7
0
        public void RotationChange(PinchContactPoints current, PinchContactPoints origin)
        {
            if (_gradientBase is EllipseGradient) return;

            double angleDelta = GetAngle(current.PrimaryContact, current.SecondaryContact) - GetAngle(origin.PrimaryContact, origin.SecondaryContact);

            _bokehData.Angle = _preAngle + angleDelta;
        }