protected virtual void inc_create_part_of_fractal(AbcissOrdinateHandler p_aoh, _2DFractalHelper fractal_helper) { ulong iter_count = f_iterations_count, iteration; ulong[][] matrix = fractal_helper.CommonMatrix; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point, dist, pdist = 0D; double[][] Ratio_matrix = (double[][])fractal_helper.GetRatioMatrix(); int percent_length = fractal_helper.PercentLength, current_percent = percent_length; double[][] Radian_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; int height = ordinate_points.Length; double cosrad = Math.Cos(inc_rotater.Radian), sinrad = Math.Sin(inc_rotater.Radian); Triplex z = new Triplex(), z0 = new Triplex(), last_valid_z = new Triplex(); //new Complex(-0.8D, 0.156D)); for (; p_aoh.abciss < p_aoh.end_of_abciss; p_aoh.abciss++) { abciss_point = abciss_points[p_aoh.abciss]; Radian_matrix[p_aoh.abciss] = new double[height]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { z0.x = abciss_point; //-0.8D; z0.y = ordinate_points[p_aoh.ordinate]; //0.156D;// z0.z = 0D; inc_rotater.Rotate(z0); z.x = z0.x; z.y = z0.y; z.z = z0.z; dist = 0D; for (iteration = 0; iteration < iter_count && dist < 4D; iteration++) { pdist = dist; last_valid_z.x = z.x; last_valid_z.y = z.y; last_valid_z.z = z.z; z.tsqr(); z.tadd(z0); dist = (z.x * z.x + z.y * z.y + z.z * z.z); } Ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; matrix[p_aoh.abciss][p_aoh.ordinate] = iteration; Radian_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_z.y, last_valid_z.x) * cosrad + sinrad * Math.Atan2(last_valid_z.z, last_valid_z.x); } p_aoh.ordinate = 0; if ((--current_percent) == 0) { current_percent = percent_length; f_new_percent_in_parallel_activate(); } } }
protected virtual void _m_create_part_of_fractal(AbcissOrdinateHandler p_aoh, _2DFractalHelper fractal_helper) { ulong iter_count = f_iterations_count, iteration; ulong[][] matrix = fractal_helper.CommonMatrix; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point, dist, pdist = 0D; double[][] Ratio_matrix = (double[][])fractal_helper.GetRatioMatrix(); int percent_length = fractal_helper.PercentLength, current_percent = percent_length; Complex z = new Complex(), z0 = new Complex(), last_valid_z = new Complex(); double[][] Radian_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; int height = ordinate_points.Length; for (; p_aoh.abciss < p_aoh.end_of_abciss; p_aoh.abciss++) { abciss_point = abciss_points[p_aoh.abciss]; Radian_matrix[p_aoh.abciss] = new double[height]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { z0.Real = abciss_point; z0.Imagine = ordinate_points[p_aoh.ordinate]; z.Real = z0.Real; z.Imagine = z0.Imagine; dist = 0D; for (iteration = 0; iteration < iter_count && dist < 4D; iteration++) { pdist = dist; last_valid_z.Real = z.Real; last_valid_z.Imagine = z.Imagine; z.tsqr(); z.Real += z0.Real; z.Imagine += z0.Imagine; dist = (z.Real * z.Real + z.Imagine * z.Imagine); } Ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; matrix[p_aoh.abciss][p_aoh.ordinate] = iteration; Radian_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_z.Imagine, last_valid_z.Real); } p_aoh.ordinate = 0; if ((--current_percent) == 0) { current_percent = percent_length; f_new_percent_in_parallel_activate(); } } }
protected virtual void _j_create_part_of_fractal(AbcissOrdinateHandler p_aoh, _2DFractalHelper fractal_helper) { ulong max_iterations = f_iterations_count, iterations; ulong[][] result_matrix = fractal_helper.CommonMatrix; int percent_length = fractal_helper.PercentLength, percent_counter = percent_length, height; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point, dist, pdist = 0D, sqr; double[][] ratio_matrix = (double[][])fractal_helper.GetRatioMatrix(); Complex complex_iterator = new Complex(), last_valid_complex = new Complex(); double[][] radiad_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; height = ordinate_points.Length; for (; p_aoh.abciss < p_aoh.end_of_abciss; ++p_aoh.abciss) { abciss_point = abciss_points[p_aoh.abciss]; radiad_matrix[p_aoh.abciss] = new double[height]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { complex_iterator.Real = abciss_point; complex_iterator.Imagine = ordinate_points[p_aoh.ordinate]; dist = 0D; for (iterations = 0; dist < 4D && iterations < max_iterations; ++iterations) { pdist = dist; last_valid_complex.Real = complex_iterator.Real; last_valid_complex.Imagine = complex_iterator.Imagine; sqr = complex_iterator.Real * 2; complex_iterator.Real = complex_iterator.Real * complex_iterator.Real - complex_iterator.Imagine * complex_iterator.Imagine; complex_iterator.Imagine *= sqr; complex_iterator.Real += j_complex_const.Real; complex_iterator.Imagine += j_complex_const.Imagine; dist = (complex_iterator.Real * complex_iterator.Real + complex_iterator.Imagine * complex_iterator.Imagine); } result_matrix[p_aoh.abciss][p_aoh.ordinate] = iterations; ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; radiad_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_complex.Imagine, last_valid_complex.Real); } p_aoh.ordinate = 0; if ((--percent_counter) == 0) { percent_counter = percent_length; f_new_percent_in_parallel_activate(); } } }
protected unsafe override void _j_create_part_of_fractal(AbcissOrdinateHandler p_aoh, _2DFractalHelper fractal_helper) { ulong max_iterations = f_iterations_count, iterations; ulong[][] result_matrix = fractal_helper.CommonMatrix; int percent_length = fractal_helper.PercentLength, percent_counter = percent_length, height; double dist, pdist = 0D, sqr,abciss_interval_length=_2df_get_double_abciss_interval_length(), ordinate_interval_length=_2df_get_double_ordinate_interval_length(),abciss_start=_2df_get_double_abciss_start(), ordinate_start=_2df_get_double_ordinate_start(); double[][] ratio_matrix = fractal_helper.GetRatioMatrix(); Complex complex_iterator = new Complex(), last_valid_complex = new Complex(); double[][] radiad_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; height = fractal_helper.Height; int fcp_height=height / _ordinate_step_length + (height % _ordinate_step_length != 0 ? 1 : 0); FractalCloudPoint[][][] fcp_matrix = ((FractalCloudPoints)fractal_helper.GetUnique(typeof(FractalCloudPoints))).fractalCloudPoint; List<FractalCloudPoint> fcp_list = new List<FractalCloudPoint>(); FractalCloudPoint fcp; double* abciss_point,ordinate_point= fractal_helper.OrdinateRealPointer; abciss_point = fractal_helper.AbscissPointer + (p_aoh.abciss - 1); for (; p_aoh.abciss < p_aoh.end_of_abciss; ++p_aoh.abciss) { ++abciss_point; radiad_matrix[p_aoh.abciss] = new double[height]; if (p_aoh.abciss % _abciss_step_length == 0) fcp_matrix[p_aoh.abciss / _abciss_step_length] = new FractalCloudPoint[fcp_height][]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { complex_iterator.Real = *abciss_point; complex_iterator.Imagine = *(ordinate_point++); dist = 0D; iterations = 0; if (((p_aoh.abciss % _abciss_step_length) == 0) && ((p_aoh.ordinate % _ordinate_step_length) == 0)) { fcp_list.Clear(); for (; dist < 4D && iterations <= (ulong)_max_ammount_at_trace; ++iterations) { pdist = dist; last_valid_complex.Real = complex_iterator.Real; last_valid_complex.Imagine = complex_iterator.Imagine; sqr = complex_iterator.Real * 2; complex_iterator.Real = complex_iterator.Real * complex_iterator.Real - complex_iterator.Imagine * complex_iterator.Imagine; complex_iterator.Imagine *= sqr; complex_iterator.Real += j_complex_const.Real; complex_iterator.Imagine += j_complex_const.Imagine; dist = (complex_iterator.Real * complex_iterator.Real + complex_iterator.Imagine * complex_iterator.Imagine); fcp.AbcissLocation=(int)((complex_iterator.Real-abciss_start)/abciss_interval_length); fcp.OrdinateLocation = (int)((complex_iterator.Imagine - ordinate_start) / ordinate_interval_length); fcp_list.Add(fcp); } fcp_matrix[p_aoh.abciss / _abciss_step_length][p_aoh.ordinate / _ordinate_step_length] = fcp_list.ToArray(); } for (; dist < 4D && iterations < max_iterations; ++iterations) { pdist = dist; last_valid_complex.Real = complex_iterator.Real; last_valid_complex.Imagine = complex_iterator.Imagine; sqr = complex_iterator.Real * 2; complex_iterator.Real = complex_iterator.Real * complex_iterator.Real - complex_iterator.Imagine * complex_iterator.Imagine; complex_iterator.Imagine *= sqr; complex_iterator.Real += j_complex_const.Real; complex_iterator.Imagine += j_complex_const.Imagine; dist = (complex_iterator.Real * complex_iterator.Real + complex_iterator.Imagine * complex_iterator.Imagine); } result_matrix[p_aoh.abciss][p_aoh.ordinate] = iterations; ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; radiad_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_complex.Imagine, last_valid_complex.Real); } ordinate_point -= height; p_aoh.ordinate = 0; if ((--percent_counter) == 0) { percent_counter = percent_length; f_new_percent_in_parallel_activate(); } } }
protected virtual void inc_create_part_of_fractal(AbcissOrdinateHandler p_aoh,_2DFractalHelper fractal_helper) { ulong iter_count = f_iterations_count, iteration; ulong[][] matrix = fractal_helper.CommonMatrix; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point, dist, pdist = 0D; double[][] Ratio_matrix = (double[][])fractal_helper.GetRatioMatrix(); int percent_length = fractal_helper.PercentLength, current_percent = percent_length; double[][] Radian_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; int height = ordinate_points.Length; double cosrad = Math.Cos(inc_rotater.Radian),sinrad=Math.Sin(inc_rotater.Radian); Triplex z=new Triplex(), z0=(Triplex)inc_const.Clone(),last_valid_z=new Triplex(); inc_rotater.Rotate(z0); for (; p_aoh.abciss < p_aoh.end_of_abciss; p_aoh.abciss++) { abciss_point = abciss_points[p_aoh.abciss]; Radian_matrix[p_aoh.abciss] = new double[height]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { z.x = abciss_point; z.y = ordinate_points[p_aoh.ordinate]; z.z =0; inc_rotater.Rotate(z); dist = 0D; for (iteration = 0; iteration < iter_count && dist < 4D; iteration++) { pdist = dist; last_valid_z.x = z.x; last_valid_z.y = z.y; last_valid_z.z = z.z; z.tsqr(); z.tadd(z0); dist = (z.x * z.x + z.y * z.y + z.z * z.z); } Ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; matrix[p_aoh.abciss][p_aoh.ordinate] = iteration; Radian_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_z.y, last_valid_z.x) * cosrad + sinrad * Math.Atan2(last_valid_z.z, last_valid_z.x); } p_aoh.ordinate = 0; if ((--current_percent) == 0) { current_percent = percent_length; f_new_percent_in_parallel_activate(); } } }
unsafe protected override void _j_create_part_of_fractal(AbcissOrdinateHandler p_aoh, _2DFractalHelper fractal_helper) { ulong max_iterations = f_iterations_count, iterations; ulong[][] result_matrix = fractal_helper.CommonMatrix; int percent_length = fractal_helper.PercentLength, percent_counter = percent_length, height; double dist, pdist = 0D, sqr, abciss_interval_length = _2df_get_double_abciss_interval_length(), ordinate_interval_length = _2df_get_double_ordinate_interval_length(), abciss_start = _2df_get_double_abciss_start(), ordinate_start = _2df_get_double_ordinate_start(); double[][] ratio_matrix = fractal_helper.GetRatioMatrix(); Complex complex_iterator = new Complex(), last_valid_complex = new Complex(); double[][] radiad_matrix = ((RadianMatrix)fractal_helper.GetUnique(typeof(RadianMatrix))).Matrix; height = fractal_helper.Height; int fcp_height = height / _ordinate_step_length + (height % _ordinate_step_length != 0 ? 1 : 0); FractalCloudPoint[][][] fcp_matrix = ((FractalCloudPoints)fractal_helper.GetUnique(typeof(FractalCloudPoints))).fractalCloudPoint; List <FractalCloudPoint> fcp_list = new List <FractalCloudPoint>(); FractalCloudPoint fcp; double *abciss_point, ordinate_point = fractal_helper.OrdinateRealPointer; abciss_point = fractal_helper.AbscissPointer + (p_aoh.abciss - 1); for (; p_aoh.abciss < p_aoh.end_of_abciss; ++p_aoh.abciss) { ++abciss_point; radiad_matrix[p_aoh.abciss] = new double[height]; if (p_aoh.abciss % _abciss_step_length == 0) { fcp_matrix[p_aoh.abciss / _abciss_step_length] = new FractalCloudPoint[fcp_height][]; } for (; p_aoh.ordinate < p_aoh.end_of_ordinate; ++p_aoh.ordinate) { complex_iterator.Real = *abciss_point; complex_iterator.Imagine = *(ordinate_point++); dist = 0D; iterations = 0; if (((p_aoh.abciss % _abciss_step_length) == 0) && ((p_aoh.ordinate % _ordinate_step_length) == 0)) { fcp_list.Clear(); for (; dist < 4D && iterations <= (ulong)_max_ammount_at_trace; ++iterations) { pdist = dist; last_valid_complex.Real = complex_iterator.Real; last_valid_complex.Imagine = complex_iterator.Imagine; sqr = complex_iterator.Real * 2; complex_iterator.Real = complex_iterator.Real * complex_iterator.Real - complex_iterator.Imagine * complex_iterator.Imagine; complex_iterator.Imagine *= sqr; complex_iterator.Real += j_complex_const.Real; complex_iterator.Imagine += j_complex_const.Imagine; dist = (complex_iterator.Real * complex_iterator.Real + complex_iterator.Imagine * complex_iterator.Imagine); fcp.AbcissLocation = (int)((complex_iterator.Real - abciss_start) / abciss_interval_length); fcp.OrdinateLocation = (int)((complex_iterator.Imagine - ordinate_start) / ordinate_interval_length); fcp_list.Add(fcp); } fcp_matrix[p_aoh.abciss / _abciss_step_length][p_aoh.ordinate / _ordinate_step_length] = fcp_list.ToArray(); } for (; dist < 4D && iterations < max_iterations; ++iterations) { pdist = dist; last_valid_complex.Real = complex_iterator.Real; last_valid_complex.Imagine = complex_iterator.Imagine; sqr = complex_iterator.Real * 2; complex_iterator.Real = complex_iterator.Real * complex_iterator.Real - complex_iterator.Imagine * complex_iterator.Imagine; complex_iterator.Imagine *= sqr; complex_iterator.Real += j_complex_const.Real; complex_iterator.Imagine += j_complex_const.Imagine; dist = (complex_iterator.Real * complex_iterator.Real + complex_iterator.Imagine * complex_iterator.Imagine); } result_matrix[p_aoh.abciss][p_aoh.ordinate] = iterations; ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = pdist; radiad_matrix[p_aoh.abciss][p_aoh.ordinate] = Math.Atan2(last_valid_complex.Imagine, last_valid_complex.Real); } ordinate_point -= height; p_aoh.ordinate = 0; if ((--percent_counter) == 0) { percent_counter = percent_length; f_new_percent_in_parallel_activate(); } } }
private void Create_part_of_fractal(_2DFractalHelper fractal_helper,AbcissOrdinateHandler p_aoh) { ulong iterations; int percent_length=fractal_helper.PercentLength, current_percent=percent_length,trio_height; ulong[][] iter_matrix = fractal_helper.CommonMatrix; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point,ratio,lratio; double[][] Ratio_matrix = fractal_helper.GetRatioMatrix(); double[][][] trio_matrix = (double[][][])fractal_helper.GetUnique(typeof(double[][][])); double v1, v2, v3, v1total, v2total, v3total, v1min, v1max, v2min, v2max, v3min, v3max; Complex value=new Complex(), z=new Complex(); trio_height=Ratio_matrix[0].Length; for(;p_aoh.abciss<p_aoh.end_of_abciss;p_aoh.abciss++) { abciss_point = abciss_points[p_aoh.abciss]; trio_matrix[p_aoh.abciss] = new double[trio_height][]; for(;p_aoh.ordinate<p_aoh.end_of_ordinate;p_aoh.ordinate++) { z.Real=abciss_point; z.Imagine = ordinate_points[p_aoh.ordinate]; //z0 = z.getclone(); v1 = v2 = v3 = v1total = v1max = v1min = v2total = v2max = v2min = v3total = v3max = v3min = 0D; ratio = (z.Real * z.Real + z.Imagine * z.Imagine); lratio = 0; for(iterations=0;iterations<f_iterations_count&&ratio<400D;iterations++) { lratio = ratio; z = Complex.SSin(z); z.Real += _P.Real; z.Imagine += _P.Imagine; value = Complex.Sec(z); ratio = z.Real*z.Real+z.Imagine*z.Imagine; if (double.IsNaN(value.Real) || double.IsNaN(value.Imagine)) { v1 = v2 = v3 = 0; } else{v1 = value.abs; v2 = value.sqr().abs; v3 = value.Pow(3).abs; v1total += v1; v2total += v2; v3total += v3; if (v1 < v1min) v1min = v1; else if (v1 > v1max) v1max = v1; if (v2 < v2min) v2min = v2; else if (v2 > v2max) v2max = v2; if (v3 < v3min) v3min = v3; else if (v3 > v3max) v3max = v3;} } //$r = (($v1total / $count) - $v1min) / ($v1max - $v1min); Ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = lratio; if (iterations > 0) { trio_matrix[p_aoh.abciss][p_aoh.ordinate] = new double[] {((v1total/(double)iterations)-v1min)/(v1max-v1min), ((v2total/(double)iterations)-v2min)/(v2max-v2min), ((v3total/(double)iterations)-v3min)/(v3max-v3min)}; } else trio_matrix[p_aoh.abciss][p_aoh.ordinate] = new double[3]; iter_matrix[p_aoh.abciss][p_aoh.ordinate] = iterations; } p_aoh.ordinate = 0; if((--current_percent)==0) { current_percent = percent_length; f_new_percent_in_parallel_activate(); } } }
private void Create_part_of_fractal(_2DFractalHelper fractal_helper, AbcissOrdinateHandler p_aoh) { ulong iterations; int percent_length = fractal_helper.PercentLength, current_percent = percent_length, trio_height; ulong[][] iter_matrix = fractal_helper.CommonMatrix; double[] abciss_points = fractal_helper.AbcissRealValues, ordinate_points = fractal_helper.OrdinateRealValues; double abciss_point, ratio, lratio; double[][] Ratio_matrix = fractal_helper.GetRatioMatrix(); double[][][] trio_matrix = (double[][][])fractal_helper.GetUnique(typeof(double[][][])); double v1, v2, v3, v1total, v2total, v3total, v1min, v1max, v2min, v2max, v3min, v3max; Complex value = new Complex(), z = new Complex(); trio_height = Ratio_matrix[0].Length; for (; p_aoh.abciss < p_aoh.end_of_abciss; p_aoh.abciss++) { abciss_point = abciss_points[p_aoh.abciss]; trio_matrix[p_aoh.abciss] = new double[trio_height][]; for (; p_aoh.ordinate < p_aoh.end_of_ordinate; p_aoh.ordinate++) { z.Real = abciss_point; z.Imagine = ordinate_points[p_aoh.ordinate]; //z0 = z.getclone(); v1 = v2 = v3 = v1total = v1max = v1min = v2total = v2max = v2min = v3total = v3max = v3min = 0D; ratio = (z.Real * z.Real + z.Imagine * z.Imagine); lratio = 0; for (iterations = 0; iterations < f_iterations_count && ratio < 400D; iterations++) { lratio = ratio; z = Complex.SSin(z); z.Real += _P.Real; z.Imagine += _P.Imagine; value = Complex.Sec(z); ratio = z.Real * z.Real + z.Imagine * z.Imagine; if (double.IsNaN(value.Real) || double.IsNaN(value.Imagine)) { v1 = v2 = v3 = 0; } else { v1 = value.abs; v2 = value.sqr().abs; v3 = value.Pow(3).abs; v1total += v1; v2total += v2; v3total += v3; if (v1 < v1min) { v1min = v1; } else if (v1 > v1max) { v1max = v1; } if (v2 < v2min) { v2min = v2; } else if (v2 > v2max) { v2max = v2; } if (v3 < v3min) { v3min = v3; } else if (v3 > v3max) { v3max = v3; } } } //$r = (($v1total / $count) - $v1min) / ($v1max - $v1min); Ratio_matrix[p_aoh.abciss][p_aoh.ordinate] = lratio; if (iterations > 0) { trio_matrix[p_aoh.abciss][p_aoh.ordinate] = new double[] { ((v1total / (double)iterations) - v1min) / (v1max - v1min), ((v2total / (double)iterations) - v2min) / (v2max - v2min), ((v3total / (double)iterations) - v3min) / (v3max - v3min) }; } else { trio_matrix[p_aoh.abciss][p_aoh.ordinate] = new double[3]; } iter_matrix[p_aoh.abciss][p_aoh.ordinate] = iterations; } p_aoh.ordinate = 0; if ((--current_percent) == 0) { current_percent = percent_length; f_new_percent_in_parallel_activate(); } } }