Author Topic: Maurer Rose Pattern  (Read 4499 times)

0 Members and 1 Guest are viewing this topic.

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Maurer Rose Pattern
« 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.  
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Maurer Rose Pattern
« Reply #1 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!

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Maurer Rose Pattern
« Reply #2 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!
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Maurer Rose Pattern
« Reply #3 on: October 29, 2019, 12:35:23 pm »
Amazing program Ashish, great job!

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Maurer Rose Pattern
« Reply #4 on: October 29, 2019, 01:04:56 pm »
Thank You, SierraKen! :D
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Maurer Rose Pattern
« Reply #5 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!!!
Logic is the beginning of wisdom.

Offline codeguy

  • Forum Regular
  • Posts: 174
    • View Profile
Re: Maurer Rose Pattern
« Reply #6 on: October 30, 2019, 04:03:45 am »
As usual, Ashish does a fine job. Thank you.

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: Maurer Rose Pattern
« Reply #7 on: October 30, 2019, 04:52:02 am »
Nice !
Why not yes ?

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Maurer Rose Pattern
« Reply #8 on: October 30, 2019, 10:43:26 am »
Thanks everyone!! :D
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials