list-comprehension-demos
list-comprehension-demos copied to clipboard
Difference between sweep() and skin()
I have been testing the sweep() and skin() function, they are trully amazing. I am still confused about the difference between these two functions. Which is more suited for what? For example, here are two ways to do the same thing:
use <scad-utils/transformations.scad>
use <scad-utils/trajectory_path.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/shapes.scad>
use <skin.scad>
use <sweep.scad>
path_definition = [
trajectory(forward = 10, roll = 0),
trajectory(forward = 5*3.14159265359, pitch = 180),
trajectory(forward = 10, roll = 0)
];
// sweep
path = quantize_trajectories(path_definition, steps=100);
sweep(rectangle_profile([2,3]), path);
// skin
trans = [ for (i=[0:len(path)-1]) transform(path[i], rectangle_profile([2,3])) ];
translate([0,10,0])
skin(trans);
Is there any fundamental differences between these two methods? Do you recommend one of them for this kind of part?
I haven't looked at the code in the examples, but it's probably that sweep is for rigidly transformed profiles, and skin is for more plastic changes in profiles.
There's a discussion about the various ways to handle more general notions of extrusion where it came up.
https://github.com/openscad/openscad/issues/114
@jgrizou One primary difference is that skin() will be able to skin differently shaped layers, while sweep can only do linear transformations.
@jgrizou this is the difference
use <scad-utils/transformations.scad>
use <scad-utils/trajectory_path.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/shapes.scad>
use <list-comprehension-demo/skin.scad>
use <list-comprehension-demo/sweep.scad>
path_definition = [
trajectory(forward = 10, roll = 0),
trajectory(forward = 5*3.14159265359, pitch = 180),
trajectory(forward = 10, roll = 0)
];
// sweep
path = quantize_trajectories(path_definition, steps=100);
sweep(rectangle_profile([2,3]), path);
// skin
myLen = len(path)-1;
trans = [ for (i=[0:len(path)-1]) transform(path[i], rounded_rectangle_profile([4,4], i/myLen*2)) ];
translate([0,10,0])
skin(trans);
I cannot find rounded_rectangle_profile()... can someone point?
Probably that one: https://github.com/openscad/scad-utils/blob/26f8c2cf8124cdafe2fc21f9f9bbf2514e404834/shapes.scad#L7
Probably that one: https://github.com/openscad/scad-utils/blob/26f8c2cf8124cdafe2fc21f9f9bbf2514e404834/shapes.scad#L7
doesn't look rounded to me ; also, see line 16:
// FIXME: Move rectangle and rounded rectangle from extrusion