Fixed division by zero case in SphericalProjector::mapForward
This commit is contained in:
parent
017abbd963
commit
0ceb9b6a00
@ -242,7 +242,8 @@ void SphericalProjector::mapForward(float x, float y, float &u, float &v)
|
||||
float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
|
||||
|
||||
u = scale * atan2f(x_, z_);
|
||||
v = scale * (static_cast<float>(CV_PI) - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)));
|
||||
float w = y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_);
|
||||
v = scale * (static_cast<float>(CV_PI) - acosf(w == w ? w : 0));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user