Last active
May 7, 2022 19:21
-
-
Save sylefeb/aaedd009397f4714eb199a71c4493e2d to your computer and use it in GitHub Desktop.
Repairing a toy car with a new wheel, modeled in IceSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- A wheel | |
| -- @sylefeb 2022-05-07 | |
| -- MIT license | |
| -- model for https://icesl.loria.fr/ | |
| wdiam = 21.6 | |
| wh = 6 | |
| waxle = 2.1 | |
| wrimh = 1 | |
| dentsz = 1.8 | |
| N = math.floor(ui_scalar('dents',20,6,30)) | |
| -- wheel body | |
| wbody = difference( | |
| union{ | |
| translate(0,0,wrimh) | |
| *cylinder(wdiam/2,wh-wrimh*2), | |
| translate(0,0,wh-wrimh) | |
| *cone(wdiam/2,wdiam/2-4,wrimh), | |
| translate(0,0,0) | |
| *cone(wdiam/2-0.3,wdiam/2,wrimh) | |
| }, | |
| cylinder(waxle/2,wh) | |
| ) | |
| -- wheel dents | |
| wridge = {} | |
| for i = 1,N do | |
| wridge[#wridge+1] = rotate(0,0,360*i/N) | |
| * translate(wdiam/2,0,0) | |
| * scale(1,0.5,1) | |
| * rotate(0,0,45) | |
| * cube(dentsz,dentsz,wh) | |
| end | |
| -- subtract dents from wheel | |
| wbody = difference(wbody,union(wridge)) | |
| -- emit the result | |
| emit(wbody) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment