Strange/incorrect sphere shapes
scrapmech opened this issue ยท 19 comments
Minecraft version: 1.18.1
MiniHUD version: 0.21.3
When using Sphere block-based generator I noticed strange behavior: generated spheres are often not symmetrical, especially when using block snap corner or none options. Adjustable spawn sphere seems to produce better results.
Attached is an example for this behavior. You can see that on the right side there are several extra blocks.
@maruohon The center of the sphere is exactly in the corner of a block though? The block centers of blocks that are symmetric are exactly the same distance from it. For example sphere with center at (0, 63, 0) and radius of 6. Two gold blocks whose centers are at (3.5, 66.5, 3.5) and (-3.5, 66.5, 3.5). The distance is sqrt((3.5^2)*3)=6.062177826. Left one is included in the sphere but right one is not
I believe the "normal" sphere uses the distance of the block center to the center point as the deciding criteria for which blocks to consider as the edge. So if the center of the circle is not centered on a block, then I guess it's entirely possible that it will not look symmetrical because the "unsymmetrical distances" on the opposing sides of the sphere result in different blocks being selected as the edge.
Yep that is certainly weird when the center is at the corner of the blocks. I haven't properly debugged this yet, but it might be a sort of directional preference in the way the code builds the "rings" by walking around the perimeter. Maybe it's not properly trying all the required sides when it comes to the points where the "outside direction vector" kinda changes. I'll need to take a proper look at it at some point soon.
@HiggsBogan Is the center point, block snap setting and radius exactly the same as before? If you didn't use a block snap setting and you moved the center point even slightly, then it's possible that the positions changed like this. What version of the mod did you use before? If this was all in the 1.18+ versions, then I don't think I changed anything yet with the sphere stuff since the first "official" 1.18.0 release. I did rewrite some of the sphere stuff recently at one point, but I think it was leading up to the full 1.18.0 release.
I decided to leave the fixes this issue report is related to, to the bigger mod rewrites that are happening in 1.12.2, as I may need to or want to rewrite some more of how the shapes are generated, so I didn't want to delay the 1.18.2 updates further. So it's also possible that the sphere is just slightly crooked depending on the center point in relation to the block bounds (apparently). But even so it shouldn't change over time if the center and the settings remain the same.
not too long ago I messed up and deleted the sphere i was using. once i got it back to where it should be i took a screen shot of the coords and set up. the one above maybe off a bit because i was trying to get it right. just for you i re installed what i had before and set it to the settings in the screen shot i took for reference. heres that one
As you can see give or take the few mis placed blocks everything is fine.
Its all good :) I can wait or if i need to i will roll back when i need too. just thought id show you that its a bit wonky.
Thanks for your response
Oh also yeh I was using 0.19.0 - dev20211204.230657
Has there been any update on this bug? I am encountering the same issue. It seems to me like the misshapen side is always on the west, regardless of any combination of settings. I notice the images provided by the OP also show errors on the west side only.
As is, I consider the sphere tool to be unusable.
Before creating my issue, I failed to use the search function to figure out if this was already reported. I had the same issue wiuth spheres. It does not matter what snap method is used. The sphere is always asymetrical. Cylinders shapes ARE symetrical so my guess is that the function to calculate the points on the sphere is faulty (My guess is that the floating point arythmetic is incorrect. Ssome rounding issue? Using integers where floating/fixed point values ought to be used?)..
I am aware of it, I just haven't had a chance to look at it yet (1.20.6/1.21)
I guess in the meantime the only fix is to make a cylinder with a radius of +1/-1 for each increment of y level
Very very very inconvenient but it's better than a wrong sphere
Maruohon, like, disable the sphere feature until it's fixed.
The only thing worse than not having a sphere tool is having a sphere tool that you only realise hasn't worked properly until your minecraft project is done
I built something with this, unaware that it was not correct. Please disable the feature until fixed.
I guess in the meantime the only fix is to make a cylinder with a radius of +1/-1 for each increment of y level
That's a cone my brother, not a sphere.
This issue still persists in Java 1.21.4! (Latest Minihud as of 12/13/24) Clearly these are not perfect spheres even when using the sphere shape in Minihud. They also don't agree with: https://www.plotz.co.uk/plotz-model.php?model=Sphere which I know has correct dimensions. Please fix this stat! Seems like the most basic feature of Minihud doesn't work correctly: