mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 05:21:38 +02:00
add ptf_circle to preview
This commit is contained in:
@@ -172,6 +172,7 @@ See [examples](examples).
|
|||||||
- ptf/ptf_rotate
|
- ptf/ptf_rotate
|
||||||
- ptf/ptf_x_twist
|
- ptf/ptf_x_twist
|
||||||
- ptf/ptf_y_twist
|
- ptf/ptf_y_twist
|
||||||
|
- ptf/ptf_circle
|
||||||
- ptf/ptf_bend
|
- ptf/ptf_bend
|
||||||
- ptf/ptf_ring
|
- ptf/ptf_ring
|
||||||
- ptf/ptf_sphere
|
- ptf/ptf_sphere
|
||||||
|
@@ -16,15 +16,15 @@ module noisy_circle_maze(start, r_blocks, block_width, wall_thickness, origin_of
|
|||||||
walls = mz_walls(blocks, double_r_blocks, double_r_blocks, block_width);
|
walls = mz_walls(blocks, double_r_blocks, double_r_blocks, block_width);
|
||||||
|
|
||||||
half_width = width / 2;
|
half_width = width / 2;
|
||||||
offset = is_undef(origin_offset) ? [-half_width, -half_width] : origin_offset;
|
rect_size = is_undef(origin_offset) ? [width, width] : [width, width] - origin_offset * 2;
|
||||||
|
|
||||||
noisy_f = is_undef(noisy_factor) ? 1 : noisy_factor;
|
noisy_f = is_undef(noisy_factor) ? 1 : noisy_factor;
|
||||||
|
|
||||||
seed = rand(0, 256);
|
seed = rand(0, 256);
|
||||||
for(wall = walls) {
|
for(wall = walls) {
|
||||||
for(i = [0:len(wall) - 2]) {
|
for(i = [0:len(wall) - 2]) {
|
||||||
p0 = ptf_circle(wall[i], offset);
|
p0 = ptf_circle(rect_size, wall[i]);
|
||||||
p1 = ptf_circle(wall[i + 1], offset);
|
p1 = ptf_circle(rect_size, wall[i + 1]);
|
||||||
pn00 = pnoise2(p0[0], p0[1], seed) * noisy_f;
|
pn00 = pnoise2(p0[0], p0[1], seed) * noisy_f;
|
||||||
pn01 = pnoise2(p0[0] + seed, p0[1] + seed, seed) * noisy_f;
|
pn01 = pnoise2(p0[0] + seed, p0[1] + seed, seed) * noisy_f;
|
||||||
pn10 = pnoise2(p1[0], p1[1], seed) * noisy_f;
|
pn10 = pnoise2(p1[0], p1[1], seed) * noisy_f;
|
||||||
|
@@ -32,6 +32,7 @@ Preview
|
|||||||
- `ptf/ptf_rotate`
|
- `ptf/ptf_rotate`
|
||||||
- `ptf/ptf_x_twist`
|
- `ptf/ptf_x_twist`
|
||||||
- `ptf/ptf_y_twist`
|
- `ptf/ptf_y_twist`
|
||||||
|
- `ptf/ptf_circle`
|
||||||
- `ptf/ptf_bend`
|
- `ptf/ptf_bend`
|
||||||
- `ptf/ptf_ring`
|
- `ptf/ptf_ring`
|
||||||
- `ptf/ptf_sphere`
|
- `ptf/ptf_sphere`
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
function ptf_circle(point, offset) =
|
function ptf_circle(size, point) =
|
||||||
let(
|
let(
|
||||||
p = [point[0] + offset[1], point[1] + offset[0]],
|
p_offset = -size / 2,
|
||||||
|
p = [point[0] + p_offset[1], point[1] + p_offset[0]],
|
||||||
n = max(abs(p[0]), abs(p[1])),
|
n = max(abs(p[0]), abs(p[1])),
|
||||||
r = n * 1.414,
|
r = n * 1.414,
|
||||||
a = atan2(p[0], p[1])
|
a = atan2(p[0], p[1])
|
Reference in New Issue
Block a user