def test_shortest_surface_path(self): surface = SVMTK.Surface() surface.make_cube(-1., -1., -1., 1., 1., 1., 1) a = surface.shortest_surface_path(SVMTK.Point_3(-1, -1, 1), SVMTK.Point_3(1, -1, 1)) self.assertTrue(a[1] == SVMTK.Point_3(-1, -1, 1) and a[0] == SVMTK.Point_3(1, -1, 1))
def test_domain_with_polyline_meshing(self): surface = SVMTK.Surface(); surface.make_sphere(0.0,0.0,0.0,3.0,1.0) domain = SVMTK.Domain(surface) line0 = [SVMTK.Point_3(0,0,0.0), SVMTK.Point_3(0,1.0,1.0)] domain.add_feature( line0) domain.create_mesh(1.) self.assertTrue(domain.number_of_curves() >0)
def test_simple_cgal_wrappers(self): p3 = SVMTK.Point_3(1., 0, 1.0) self.assertEqual(p3.x(), 1.0) self.assertEqual(p3.y(), 0.0) self.assertEqual(p3.z(), 1.0) p2 = SVMTK.Point_2(0, 1.) self.assertEqual(p2.x(), 0) self.assertEqual(p2.y(), 1.0) pl3 = SVMTK.Plane_3(1, 2, 3, 4) self.assertEqual(pl3.a(), 1.0) self.assertEqual(pl3.b(), 2.0) self.assertEqual(pl3.c(), 3.0) self.assertEqual(pl3.d(), 4.0) v3 = SVMTK.Vector_3(0, 1.0, 0.0) self.assertEqual(v3.x(), 0.0) self.assertEqual(v3.y(), 1.0) self.assertEqual(v3.z(), 0.0) pl3 = SVMTK.Plane_3(p3, v3) self.assertEqual(pl3.a(), 0.0) self.assertEqual(pl3.b(), 1.0) self.assertEqual(pl3.c(), 0.0) self.assertEqual(pl3.d(), 0.0)
def test_extension(self): surface = SVMTK.Surface() surface.make_cube(-1., -1., -1., 1., 1., 1., 1) surface.extension(SVMTK.Point_3(0, 0, 2), 1, 1, True) self.assertTrue(surface.num_edges(), 108)
import SVMTK as svm if __name__ == "__main__": surf = svm.Surface() surf.make_cube(-2., -2., -2., 2., 2., 2., 16) surf.save("cube_.off") maker = svm.Domain(surf) maker.add_sharp_border_edges(surf, 85) line0 = [svm.Point_3(0, 0, 0.0), svm.Point_3(0, 1.0, 1.0)] line1 = [svm.Point_3(0, 0, -1.0), svm.Point_3(0, 0, 0.0)] line2 = [svm.Point_3(0, 0, 0.0), svm.Point_3(0, -1.0, 1.0)] maker.add_feature(line0) maker.add_feature(line1) maker.add_feature(line2) maker.create_mesh(24.) maker.exude(100, 0) maker.save("bifurcation_in_cube.mesh", True)
import SVMTK as svm import numpy as np if __name__ == "__main__": lines = [] surf = svm.Surface() surf.make_cylinder(0., 0., 0., 0., 0., 10., 5., 60) R = 3.0 helix1 = [] helix2 = [] for i in np.linspace(0, 10, 40): helix1.append( svm.Point_3(R * np.cos(np.pi * i * 0.5), R * np.sin(np.pi * i * 0.5), i)) helix2.append( svm.Point_3(-R * np.cos(np.pi * i * 0.5), -R * np.sin(np.pi * i * 0.5), i)) lines.append(helix1) lines.append(helix2) maker = svm.Domain(surf) for k in lines: maker.add_feature(k) #maker.add_sharp_border_edges(surf,70) maker.create_mesh(22.) print(maker.get_curves())