diff options
author | Camil Staps | 2015-06-02 09:41:17 +0200 |
---|---|---|
committer | Camil Staps | 2015-06-02 09:41:17 +0200 |
commit | f92dcfbbce3d2057e39314312deed941c22881f5 (patch) | |
tree | 22b45e41686a10be4f2e87e5be752514dec5acf4 /Week15 Mandelbrot/src/mandelbrot/Area.java | |
parent | week 14 tarball (diff) |
Start week15
Diffstat (limited to 'Week15 Mandelbrot/src/mandelbrot/Area.java')
-rw-r--r-- | Week15 Mandelbrot/src/mandelbrot/Area.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Week15 Mandelbrot/src/mandelbrot/Area.java b/Week15 Mandelbrot/src/mandelbrot/Area.java new file mode 100644 index 0000000..75331e3 --- /dev/null +++ b/Week15 Mandelbrot/src/mandelbrot/Area.java @@ -0,0 +1,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);
+ }
+
+}
|