1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 09:44:16 +02:00

added messages

This commit is contained in:
Justin Lin
2017-05-25 11:48:02 +08:00
parent a93c824a5f
commit e6f96055cd
3 changed files with 16 additions and 2 deletions

View File

@@ -22,9 +22,19 @@ module rounded_square(size, corner_r, center = false) {
x = is_vt ? size[0] : size;
y = is_vt ? size[1] : size;
translate(center ? [0, 0] : [x / 2, y / 2]) polygon(__trapezium(
position = center ? [0, 0] : [x / 2, y / 2];
points = __trapezium(
length = x,
h = y,
round_r = corner_r
));
);
translate(position)
polygon(points);
// hook for testing
test_rounded_square(position, points);
}
module test_rounded_square(position, points) {
}

View File

@@ -1,6 +1,8 @@
include <unittest.scad>;
include <shape_ellipse.scad>;
echo("==== test_shape_ellipse ====");
expected = [[40, 0], [39.1259, 4.15823], [36.5418, 8.13473], [32.3607, 11.7557], [26.7652, 14.8629], [20, 17.3205], [12.3607, 19.0211], [4.18114, 19.8904], [-4.18114, 19.8904], [-12.3607, 19.0211], [-20, 17.3205], [-26.7652, 14.8629], [-32.3607, 11.7557], [-36.5418, 8.13473], [-39.1259, 4.15823], [-40, 0], [-39.1259, -4.15823], [-36.5418, -8.13473], [-32.3607, -11.7557], [-26.7652, -14.8629], [-20, -17.3205], [-12.3607, -19.0211], [-4.18114, -19.8904], [4.18114, -19.8904], [12.3607, -19.0211], [20, -17.3205], [26.7652, -14.8629], [32.3607, -11.7557], [36.5418, -8.13473], [39.1259, -4.15823]];
actual = shape_ellipse([40, 20]);

View File

@@ -1,6 +1,8 @@
include <unittest.scad>;
include <shape_square.scad>;
echo("==== test_shape_square ====");
expected = [[20, -25], [21.9471, -24.6053], [23.5868, -23.4835], [24.6602, -21.8118], [25, -20], [25, 20], [24.6053, 21.9471], [23.4835, 23.5868], [21.8118, 24.6602], [20, 25], [-20, 25], [-21.8118, 24.6602], [-23.4835, 23.5868], [-24.6053, 21.9471], [-25, 20], [-25, -20], [-24.6602, -21.8118], [-23.5868, -23.4835], [-21.9471, -24.6053], [-20, -25]];
actual = shape_square(size = 50, corner_r = 5);