01: package org.cougaar.demo.mandelbrot.v2;
02:
03: import org.cougaar.demo.mandelbrot.util.Arguments;
04: import org.cougaar.demo.mandelbrot.util.FractalMath;
05:
06: /**
07: * This plugin advertises a {@link FractalService} that computes the
08: * Julia Set.
09: * <p>
10: * Two optional plugin parameters are supported, where the defaults are:<pre>
11: * <argument name="cx" value="-0.70176"/>
12: * <argument name="cy" value="-0.3842"/>
13: * </pre>
14: *
15: * @see MandelbrotCalculator The MandelbrotCalculator is a pluggable
16: * replacement for this plugin
17: */
18: public class JuliaCalculator extends CalculatorBase {
19:
20: /**
21: * This default is from the Wikipedia "Julia_set" page.
22: * <p>
23: * A couple interesting configurations from that page are:<ul>
24: * <li>cx=-0.70176, cy=-0.3842</li>
25: * <li>cx= 0.285, cy= 0.01</li>
26: * <li>cx=-0.382, cy= 0.618</li>
27: * </ul>
28: */
29: private static final Arguments DEFAULT_ARGS = new Arguments(
30: new String[] { "cx=-0.70176", "cy=-0.3842" });
31:
32: private Arguments args = DEFAULT_ARGS;
33:
34: public void setParameter(Object o) {
35: args = new Arguments(o, DEFAULT_ARGS);
36: }
37:
38: protected byte[] calculate(int width, int height, double min_x,
39: double max_x, double min_y, double max_y) {
40: return FractalMath.julia(width, height, min_x, max_x, min_y,
41: max_y, args.getDouble("cx"), args.getDouble("cy"));
42: }
43: }
|