1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-04 13:57:33 +02:00

smooth path

This commit is contained in:
Justin Lin
2020-01-23 10:31:37 +08:00
parent 5cfa5108d4
commit f18d5b69e1

View File

@@ -3,8 +3,7 @@ include <arc_path.scad>;
include <circle_path.scad>; include <circle_path.scad>;
include <path_extrude.scad>; include <path_extrude.scad>;
include <bezier_curve.scad>; include <bezier_curve.scad>;
include <polyline2d.scad>; include <hull_polyline2d.scad>;
include <line2d.scad>;
include <rotate_p.scad>; include <rotate_p.scad>;
include <bspline_curve.scad>; include <bspline_curve.scad>;
@@ -23,20 +22,19 @@ module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
module bottom() { module bottom() {
rotate(180) rotate(180)
rotate_extrude() { rotate_extrude() {
translate([radius1 + radius2, 0, 0]) ph1 = arc_path(radius = radius2, angle = [180, 360]);
polyline2d( ph2 = bezier_curve(t_step, [
arc_path(radius = radius2, angle = [180, 360])
,thickness
);
polyline2d(
bezier_curve(t_step, [
[radius1 + radius2 * 2, 0, 0], [radius1 + radius2 * 2, 0, 0],
[radius1 + radius2 * 2, bottom_height * 0.25, 0], [radius1 + radius2 * 2, bottom_height * 0.25, 0],
[radius1 + radius2 * 0.5, bottom_height * 0.5, 0], [radius1 + radius2 * 0.5, bottom_height * 0.5, 0],
[radius1, bottom_height * 0.75, 0], [radius1, bottom_height * 0.75, 0],
[radius1, bottom_height, 0] [radius1, bottom_height, 0]
]), ]);
path = concat([for(p = ph1) p + [radius1 + radius2, 0, 0]], ph2);
hull_polyline2d(
path,
thickness thickness
); );
} }
@@ -80,13 +78,13 @@ module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
union() { union() {
bottom(); bottom();
path_extrude( rotate(-90) path_extrude(
circle_path(radius1 + half_thickness), circle_path(radius1 + half_thickness),
tube_path tube_path
); );
} }
path_extrude( rotate(-90) path_extrude(
circle_path(radius1 - half_thickness), circle_path(radius1 - half_thickness),
tube_path2 tube_path2
); );