EvilZone

Programming and Scripting => Scripting Languages => Topic started by: Psycho_Coder on March 17, 2015, 01:58:04 PM

Title: [Python] Peter de Attractor in Python using PyGame
Post by: Psycho_Coder 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.

(http://i.imgur.com/GOVr9W9.png)


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.