def test_tesselate_torus(self): """ 2st test : tesselation of a torus """ a_box = BRepPrimAPI_MakeTorus(10, 4).Shape() tess = Tesselator(a_box, atNormal, 1.0, 1, 0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.) self.assert_(tess.ObjGetTriangleCount() > 100) self.assert_(tess.ObjGetNormalCount() > 100)
def test_tesselate_box(self): """ 1st test : tesselation of a box """ a_box = BRepPrimAPI_MakeBox(10, 20, 30).Shape() tess = Tesselator(a_box, atNormal, 1.0, 1, 0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.) self.assert_(tess.ObjGetTriangleCount() == 12) self.assert_(tess.ObjGetNormalCount() == 24)
def test_tesselate_torus_with_edges(self): """ 2st test : tesselation of a torus """ a_torus = BRepPrimAPI_MakeTorus(10, 4).Shape() tess = Tesselator(a_torus, atNormal, 1.0, 1, 0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.) tess.Compute(compute_edges=True) self.assert_(tess.ObjGetTriangleCount() > 100) self.assert_(tess.ObjGetNormalCount() > 100)
def test_tesselate_torus_with_bad_quality(self): """ 2st test : tesselation of a torus """ a_torus = BRepPrimAPI_MakeTorus(10, 4).Shape() tess = Tesselator(a_torus, atNormal, 1.0, 1, 0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.) tess.Compute(mesh_quality=40.) # since mesh quality is much lower, we should count less vertices and # triangles self.assert_(tess.ObjGetTriangleCount() > 10) self.assert_(tess.ObjGetTriangleCount() < 100) self.assert_(tess.ObjGetNormalCount() > 10) self.assert_(tess.ObjGetNormalCount() < 100)