def test_filling(self): e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0), (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0), (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) w1 = cm.wire([e1, e2]) f1 = cm.filling(w1) # empirical self.assert_(close(5.479, f1.area(), 0.01)) # Can vary
def test_filling(self): e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0), (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0), (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) w1 = cm.Wire([e1, e2]) f1 = cm.filling(w1) # empirical # Can vary considerably given the spline nature # self.assert_(close(5.479, f1.area(), 0.01)) self.assert_(close(5.44100168973, f1.area(), 0.01))
def face_filling(): e1 = cm.spline([(0.0, 0.0, 0.0), (1.0, 0.2, 0.3), (1.5, 0.8, 1.0), (0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) e2 = cm.spline([(0.0, 0.0, 0.0), (-1.0, 0.2, 0.3), (-1.5, 0.8, 1.0), (-0.8, 1.2, 0.2), (0.0, 1.0, 0.0)]) w1 = cm.wire([e1, e2]) f1 = cm.filling(w1) v.viewstandard(viewtype='iso') v.display(w1, color=(1.0, 0.0, 0.0)) v.display(f1) v.fit() v.save('face_filling.png') v.clear()
def test_spline(self): pts = [(0.0, 0.0, 0.0), (0.2, 0.1, 0.0), (0.5, 0.2, 0.0), (-0.5, 0.3, 0.0)] e1 = cm.spline(pts) # empirical self.assert_(close(1.864, e1.length(), 0.001))
def edge_spline(): pts = [(0.0, 0.0, 0.0), (0.2, 0.1, 0.0), (0.5, 0.2, 0.0), (-0.5, 0.3, 0.0)] e1 = cm.spline(pts) v.viewstandard(viewtype='top') v.display(e1, (0.0, 0.0, 0.0)) for pt in pts: v.display(cm.vertex(pt), (1.0, 0.0, 0.0)) v.fit() v.save('edge_spline.png') v.clear()