Ghoulboy78 / Scarpet-edit

A useful tool for developing decorative builds etc in scarpet.
Creative Commons Zero v1.0 Universal
22 stars 4 forks source link

Re-adding working shapes plus some new ones #97

Closed Firigion closed 2 years ago

Firigion commented 2 years ago

I re-introduced the old shapes implementations to ahve a version to ship with the next release until #94 is done. Also:

Should we add a link to the discor dserver/channel in either readme, the docs or the contribution manual?

Ghoulboy78 commented 2 years ago

Wait, I see you've added a bunch of new functions. Do you intend on keeping them even after I implement the new shapes from shapes.scl, or not? cos if so it's best to mention that you're gonna remove them, and if not you could add comments explaining what they do.

Firigion commented 2 years ago

I'll add comments. Some functions are staying, since they are used in shapes that are not gonne be replaced. And I'd discuss the replacement of some of the rhapes anyway, I wrote some decent code this time. We'll have to test efficiencies once the library is finished.

Right now, diamond can't get much better, I'm pretty sure, I do absolutely no extra check, just calculate the blocks needed in the most straightforward way, i even minimized the ammount of divisions needed.

Pyramid is quite good too, for the same reason. Cone and cylinder could use a better circle algorithm, right now for a circle with radius r I'm doing r²/2 checks (the naive approach is 4r²), but that's still O(r²). Note that the area in a disc scales with r², so it's not such a bad algorithm, and the circle is calculated in the same pass as the disc, so that's not an overhead.

Only case where an improvement would actually impact the performance is in hollow cone, since making the case where height is smaller than radius work properly requires checking all the r²/2 blocks for every layer (r being smaller each layer). We can improve this a bit in detriment of the shape of the cone, which I think is quite good now.

Shperes and eliposids I didn't touch and those are really bad. They check 8r³ blocks one by one.