So a bit of context from the start - I`m trying to program an applet to export .VOX files used by a popular 3d modeling tool MagicaVoxel into a JSON based configuration files used by game Minecraft. Since binary files are more efficient then UTF-8 encoded JSON files and the maximum number of elements VOX files support is $$ 256^{3} $$ elements per model it really doesn't very well. However Minecraft file format allows for any cuboid which implies that the size and the relation of height to width to length can change. I wondered if its possible to implement an algorithm which will take a model like so and split it similarly to enter image description here. My first idea was to try to base my algorithm on the Ear Clipping method used to split convex polygons into triangles but check whether all angles in the closed of region will equate to 90, but I wasn't sure how to preform the convexity check as I cant just do it by checking every vertex presence in the triangle with cross product because those are rectangles. Taking it to 3d seem to complicate it even further.

Does anyone have an advice on how to preform the ear clipping with rectangles if its possible. Or perhaps there is a simpler solution which I didn't think of?



You must log in to answer this question.

Browse other questions tagged .