From 9370039015228103ac3b8946a1c07e60b4287eb0 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Mon, 7 Nov 2022 07:42:24 -0800 Subject: [PATCH] Use a non-symmetric tetrahedron for user_mesh_test. PiperOrigin-RevId: 486658331 Change-Id: I96edd3b2aba916f9215661a7ba94271696690807 --- test/user/user_mesh_test.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/user/user_mesh_test.cc b/test/user/user_mesh_test.cc index a1b59915..b5fe6343 100644 --- a/test/user/user_mesh_test.cc +++ b/test/user/user_mesh_test.cc @@ -247,12 +247,17 @@ TEST_F(MjCMeshTest, FlippedFaceFails) { } void CheckTetrahedronWasRescaled(mjModel* model) { - // the rotated and rescaled positions of the standard tetrahedron - mjtNum vert[] = { - -mju_sqrt(3)/4, 0., 0, mju_sqrt(3)/12, 0, mju_sqrt(6)/3, mju_sqrt(3)/12, - -mju_sqrt(2)/2, -mju_sqrt(6)/6, mju_sqrt(3)/12, mju_sqrt(2)/2, -mju_sqrt(6)/6}; - for (int i=0; i<12; ++i) { - EXPECT_NEAR(model->mesh_vert[i], vert[i], std::numeric_limits::epsilon()); + // The rotated and rescaled positions of the tetrahedron + // with vertices (0, 0, 0), (1, 0, 0), (0, 2, 0), (0, 0, 3) + // after mesh preprocessing is performed + std::vector vert = { + -0.51610732078552246, -0.57402724027633667, -0.5283237099647522, + 0.42337465286254883, -0.90627568960189819, -0.61189728975296021, + 0.065528042614459991, 1.2306677103042603, -1.1645441055297852, + 0.027204651385545731, 0.24963514506816864, 2.3047652244567871}; + mjtNum tolerance = std::numeric_limits::epsilon(); + for (int i=0; i < 12; ++i) { + EXPECT_NEAR(model->mesh_vert[i], vert[i], tolerance); } } @@ -261,7 +266,7 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedWorld) { @@ -281,7 +286,7 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedNoMass) { @@ -303,7 +308,7 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedInertial) { @@ -326,7 +331,7 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedNegligibleArea) {