Thread: Fractal Zooming

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Fractal Zooming

    Hello

    I'm trying to zoom into a fractal and to do this I'm using mouse click to calculate where the centre should be and then taking away 1 from the right and top and adding 1 to the left and bottom to make a zoomed in version. This works perfectly... for 5 zooms. When the value of the left and right meet eachother the fractal starts zooming out instead of in. Is there a way to get around this? Through multiplication maybe?

    Thanks!

    Code:
    if (myInput.mouseclick)
       {       
     //Zoom in        
    left +=0.1;       
     right -=0.1;        
    bottom +=0.1;      
      top -=0.1;        
    
    //Generate the zoomed in texture        
    GenerateFractal(&data); 
     }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Perhaps something like
    delta = (right-left)/10;
    left += delta;
    right -= delta;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fractal Generator
    By darren78 in forum C++ Programming
    Replies: 4
    Last Post: 10-12-2010, 09:01 AM
  2. 2D Fractal Terrain
    By TheSpook in forum C++ Programming
    Replies: 15
    Last Post: 01-14-2010, 10:28 PM
  3. Zooming Algorithm Bug
    By stuffy_boiz in forum C Programming
    Replies: 2
    Last Post: 01-19-2009, 02:34 AM
  4. fractal maker
    By arjunajay in forum C++ Programming
    Replies: 2
    Last Post: 07-04-2005, 07:08 AM
  5. help with zooming and turing camera
    By godhand in forum Game Programming
    Replies: 4
    Last Post: 05-25-2004, 11:39 PM