surfaces/surf/test/edge.py
2012-05-09 00:32:34 -06:00

26 lines
682 B
Python

import json
import os
import unittest
from surf.geometry import Vertex, PolygonMesh
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)
def test_centroid(self):
e = self.cube.edges[0]
v = self.cube.centroid(e)
self.assertEqual(v, Vertex(-1, 0, 1))
if __name__ == '__main__':
unittest.main(verbosity=3)