aboutsummaryrefslogtreecommitdiff
path: root/Week15 Mandelbrot/src/mandelbrot/Area.java
blob: 75331e342b2114d9444dbab7a40e3fa97a79a1ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package mandelbrot;

/**
 *
 * @author Sjaak
 */
public class Area {
    private final double startX, startY, width, height;
    
    public Area (double x_tl, double y_tl, double width, double height) {
        startX = x_tl; startY = y_tl; this.width = width; this.height = height;
    }
    
    public double getX ()       { return startX; }
    public double getY ()       { return startY; }
    public double getWidth ()   { return width; }
    public double getHeight ()  { return height; }
    
    public Area zoom (int xul, int yul, int zw, int zh, int tw, int th) {
        double zoom_fact = ((double) zw) / tw;
        return new Area (startX + (width  * xul) / tw,
                         startY - (height * yul) / th,
                         width * zoom_fact,
                         height * zoom_fact);
    }
    
}