Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8727199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:23:42+00:00 2026-06-13T08:23:42+00:00

I am a fairly new to programming in C++, and for the sake of

  • 0

I am a fairly new to programming in C++, and for the sake of improving I am trying to make a mandelbrot set consol application. I have gotten it to work almost perfectly: The image generates, I can zoom in/out, and move around very easily. The problem I have, though, is when I start zooming on into the edges of the image, the edges will start to get “cut off”

Image zoomed out:

http://i.imgur.com/Fy70o.png

Image zoomed in a little – as you can see half the last “circle” has been chopped off:

http://i.imgur.com/1nlVP.png

Lastly, zoomed in one for time, the whole last “circle” has been completely chopped off:

http://i.imgur.com/lao8j.png

If I kept zooming in, then the edges of the bigger circle would start to be chopped, too.
I do not understand completely why this is happening, but my guess would be my zooming method is somehow to blame.

Here is the source code for the algorithm calculation function (where I’m guessing the error is):

int fractalCalc(double x0, double y0, double zoom)
{
    double x = 0;
    double y = 0;

    int iteration = 0;
    int max_iteration = 1000; //1000

    double xtemp;
    while (x*x + y*y < 2*2 && iteration < max_iteration) //x*x + y*y < 2*2 && iteration < max_iteration
    {
        xtemp = x*x - y*y + x0;
        y = 2*x*y + y0;
        y /= zoom;
        x = xtemp;
        x /= zoom;
        iteration++;
    }


    return iteration;
}

For the whole source code, go to (because my prediction is most likely wrong): http://pastebin.com/WhbS0WYE

Any suggestions and/or assistance welcome. Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:23:43+00:00Added an answer on June 13, 2026 at 8:23 am

    I haven’t done the maths closely, but I suspect it’s due to the way you’re handling the zoom. I would suggest not doing it in the code which handles the actual Mandelbrot depth calculation.

    Instead, use the zoom to pick a “viewport” from which to pick samples. Work out which co-ordinates you want to sample, and then write your fractalCalc function to just compute the depth of a specific point. That function doesn’t need to know anything about what you’re displaying.

    Aside from anything else, this separation of concerns (viewport vs fractal part) will make it easier to reason about and debug. It will also mean you’re doing fewer calculations per iteration, which should lead to fewer floating point inaccuracies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to programming and trying to resolve this problem. I have
I am fairly new to iOS programming and I'm trying to make an iOS
I am fairly new to programming and to python and wxpython. I have looked
I'm fairly new to database programming in WinForms, and have been using BindingSource, DataSet,
I'm fairly new to iPhone programming and am trying to implement a double-component PickerView.
I'm fairly new to programming in general but have been working with Java for
I'm fairly new to programming and from learning I have seen different ways of
I am fairly new to Perl programming, but I have a fair amount of
I'm fairly new to iOS programming, but have a basic understanding of it. I
I'm fairly new to programming and have been focussing a great deal on Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.