コード例 #1
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_clustered_verts(self):
     verts = [(1, 0), (0.3, 0), (0.2, 0), (0.1, 0), (0, 0), (0, 0.1), (0, 0.2), (0, 0.3), (0, 1), (1, 1)]
     self.assertEquals(centroid(verts), (0.5, 0.5), "bad centroid unitsquare")
コード例 #2
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_triangle_counterclockwise(self):
     verts = [(2, 2), (4, 2), (6, 5)]
     verts.reverse()
     self.assertEquals(centroid(verts), (4, 3), "bad centroid big slanty square")
コード例 #3
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_regular_octagon(self):
     verts = [(80, 90), (80, 110), (90, 120), (110, 120), (120, 110), (120, 90), (110, 80), (90, 80)]
     self.assertEquals(centroid(verts), (100, 100), "bad centroid big slanty square")
コード例 #4
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_triangle(self):
     verts = [(2, 2), (4, 2), (6, 5)]
     self.assertEquals(centroid(verts), (4, 3), "bad centroid big slanty square")
コード例 #5
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_big_slanty_square(self):
     verts = [(90, 100), (100, 110), (110, 100), (100, 90)]
     self.assertEquals(centroid(verts), (100, 100), "bad centroid big slanty square")
コード例 #6
0
ファイル: poly_test.py プロジェクト: tartley/sole-scion
 def test_centroid_unit_square(self):
     verts = [(0, 0), (0, 1), (1, 1), (1, 0)]
     self.assertEquals(centroid(verts), (0.5, 0.5), "bad centroid unitsquare")
コード例 #7
0
ファイル: block.py プロジェクト: tartley/sole-scion
 def get_centroid(self):
     return centroid(self.verts)
コード例 #8
0
ファイル: block.py プロジェクト: tartley/sole-scion
 def _centralize_verts(self):
     center = centroid(self.verts)
     self.offset((-center[0], -center[1]))