27 lines
727 B
Python
27 lines
727 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')
|
|
with open(self.cube_file_name, 'r') as cube_file:
|
|
cube_json = json.load(cube_file)
|
|
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)
|