Creating a circular "grid" ?

My quest is to essentially create different-sized rings, centered around the same point, that are made of 1-unit pieces.

My problems are that I have difficulty understanding the math required to create such. I know how to create rings that are made of differing SIZED pieces, like 360 degrees = 360 pieces per ring, but the pieces get progressively larger as you go away from the origin point. I don’t want that - I want the pieces to stay the same size, instead creating more as you go outward.

I was hoping someone would help me figure out how to fix up my code in order to do this.

      float radians = (float) Math.toRadians(degrees);
      
      float[] data = new float[] {};
      
      float circ = MathUtil.getCircumference(depth); // Get the circumference at the chosen depth
      float circt = MathUtil.fastfloor(circ); // Round the circumference
      
      for (int c = 0; c < circt; c++) { // For every 1 "unit" do
         float rads = (float) c / circt; // Dividing the count by the circumference gives us the radian measure for each block
         
      }

That was as far as I had gotten before this made itself clear to my mind.

Just use a normal “square” grid and don’t draw/make the ones that don’t fit your desired shape moot.

Hexagonal grids, for instance, also just use a normal “square” grid jut viewed at a funny angle basically. The “data” that makes up the grids are essentially the same.

I would do it that way, were it not for that you’re supposed to be viewing these at all angles - the “up” can be in any direction along this single plane. But since it’s like that, it’s supposed to look like everything is going towards the center - if I were to use a square grid in this case, if you were looking at it at a 45 degree angle, everything would be diagonal.

Data doesn’t care about angles, though :smiley:

You need to multiply by 2*pi to get the angle in rads.

At the moment I’m under the impression you want a set of concentric rings broken into segments, with each segment of every ring having the same area as every other segment.

If this is not the case, maybe you should show us a diagram to better explain what it is you’re after.

I agree with jonjava, for just storing data, angles and other like calculations are irrelevant. :slight_smile:
Watch, as I magically store boolean values for a magical 4-dimensional grid :
(psuedo-code for times sake)

4DGrid grid = new 4DGrid();
 grid.point(1,3,5,7) = false;
 grid.point(10,3,5,64) = true;

Now, I couldnt DRAW that grid, it would be impossible. :stuck_out_tongue:

Interesting problem.

If the length of the piece of circumference for a piece is to stay the same, then you will be limited to radii that allow whole-number multiples of the unit size.

C = 2 PI R

If your distance of a unit is, say 10, possible circumferences are multiples of 10, and you can calculate your radii from there.

8 units = total circumference of 80, so radius would be 40 / PI.
12 units = total circumference of 120, so radius would be 60 / PI.

There is also the matter of settling the ‘phase’ of each ring, i.e., at what angle the first unit starts.

Abuse has the right idea, and philfrei goes a little more in depth.