mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-20 06:02:05 +02:00
changed parameter name
This commit is contained in:
parent
35e781f329
commit
a6edd169c1
@ -14,7 +14,7 @@ Returns shape points of an isosceles trapezoid. They can be used with xxx_extrud
|
||||
include <shape_trapezium.scad>;
|
||||
|
||||
polygon(
|
||||
shape_trapezium([20, 10],
|
||||
shape_trapezium([40, 20],
|
||||
h = 20,
|
||||
corner_r = 2)
|
||||
);
|
||||
@ -31,7 +31,7 @@ Returns shape points of an isosceles trapezoid. They can be used with xxx_extrud
|
||||
width = 2;
|
||||
|
||||
shape_pts = shape_trapezium(
|
||||
[20, 10],
|
||||
[40, 20],
|
||||
h = 20,
|
||||
corner_r = 2
|
||||
);
|
||||
|
@ -1,20 +1,18 @@
|
||||
function __half_trapezium(radius, h, round_r) =
|
||||
function __half_trapezium(length, h, round_r) =
|
||||
let(
|
||||
is_vt = __is_vector(radius),
|
||||
r1 = is_vt ? radius[0] : radius,
|
||||
r2 = is_vt ? radius[1] : radius,
|
||||
is_vt = __is_vector(length),
|
||||
l1 = is_vt ? length[0] : length,
|
||||
l2 = is_vt ? length[1] : length,
|
||||
frags = __frags(round_r),
|
||||
b_ang = atan2(h, r1 - r2),
|
||||
b_ang = atan2(h, l1 - l2),
|
||||
b_sector_angle = 180 - b_ang,
|
||||
b_leng = r1 - round_r / tan(b_ang / 2),
|
||||
b_leng = l1 - round_r / tan(b_ang / 2),
|
||||
b_round_frags = frags * b_sector_angle / 360,
|
||||
b_end_angle = -90 + b_sector_angle,
|
||||
t_sector_angle = b_ang,
|
||||
t_leng = r2 - round_r * tan(t_sector_angle / 2),
|
||||
t_leng = l2 - round_r * tan(t_sector_angle / 2),
|
||||
t_round_frags = frags * t_sector_angle / 360,
|
||||
|
||||
half_h = h / 2,
|
||||
|
||||
br_corner = [
|
||||
for(pt = __pie_for_rounding(round_r, -90, b_end_angle, b_round_frags))
|
||||
[pt[0] + b_leng, pt[1] + round_r - half_h]
|
||||
|
@ -1,6 +1,6 @@
|
||||
function __trapezium(radius, h, round_r) =
|
||||
function __trapezium(length, h, round_r) =
|
||||
let(
|
||||
r_half_trapezium = __half_trapezium(radius, h, round_r),
|
||||
r_half_trapezium = __half_trapezium(length / 2, h, round_r),
|
||||
to = len(r_half_trapezium) - 1,
|
||||
l_half_trapezium = [
|
||||
for(i = [0:to])
|
||||
|
@ -21,12 +21,9 @@ module rounded_square(size, corner_r, center = false) {
|
||||
is_vt = __is_vector(size);
|
||||
x = is_vt ? size[0] : size;
|
||||
y = is_vt ? size[1] : size;
|
||||
|
||||
half_x = x / 2;
|
||||
half_y = y / 2;
|
||||
|
||||
translate(center ? [0, 0] : [half_x, half_y]) polygon(__trapezium(
|
||||
radius = half_x,
|
||||
translate(center ? [0, 0] : [x / 2, y / 2]) polygon(__trapezium(
|
||||
length = x,
|
||||
h = y,
|
||||
round_r = corner_r
|
||||
));
|
||||
|
@ -25,7 +25,7 @@ function shape_square(size, corner_r = 0) =
|
||||
y = is_vt ? size[1] : size
|
||||
)
|
||||
__trapezium(
|
||||
radius = x / 2,
|
||||
length = x,
|
||||
h = y,
|
||||
round_r = corner_r
|
||||
);
|
||||
|
@ -18,9 +18,9 @@ include <__private__/__pie_for_rounding.scad>;
|
||||
include <__private__/__half_trapezium.scad>;
|
||||
include <__private__/__trapezium.scad>;
|
||||
|
||||
function shape_trapezium(radius, h, corner_r = 0) =
|
||||
function shape_trapezium(length, h, corner_r = 0) =
|
||||
__trapezium(
|
||||
radius = radius,
|
||||
length = length,
|
||||
h = h,
|
||||
round_r = corner_r
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user