Skip to content
Advertisement

How to draw points of a sphere in a cubic environment?

Given a center point (x0, y0, z0) and a radius (g_radius) I want to use Python to generate points in a sphere in a cubic world (= Minecraft).

I’m trying to use this algorithm (I found it here on so) but it’s not precise and I have to increase the number of samples to a ridiculous huge number to get almost all the points, but it’s still not 100% accurate:

JavaScript

Here’s what you get with a small radius (5):

minecraft sphere

How would you do this?

Advertisement

Answer

This sounds like a job for raster_geometry:

enter image description here

JavaScript
Advertisement