Example #1
0
    def test_circles2d_from_curves(self):
        '''Test: circles2d from curves'''
        P1 = gp_Pnt2d(9, 6)
        P2 = gp_Pnt2d(10, 4)
        P3 = gp_Pnt2d(6, 7)
        C = gce_MakeCirc2d(P1, P2, P3).Value()

        QC = gccent_Outside(C)
        P4 = gp_Pnt2d(-2, 7)
        P5 = gp_Pnt2d(12, -3)
        L = GccAna_Lin2d2Tan(P4, P5, precision_Confusion()).ThisSolution(1)

        QL = gccent_Unqualified(L)
        radius = 2.
        TR = GccAna_Circ2d2TanRad(QC, QL, radius, precision_Confusion())

        if TR.IsDone():
            NbSol = TR.NbSolutions()
            for k in range(1, NbSol + 1):
                circ = TR.ThisSolution(k)
                # find the solution circle
                pnt1 = gp_Pnt2d()
                parsol, pararg = TR.Tangency1(k, pnt1)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the first tangent point
                pnt2 = gp_Pnt2d()
                parsol, pararg = TR.Tangency2(k, pnt2)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the second tangent point

        aLine = GCE2d_MakeSegment(L, -2, 20).Value()
        self.assertIsInstance(aLine, Geom2d_TrimmedCurve)
        if TR.IsDone():
            NbSol = TR.NbSolutions()
            for k in range(1, NbSol + 1):
                circ = TR.ThisSolution(k)
                aCircle = Geom2d_Circle(circ)
                self.assertIsInstance(aCircle, Geom2d_Circle)
                # find the solution circle (index, outvalue, outvalue, gp_Pnt2d)
                pnt3 = gp_Pnt2d()
                parsol, pararg = TR.Tangency1(k, pnt3)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the first tangent point
                pnt4 = gp_Pnt2d()
                parsol, pararg = TR.Tangency2(k, pnt4)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
    def test_circles2d_from_curves(self):
        '''Test: circles2d from curves'''
        P1 = gp_Pnt2d(9, 6)
        P2 = gp_Pnt2d(10, 4)
        P3 = gp_Pnt2d(6, 7)
        C = gce_MakeCirc2d(P1, P2, P3).Value()

        QC = gccent_Outside(C)
        P4 = gp_Pnt2d(-2, 7)
        P5 = gp_Pnt2d(12, -3)
        L = GccAna_Lin2d2Tan(P4, P5, precision_Confusion()).ThisSolution(1)

        QL = gccent_Unqualified(L)
        radius = 2.
        TR = GccAna_Circ2d2TanRad(QC, QL, radius, precision_Confusion())

        if TR.IsDone():
            NbSol = TR.NbSolutions()
            for k in range(1, NbSol+1):
                circ = TR.ThisSolution(k)
                # find the solution circle
                pnt1 = gp_Pnt2d()
                parsol, pararg = TR.Tangency1(k, pnt1)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the first tangent point
                pnt2 = gp_Pnt2d()
                parsol, pararg = TR.Tangency2(k, pnt2)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the second tangent point

        aLine = GCE2d_MakeSegment(L, -2, 20).Value()
        self.assertIsInstance(aLine, Geom2d_TrimmedCurve)
        if TR.IsDone():
            NbSol = TR.NbSolutions()
            for k in range(1, NbSol+1):
                circ = TR.ThisSolution(k)
                aCircle = Geom2d_Circle(circ)
                self.assertIsInstance(aCircle, Geom2d_Circle)
                # find the solution circle (index, outvalue, outvalue, gp_Pnt2d)
                pnt3 = gp_Pnt2d()
                parsol, pararg = TR.Tangency1(k, pnt3)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)
                # find the first tangent point
                pnt4 = gp_Pnt2d()
                parsol, pararg = TR.Tangency2(k, pnt4)
                self.assertGreater(parsol, 0.)
                self.assertGreater(pararg, 0.)