mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-25 07:31:20 +02:00
refactor deps
This commit is contained in:
@@ -8,12 +8,11 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__comm__/__nearest_multiple_of_4.scad>;
|
use <__comm__/__nearest_multiple_of_4.scad>;
|
||||||
include <__comm__/__frags.scad>;
|
use <__comm__/__frags.scad>;
|
||||||
include <__comm__/__ra_to_xy.scad>;
|
use <shape_arc.scad>;
|
||||||
include <__comm__/__edge_r.scad>;
|
use <shape_pie.scad>;
|
||||||
include <__comm__/__shape_pie.scad>;
|
use <ring_extrude.scad>;
|
||||||
include <__comm__/__shape_arc.scad>;
|
|
||||||
|
|
||||||
module crystal_ball(radius, theta = 360, phi = 180, thickness) {
|
module crystal_ball(radius, theta = 360, phi = 180, thickness) {
|
||||||
phis = is_num(phi) ? [0, phi] : phi;
|
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]];
|
angle = [90 - phis[1], 90 - phis[0]];
|
||||||
|
|
||||||
shape_pts = is_undef(thickness) ?
|
shape_pts = is_undef(thickness) ?
|
||||||
__shape_pie(
|
shape_pie(
|
||||||
radius,
|
radius,
|
||||||
angle ,
|
angle ,
|
||||||
$fn = __nearest_multiple_of_4(frags)
|
$fn = __nearest_multiple_of_4(frags)
|
||||||
) :
|
) :
|
||||||
__shape_arc(
|
shape_arc(
|
||||||
radius,
|
radius,
|
||||||
angle,
|
angle,
|
||||||
width = thickness,
|
width = thickness,
|
||||||
|
@@ -1,89 +1,20 @@
|
|||||||
include <unittest.scad>;
|
use <unittest.scad>;
|
||||||
|
use <crystal_ball.scad>;
|
||||||
|
|
||||||
include <rotate_p.scad>;
|
module test_crystal_ball_pie(shape_pts) {
|
||||||
include <cross_sections.scad>;
|
expected = [[0, 0], [5.1392, 2.9671], [4.8541, 3.5267], [3.5267, 4.8541], [2.9671, 5.1392]];
|
||||||
include <polysections.scad>;
|
assertEqualPoints(expected, shape_pts);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user