[OpenSCAD] Functional OpenSCAD, working with vertex data

Jordan Brown openscad at jordan.maileater.net
Tue Jan 30 11:37:09 EST 2018


On 1/30/2018 7:42 AM, Parkinbot wrote:
> let me annote that hull() itself is not the problem. To avoid a time
> consuming CGAL round trip, don't use (implicit) unions inside a
> hull(). If you implement rounded_cube() more explicitely, rendering is
> fast (seconds). 

So you're saying it's better if the objects are simple and direct
children of the hull, rather than being a union (through whatever
mechanism) of those same objects?

> $fa = 0.1;
> $fs = 0.1;
> rounded_cube_([4, 20, 5], r=1, center=[1,1,1]);
>
> module rounded_cube_(size, r=0, center=false)
> {
>   sz = size[0]==undef?[size, size, size]:size; 
>   ce = center[0]==undef?[center, center, center]:center; 
>   r_ = min(abs(r), abs(size.x/2), abs(size.y/2), abs(size.z/2));  // correct
> r
>   translate([ce.x?-sz.x/2:0,ce.y?-sz.y/2:0, ce.z?-sz.z/2:0])
>   if(r)
>     hull() 
>     {
>       translate([r_, r_, r_]) sphere(r_); 
>       translate([r_, r_, sz.z-r_]) sphere(r_); 
>       translate([r_, sz.y-r_, r_]) sphere(r_); 
>       translate([r_, sz.y-r_, sz.z-r_]) sphere(r_); 
>       translate([sz.x-r_, r_, r_]) sphere(r_); 
>       translate([sz.x-r_, r_, sz.z-r_]) sphere(r_); 
>       translate([sz.x-r_, sz.y-r_, r_]) sphere(r_); 
>       translate([sz.x-r_, sz.y-r_, sz.z-r_]) sphere(r_); 
>     }
>   else 
>     cube(size); 
> }
>
> in contrast the following call of hull will take minutes. 
>
>   hull()  
>   for(x=[r_,size.x-r_], y=[r_,size.y-r_], z=[r_,size.z-r_])
>     translate([x,y,z]) sphere(r_); 
>
> However, rounded_cube_ is currently a typical libary module. I wouldn't add
> it to the core language unless cylinder(), linear_extrude() and maybe hull()
> also get a r parameter. 
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180130/8aa79f14/attachment-0002.html>


More information about the Discuss mailing list