#import wxTurtle
#import math    # must be built-in, this isn't needed for sin and cos ?!

from tWrapper import tWrapper

# wrapper for any additional drawing routines
# that need to know about each other
#class turtleWrapper(wxTurtle.Pen):
class turtleWrapper(tWrapper):
    def chaos2(self, a=1.5732, xOrig=0.0, yOrig=0.0, endRange=38, xOffset=250, yOffset=250, scale=200):
        #scale = 200
        #xOffset = 250
        #yOffset = 250
        #a = 1.5732
        #a = 1.1111
        #xOrig = 0.0
        #yOrig = 0.0
        #endRange = 38
        mult = 1.2 / endRange
        
        for j in range(1, endRange + 1):
            x = xOrig + mult * j
            y = yOrig + mult * j
            for i in range(1000):
                temp = x * cos(a) - (y - (x * x)) * sin(a)
                y = x * sin(a) + (y - (x * x)) * cos(a)
                x = temp
                try:
                    x1 = int(xOffset + scale * x)
                    y1 = int(yOffset + scale * y)
                    self.plot(x1, y1)
                    #dc.DrawLine(x1, y1, x1 + 1, y1 + 1)
                except:
                    continue

def drawMain(dc_local, w, turtleWrapper=turtleWrapper):
    t = turtleWrapper(dc_local)
    t.cls()
    #t.chaos2(1.5732, 0.0, 0.0, 38, 250, 250, 200)
    t.chaos2(1.1111, 0.0, 0.0, 38, 250, 250, 200)
    #t.chaos2(1.1111, 0.74, 0.27, 500, 0, 0, 500)
