Esempio n. 1
0
 public override bool Compare(DominoDefinition dominoDefinition)
 {
     if ((dominoDefinition is PathDomino))
     {
         PathDomino d = dominoDefinition as PathDomino;
         if (!d.xCoordinates.SequenceEqual(this.xCoordinates) || !d.yCoordinates.SequenceEqual(this.yCoordinates))
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public override DominoDefinition TransformDefinition(float move_x, float move_y, int i, int j, int width, int height)
        {
            PathDomino d = new PathDomino();

            d.ProtocolDefinition = TransformProtocol(i, j, width, height);
            float[] xCoord = new float[xCoordinates.Length];
            float[] yCoord = new float[xCoordinates.Length];
            for (int k = 0; k < xCoordinates.Length; k++)
            {
                xCoord[k] = xCoordinates[k] + move_x;
                yCoord[k] = yCoordinates[k] + move_y;
            }
            d.xCoordinates = xCoord;
            d.yCoordinates = yCoord;
            return(d);
        }
Esempio n. 3
0
        private DominoDefinition GenerateDomino(int diameter, double angle, double domino_angle)
        {
            double     normal_angle = angle + domino_angle / 2;
            double     x1           = diameter / 2d * Math.Cos(angle);
            double     y1           = diameter / 2d * Math.Sin(angle);
            double     x2           = diameter / 2d * Math.Cos(angle + domino_angle);
            double     y2           = diameter / 2d * Math.Sin(angle + domino_angle);
            double     x4           = diameter / 2d * Math.Cos(angle) + Math.Cos(normal_angle) * domino_height;
            double     y4           = diameter / 2d * Math.Sin(angle) + Math.Sin(normal_angle) * domino_height;
            double     x3           = diameter / 2d * Math.Cos(angle + domino_angle) + Math.Cos(normal_angle) * domino_height;
            double     y3           = diameter / 2d * Math.Sin(angle + domino_angle) + Math.Sin(normal_angle) * domino_height;
            PathDomino d            = new PathDomino()
            {
                xCoordinates = new float[] { (float)x1, (float)x2, (float)x3, (float)x4 },
                yCoordinates = new float[] { (float)y1, (float)y2, (float)y3, (float)y4 }
            };

            return(d);
        }
Esempio n. 4
0
        public DominoDefinition CreateDomino(double theta)
        {
            double     normal_angle = GetTangentAngle(theta); // mal sehen ob das passt
            double     x1           = getPoint(theta).X + 0.5d * (double)domino_width * Math.Cos(0.5d * Math.PI - normal_angle) - 0.5d * (double)domino_height * Math.Cos(normal_angle);
            double     y1           = getPoint(theta).Y - 0.5d * (double)domino_width * Math.Sin(0.5d * Math.PI - normal_angle) - 0.5d * (double)domino_height * Math.Sin(normal_angle);
            double     x2           = x1 - (double)domino_width * Math.Cos(0.5d * Math.PI - normal_angle);
            double     y2           = y1 + (double)domino_width * Math.Sin(0.5d * Math.PI - normal_angle);
            double     x3           = x2 + Math.Cos(normal_angle) * (double)domino_height;
            double     y3           = y2 + Math.Sin(normal_angle) * (double)domino_height;
            double     x4           = x3 + (double)domino_width * Math.Cos(0.5d * Math.PI - normal_angle);
            double     y4           = y3 - (double)domino_width * Math.Sin(0.5d * Math.PI - normal_angle);
            PathDomino d            = new PathDomino()
            {
                xCoordinates = new float[] { (float)x1, (float)x2, (float)x3, (float)x4 },
                yCoordinates = new float[] { (float)y1, (float)y2, (float)y3, (float)y4 }
            };

            return(d);
        }