Logo by Pauldelbrot - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. November 30, 2025, 09:52:24 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: phyllotaxis parastichy  (Read 352 times)
Description: how to find secondary spirals in Fermat's spiral
0 Members and 1 Guest are viewing this topic.
arturv
Guest
« on: March 21, 2012, 09:11:31 AM »

Hello! I'm new here. Also relatively new to programming and math.

I'm building sunflower pattern (phyllotaxis) in RSL (renderman) and I need to find secondary spirals (parastichy) and use them to define new x and y coordinates. I've got the pattern (phyllotaxis) in green and then parastichy arms (red and blue) matched by fudging some values in. You can see the values 0.0026 and 0.0010 used in defining parastichyR and parastichyL. But I'm curious how to find these values properly. How to define relationship between phyllotaxis pattern and parastichies or how to find spiral angles using existing variables (golden ratio etc)



Code:
  //cartesian to polar coordinate system
  float r = sqrt( pow( x, 2 ) + pow( y, 2 ));
  float theta = atan( x, y) / (PI * 2) + 0.5;

  float spread = .003; // spiral spreading factor
  float n = 150; // number of florets
  float floretR = .001; // floret size
  float phi = pow( (1 + sqrt(5))/2, 2 ); // golden ratio squared ( change + to - for mirrored spiral )
  float goldenA = 2*PI / phi; // golden angle 2.4 radians
  float goldenF = 1 / phi; // golden fraction 0.382

  float parastichyR = mod( (theta + ( 0.0026 / spread * r )) * 13, 1 ); // 13 spiral arms to right
  float parastichyL = mod( (theta - ( 0.0010 / spread * r )) * 21, 1 ); // 21 spiral arms to left

  float floret = 0; float i ,a , b; // init
  for(i=0; i<= n; i+=1)
  {
a =  mod( goldenF * i , 1 ); // rotate golden fractian on each count
b =  i * spread; // spreading radius. sqrt(i) for linear spread
if( pow( theta - a, 2) + pow( r - b, 2) <= floretR / sqrt(i))  // calculate a circle
    floret += 1; // draw a floret circle
  }     

 red = parastichyL;
 green = floret;
 blue = parastichyR;

I've stumbled across pretty cool website with java applets and all that does some explanation but just a bit beyond me.
http://www.math.smith.edu/phyllo

even some java source code for calculating parastitchies but it looks very different to my approach
http://www.math.smith.edu/~cgole/PHYLLOH/SUSAN/psyral.java

Any help appreciated

art.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.207 seconds with 21 queries. (Pretty URLs adds 0.009s, 2q)