Skip to content

Commit

Permalink
Drop Field FractalSpecific::is_integer
Browse files Browse the repository at this point in the history
Drop unused integer fractal functions

Fixes #244
  • Loading branch information
LegalizeAdulthood committed Feb 9, 2025
1 parent 3bd0f39 commit cafcaec
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 1,765 deletions.
4 changes: 2 additions & 2 deletions libid/engine/calc_frac_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ void calc_frac_init() // initialize a *pile* of stuff for fractal calculation
}

// match Julibrot with integer mode of orbit
if (g_fractal_type == FractalType::JULIBROT && get_fractal_specific(g_new_orbit_type)->is_integer == 0)
if (g_fractal_type == FractalType::JULIBROT)
{
set_fractal_type(FractalType::JULIBROT_FP);
}

assert(g_cur_fractal_specific == get_fractal_specific(g_fractal_type));
g_cur_fractal_specific = get_fractal_specific(g_fractal_type);

g_integer_fractal = g_cur_fractal_specific->is_integer;
g_integer_fractal = 0;

if (g_potential_flag && g_potential_params[2] != 0.0)
{
Expand Down
7 changes: 0 additions & 7 deletions libid/engine/fractals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ int pow(LComplex *base, int exp, LComplex *result, int bit_shift)
return g_overflow;
}

int julia_fractal()
{
g_l_new_z.x = g_l_temp_sqr_x - g_l_temp_sqr_y + g_long_param->x;
g_l_new_z.y = multiply(g_l_old_z.x, g_l_old_z.y, g_bit_shift_less_1) + g_long_param->y;
return g_bailout_long();
}

int julia_fp_fractal()
{
g_new_z.x = g_temp_sqr_x - g_temp_sqr_y + g_float_param->x;
Expand Down
114 changes: 2 additions & 112 deletions libid/fractals/fractalp.cpp

Large diffs are not rendered by default.

156 changes: 0 additions & 156 deletions libid/fractals/frasetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,162 +389,6 @@ julia_fp_setup()
return true;
}

bool
mandel_long_setup()
{
g_fudge_half = g_fudge_factor/2;
g_c_exponent = (int)g_params[2];
if (g_fractal_type == FractalType::MARKS_MANDEL && g_c_exponent < 1)
{
g_c_exponent = 1;
g_params[2] = 1;
}
if ((g_fractal_type == FractalType::MARKS_MANDEL && !(g_c_exponent & 1))
|| (g_fractal_type == FractalType::MANDEL_Z_POWER_L && (g_c_exponent & 1)))
{
g_symmetry = SymmetryType::XY_AXIS_NO_PARAM; // odd exponents
}
if ((g_fractal_type == FractalType::MARKS_MANDEL && (g_c_exponent & 1)) ||
g_fractal_type == FractalType::LAMBDA_TRIG_FP)
{
g_symmetry = SymmetryType::X_AXIS_NO_PARAM;
}
if (g_fractal_type == FractalType::SPIDER && g_periodicity_check == 1)
{
g_periodicity_check = 4;
}
g_long_param = &g_l_init;
if (g_fractal_type == FractalType::MANDEL_Z_POWER_L)
{
if (g_params[3] == 0.0 && g_debug_flag != DebugFlags::FORCE_COMPLEX_POWER && (double)g_c_exponent == g_params[2])
{
get_fractal_specific(g_fractal_type)->orbit_calc = long_z_power_fractal;
}
else
{
get_fractal_specific(g_fractal_type)->orbit_calc = long_cmplx_z_power_fractal;
}
if (g_params[3] != 0 || (double)g_c_exponent != g_params[2])
{
g_symmetry = SymmetryType::NONE;
}
}
if ((g_fractal_type == FractalType::MAN_TRIG_PLUS_EXP_L) || (g_fractal_type == FractalType::MAN_TRIG_PLUS_Z_SQRD_L))
{
if (g_param_z1.y == 0.0)
{
g_symmetry = SymmetryType::X_AXIS;
}
else
{
g_symmetry = SymmetryType::NONE;
}
if ((g_trig_index[0] == TrigFn::LOG) || (g_trig_index[0] == TrigFn::FLIP))
{
g_symmetry = SymmetryType::NONE;
}
}
if (g_fractal_type == FractalType::TIMS_ERROR)
{
if (g_trig_index[0] == TrigFn::FLIP)
{
g_symmetry = SymmetryType::NONE;
}
}
if (g_fractal_type == FractalType::MARKS_MANDEL_PWR)
{
if (g_trig_index[0] == TrigFn::FLIP)
{
g_symmetry = SymmetryType::NONE;
}
}
return true;
}

bool
julia_long_setup()
{
g_c_exponent = (int)g_params[2];
g_long_param = &g_l_param;
switch (g_fractal_type)
{
case FractalType::JULIA_Z_POWER_L:
if ((g_c_exponent & 1) || g_params[3] != 0.0 || (double)g_c_exponent != g_params[2])
{
g_symmetry = SymmetryType::NONE;
}
if (g_params[3] == 0.0 && g_debug_flag != DebugFlags::FORCE_COMPLEX_POWER && (double)g_c_exponent == g_params[2])
{
get_fractal_specific(g_fractal_type)->orbit_calc = long_z_power_fractal;
}
else
{
get_fractal_specific(g_fractal_type)->orbit_calc = long_cmplx_z_power_fractal;
}
break;
case FractalType::LAMBDA:
get_julia_attractor(0.0, 0.0); // another attractor?
get_julia_attractor(0.5, 0.0); // another attractor?
break;
case FractalType::MANDEL_TRIG:
if (g_l_param.y == 0)
{
g_symmetry = SymmetryType::X_AXIS;
}
break;
case FractalType::JUL_TRIG_PLUS_EXP_L:
case FractalType::JUL_TRIG_PLUS_Z_SQRD_L:
if (g_param_z1.y == 0.0)
{
g_symmetry = SymmetryType::X_AXIS;
}
else
{
g_symmetry = SymmetryType::NONE;
}
if ((g_trig_index[0] == TrigFn::LOG) || (g_trig_index[0] == TrigFn::FLIP))
{
g_symmetry = SymmetryType::NONE;
}
get_julia_attractor(0.0, 0.0); // another attractor?
break;
case FractalType::POPCORN_L:
case FractalType::POPCORN_JUL_L:
{
bool default_functions = false;
if (g_trig_index[0] == TrigFn::SIN
&& g_trig_index[1] == TrigFn::TAN
&& g_trig_index[2] == TrigFn::SIN
&& g_trig_index[3] == TrigFn::TAN
&& std::abs(g_param_z2.x - 3.0) < .0001
&& g_param_z2.y == 0
&& g_param_z1.y == 0)
{
default_functions = true;
if (g_fractal_type == FractalType::POPCORN_JUL_L)
{
g_symmetry = SymmetryType::ORIGIN;
}
}
if (default_functions && g_debug_flag == DebugFlags::FORCE_REAL_POPCORN)
{
g_cur_fractal_specific->orbit_calc = long_popcorn_fractal;
}
else
{
g_cur_fractal_specific->orbit_calc = long_popcorn_fractal_fn;
}
get_julia_attractor(0.0, 0.0); // another attractor?
break;
}

default:
get_julia_attractor(0.0, 0.0); // another attractor?
break;
}
return true;
}

bool
standard_setup()
{
Expand Down
55 changes: 0 additions & 55 deletions libid/fractals/jb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,61 +139,6 @@ bool julibrot_setup()
s_jb_fp.left_eye.zy = s_jb_fp.right_eye.zy;
s_b_base = 128;

if (get_fractal_specific(g_fractal_type)->is_integer > 0)
{
if (get_fractal_specific(g_new_orbit_type)->is_integer == 0)
{
stop_msg("Julibrot orbit type isinteger mismatch");
}
if (get_fractal_specific(g_new_orbit_type)->is_integer > 1)
{
g_bit_shift = get_fractal_specific(g_new_orbit_type)->is_integer;
}
s_fg = (double)(1L << g_bit_shift);
s_fg16 = (double)(1L << 16);
long j_x_min = (long) (g_x_min * s_fg);
long j_x_max = (long) (g_x_max * s_fg);
s_jb.x_offset = (j_x_max + j_x_min) / 2; // Calculate average
long j_y_min = (long) (g_y_min * s_fg);
long j_y_max = (long) (g_y_max * s_fg);
s_jb.y_offset = (j_y_max + j_y_min) / 2; // Calculate average
s_mx_min = (long)(g_julibrot_x_min * s_fg);
long m_x_max = (long) (g_julibrot_x_max * s_fg);
s_my_min = (long)(g_julibrot_y_min * s_fg);
long m_y_max = (long) (g_julibrot_y_max * s_fg);
long origin = (long)(g_julibrot_origin_fp * s_fg16);
s_depth = (long)(g_julibrot_depth_fp * s_fg16);
s_width = (long)(g_julibrot_width_fp * s_fg16);
s_dist = (long)(g_julibrot_dist_fp * s_fg16);
s_eyes = (long)(g_eyes_fp * s_fg16);
s_br_ratio = (long)(s_br_ratio_fp * s_fg16);
s_jb.delta_mx = (m_x_max - s_mx_min) / g_julibrot_z_dots;
s_jb.delta_my = (m_y_max - s_my_min) / g_julibrot_z_dots;
g_long_param = &s_jb.jb_c;

s_jb.x_per_inch = (long)((g_x_min - g_x_max) / g_julibrot_width_fp * s_fg);
s_jb.y_per_inch = (long)((g_y_max - g_y_min) / g_julibrot_height_fp * s_fg);
s_jb.inch_per_x_dot = (long)((g_julibrot_width_fp / g_logical_screen_x_dots) * s_fg16);
s_jb.inch_per_y_dot = (long)((g_julibrot_height_fp / g_logical_screen_y_dots) * s_fg16);
s_jb.init_z = origin - (s_depth / 2);
if (g_julibrot_3d_mode == Julibrot3DMode::MONOCULAR)
{
s_jb.right_eye.x = 0L;
}
else
{
s_jb.right_eye.x = s_eyes / 2;
}
s_jb.left_eye.x = -s_jb.right_eye.x;
s_jb.right_eye.y = 0L;
s_jb.left_eye.y = s_jb.right_eye.y;
s_jb.right_eye.zx = s_dist;
s_jb.left_eye.zx = s_jb.right_eye.zx;
s_jb.right_eye.zy = s_dist;
s_jb.left_eye.zy = s_jb.right_eye.zy;
s_b_base = (int)(128.0 * s_br_ratio_fp);
}

if (g_julibrot_3d_mode == Julibrot3DMode::RED_BLUE)
{
g_save_dac = 0;
Expand Down
78 changes: 10 additions & 68 deletions libid/fractals/lambda_fn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,54 +170,25 @@ static int lambda_exponent_fractal()

bool lambda_trig_setup()
{
bool const is_integer = g_cur_fractal_specific->is_integer != 0;
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal;
switch (g_trig_index[0])
{
case TrigFn::SIN:
case TrigFn::COSXX:
case TrigFn::COS:
g_symmetry = SymmetryType::PI_SYM;
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal1;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal1;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal1;
break;
case TrigFn::SINH:
case TrigFn::COSH:
g_symmetry = SymmetryType::ORIGIN;
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal2;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal2;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal2;
break;
case TrigFn::SQR:
g_symmetry = SymmetryType::ORIGIN;
break;
case TrigFn::EXP:
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = long_lambda_exponent_fractal;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_exponent_fractal;
}
g_cur_fractal_specific->orbit_calc = lambda_exponent_fractal;
g_symmetry = SymmetryType::NONE;
break;
case TrigFn::LOG:
Expand All @@ -228,55 +199,26 @@ bool lambda_trig_setup()
break;
}
get_julia_attractor(0.0, 0.0); // an attractor?
return is_integer ? julia_long_setup() : julia_fp_setup();
return julia_fp_setup();
}

bool mandel_trig_setup()
{
bool const is_integer = g_cur_fractal_specific->is_integer != 0;
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal;
g_symmetry = SymmetryType::XY_AXIS_NO_PARAM;
switch (g_trig_index[0])
{
case TrigFn::SIN:
case TrigFn::COSXX:
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal1;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal1;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal1;
break;
case TrigFn::SINH:
case TrigFn::COSH:
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fractal2;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal2;
}
g_cur_fractal_specific->orbit_calc = lambda_trig_fp_fractal2;
break;
case TrigFn::EXP:
g_symmetry = SymmetryType::X_AXIS_NO_PARAM;
if (is_integer)
{
g_cur_fractal_specific->orbit_calc = long_lambda_exponent_fractal;
}
else
{
g_cur_fractal_specific->orbit_calc = lambda_exponent_fractal;
}
g_cur_fractal_specific->orbit_calc = lambda_exponent_fractal;
break;
case TrigFn::LOG:
g_symmetry = SymmetryType::X_AXIS_NO_PARAM;
Expand All @@ -285,5 +227,5 @@ bool mandel_trig_setup()
g_symmetry = SymmetryType::XY_AXIS_NO_PARAM;
break;
}
return is_integer ? mandel_long_setup() : mandel_fp_setup();
return mandel_fp_setup();
}
Loading

0 comments on commit cafcaec

Please sign in to comment.