Complex Complex::operator/(const Complex &other) const
{
float len = other.length();
if( len == 0 ) return Complex(0,0);
Complex res((r*other.r + i*other.i)/len, (i*other.r - r*other.i)/len);
return res;
}
when it should be
Complex Complex::operator/(const Complex &other) const
{
float squaredLen = other.squaredlength();
if( squaredLen == 0 ) return Complex(0,0);
Complex res((r*other.r + i*other.i)/squaredLen, (i*other.r - r*other.i)/squaredLen);
return res;
}
And of course, you have to define the function squaredlength:
float Complex::squaredlength() const
{
return r*r + i*i;
}
And then works fine.
I've been using Angelscript in my fractal generating app and it works nicely, and the process of integrating it was painless thanks to it's clean API and good documentation. Thanks a lot for your work!