QB64.org Forum

Active Forums => Programs => Topic started by: Ashish on October 29, 2019, 09:53:09 am

Title: Maurer Rose Pattern
Post by: Ashish on October 29, 2019, 09:53:09 am
Hi everyone!
After watching Shiffman's video on Maurer Rose, I decided to code one in QB64
Maurer Rose algorithm generate very beautiful & satisfying rose pattern!
Run the program & enjoy! Also, Happy Diwali

Code: QB64: [Select]
  1. 'By Ashish
  2. '29 Oct, 2019
  3. 'https://en.wikipedia.org/wiki/Maurer_rose
  4. _TITLE "Maurer Rose"
  5. 'Ploting (sin(n*k),k) in polar coordinates to get beautiful Rose Pattern.
  6. SCREEN _NEWIMAGE(600, 600, 32)
  7. 'Special values of n & d to get cool pattern :- n=2,d=39 or n=3,d=47 or n=4,d=31 or n=5,d=97 or n=7,d=19 or n=6,d=71
  8. 0 CLS
  9. n = (RND * 4) + 3
  10. d = (RND * 50) + 20
  11. xoff = _WIDTH / 2
  12. yoff = _HEIGHT / 2
  13.  
  14. FOR i = 0 TO 360 STEP .25
  15.     k1 = i * d
  16.     k2 = (i + 1) * d
  17.     r1 = SIN(_D2R(n * k1)) * 300
  18.     r2 = SIN(_D2R(n * k2)) * 300
  19.     x1 = r1 * COS(_D2R(k1)) + xoff
  20.     y1 = r1 * SIN(_D2R(k1)) + yoff
  21.     x2 = r2 * COS(_D2R(k2)) + xoff
  22.     y2 = r2 * SIN(_D2R(k2)) + yoff
  23.  
  24.     LINE (x1, y1)-(x2, y2), _RGBA(255, 100, 100, 90)
  25. _DELAY 0.5
  26.  
Title: Re: Maurer Rose Pattern
Post by: bplus on October 29, 2019, 11:12:30 am
Ah Rose Patterns, we explored this before: https://www.qb64.org/forum/index.php?topic=1288.msg104938#msg104938

But here, yours remind me of a crop circle program I did some time ago, yours is better :D
Just out of curiosity, why did you choose GOTO to loop around?

Happy Diwali, I will try to code something to celebrate color and light!
Title: Re: Maurer Rose Pattern
Post by: Ashish on October 29, 2019, 11:31:02 am
...
But here, yours remind me of a crop circle program I did some time ago, yours is better :D
Just out of curiosity, why did you choose GOTO to loop around?
...
Thank You. Why did I choose GOTO? I don't know. It is just what I typed. I didn't thought about this. My hand just type type ......
...
Happy Diwali, I will try to code something to celebrate color and light!
:D I'm eager to see that!
Title: Re: Maurer Rose Pattern
Post by: SierraKen on October 29, 2019, 12:35:23 pm
Amazing program Ashish, great job!
Title: Re: Maurer Rose Pattern
Post by: Ashish on October 29, 2019, 01:04:56 pm
Thank You, SierraKen! :D
Title: Re: Maurer Rose Pattern
Post by: johnno56 on October 29, 2019, 04:30:28 pm
This is brilliant and SO fast... The old clunker that I used to have, you could actually see 'each' line being drawn... it could take a minute or two just to draw 'one' image.... Well done!!!
Title: Re: Maurer Rose Pattern
Post by: codeguy on October 30, 2019, 04:03:45 am
As usual, Ashish does a fine job. Thank you.
Title: Re: Maurer Rose Pattern
Post by: euklides on October 30, 2019, 04:52:02 am
Nice !
Title: Re: Maurer Rose Pattern
Post by: Ashish on October 30, 2019, 10:43:26 am
Thanks everyone!! :D