Skip to content

Instantly share code, notes, and snippets.

@behreajj
Last active March 7, 2019 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save behreajj/b8075a5ba9a687e35ae977af9a1a0efb to your computer and use it in GitHub Desktop.
Save behreajj/b8075a5ba9a687e35ae977af9a1a0efb to your computer and use it in GitHub Desktop.
Julia
def julia(seed=Vector((-0.8, 0.156, 0.0)),
points=[],
exponent=Vector((2.0, 0.0, 0.0)),
iterations=32,
exclude_upper=False):
results = []
for point in points:
result = julia_step(
seed=seed,
z=point,
exponent=exponent,
iterations=iterations,
exclude_upper=exclude_upper)
results.append(result)
return results
def cube_julia(count=32,
collection=context.collection,
name='Julia',
material=None,
min_corner=Vector((-0.5, -0.5, 0.0)),
max_corner=Vector((0.5, 0.5, 0.0)),
seed=Vector((-0.8, 0.156, 0.0)),
exponent=Vector((2.0, 0.0, 0.0)),
iterations=32,
exclude_upper_julia=False,
fractal_offset=Vector((0.0, 0.0, 0.0)),
fractal_scale=2.75,
prune_cubes=True,
prune_lower_bound=0.05,
prune_upper_bound=1.0,
min_cube_size=0.1,
max_cube_size=0.9,
cube_pivot=Vector((0.0, 0.0, -0.5)),
easing_func=float_lerp):
grid = gen_2d_grid(
count=count,
offset=fractal_offset,
scale=fractal_scale,
min_corner=min_corner,
max_corner=max_corner)
w = grid['width']
h = grid['height']
points = grid['points']
dimensions = Vector((w, h, (w + h) * 0.5)) / count
results = julia(
seed=seed,
points=points,
exponent=exponent,
iterations=iterations,
exclude_upper=exclude_upper_julia)
return visualize_fractal(
collection=collection,
name=name,
material=material,
results=results,
fractal_center=fractal_offset,
fractal_scale=fractal_scale,
prune_cubes=prune_cubes,
prune_lower_bound=prune_lower_bound,
prune_upper_bound=prune_upper_bound,
cube_pivot=cube_pivot,
cube_size=dimensions,
min_cube_size=min_cube_size,
max_cube_size=max_cube_size,
easing_func=easing_func)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment