Change elevation to [0,pi] in mj_multiRay.

PiperOrigin-RevId: 529393944
Change-Id: I23f3113fd91e909fa1dc23b620d66e963db59355
This commit is contained in:
Alessio Quaglino
2023-05-04 06:42:03 -07:00
committed by Copybara-Service
parent 7e49d935ba
commit 267299fb59
2 changed files with 11 additions and 15 deletions
+5 -9
View File
@@ -56,11 +56,7 @@ static mjtNum longitude(const mjtNum vec[3]) {
// map to elevation angle in spherical coordinates
static mjtNum latitude(const mjtNum vec[3]) {
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;
}
return mju_atan2(mju_sqrt(vec[0]*vec[0] + vec[1]*vec[1]), vec[2]);
}
@@ -892,9 +888,9 @@ void mju_multiRayPrepare(const mjModel* m, const mjData* d, const mjtNum pnt[3],
if (point_in_box(aabb, xpos, xmat, pnt)) {
(geom_ba+4*g)[0] = -mjPI;
(geom_ba+4*g)[1] = -mjPI/2;
(geom_ba+4*g)[1] = 0;
(geom_ba+4*g)[2] = mjPI;
(geom_ba+4*g)[3] = mjPI/2;
(geom_ba+4*g)[3] = mjPI;
continue;
}
@@ -923,9 +919,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[1] = 0;
AABB[2] = mjPI;
AABB[3] = mjPI/2;
AABB[3] = mjPI;
}
if (AABB[3]-AABB[1] > mjPI) { // SHOULD NOT OCCUR