Use enum instead of NaNs for alternative orientation specification.

PiperOrigin-RevId: 627413508
Change-Id: I9f1a682a1533e1a3fa3cac0a462f28ce9b0fa192
This commit is contained in:
Yuval Tassa
2024-04-23 09:31:27 -07:00
committed by Copybara-Service
parent f457789de1
commit cf433a4ad9
5 changed files with 46 additions and 23 deletions
+4 -4
View File
@@ -194,7 +194,7 @@ const char* ResolveOrientation(double* quat, bool degree, const char* sequence,
mjuu_copyvec(euler, orient.euler, 3);
// set quat using axisangle
if (mjuu_defined(axisangle[0])) {
if (orient.type == mjORIENTATION_AXISANGLE) {
// convert to radians if necessary, normalize axis
if (degree) {
axisangle[3] = axisangle[3] / 180.0 * mjPI;
@@ -212,7 +212,7 @@ const char* ResolveOrientation(double* quat, bool degree, const char* sequence,
}
// set quat using xyaxes
if (mjuu_defined(xyaxes[0])) {
if (orient.type == mjORIENTATION_XYAXES) {
// normalize x axis
if (mjuu_normvec(xyaxes, 3)<mjEPS) {
return "xaxis too small";
@@ -239,7 +239,7 @@ const char* ResolveOrientation(double* quat, bool degree, const char* sequence,
}
// set quat using zaxis
if (mjuu_defined(zaxis[0])) {
if (orient.type == mjORIENTATION_ZAXIS) {
if (mjuu_normvec(zaxis, 3)<mjEPS) {
return "zaxis too small";
}
@@ -248,7 +248,7 @@ const char* ResolveOrientation(double* quat, bool degree, const char* sequence,
// handle euler
if (mjuu_defined(euler[0])) {
if (orient.type == mjORIENTATION_EULER) {
// convert to radians if necessary
if (degree) {
for (int i=0; i<3; i++) {