Fixed nan problem. The sqrtf()-function generated infinities -> now replaced by sqrt(). The cotangent-implementation 1/tan(x) also generated infinities for phiReal=90°. This is now implemented by cotan(X)=tan(PI/2 - x).