surfaces/surf/test/edge.py

26 lines
682 B
Python
Raw Normal View History

import json
import os
2012-05-07 22:17:46 -07:00
import unittest
from surf.geometry import Vertex, PolygonMesh
2012-05-07 22:17:46 -07:00
class TestEdge(unittest.TestCase):
def setUp(self):
path, file_name = os.path.split(__file__)
self.samples_dir = os.path.join(path, os.pardir, os.pardir,
'blender', 'samples')
self.cube_file_name = os.path.join(self.samples_dir, 'cube.json')
cube_json = json.load(open(self.cube_file_name, 'r'))
self.cube = PolygonMesh(**cube_json)
2012-05-07 22:17:46 -07:00
def test_centroid(self):
e = self.cube.edges[0]
v = self.cube.centroid(e)
self.assertEqual(v, Vertex(-1, 0, 1))
2012-05-07 22:17:46 -07:00
if __name__ == '__main__':
unittest.main(verbosity=3)