コード例 #1
0
ファイル: test_Point.py プロジェクト: bobbyrward/pyflam3ng
    def testInRect(self):
        p = Point(10.1, 20.2)
        self.assertFalse(p.in_rect(11, 21, 15, 22))
        self.assertTrue(p.in_rect(10, 20, 15, 22))

        self.assertFalse(p.in_rect_wh(11, 21, 4, 1))
        self.assertTrue(p.in_rect_wh(10, 20, 4, 1))
コード例 #2
0
ファイル: test_Point.py プロジェクト: bobbyrward/pyflam3ng
    def testInTriangle(self):
        p = Point(6.0, 6.0)

        self.assertTrue(p.in_triangle(
                Point(5.0, 5.0),
                Point(7.0, 5.0),
                Point(6.0, 7.0)
            ))

        self.assertFalse(p.in_triangle(
                Point(5.0, 5.0),
                Point(6.0, 5.0),
                Point(5.0, 6.0)
            ))
コード例 #3
0
ファイル: test_Point.py プロジェクト: bobbyrward/pyflam3ng
 def testAngle(self):
     p = Point(10.1, 20.2)
     self.assertAlmostEqual(p.angle(), 63.43494882292201)
コード例 #4
0
ファイル: test_Point.py プロジェクト: bobbyrward/pyflam3ng
 def testInCircle(self):
     p = Point(10.1, 20.2)
     self.assertFalse(p.in_circle(Point(0.0, 0.0), 15.0))
     self.assertTrue(p.in_circle(Point(0.0, 0.0), 22.6))
コード例 #5
0
ファイル: test_Point.py プロジェクト: bobbyrward/pyflam3ng
 def testMagnitude(self):
     p = Point(10.1, 20.2)
     self.assertAlmostEqual(p.magnitude(), 22.584286572747875)