Skip to content

Julia.pyde differences between repo, book code, and screenshot #3

@TimPasquini

Description

@TimPasquini

The text tells you to save a copy of your Mandelbrot.pyde as Julia.pyde and then replace mandelbrot() function with the provided julia() function and then update the draw() function.

After doing so, I thought the program was freezing or taking a really long time, until I noticed a tiny 1x1 or 2x2 orange pixel in the center of the display canvas. This made me think it was a scaling issue and I ended up figuring out that the xscl = float(rangex)/width (and corresponding y-scale) code from the mandelbrot setup() function needed to be changed to xscl = width/rangex (and corresponding y-scale too).

I also found the image produced was actually upside-down, but thanks to the previous information about imaginary numbers, I knew I could just flip the second value in my c variable to negative to get the mirror image and finally get the same image as the book.

When looking on how to report these issues, I found the link to this repo from the No Starch website and saw that the repo here uses the correct scaling and different code inside the draw() function compared to what is in the book. I am assuming that this is the code that ultimately created the image in the book and thus explains the differences.

Hopefully this helps anyone else who gets stuck in the Julia Set section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions