Esempio n. 1
0
        protected void CalcPoints(Color c)
        {
            float        A   = (float)parameters[0];
            float        B   = (float)parameters[6];
            DirectBitmap map = Map;

            deltaX = (1.0 * extremas.xmax - extremas.xmin);
            deltaY = (1.0 * extremas.ymax - extremas.ymin);
            PointF p0  = calcedPoints[0];
            double Xr0 = (int)(10 + (Map.Width - 20) * (p0.X - extremas.xmin) / deltaX);
            double Yr0 = (int)(10 + (Map.Height - 20) * (p0.Y - extremas.ymin) / deltaY);

            for (int i = 1; i < calcedPoints.Count; i++)
            {
                PointF p  = calcedPoints[i];
                double Xr = (int)(10 + (Map.Width - 20) * (p.X - extremas.xmin) / deltaX);
                double Yr = (int)(10 + (Map.Height - 20) * (p.Y - extremas.ymin) / deltaY);
                if (Yr < 0)
                {
                    Yr = 0;
                }
                if (Yr >= Map.Height)
                {
                    Yr = Map.Height - 1;
                }
                if (Math.Abs(Xr) >= Map.Width)
                {
                    Xr = Map.Width - 1;
                }
                map.SetLine((int)Xr0, (int)Yr0, (int)Xr, (int)Yr, Color.Black);
                Xr0 = Xr;
                Yr0 = Yr;
            }
        }
Esempio n. 2
0
        protected void CalcPoints(Color c)
        {
            float        A   = (float)parameters[0];
            float        B   = (float)parameters[6];
            DirectBitmap map = Map;
            //bol spiraal van Esscher: 2 schepen piraat <--> koopvaart

            double halfRoot2 = 1 / Math.Sqrt(2);
            double Q         = halfRoot2 * Math.Sqrt(1 - B * B);

            // Calculate the values.
            double deltaAlpha = Math.PI / 50;
            double xr0        = 0;
            double yr0        = 0;

            for (long N = -maxIterations / 2; N < maxIterations / 2; N++)
            {
                double S   = N * deltaAlpha;
                double Phi = Math.Atan(Math.Sinh(A * S));
                if (!spreadA)
                {
                    Phi = Math.Atan(A * S);
                }
                double X = Math.Cos(S) * Math.Cos(Phi);
                double Y = Math.Sin(S) * Math.Cos(Phi);
                double Z = Math.Sin(Phi);
                double U = halfRoot2 * (Y - X);
                double V = -Q * (Y + X) + B * Z;

                double Xr = (int)(10 + (Map.Width - 20) * (U - extremas.xmin) / deltaX);
                double Yr = (int)(10 + (Map.Height - 20) * (V - extremas.ymin) / deltaY);
                if (Yr < 0)
                {
                    Yr = 0;
                }
                if (Yr >= Map.Height)
                {
                    Yr = Map.Height - 1;
                }
                if (N == -maxIterations / 2)
                {
                    map.SetPixel((int)Xr, (int)Yr, Color.Black);
                }
                else
                {
                    map.SetPixel((int)Xr, (int)Yr, Color.Black);
                    map.SetLine(Xr, Yr, xr0, yr0, Color.Black);
                }
                xr0 = Xr;
                yr0 = Yr;
            }
        }