def bisect_linecircle(event=None): display.EraseAll() ci1 = gp_Circ2d(gp_Ax22d(), 10000) li1 = gp_Lin2d(gp_Pnt2d(2000000, 20), gp_Dir2d(0, 1)) bi = GccAna_CircLin2dBisec(ci1, li1) assert bi.IsDone() bisec = bi.ThisSolution(1) pb = bisec.Parabola() display.DisplayShape([make_edge2d(ci1), make_edge2d(li1)]) display.DisplayColoredShape(make_edge2d(pb), 'BLUE') display.FitAll()
def test_parabola(self): '''Test: parabola''' # P is the vertex point # P and D give the axis of symmetry # 6 is the focal length of the parabola P = gp_Pnt2d(2., 3.) D = gp_Dir2d(4., 5.) A = gp_Ax22d(P, D, True) Para = gp_Parab2d(A, 6) aParabola = GCE2d_MakeParabola(Para) gParabola = aParabola.Value() aTrimmedCurve = Geom2d_TrimmedCurve(gParabola, -100, 100, True)
def test_parabola(self): """Test: parabola""" # P is the vertex point # P and D give the axis of symmetry # 6 is the focal length of the parabola P = gp_Pnt2d(2.0, 3.0) D = gp_Dir2d(4.0, 5.0) A = gp_Ax22d(P, D, True) Para = gp_Parab2d(A, 6) aParabola = GCE2d_MakeParabola(Para) gParabola = aParabola.Value() self.assertIsInstance(gParabola, Geom2d_Parabola) aTrimmedCurve = Geom2d_TrimmedCurve(gParabola, -100, 100, True) self.assertIsNotNone(aTrimmedCurve) self.assertFalse(aTrimmedCurve is None)
def test_parabola(self): '''Test: parabola''' # P is the vertex point # P and D give the axis of symmetry # 6 is the focal length of the parabola P = gp_Pnt2d(2., 3.) D = gp_Dir2d(4., 5.) A = gp_Ax22d(P, D, True) Para = gp_Parab2d(A, 6) aParabola = GCE2d_MakeParabola(Para) gParabola = aParabola.Value() self.assertIsInstance(gParabola, Geom2d_Parabola) aTrimmedCurve = Geom2d_TrimmedCurve(gParabola, -100, 100, True) self.assertIsNotNone(aTrimmedCurve) self.assertFalse(aTrimmedCurve.IsNull())
def parabola(event=None): # P is the vertex point # P and D give the axis of symmetry # 6 is the focal length of the parabola a_pnt = gp_Pnt2d(2, 3) a_dir = gp_Dir2d(4, 5) an_ax = gp_Ax22d(a_pnt, a_dir, True) para = gp_Parab2d(an_ax, 6) display.DisplayShape(a_pnt) display.DisplayMessage(a_pnt, "P") aParabola = GCE2d_MakeParabola(para) gParabola = aParabola.Value() aTrimmedCurve = Geom2d_TrimmedCurve(gParabola, -100, 100, True) display.DisplayShape(aTrimmedCurve, update=True)
def bisect_crvcrv(event=None): display.EraseAll() ax = gp_Ax22d(gp_Pnt2d(), gp_Dir2d(1, 0), gp_Dir2d(0, -1)) circ = gp_Circ2d(ax, 5) crv1 = GCE2d_MakeCircle(circ).Value() edg1 = make_edge2d(crv1, -1.0, 1.0) display.DisplayColoredShape(edg1, 'BLUE') p1 = gp_Pnt2d(-10, 0) p2 = gp_Pnt2d(-10, 10) crv2 = GCE2d_MakeLine(p1, p2).Value() edg2 = make_edge2d(crv2, -10.0, 10.0) display.DisplayColoredShape(edg2, 'GREEN') bi = Bisector_BisecCC(crv1, crv2, 50, -5, gp_Pnt2d(0, 0)) crv_bi = bi.Curve(1) edg3 = make_edge2d(crv_bi, -1.0, 1.0) display.DisplayColoredShape(edg3, 'RED') display.FitAll()