コード例 #1
0
ファイル: entity.py プロジェクト: jdddog/hri
    def is_right_of(self, other_entity):
        if not isinstance(other_entity, AbstractEntity):
            raise TypeError("is_right_of() parameter other_entity={0} is not a subclass of AbstractEntity".format(other_entity))

        origin = Point()
        other = self.translation_to(other_entity)
        return GeomMath.is_right_of(other, origin)
コード例 #2
0
ファイル: entity.py プロジェクト: jdddog/hri
    def distance_to(self, other_entity):
        if not isinstance(other_entity, AbstractEntity):
            raise TypeError("distance_to() parameter other_entity={0} is not a subclass of AbstractEntity".format(other_entity))

        origin = Point()
        other = self.translation_to(other_entity)
        return GeomMath.distance_between(origin, other)
コード例 #3
0
ファイル: entity.py プロジェクト: jdddog/hri
    def is_left_of(self, other_entity):
        if not isinstance(other_entity, AbstractEntity):
            raise TypeError(
                "is_behind() parameter other_entity={0} is not a subclass of AbstractEntity"
                .format(other_entity))

        origin = Point()
        other = self.translation_to(other_entity)
        return GeomMath.is_left_of(other, origin)
コード例 #4
0
ファイル: entity.py プロジェクト: jdddog/hri
    def distance_to(self, other_entity):
        if not isinstance(other_entity, AbstractEntity):
            raise TypeError(
                "distance_to() parameter other_entity={0} is not a subclass of AbstractEntity"
                .format(other_entity))

        origin = Point()
        other = self.translation_to(other_entity)
        return GeomMath.distance_between(origin, other)
コード例 #5
0
ファイル: test_geom_math.py プロジェクト: linas/hri
 def test_is_right_of(self):
     self.assertTrue(GeomMath.is_right_of(self.right, self.center))
     self.assertFalse(GeomMath.is_right_of(self.left, self.center))
コード例 #6
0
ファイル: test_geom_math.py プロジェクト: linas/hri
 def test_is_behind(self):
     self.assertTrue(GeomMath.is_behind(self.behind, self.center))
     self.assertFalse(GeomMath.is_behind(self.infront, self.center))
コード例 #7
0
ファイル: test_geom_math.py プロジェクト: linas/hri
 def test_distance_to(self):
     distance = GeomMath.distance_between(self.center, self.infront)
     self.assertEqual(distance, math.sqrt(3))
コード例 #8
0
ファイル: test_geom_math.py プロジェクト: jdddog/hri
 def test_is_right_of(self):
     self.assertTrue(GeomMath.is_right_of(self.right, self.center))
     self.assertFalse(GeomMath.is_right_of(self.left, self.center))
コード例 #9
0
ファイル: test_geom_math.py プロジェクト: jdddog/hri
 def test_is_behind(self):
     self.assertTrue(GeomMath.is_behind(self.behind, self.center))
     self.assertFalse(GeomMath.is_behind(self.infront, self.center))
コード例 #10
0
ファイル: test_geom_math.py プロジェクト: jdddog/hri
 def test_distance_to(self):
     distance = GeomMath.distance_between(self.center, self.infront)
     self.assertEqual(distance, math.sqrt(3))