1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-24 15:22:53 +02:00

refactor deps

This commit is contained in:
Justin Lin
2020-01-27 10:18:36 +08:00
parent a2deee0784
commit 9be7582777
2 changed files with 24 additions and 94 deletions

View File

@@ -8,12 +8,11 @@
*
**/
include <__comm__/__nearest_multiple_of_4.scad>;
include <__comm__/__frags.scad>;
include <__comm__/__ra_to_xy.scad>;
include <__comm__/__edge_r.scad>;
include <__comm__/__shape_pie.scad>;
include <__comm__/__shape_arc.scad>;
use <__comm__/__nearest_multiple_of_4.scad>;
use <__comm__/__frags.scad>;
use <shape_arc.scad>;
use <shape_pie.scad>;
use <ring_extrude.scad>;
module crystal_ball(radius, theta = 360, phi = 180, thickness) {
phis = is_num(phi) ? [0, phi] : phi;
@@ -23,12 +22,12 @@ module crystal_ball(radius, theta = 360, phi = 180, thickness) {
angle = [90 - phis[1], 90 - phis[0]];
shape_pts = is_undef(thickness) ?
__shape_pie(
shape_pie(
radius,
angle ,
$fn = __nearest_multiple_of_4(frags)
) :
__shape_arc(
shape_arc(
radius,
angle,
width = thickness,

View File

@@ -1,89 +1,20 @@
include <unittest.scad>;
use <unittest.scad>;
use <crystal_ball.scad>;
include <rotate_p.scad>;
include <cross_sections.scad>;
include <polysections.scad>;
include <ring_extrude.scad>;
include <shape_pie.scad>;
module test_crystal_ball() {
module test_a_ball() {
echo("==== test_crystal_ball_a_ball ====");
include <crystal_ball.scad>;
module test_crystal_ball_pie(shape_pts) {
expected = [[0, 0], [0, -6], [1.8541, -5.7063], [3.5267, -4.8541], [4.8541, -3.5267], [5.7063, -1.8541], [6, 0], [5.7063, 1.8541], [4.8541, 3.5267], [3.5267, 4.8541], [1.8541, 5.7063], [0, 6]];
assertEqualPoints(expected, shape_pts);
}
crystal_ball(radius = 6);
}
module test_theta() {
echo("==== test_crystal_ball_theta ====");
include <crystal_ball.scad>;
module test_crystal_ball_pie(shape_pts) {
expected = [[0, 0], [0, -6], [3, -5.1962], [5.1962, -3], [6, 0], [5.1962, 3], [3, 5.1962], [0, 6]];
assertEqualPoints(expected, shape_pts);
}
crystal_ball(
radius = 6,
theta = 270,
$fn = 12
);
}
module test_phi() {
include <crystal_ball.scad>;
module test_crystal_ball_pie(shape_pts) {
echo("==== test_crystal_ball_phi ====");
expected = [[0, 0], [6, 0], [5.1962, 3], [3, 5.1962], [0, 6]];
assertEqualPoints(expected, shape_pts);
}
crystal_ball(
radius = 6,
theta = 270,
phi = 90,
$fn = 12
);
}
module test_theta_phi() {
echo("==== test_crystal_ball_theta_phi ====");
include <crystal_ball.scad>;
module test_crystal_ball_pie(shape_pts) {
expected = [[0, 0], [5.1392, 2.9671], [4.8541, 3.5267], [3.5267, 4.8541], [2.9671, 5.1392]];
assertEqualPoints(expected, shape_pts);
}
crystal_ball(
radius = 6,
theta = [-30, 270],
phi = [30, 60]
);
}
test_a_ball();
test_theta();
test_phi();
test_theta_phi();
module test_crystal_ball_pie(shape_pts) {
expected = [[0, 0], [5.1392, 2.9671], [4.8541, 3.5267], [3.5267, 4.8541], [2.9671, 5.1392]];
assertEqualPoints(expected, shape_pts);
}
test_crystal_ball();
module test_theta_phi() {
echo("==== test_crystal_ball_theta_phi ====");
crystal_ball(
radius = 6,
theta = [-30, 270],
phi = [30, 60]
);
}
test_theta_phi();