Author Topic: [Python] Peter de Attractor in Python using PyGame  (Read 414 times)

0 Members and 1 Guest are viewing this topic.

Offline Psycho_Coder

  • Knight
  • **
  • Posts: 166
  • Cookies: 84
  • Programmer, Forensic Analyst
    • View Profile
    • Code Hackers Blog
[Python] Peter de Attractor in Python using PyGame
« on: March 17, 2015, 01:58:04 pm »
Peter de Jong Attractor in Python using PyGame

An attractor is defined as the smallest unit which cannot be itself decomposed into two or more attractors with distinct basins of attraction. This restriction is necessary since a dynamical system may have multiple attractors, each with its own basin of attraction. (Source: Wiki)

Topic like Attractors or Chaos Theory have found application in physical level security.



Code :- https://gist.github.com/AnimeshShaw/267b7ba82ffe5e33b326


This section is the main part where we get the coordinates of the points to plot.

Code: [Select]
self.xn, self.yn = ( sin( self.constants["a"] * self.yn ) - cos ( self.constants["b"] \
                                    * self.xn ) ), ( sin( self.constants["c"] * self.xn ) - cos( self.constants["d"] * self.yn ) )
                    #  xn, yn = ( d * sin( a * xn ) - sin ( b * yn ) ), ( c * cos( a * xn ) + cos( b * yn ) )
                    self.coords.append( ( self.xn, self.yn ) )
                    pygame.draw.circle( self.screen, self.grayshade , ( self.width // 2 + \
                                            int( 120 * self.xn ), self.height // 2 + int( 120 * self.yn ) ), 1, 1 )


I hope you like these. The better one's are on the way :D

I am making a gallery of "Art and Designs made with Code" which I will be posting shortly.


Thank you,
Sincerely,
Psycho_Coder.
"Don't do anything by half. If you love someone, love them with all your soul. When you hate someone, hate them until it hurts."--- Henry Rollins