Ring approximation calculation
2021-01-25, 18:09 (This post was last modified: 2021-01-26, 7:38 by Philippe Hurbain.)
2021-01-25, 18:09 (This post was last modified: 2021-01-26, 7:38 by Philippe Hurbain.)
Following review of this part, Magnus asked for my method to calculate ring approximations... as it maybe helpful for many people, I answer here...
Original pattern used a lot of thing rings to get "precise" dimensions, though this is mostly useless since measurements on prints (and prints themselves!) are pretty approximative.
I propose to simplify this code with an approximation:
The method to get it is simple, and works well if the ring thickness is relatively low compared to its radius. I'll start from inner ring and progress to outer (here I don't want to need changes to the inner delicate pattern!), but you can do it also in the other order.
Of course if you calculate from outside to inside, you must compensate for the "+1" between inner and outer radii of LDraw rings...
Formula is int(inner diameter / desired thickness) in the first case, int(outer diameter / desired thickness)-1 for the second.
Original pattern used a lot of thing rings to get "precise" dimensions, though this is mostly useless since measurements on prints (and prints themselves!) are pretty approximative.
Code:
1 0 0 12.25 -10 .5 0 0 0 0 .5 0 1 0 4-4rin14.dat
1 0 0 12.25 -10 .25 0 0 0 0 .25 0 1 0 4-4rin30.dat
1 4 0 12.25 -10 .125 0 0 0 0 .125 0 1 0 4-4ring62.dat
1 4 0 12.25 -10 1.125 0 0 0 0 1.125 0 1 0 4-4ring7.dat
1 4 0 12.25 -10 .25 0 0 0 0 .25 0 1 0 4-4rin36.dat
1 0 0 12.25 -10 .125 0 0 0 0 .125 0 1 0 4-4ring74.dat
1 0 0 12.25 -10 .625 0 0 0 0 .625 0 1 0 4-4rin15.dat
1 0 0 12.25 -10 .25 0 0 0 0 .25 0 1 0 4-4rin40.dat
1 16 0 12.25 -10 10.25 0 0 0 0 10.25 0 1 0 4-4ndis.dat
Code:
1 0 0 12.25 -10 .77778 0 0 0 0 .77778 0 1 0 4-4ring9.dat
1 4 0 12.25 -10 1.55556 0 0 0 0 1.55556 0 1 0 4-4ring5.dat
1 0 0 12.25 -10 1.03704 0 0 0 0 1.03704 0 1 0 4-4ring9.dat
1 16 0 12.25 -10 10.37037 0 0 0 0 10.37037 0 1 0 4-4ndis.dat
- First ring: inner diameter is 7 (14/2), desired thickness is 0.75. 7/0.75=9.3333. Round to nearest integer, we get a ring9. To fit inner diameter, thickness must be 7/9=0.777777777. Close enough to the 0.75 target.
- Second ring: Inner diameter is 7.77777777 (0.777777777*(9+1)). Previous pattern outer diameter is 37*.25=9.25. Desired thickness is thus 9.25-7.77777777=1.47222222. Second ring will be obtained as int(7.77777777777/1.47222222222) -> ring5. To fit inner diameter, thickness must be 7.77777777/5=1.5555555. A bit further than the 1.47 target, but good enough...
- And third ring: needed thickness is 0.91666666, we get int(9.3333333333/0.9166666666)=10, with a thickness of 0.93333333333
Of course if you calculate from outside to inside, you must compensate for the "+1" between inner and outer radii of LDraw rings...
Formula is int(inner diameter / desired thickness) in the first case, int(outer diameter / desired thickness)-1 for the second.