Skip to content

Commit

Permalink
py geometry: Bind HalfSpace.MakePose (#13414)
Browse files Browse the repository at this point in the history
* py geometry: Bind HalfSpace.MakePose
  • Loading branch information
EricCousineau-TRI committed May 27, 2020
1 parent 33fda24 commit ceedc13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bindings/pydrake/geometry_py.cc
Expand Up @@ -589,7 +589,9 @@ void DoScalarIndependentDefinitions(py::module m) {
.def("height", &Box::height, doc.Box.height.doc)
.def("size", &Box::size, py_reference_internal, doc.Box.size.doc);
py::class_<HalfSpace, Shape>(m, "HalfSpace", doc.HalfSpace.doc)
.def(py::init<>(), doc.HalfSpace.ctor.doc);
.def(py::init<>(), doc.HalfSpace.ctor.doc)
.def_static("MakePose", &HalfSpace::MakePose, py::arg("Hz_dir_F"),
py::arg("p_FB"), doc.HalfSpace.MakePose.doc);
py::class_<Mesh, Shape>(m, "Mesh", doc.Mesh.doc)
.def(py::init<std::string, double>(), py::arg("absolute_filename"),
py::arg("scale") = 1.0, doc.Mesh.ctor.doc)
Expand Down
3 changes: 3 additions & 0 deletions bindings/pydrake/test/geometry_test.py
Expand Up @@ -246,6 +246,7 @@ def test_shape_constructors(self):
self.assertIsNot(shape, shape_copy)

def test_shapes(self):
RigidTransform = RigidTransform_[float]
sphere = mut.Sphere(radius=1.0)
self.assertEqual(sphere.radius(), 1.0)
cylinder = mut.Cylinder(radius=1.0, length=2.0)
Expand All @@ -256,6 +257,8 @@ def test_shapes(self):
self.assertEqual(box.depth(), 2.0)
self.assertEqual(box.height(), 3.0)
numpy_compare.assert_float_equal(box.size(), np.array([1.0, 2.0, 3.0]))
X_FH = mut.HalfSpace.MakePose(Hz_dir_F=[0, 1, 0], p_FB=[1, 1, 1])
self.assertIsInstance(X_FH, RigidTransform)
box_mesh_path = FindResourceOrThrow(
"drake/systems/sensors/test/models/meshes/box.obj")
mesh = mut.Mesh(absolute_filename=box_mesh_path, scale=1.0)
Expand Down

0 comments on commit ceedc13

Please sign in to comment.