Esempio n. 1
0
 private void DenormalizeAngles(ref Angles a)
 {
     a.alpha = ((a.alpha - 0.1) / 0.8 * 180);
     a.beta  = ((a.beta - 0.1) / 0.8 * 180);
     if (file > 0)
     {
         a.beta = -180 + a.beta;
     }
 }
Esempio n. 2
0
        public Arm GiveAnswer(ref Point p)
        {
            NormalizePoint(ref p);
            Example t = new Example(p);

            GoForward(t);
            Angles angles = GetAngles();

            DenormalizeAngles(ref angles);
            Debug.WriteLine("alfa: {0}, beta: {1}", angles.alpha, angles.beta);
            return(GetArmByAngles(ref angles));
        }
Esempio n. 3
0
        private double E(int n)
        {
            double result         = 0;
            Angles t              = examples[n].angles;
            int    lastLayerIndex = perceptrons.Length - 1;

            GoForward(examples[n]);
            result += (Math.Pow(perceptrons[lastLayerIndex][0].sigmaX - t.alpha, 2));
            result += (Math.Pow(perceptrons[lastLayerIndex][1].sigmaX - t.beta, 2));

            return(result);
        }
Esempio n. 4
0
        private Arm GetArmByAngles(ref Angles a)
        {
            Arm arm = new Arm();

            Point initialElbow = new Point(0, Globals.MountPoint.Y - Globals.ArmLength);

            arm.elbow = RotatePoint(initialElbow, Globals.MountPoint, a.alpha);

            Point initialHand = new Point(0, Globals.MountPoint.Y - 2 * Globals.ArmLength);
            var   rotatedHand = RotatePoint(initialHand, Globals.MountPoint, a.alpha);

            arm.hand = RotatePoint(rotatedHand, arm.elbow, a.beta);

            return(arm);
        }
Esempio n. 5
0
 public Example(Point p)
 {
     point  = p;
     angles = new Angles(0, 0);
 }
Esempio n. 6
0
 public Example(double x, double y, double a, double b)
 {
     point  = new Point(x, y);
     angles = new Angles(a, b);
 }
Esempio n. 7
0
 public Example(double x, double y)
 {
     point  = new Point(x, y);
     angles = new Angles(Globals.Random.NextDouble() * 180, Globals.Random.NextDouble() * 180);
 }
Esempio n. 8
0
 private void NormalizeAngles(ref Angles a)
 {
     a.alpha = ((a.alpha / 180.0) * 0.8 + 0.1);
     a.beta  = ((a.beta / 180.0) * 0.8 + 0.1);
 }