![JAR search and dependency download from the Maven repository](/logo.png)
jadex.micro.mandelbrot.model.MandelbrotAlgorithm Maven / Gradle / Ivy
The newest version!
package jadex.micro.mandelbrot.model;
import jadex.common.ClassInfo;
/**
* Algorithm for calculating the mandelbrot set.
*/
public class MandelbrotAlgorithm extends AbstractFractalAlgorithm
{
//-------- IFractalAlgorithm interface --------
/**
* Determine the color of a point.
* @param x The x coordinate.
* @param y The y coordinate.
* @param max The maximum depth.
* @return A value for the point from 0 to max.
*/
public short determineColor(double xn, double yn, short max)
{
double x0 = xn;
double y0 = yn;
short i = 0;
double c = Math.sqrt(xn*xn + yn*yn);
for(i=0; c<2 && i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy