Unverified Commit d7a7bd3f authored by Joseph Mirabel's avatar Joseph Mirabel Committed by GitHub
Browse files

Merge pull request #142 from jmirabel/devel

[Python] Fix bindings of CollisionResult.
parents 4359f817 ac577cc3
......@@ -134,7 +134,7 @@ void exposeCollisionAPI ()
if(!eigenpy::register_symbolic_link_to_registered_type< std::vector<CollisionResult> >())
{
class_< std::vector<CollisionResult> >("CollisionResult")
class_< std::vector<CollisionResult> >("StdVec_CollisionResult")
.def(vector_indexing_suite< std::vector<CollisionResult> >())
;
}
......
SET(${PROJECT_NAME}_PYTHON_TESTS
geometric_shapes
api
)
FOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
......
import unittest
from test_case import TestCase
import hppfcl
hppfcl.switchToNumpyArray()
import numpy as np
class TestMainAPI(TestCase):
def test_collision(self):
capsule = hppfcl.Capsule(1.,2.)
M1 = hppfcl.Transform3f()
M2 = hppfcl.Transform3f(np.eye(3),np.array([3, 0, 0]))
req=hppfcl.CollisionRequest()
res=hppfcl.CollisionResult()
self.assertTrue(not hppfcl.collide(capsule, M1, capsule, M2, req, res))
def test_distance(self):
capsule = hppfcl.Capsule(1.,2.)
M1 = hppfcl.Transform3f()
M2 = hppfcl.Transform3f(np.eye(3),np.array([3, 0, 0]))
req=hppfcl.DistanceRequest()
res=hppfcl.DistanceResult()
self.assertTrue(hppfcl.distance(capsule, M1, capsule, M2, req, res) > 0)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment