Irev-Dev / Irev-Dev/Round-Anything

extrudeWithRadius rounds top and bottom differently

Open
#45 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
OpenSCAD
Stars
677
Forks
52
PR merge metrics
No merged PRs in 30d

Description

If you specify the same radius for top and bottom, the rendered shape is different for the top and the bottom. The top and bottom layers seem to be shifted by 1 layer. Example (see picture):

```
extrudeWithRadius(5,r1=2,r2=2,fn=10)
offset(r = 5)
offset(delta = -5)
polygon([[0,0],[20,0],[20,20]]);

module extrudeWithRadius(length,r1=0,r2=0,fn=30){
n1=sign(r1);n2=sign(r2);
r1=abs(r1);r2=abs(r2);
# translate([0,0,r1]){
linear_extrude(length-r1-r2){
children();
}
}
for(i=[0:fn-1]){
translate([0,0,i/fn*r1]){
linear_extrude(r1/fn+0.01){
offset(n1*sqrt(sq(r1)-sq(r1-i/fn*r1))-n1*r1){
children();
}
}
}
translate([0,0,length-r2+i/fn*r2]){
linear_extrude(r2/fn+0.01){
offset(n2*sqrt(sq(r2)-sq(i/fn*r2))-n2*r2){
children();
}
}
}
}

}

function sq(x)=x*x;
```
![extrudeWithRadius-rounds-top-and-bottom-differently](https://user-images.githubusercontent.com/3208044/210686629-65d22897-5358-4905-b406-522734f0302e.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.