Add built-in sphere mesh.
PiperOrigin-RevId: 791162850 Change-Id: I573a414727e79f1a495e0f2282b2faff48ab3443
This commit is contained in:
committed by
Copybara-Service
parent
5220767457
commit
996f0040fd
Vendored
+3
-1
@@ -1,5 +1,6 @@
|
||||
<mujoco model="makemesh">
|
||||
<asset>
|
||||
<mesh name="sphere" builtin="sphere" params="2" scale=".8 .8 .8"/>
|
||||
<mesh name="hemisphere" builtin="hemisphere" params="4" scale=".8 .8 .8"/>
|
||||
<mesh name="wedge" builtin="wedge" params="10 10 60 60 0"/>
|
||||
<mesh name="prism3" builtin="cone" params="3 1" scale=".3 .3 .3"/>
|
||||
@@ -10,7 +11,8 @@
|
||||
|
||||
<worldbody>
|
||||
<light pos="0 0 10"/>
|
||||
<geom mesh="hemisphere" type="mesh" pos="-2 0 0"/>
|
||||
<geom mesh="sphere" type="mesh" pos="-3 0 0"/>
|
||||
<geom mesh="hemisphere" type="mesh" pos="-1 0 0"/>
|
||||
<geom mesh="wedge" type="mesh" euler="90 -90 0"/>
|
||||
<geom mesh="prism5" type="mesh" pos="2 0 0" euler="90 0 0"/>
|
||||
<geom mesh="prism3" type="mesh" pos="3 0 0"/>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// Tests for user/user_objects.cc.
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@@ -732,7 +733,6 @@ TEST_F(MjCMeshTest, VolumeTooSmall) {
|
||||
EXPECT_THAT(model, testing::IsNull());
|
||||
EXPECT_THAT(error.data(), HasSubstr("mesh volume is too small"));
|
||||
mj_deleteModel(model);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, VisualVolumeTooSmall) {
|
||||
@@ -760,7 +760,6 @@ TEST_F(MjCMeshTest, VisualVolumeTooSmall) {
|
||||
EXPECT_THAT(model, testing::IsNull());
|
||||
EXPECT_THAT(error.data(), HasSubstr("mesh volume is too small"));
|
||||
mj_deleteModel(model);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, VisualVolumeSmallAllowedShell) {
|
||||
@@ -1310,5 +1309,27 @@ TEST_F(MjCMeshTest, HemisphereSizes) {
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, SphereSizes) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco model="makemesh">
|
||||
<asset>
|
||||
<mesh name="h0" builtin="sphere" params="0"/>
|
||||
<mesh name="h1" builtin="sphere" params="1"/>
|
||||
<mesh name="h2" builtin="sphere" params="2"/>
|
||||
</asset>
|
||||
</mujoco>
|
||||
)";
|
||||
std::array<char, 1024> error;
|
||||
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(model, NotNull()) << error.data();
|
||||
EXPECT_EQ(model->mesh_vertnum[0], 2 + 10 * std::pow(4, 0));
|
||||
EXPECT_EQ(model->mesh_vertnum[1], 2 + 10 * std::pow(4, 1));
|
||||
EXPECT_EQ(model->mesh_vertnum[2], 2 + 10 * std::pow(4, 2));
|
||||
EXPECT_EQ(model->mesh_facenum[0], 20 * std::pow(4, 0));
|
||||
EXPECT_EQ(model->mesh_facenum[1], 20 * std::pow(4, 1));
|
||||
EXPECT_EQ(model->mesh_facenum[2], 20 * std::pow(4, 2));
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mujoco
|
||||
|
||||
Reference in New Issue
Block a user