If you’ve ever 3D printed some sort of circular shape, you will notice the faceted look you get if not enough points are used. A larger radius will require more points than a smaller radius, but how do you determine how many are good enough? The answer is pretty straightforward, but the calculations may be beyond some users. In order to facilitate this, I’ve created a simple plugin that will tell you how many segments you need to specify for either a full circle or an arc, given the radius, the tolerance desired, and the angle in question.
The equation used (for a full circle) is:
where R is the radius and e is the tolerance and N is the number of sides that should be used.
@jimhami42
would it not be a good idea to keep the cardinal points for circles…
e.g.
n = (scale * Math::PI / Math.acos((radius - error) / radius)).to_i
for i in -6..6 do
n = i + n if (i + n).modulo(12).zero?
end
UI.messagebox("N = " + n.to_s)
I probably could have made things a little clearer …
The tolerance is the amount you’re willing to deviate from the true radius. While the calculations don’t depend on the actual units, the numbers should be meaningful in the units you are using. My example would be suitable if you’re using inches and want to maintain 1/1000th of a inch (0.001") tolerance. If you were using millimeters, a reasonable value for the tolerance might be 0.025.
Why 0.001? In a former life, I did a lot of CNC machining and typically used this approach to create smooth circles using linear cuts when the controller didn’t support circular interpolation. At the time, I typically used 0.0005" for the tolerance … given the tolerances of today’s 3D printing, this is a bit overkill, so I’ve been using 0.001" quite satisfactorily.
I think that’s a good idea, depending on what you’re going to do with the circle. Perhaps it should round up to the next multiple of 12 instead of -/+? I typically will mentally adjust the number I need to make it more readily divisible at the node points. I would note that the cardinal points are harder to calculate (if they exist at all) if only a small arc is used (like 27 degrees).
I see now! Tolerance in mechanical terms for me is an entirely different thing and I’m sure you know what I’m talking about. Here you use the term for “tolerance to bumpiness” or words to that effect
I don’t have the time right now but I’ll come back to you later, that “e” parameter must have a specific name in Euclidean geometry that I can’t recall now and that’s what threw me off.
Nailed it! The term for your “e” dimension is the Sagitta, which means Arrow in Latin. I should know this, because “arrow” is the exact term in my native language, and I should have it hammered in to my had for the amount of times I heard in the Boy Scouts: “Your tent is 'orribly floppy again! Now give it a stretch and if next time I come round and see such a Sagitta, your rotating latrine detail will become permanent!” So I had a good incentive.
Now I was thinking whether this common “quadrangulars” sphere generating method we use wouldn’t come in handy for replacement with geodesic shapes, see TaffGoch’s work at the Warehouse, namely his Geodesic Catalogs. If we use qadrangulars sooner or later as work proceeds they’ll get triangulated (heck, I love this kind of scientific language ) so we might as well start with triangles anyway. How does that strike you?
@slbaumgartner,
that’s just me, I use multiples of twelve when doing them manually by eye for some unknown reason…
in code I would probably use 4, or more likely ± 2 to make the jump more gradual…
john
Depending on why you are calculating the number of points to use in the first place will determine whether you want to use the number calculated or modify it to an even number, odd number, multiple of 4, 8, 12, 16, etc.
Using 12 allows for easy division of a full circle into 2, 3, and 4 equal parts. I tend to use 12 simply because I’ve had this image burned into my brain for 45 years:
@jimhami42,
so it’s not just me, now you’ve prompted my memory, divisibility when joining different radius tubes is why I started doing it…
it helps if you want make sheet metal patterns or to render textures…
john
I’m too tired for maths this evening, but you didn’t need to be so literal in your latest sketch, Jim. I fully understand the “s” stands for Sagitta, but the “R”, for rope?
I made a slight change to the N Calc plugin … you can now specify the minimum value of the “Flat” (chord) or the “Sagitta” when calculating the number of points. Mathematically speaking, the flat should be no more than 1/2 the x/y resolution of the printer, but this yields ridiculously high point counts. From my own experience, I think a flat length of 0.025" will still give good results in medium to high-resolution printers.
I see, thank you very much. I’m going to give this a try soon as I’m working on a perspex nose - not for me, for a WW2 bomber - and I certainly don’t want it to look like the eye of an insect!
This must be one of my designs, it’s full of awkward geometries!