Esempio n. 1
0
        public void ComputeApprox(double[] XValues, double[] YValues, int maxIterations, int[] curCounts)
        {
            for (int i = 0; i < curCounts.Length; i++)
            {
                curCounts[i] = 0;
            }

            int width  = XValues.Length;
            int height = YValues.Length;

            for (int yPtr = 1; yPtr < height - 1; yPtr += 3)
            {
                for (int xPtr = 1; xPtr < width - 1; xPtr += 3)
                {
                    ApCell cell = GetCell(xPtr, yPtr, XValues, YValues);
                    int[]  cnts = cell.Iterate3(maxIterations);

                    UpdateCnts(xPtr, yPtr, cnts, curCounts, XValues.Length);
                }
            }
        }
Esempio n. 2
0
        private ApCell GetCell(int x, int y, double[] XValues, double[] YValues)
        {
            DPoint refC = new DPoint(XValues[x], YValues[y]);

            ApDetail[] details = new ApDetail[8];

            details[0] = new ApDetail(refC - new DPoint(XValues[x - 1], YValues[y - 1]));
            details[1] = new ApDetail(refC - new DPoint(XValues[x], YValues[y - 1]));
            details[2] = new ApDetail(refC - new DPoint(XValues[x + 1], YValues[y - 1]));

            details[3] = new ApDetail(refC - new DPoint(XValues[x - 1], YValues[y]));
            details[4] = new ApDetail(refC - new DPoint(XValues[x + 1], YValues[y]));

            details[5] = new ApDetail(refC - new DPoint(XValues[x - 1], YValues[y + 1]));
            details[6] = new ApDetail(refC - new DPoint(XValues[x], YValues[y + 1]));
            details[7] = new ApDetail(refC - new DPoint(XValues[x + 1], YValues[y + 1]));

            ApCell result = new ApCell(refC, details);

            return(result);
        }