1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 06:08:31 +01:00

will deprecate rotate_p

This commit is contained in:
Justin Lin 2020-03-24 17:31:32 +08:00
parent 55c9493fca
commit 2270f676c4
16 changed files with 47 additions and 39 deletions

View File

@ -1,5 +1,5 @@
use <__comm__/__fast_fibonacci.scad>;
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <shape_circle.scad>;
function _fast_fibonacci_sub(nth) =
@ -46,7 +46,7 @@ function _golden_spiral_from_ls_or_eql_to(from, to, point_distance, rt_dir) =
[
for(pt_a = _golden_spiral(from + 1, to, point_distance, rt_dir))
[
rotate_p(pt_a[0], [0, 0, 90 * rt_dir]) +
ptf_rotate(pt_a[0], [0, 0, 90 * rt_dir]) +
(rt_dir == 1 ? [0, -offset, 0] : [-offset, 0, 0]),
pt_a[1] + 90 * rt_dir
]

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <shape_pie.scad>;
use <bezier_curve.scad>;
@ -15,7 +15,7 @@ function _glued2circles_pie_curve(radius, centre_dist, tangent_angle) =
function _glued2circles_bezier(radius, centre_dist, tangent_angle, t_step, ctrl_p1) =
let(
ctrl_p = rotate_p([radius * tan(tangent_angle), -radius], tangent_angle),
ctrl_p = ptf_rotate([radius * tan(tangent_angle), -radius], tangent_angle),
ctrl_p2 = [-ctrl_p[0], ctrl_p[1]] + [centre_dist / 2, 0],
ctrl_p3 = [-ctrl_p2[0], ctrl_p2[1]],
ctrl_p4 = [-ctrl_p1[0], ctrl_p1[1]]

View File

@ -9,7 +9,7 @@
**/
use <__comm__/__to3d.scad>;
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
function cross_sections(shape_pts, path_pts, angles, twist = 0, scale = 1.0) =
let(
@ -29,8 +29,8 @@ function cross_sections(shape_pts, path_pts, angles, twist = 0, scale = 1.0) =
[
for(p = sh_pts)
let(scaled_p = [p[0] * (1 + scale_step_x * i), p[1] * (1 + scale_step_y * i), p[2]])
rotate_p(
rotate_p(scaled_p, twist_step * i)
ptf_rotate(
ptf_rotate(scaled_p, twist_step * i)
, angles[i]
) + pth_pts[i]
]

View File

@ -1,5 +1,5 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
function _default_region_size(points) =
let(
@ -20,6 +20,6 @@ function _cells_lt_before_intersection(shape, size, points, pt) =
)
[
for(sp = shape)
rotate_p(sp, a) + offset
ptf_rotate(sp, a) + offset
]
];

View File

@ -1,11 +1,11 @@
use <hull_polyline2d.scad>;
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <shape_square.scad>;
use <experimental/convex_intersection.scad>;
sq1 = shape_square(size = 10, corner_r = 3, $fn = 12);
sq2 = [for(p = sq1) rotate_p(p + [5, 0], 45)];
sq3 = [for(p = sq1) rotate_p(p + [5, 0], -45)];
sq2 = [for(p = sq1) ptf_rotate(p + [5, 0], 45)];
sq3 = [for(p = sq1) ptf_rotate(p + [5, 0], -45)];
intersection1 = convex_intersection(sq1, sq2);
intersection2 = convex_intersection(intersection1, sq3);

View File

@ -1,12 +1,12 @@
use <shape_starburst.scad>;
use <shape_circle.scad>;
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <experimental/loft.scad>;
sects = [
for(i = 10; i >= 4; i = i - 1)
[
for(p = shape_starburst(15, 12, i % 2 == 1 ? i : i - 1)) rotate_p([p[0], p[1], 5 * (i - 4)], i * 10)
for(p = shape_starburst(15, 12, i % 2 == 1 ? i : i - 1)) ptf_rotate([p[0], p[1], 5 * (i - 4)], i * 10)
]
];
loft(sects, slices = 3);

View File

@ -1,6 +1,7 @@
- deprecate `polysections`, use `sweep`.
- deprecate `trianglate`, use `tri_ear_clipping`.
- deprecate `circle_path`, `use circle_shape`.
- deprecate `circle_path`, use `circle_shape`.
- deprecate `rotate_p`, use `ptf_rotate`.
Category
@ -28,6 +29,13 @@ Preview
- `util/bsearch`
- `util/sort` supports `by = "vt"`
- `shape_circle`
- `ptf/ptf_rotate`
- `ptf/ptf_x_twist`
- `ptf/ptf_y_twist`
- `ptf/ptf_bend`
- `ptf/ptf_ring`
- `ptf/ptf_sphere`
- `ptf/ptf_torus`
Bugfixes:
- `helix_extrude`: wrong orientation when CLK

View File

@ -10,7 +10,7 @@
use <__comm__/__to3d.scad>;
use <__comm__/__angy_angz.scad>;
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <sweep.scad>;
use <matrix/m_rotation.scad>;
@ -32,7 +32,7 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
for(p = pts) [p[0] + t[0], p[1] + t[1], p[2] + t[2]]
];
function rotate_pts(pts, a, v) = [for(p = pts) rotate_p(p, a, v)];
function rotate_pts(pts, a, v) = [for(p = pts) ptf_rotate(p, a, v)];
scale_step_vt = is_num(scale) ?
let(s = (scale - 1) / len_path_pts_minus_one) [s, s, s] :
@ -173,9 +173,9 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
[
for(p = sh_pts)
let(scaled_p = [p[0] * (1 + scale_step_x * i), p[1] * (1 + scale_step_y * i), p[2]])
rotate_p(
rotate_p(
rotate_p(scaled_p, twist_step * i), [90, 0, -90]
ptf_rotate(
ptf_rotate(
ptf_rotate(scaled_p, twist_step * i), [90, 0, -90]
) + [i == 0 ? 0 : length, 0, 0],
[0, ay, az]
) + p1

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
use <ptf/ptf_y_twist.scad>;
/*
@ -14,4 +14,4 @@ function ptf_ring(size, point, radius, angle = 360, twist = 0) =
a_step = angle / yleng,
twisted = ptf_y_twist(size, point, twist)
)
rotate_p([radius + twisted[0], 0, twisted[2]], a_step * twisted[1]);
ptf_rotate([radius + twisted[0], 0, twisted[2]], a_step * twisted[1]);

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
/*
size: The size of the rectangle mapping to a sphere.
@ -18,6 +18,6 @@ function ptf_sphere(size, point, radius, angle = [180, 360]) =
za_step = za / ylen,
rza = za_step * y,
rzpt = [(radius + z) * cos(rza), (radius + z) * sin(rza), 0],
rxpt = rotate_p(rzpt, [90 - xa / xlen * x, 90, 0])
rxpt = ptf_rotate(rzpt, [90 - xa / xlen * x, 90, 0])
)
rxpt;

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
/*
size: The size of a rectangle.
@ -23,4 +23,4 @@ function ptf_torus(size, point, radius, angle = [360, 360], twist = 0) =
ya = 180 - x * ya_step + twa_step * y,
za = za_step * y
)
rotate_p([r * cos(ya) + R + r, 0, r * sin(ya)], za);
ptf_rotate([r * cos(ya) + R + r, 0, r * sin(ya)], za);

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
/*
size: The size of a rectangle.
@ -13,4 +13,4 @@ function ptf_x_twist(size, point, angle) =
a_step = angle / xlen,
y_centered = [point[0], point[1], is_undef(point[2]) ? 0 : point[2]] + [0, -y_offset, 0]
)
rotate_p(y_centered, [point[0] * a_step, 0, 0]) + [0, y_offset, 0];
ptf_rotate(y_centered, [point[0] * a_step, 0, 0]) + [0, y_offset, 0];

View File

@ -1,4 +1,4 @@
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
/*
size: The size of a rectangle.
@ -13,4 +13,4 @@ function ptf_y_twist(size, point, angle) =
a_step = angle / ylen,
x_centered = [point[0], point[1], is_undef(point[2]) ? 0 : point[2]] + [-x_offset, 0, 0]
)
rotate_p(x_centered, [0, point[1] * a_step, 0]) + [x_offset, 0, 0];
ptf_rotate(x_centered, [0, point[1] * a_step, 0]) + [x_offset, 0, 0];

View File

@ -8,7 +8,7 @@
*
**/
use <rotate_p.scad>;
use <ptf/ptf_rotate.scad>;
function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "SPI_DOWN", rt_dir = "CT_CLK") =
let(
@ -21,5 +21,5 @@ function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angl
za = (rt_dir == "CT_CLK" ? 1 : -1) * a,
ra = [0, ya, za]
)
[rotate_p([radius, 0, 0], ra), ra]
[ptf_rotate([radius, 0, 0], ra), ra]
];

View File

@ -17,7 +17,7 @@ include <test_bend.scad>;
include <test_along_with.scad>;
// Function
include <test_rotate_p.scad>;
include <test_ptf_rotate.scad>;
include <test_cross_sections.scad>;
include <test_paths2sections.scad>;
include <test_in_polyline.scad>;

File diff suppressed because one or more lines are too long