title: C++ create random shaped "blob" objects
body: <p>I need to define an object (or a region) that is kind of "blob" shaped on a discrete gridmap. It should look something like this: <a href="https://i.stack.imgur.com/qvbr4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qvbr4.png" alt="enter image description here"></a></p>
  
  <p>where the red region denotes the center point (these are just ideas, any blobby shape will work as long as it can be varied randomly). My idea so far was to iteratively increment the angle from starting point (=0 degrees) to 360 degrees and use trigonometry to calculate the outer points of a circle (which will result in the unit circle if the radius = 1 = const). I then used Bresenham's line algorithm (remember: we are moving on a discrete grid) to calculate the line that connects the center of the circle and the outer point I just came up with. My idea was that if I could vary the radius somewhat, I could create these blobby shapes. What I've come up with so far gives me nice shapes, they're just not really "blobby" though. Here's my code (note that <code>x0</code> and <code>y0</code> mark the center point of my gridmap, <code>plotBresenham</code> just puts all <code>1s</code> in the regions so the gridmap can be visualized): </p>
  
  <pre><code>double radius = 10; 
  for(int alpha=0; alpha&lt;360; alpha++) {
     double x = cos(alpha*M_PI/180.0)*radius;
     double y = sin(alpha*M_PI/180.0)*radius;
  
     if(alpha&lt;45) radius+=0.5;
     else if(alpha&lt;90) radius-=0.5; 
     else if(alpha&lt;135) radius+=0.5; 
     else if(alpha&lt;180) radius-=0.5; 
     else if(alpha&lt;225) radius+=0.5; 
     else if(alpha&lt;270) radius-=0.5; 
     else if(alpha&lt;315) radius+=0.5; 
     else radius-=0.5; 
  
     plotBresenhamLine(x0,y0,x,y)
  
  }
  </code></pre>
  
  <p>The result looks like this: </p>
  
  <p><a href="https://i.stack.imgur.com/7cVoD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7cVoD.png" alt="enter image description here"></a></p>
  
  <p>Sorry for the crude drawing. Programming language is C++, but I think the approach doesn't really depend on the language used. Any tips / help / guidance on how I can create shapes that resemble the ones I need more? Or even a Framework that does stuff like this for you? For me, it's just important to have the coordinates of the points within, to put them into my gridmap. </p>