1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-07-31 20:10:36 +02:00

use path_scaling_sections

This commit is contained in:
Justin Lin
2021-11-14 18:36:23 +08:00
parent 2600504dd5
commit 884892a3f1
6 changed files with 8 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
use <shape_circle.scad>;
use <bezier_curve.scad>;
use <sweep.scad>;
use <rail_extruded_sections.scad>;
use <path_scaling_sections.scad>;
use <bijection_offset.scad>;
use <util/rand.scad>;
use <noise/nz_perlin2s.scad>;
@@ -36,7 +36,7 @@ module distorted_vase(beginning_radius, thickness, fn, amplitude,curve_step, smo
]);
sections = rail_extruded_sections(section, edge_path);
sections = path_scaling_sections(section, edge_path);
noise = perlin == 2 ? function(pts, seed) nz_perlin2s(pts, seed) :
function(pts, seed) nz_perlin3s(pts, seed);

View File

@@ -5,7 +5,7 @@ use <curve.scad>;
use <sweep.scad>;
use <shape_circle.scad>;
use <bezier_curve.scad>;
use <rail_extruded_sections.scad>;
use <path_scaling_sections.scad>;
use <noise/nz_perlin2s.scad>;
use <dragon_head.scad>;
use <dragon_scales.scad>;
@@ -103,7 +103,7 @@ module flame_mountain(beginning_radius, fn, amplitude,curve_step, smoothness) {
]);
sections = rail_extruded_sections(section, edge_path);
sections = path_scaling_sections(section, edge_path);
noise = function(pts, seed) nz_perlin2s(pts, seed);

View File

@@ -1,6 +1,6 @@
use <trim_shape.scad>;
use <bezier_curve.scad>;
use <rail_extruded_sections.scad>;
use <path_scaling_sections.scad>;
use <sweep.scad>;
use <ptf/ptf_rotate.scad>;
use <bijection_offset.scad>;
@@ -27,7 +27,7 @@ module superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist) {
function cal_sections(shapt_pts, edge_path, twist) =
let(
sects = rail_extruded_sections(shapt_pts, edge_path),
sects = path_scaling_sections(shapt_pts, edge_path),
leng = len(sects),
twist_step = twist / leng
)

View File

@@ -1,7 +1,7 @@
use <trim_shape.scad>;
use <bezier_curve.scad>;
use <shape_taiwan.scad>;
use <rail_extruded_sections.scad>;
use <path_scaling_sections.scad>;
use <sweep.scad>;
use <ptf/ptf_rotate.scad>;
use <bijection_offset.scad>;
@@ -19,7 +19,7 @@ module dancing_formosan(x1, x2, x3, y1, y2, y3, twist, t_step) {
function cal_sections(shapt_pts, edge_path, twist) =
let(
sects = rail_extruded_sections(shapt_pts, edge_path),
sects = path_scaling_sections(shapt_pts, edge_path),
leng = len(sects),
twist_step = twist / leng
)

View File

@@ -1,7 +1,6 @@
to_do:
- deprecate paths2sections(paths) -> rails2sections(rails)
- deprecate path_scaling_sections(shape_pts, edge_path) -> rail_extruded_sections(shape_pts, rail)
- deprecate hull_polyline2d, hull_polyline3d -> polyline_join
- deprecate shape_starburst, shape_pentagram -> shape_star
- deprecate starburst -> polyhedra/star

View File

@@ -1,32 +0,0 @@
/**
* rail_extruded_sections.scad
*
* @copyright Justin Lin, 2019
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-rail_extruded_sections.html
*
**/
use <util/reverse.scad>;
use <matrix/m_scaling.scad>;
function rail_extruded_sections(shape_pts, rail) =
let(
start_point = rail[0],
base_leng = norm(start_point),
scaling_matrice = [
for(p = rail)
let(s = norm([p[0], p[1], 0]) / base_leng)
m_scaling([s, s, 1])
],
leng_rail = len(rail)
)
reverse([
for(i = 0; i < leng_rail; i = i + 1)
[
for(p = shape_pts)
let(scaled_p = scaling_matrice[i] * [p[0], p[1], rail[i][2], 1])
[scaled_p[0], scaled_p[1], scaled_p[2]]
]
]);