Exemple #1
0
def points_from_intersection():
    '''
    @param display:
    '''
    plane = gp_Pln(gp_Ax3(gp_XOY()))
    minor_radius, major_radius = 5., 8.
    ellips = gp_Elips(gp_YOZ(), major_radius, minor_radius)
    intersection = IntAna_IntConicQuad(ellips, plane, precision_Angular(),
                                       precision_Confusion())
    a_plane = GC_MakePlane(plane).Value()
    a_surface = Geom_RectangularTrimmedSurface(a_plane, -8., 8., -12., 12.,
                                               True, True)
    display.DisplayShape(a_surface, update=True)

    anEllips = GC_MakeEllipse(ellips).Value()
    display.DisplayShape(anEllips)

    if intersection.IsDone():
        nb_results = intersection.NbPoints()
        if nb_results > 0:
            for i in range(1, nb_results + 1):
                P = intersection.Point(i)
                pstring = "P%i" % i
                display.DisplayShape(P)
                display.DisplayMessage(P, pstring)
Exemple #2
0
 def test_points_from_intersection(self):
     '''Test: points from intersection'''
     PL = gp_Pln(gp_Ax3(gp_XOY()))
     MinorRadius, MajorRadius = 5, 8
     EL = gp_Elips(gp_YOZ(), MajorRadius, MinorRadius)
     ICQ = IntAna_IntConicQuad(EL, PL, precision_Angular(),
                               precision_Confusion())
     if ICQ.IsDone():
         NbResults = ICQ.NbPoints()
         if NbResults > 0:
             for i in range(1, NbResults + 1):
                 P = ICQ.Point(i)
                 self.assertIsInstance(P, gp_Pnt)
     aPlane = GC_MakePlane(PL).Value()
     aSurface = Geom_RectangularTrimmedSurface(aPlane, -8., 8., -12., 12.,
                                               True, True)
     self.assertIsNotNone(aSurface)
     self.assertFalse(aSurface.IsNull())
     anEllips = GC_MakeEllipse(EL).Value()
     self.assertIsInstance(anEllips, Geom_Ellipse)
     if ICQ.IsDone():
         NbResults = ICQ.NbPoints()
         if NbResults > 0:
             for i in range(1, NbResults + 1):
                 P = ICQ.Point(i)
                 self.assertIsInstance(P, gp_Pnt)