mj_multiRay: Reset elevation angle if crossing the coordinate singularity.
PiperOrigin-RevId: 529341397 Change-Id: I0ca6ed5b97bcc585b0f426d6fb8a6b4cf9367a2b
This commit is contained in:
committed by
Copybara-Service
parent
3d82d2a40f
commit
7e49d935ba
@@ -56,7 +56,11 @@ static mjtNum longitude(const mjtNum vec[3]) {
|
||||
|
||||
// map to elevation angle in spherical coordinates
|
||||
static mjtNum latitude(const mjtNum vec[3]) {
|
||||
return mju_atan2(mju_sqrt(vec[0]*vec[0] + vec[1]*vec[1]), vec[2]);
|
||||
if (vec[2]>0) {
|
||||
return mju_atan2(mju_sqrt(vec[0]*vec[0] + vec[1]*vec[1]), vec[2]);
|
||||
} else {
|
||||
return mju_atan2(mju_sqrt(vec[0]*vec[0] + vec[1]*vec[1]), vec[2]) - mjPI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -919,7 +923,9 @@ void mju_multiRayPrepare(const mjModel* m, const mjData* d, const mjtNum pnt[3],
|
||||
|
||||
if (AABB[2]-AABB[0] > mjPI) {
|
||||
AABB[0] = -mjPI;
|
||||
AABB[1] = -mjPI/2;
|
||||
AABB[2] = mjPI;
|
||||
AABB[3] = mjPI/2;
|
||||
}
|
||||
|
||||
if (AABB[3]-AABB[1] > mjPI) { // SHOULD NOT OCCUR
|
||||
|
||||
Reference in New Issue
Block a user