Maybe it's because of integer division.
Complex toComplex(int x, int y)
{
Complex z = new Complex();
z.real = min.real + ((x/width) * (max.real - min.real));
z.imaginary = max.imaginary - ((y/height) * (max.imaginary - min.imaginary));
return z;
}
Here, (x/width)
and (y/height)
return 0
always, since it's integer division and width
and height
are values greater than x
or y
. So, I'd use double
instead of int
.
Complex toComplex(double x, double y)
{
...
}
Fix any problems that raise because of the change and see what happens.