mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 17:24:20 +02:00
refactor: vt operation
This commit is contained in:
@@ -8,25 +8,13 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
use <util/reverse.scad>;
|
|
||||||
use <matrix/m_scaling.scad>;
|
|
||||||
|
|
||||||
function path_scaling_sections(shape_pts, edge_path) =
|
function path_scaling_sections(shape_pts, edge_path) =
|
||||||
let(
|
let(base_leng = norm(edge_path[0]))
|
||||||
start_point = edge_path[0],
|
|
||||||
base_leng = norm(start_point),
|
|
||||||
scaling_matrice = [
|
|
||||||
for(p = edge_path)
|
|
||||||
let(s = norm([p.x, p.y, 0]) / base_leng)
|
|
||||||
m_scaling([s, s, 1])
|
|
||||||
],
|
|
||||||
leng_edge_path = len(edge_path)
|
|
||||||
)
|
|
||||||
reverse([
|
|
||||||
for(i = 0; i < leng_edge_path; i = i + 1)
|
|
||||||
[
|
[
|
||||||
for(p = shape_pts)
|
for(i = [len(edge_path) - 1:-1:0])
|
||||||
let(scaled_p = scaling_matrice[i] * [p.x, p.y, edge_path[i].z, 1])
|
let(edge_p = edge_path[i], s = norm([edge_p.x, edge_p.y] / base_leng))
|
||||||
[scaled_p.x, scaled_p.y, scaled_p.z]
|
[
|
||||||
|
for(p = shape_pts * s)
|
||||||
|
[p.x, p.y, edge_p.z]
|
||||||
]
|
]
|
||||||
]);
|
];
|
Reference in New Issue
Block a user