mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-24 23:25:51 +02:00
renamed parameters
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function _combi(r, n) =
|
function _combi(n, k) =
|
||||||
n == 0 ? 1 : (_combi(r, n - 1) * (r - n + 1) / n);
|
k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k);
|
||||||
|
|
||||||
function bezier_curve_coordinate(t, pn, n, i = 0) =
|
function bezier_curve_coordinate(t, pn, n, i = 0) =
|
||||||
i == n + 1 ? 0 :
|
i == n + 1 ? 0 :
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
include <hull_polyline3d.scad>;
|
|
||||||
|
include <line3d.scad>;
|
||||||
|
include <polyline3d.scad>;
|
||||||
include <bezier_curve.scad>;
|
include <bezier_curve.scad>;
|
||||||
include <bezier_surface.scad>;
|
include <bezier_surface.scad>;
|
||||||
include <function_grapher.scad>;
|
include <function_grapher.scad>;
|
||||||
@@ -14,53 +16,72 @@ ctrl_pts = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
g = bezier_surface(t_step, ctrl_pts);
|
g = bezier_surface(t_step, ctrl_pts);
|
||||||
function_grapher(g, thickness);
|
color("yellow") function_grapher(g, thickness);
|
||||||
|
width = 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
demo = "YES";
|
demo = "YES";
|
||||||
// demo
|
ani = "YES";
|
||||||
|
|
||||||
if(demo == "YES") {
|
if(demo == "YES") {
|
||||||
width = 2;
|
width = 2;
|
||||||
r = 3;
|
r = 3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pts = [
|
pts = [
|
||||||
for(i = [0:len(ctrl_pts) - 1])
|
for(i = [0:len(ctrl_pts) - 1])
|
||||||
bezier_curve(t_step, ctrl_pts[i])
|
bezier_curve(t_step, ctrl_pts[i])
|
||||||
];
|
];
|
||||||
|
|
||||||
// first bezier curve
|
if(ani == "YES") {
|
||||||
for(i = [0:len(ctrl_pts) - 1]) {
|
// first bezier curve
|
||||||
color("green") union() {
|
for(i = [0:len(ctrl_pts) - 1]) {
|
||||||
for(j = [0:len(ctrl_pts[i]) - 1]) {
|
color("green") union() {
|
||||||
translate(ctrl_pts[i][j])
|
for(j = [0:len(ctrl_pts[i]) - 1]) {
|
||||||
sphere(r = r);
|
translate(ctrl_pts[i][j])
|
||||||
|
sphere(r = r);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(j = [0:len(ctrl_pts[i]) - 1]) {
|
||||||
|
polyline3d(
|
||||||
|
ctrl_pts[i]
|
||||||
|
, width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j = [0:len(ctrl_pts[i]) - 1]) {
|
color("red")
|
||||||
hull_polyline3d(
|
polyline3d(
|
||||||
ctrl_pts[i]
|
bezier_curve(t_step, ctrl_pts[i]), width
|
||||||
, width);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
color("red")
|
step = len(g[0]);
|
||||||
hull_polyline3d(
|
echo(step);
|
||||||
bezier_curve(t_step, ctrl_pts[i]), width
|
|
||||||
);
|
// second bezier curve
|
||||||
|
ctrl_pts2 = [for(i = [0:len(pts) - 1]) pts[i][$t * step]];
|
||||||
|
color("blue") union() {
|
||||||
|
for(pt = ctrl_pts2) {
|
||||||
|
translate(pt)
|
||||||
|
sphere(r = r);
|
||||||
|
}
|
||||||
|
polyline3d(ctrl_pts2, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
color("black")
|
||||||
|
polyline3d(g[$t * step], width);
|
||||||
|
} else {
|
||||||
|
// first bezier curve
|
||||||
|
for(i = [0:len(ctrl_pts) - 1]) {
|
||||||
|
color("green") union() {
|
||||||
|
for(j = [0:len(ctrl_pts[i]) - 1]) {
|
||||||
|
translate(ctrl_pts[i][j])
|
||||||
|
sphere(r = r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color("green") function_grapher(ctrl_pts, width, style = "LINES");
|
||||||
}
|
}
|
||||||
|
|
||||||
step = len(g[0]);
|
|
||||||
echo(step);
|
|
||||||
|
|
||||||
// second bezier curve
|
|
||||||
ctrl_pts2 = [for(i = [0:len(pts) - 1]) pts[i][$t * step]];
|
|
||||||
color("blue") union() {
|
|
||||||
for(pt = ctrl_pts2) {
|
|
||||||
translate(pt)
|
|
||||||
sphere(r = r);
|
|
||||||
}
|
|
||||||
hull_polyline3d(ctrl_pts2, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
color("black")
|
|
||||||
hull_polyline3d(g[$t * step], width);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user