2D Graphic Seed-head Patterns
Site Map Feedback
Seed Head
Up Fern Mandelbrot Parity SeedHead
To draw a seed-head on the PixelBlock, mix in the CSeedHeadStencil class below and define the Disc abstract method to use CCircleStencil::Disc:
This class uses the 'Golden Ratio' to create a picture of a Seed-head. The algorithm can be altered to draw other natural objects: Sunflower Seeds, Dandelion, Fir Cone, Pineapple etc.
#include <math.h>

class CSeedHeadStencil {
  virtual void Disc(WORD xCenter, WORD yCenter, WORD Radius, DWORD Colour) =0; // Antialiased, Filled apart from centre pixel:
public:
  CSeedHeadStencil() {}
  void Seeds(WORD x0, WORD y0, DWORD Colour, short SeedRadius=6, int Seeds=987) { // Seeds should be a number from the Fibonacci series
    const double  PI=3.1415926535897932384626433832795;
    const double Phi=1.6180339887498948482045868343656; // The Golden Ratio
    const double  dA=Phi/PI;
    double Angle= dA;
    for(int Seed=Seeds; Seed--; Angle+=(Phi-1)*2*PI) { // Move 0.618 of a circle round each time
      double r=sqrt(Seed)*SeedRadius*dA; // Position Radius is sqrt of the seed number scaled to suit SeedRadius
      Disc(x0+(WORD)(0.5+r*cos(Angle)), y0+(WORD)(0.5+r*sin(Angle)), SeedRadius-SeedRadius*Seed/Seeds, Colour);
    }
  }
};
If you have Java, you can waft your cursor over the following applet to see different levels of spiral:


Here's a tighter version:
Super Spiral
Then to 3D:
Dome
Then to create full spheres:
Golf Ball

You can mix in as many 'Stencils' as you like to provide all the primitives you need.

The Colours, Drawing and Effects sections have further extensions.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


 (115) Last modified: Fri, 15 May 2009 15:26:16 +0100

You can email, bookmark, or share this page by clicking the social networking icons below:

  • E-mail this page to a friend!
  • Google
  • Live
  • YahooMyWeb
  • TwitThis
  • StumbleUpon
  • Digg
  • Reddit
  • Facebook
  • del.icio.us
  • LinkedIn
  • Mixx
  • connotea
  • Sphinn
  • Slashdot
  • Technorati