def assertArc(self, edge, pt1, pt2, direction='CW'): """Verify that edge is an arc between pt1 and pt2 with the given direction.""" self.assertIs(type(edge.Curve), Part.Circle) self.assertCoincide(edge.valueAt(edge.FirstParameter), pt1) self.assertCoincide(edge.valueAt(edge.LastParameter), pt2) ptm = edge.valueAt((edge.LastParameter + edge.FirstParameter) / 2) side = Side.of(pt2 - pt1, ptm - pt1) if 'CW' == direction: self.assertEqual(side, Side.Left) else: self.assertEqual(side, Side.Right)
def assertArc(self, edge, pt1, pt2, direction = 'CW'): """Verify that edge is an arc between pt1 and pt2 with the given direction.""" self.assertIs(type(edge.Curve), Part.Circle) self.assertCoincide(edge.valueAt(edge.FirstParameter), pt1) self.assertCoincide(edge.valueAt(edge.LastParameter), pt2) ptm = edge.valueAt((edge.LastParameter + edge.FirstParameter)/2) side = Side.of(pt2 - pt1, ptm - pt1) if 'CW' == direction: self.assertEqual(side, Side.Left) else: self.assertEqual(side, Side.Right)
def assertArc(self, edge, pt1, pt2, direction = 'CW'): """Verify that edge is an arc between pt1 and pt2 with the given direction.""" # If an Arc is wrapped into edge, then it's curve is represented as a circle # and not as an Arc (GeomTrimmedCurve) #self.assertIs(type(edge.Curve), Part.Arc) self.assertIs(type(edge.Curve), Part.Circle) self.assertCoincide(edge.valueAt(edge.FirstParameter), pt1) self.assertCoincide(edge.valueAt(edge.LastParameter), pt2) ptm = edge.valueAt((edge.LastParameter + edge.FirstParameter)/2) side = Side.of(pt2 - pt1, ptm - pt1) #print("(%.2f, %.2f) (%.2f, %.2f) (%.2f, %.2f)" % (pt1.x, pt1.y, ptm.x, ptm.y, pt2.x, pt2.y)) #print(" (%.2f, %.2f) (%.2f, %.2f) -> %s" % ((pt2-pt1).x, (pt2-pt1).y, (ptm-pt1).x, (ptm-pt1).y, Side.toString(side))) #print(" (%.2f, %.2f) (%.2f, %.2f) -> (%.2f, %.2f)" % (pf.x,pf.y, pl.x,pl.y, pm.x, pmy)) if 'CW' == direction: self.assertEqual(side, Side.Left) else: self.assertEqual(side, Side.Right)