@@ -595,6 +595,34 @@ def test_SampleTimeGenerator_(self):
595
595
decimal = 7 , err_msg = error , \
596
596
verbose = True )
597
597
598
+ def test_GetPointFrom (self ):
599
+ # Check that each input type returns the correct xyz coord
600
+
601
+ # Kinbody
602
+ self .env .Load ('data/mug1.dae' )
603
+ mug = self .env .GetKinBody ('mug' )
604
+ mug .SetTransform (numpy .eye (4 ))
605
+ coord_kinbody = prpy .util .GetPointFrom (mug )
606
+ expected_kinbody_coords = [0 , 0 , 0 ]
607
+ #numpy.testing.assert_array_almost_equal(coord_kinbody, expected_kinbody_coords)
608
+
609
+ expected_coord = [1 , 3 , 4 ]
610
+
611
+ # Point in space
612
+ space_coord = numpy .array ([1 , 3 , 4 ])
613
+ space_result = prpy .util .GetPointFrom (space_coord )
614
+ numpy .testing .assert_array_almost_equal (space_result , expected_coord )
615
+
616
+ # 4x4 Transform
617
+ trans_coord = numpy .eye (4 )
618
+ trans_coord [0 :3 , 3 ] = expected_coord
619
+ trans_result = prpy .util .GetPointFrom (trans_coord )
620
+ numpy .testing .assert_array_almost_equal (trans_result , expected_coord )
621
+
622
+ # List
623
+ list_coord = [1 , 3 , 4 ]
624
+ list_result = prpy .util .GetPointFrom (list_coord )
625
+ numpy .testing .assert_array_almost_equal (list_result , expected_coord )
598
626
599
627
if __name__ == '__main__' :
600
628
unittest .main ()
0 commit comments