list-comprehension-demos icon indicating copy to clipboard operation
list-comprehension-demos copied to clipboard

Smoother augment_profile

Open jacekkopecky opened this issue 6 years ago • 4 comments

augment_profile in skin.scad inserts new vertices in a profile so that the result has a given number of vertices. Currently, the order of insertions is not specified, and in some cases the new vertices cause distortion.

This profile (in context of extrusion.scad) demonstrates the issue: the cylinder is visibly distorted:

// profiles that have different vertex counts
skin([
	transform(translation([0,0,0]), circle($fn=70,r=1)),
	transform(translation([0,0,1]), circle($fn=75,r=1)),
	transform(translation([0,0,2]), circle($fn=100,r=1)),
]);

This image shows the distortion. screen shot 2018-12-25 at 14 50 39

The example above is artificial, but the issue comes up when combining profiles that you naturally produce with different vertex counts.

This pull requests introduces insert_extra_vertices_1 which distributes new vertices uniformly around the length of the profile, resulting in much smaller distortions.

I'll be happy to polish the code if need be.

jacekkopecky avatar Dec 25 '18 14:12 jacekkopecky

Hi, do we have any maintainers here please? I know no commits happened in over 3 years, but maybe?

jacekkopecky avatar Jan 16 '19 23:01 jacekkopecky

Thanks for submitting. This looks like a reasonable approach. (note that both this and the original code are quite inefficient – there are better ways to do it)

Have you verified that none of the samples degrade by taking this approach?

OskarLinde avatar Jan 20 '19 20:01 OskarLinde

Hi, thanks; I'll do that but need a few more weeks before I get to it due to $dayjob.

jacekkopecky avatar Feb 02 '19 12:02 jacekkopecky

Hi, yes, I can now confirm that all the other examples in this repo that use skin work correctly.

jacekkopecky avatar Mar 06 '19 21:03 jacekkopecky