Note that there are some explanatory texts on larger screens.

plurals
  1. PODraw a sphere using 3D pixels (voxels)
    primarykey
    data
    text
    <p>Can you suggest an algorithm that can draw a sphere in 3D space using only the basic <code>plot(x,y,z)</code> primitive (which would draw a single voxel)?</p> <p>I was hoping for something similar to <a href="http://en.wikipedia.org/wiki/Midpoint_circle_algorithm" rel="noreferrer">Bresenham's circle algorithm</a>, but for 3D instead of 2D.</p> <p>FYI, I'm working on a hardware project that is a low-res 3D display using a 3-dimensional matrix of LEDs, so I need to actually draw a sphere, not just a 2D projection (i.e. circle).</p> <p>The project is very similar to this:</p> <p><img src="https://i.stack.imgur.com/TgOAv.jpg" alt="3D LED cube"></p> <p>... or see it in action <a href="http://www.youtube.com/watch?v=6mXM-oGggrM" rel="noreferrer" title="LED cube">here</a>.</p> <p>One possibility I have in mind is this: </p> <ul> <li>calculate the Y coordinates of the poles (given the radius) (for a sphere centered in the origin, these would be <code>-r</code> and <code>+r</code>)</li> <li>slice the sphere: for each horizontal plane <code>p</code><sub>i</sub> between these coordinates, calculate the radius of the circle obtained by intersecting said plane with the sphere => <code>r</code><sub>i</sub>.</li> <li>draw the actual circle of radius <code>r</code><sub>i</sub> on plane <code>p</code><sub>i</sub> using Bresenham's algorithm.</li> </ul> <p>FWIW, I'm using a <a href="http://www.ghielectronics.com/catalog/product/256" rel="noreferrer">.NET micro-framework microprocessor</a>, so programming is C#, but I don't need answers to be in C#.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload