[OpenSCAD] Functional OpenSCAD, working with vertex data

Parkinbot rudolf at parkinbot.com
Tue Jan 30 14:00:27 EST 2018

Parkinbot wrote
> See my implementation of a rounded_cylinder() and how it deals with
> conflicts between diameters and radii. It is pretty fast, but I have no
> way
> to figure out, whether it is semantically equivalent with cylinder,
> therefore I can't call cylinder() with all its parameters in case r_ is 0. 

Sorry, here is my latest implementation: 


module CyR(r = 10, h=10, r_=1, d = undef, r1=undef, r2=undef, d1 = undef, d2
= undef, center=false)
  r1 = r1==undef?d1==undef?d==undef?r:d/2:d1/2:r1; 
  r2 = r2==undef?d2==undef?d==undef?r:d/2:d2/2:r2; 
  r_=min(abs(h/4), abs(r1), abs(r2), abs(r_)); 
    offset(r_)offset(-r_) polygon([[-2*r_,0], [r1, 0], [r2, h], [0,h],
[-2*r_,h]] ); 
    square(max(r1,r2), h); 

Sent from: http://forum.openscad.org/

More information about the Discuss mailing list