Exemplo n.º 1
0
    def bulge2arc(self, Ps, Pe, bulge):
        """
        bulge2arc()
        """
        c = (1 / bulge - bulge) / 2

        # Berechnung des Mittelpunkts (Formel von Mickes!)
        # Calculation of the center (Micke's formula)
        O = Point((Ps.x + Pe.x - (Pe.y - Ps.y) * c) / 2,
                  (Ps.y + Pe.y + (Pe.x - Ps.x) * c) / 2)

        # Radius = Distance between the centre and Ps
        r = O.distance(Ps)
        # Kontrolle ob beide gleich sind (passt ...)
        # Check if they are equal (fits ...)
        # r=O.distance(Pe)

        # Unterscheidung f�r den �ffnungswinkel.
        # Distinction for the opening angle. ???
        if bulge > 0:
            return ArcGeo(Ps=Ps, Pe=Pe, O=O, r=r)
        else:
            arc = ArcGeo(Ps=Pe, Pe=Ps, O=O, r=r)
            arc.reverse()
            return arc
Exemplo n.º 2
0
 def contains_point(self, point):
     """
     Method to determine the minimal distance from the point to the shape
     @param point: a QPointF
     @return: minimal distance
     """
     min_distance = float(0x7fffffff)
     ref_point = Point(point.x(), point.y())
     t = 0.0
     while t < 1.0:
         per_point = self.path.pointAtPercent(t)
         spline_point = Point(per_point.x(), per_point.y())
         distance = ref_point.distance(spline_point)
         if distance < min_distance:
             min_distance = distance
         t += 0.01
     return min_distance
Exemplo n.º 3
0
    def bulge2arc(self, Ps, Pe, bulge):
        """
        bulge2arc()
        """
        c = (1 / bulge - bulge) / 2

        # Calculate the centre point (Micke's formula!)
        O = Point((Ps.x + Pe.x - (Pe.y - Ps.y) * c) / 2,
                  (Ps.y + Pe.y + (Pe.x - Ps.x) * c) / 2)

        # Radius = Distance between the centre and Ps
        r = O.distance(Ps)

        # Check if they are equal (fits ...)
        # r=O.distance(Pe)

        # Unterscheidung f�r den �ffnungswinkel.
        # Distinction for the opening angle. ???
        if bulge > 0:
            return ArcGeo(Ps=Ps, Pe=Pe, O=O, r=r)
        else:
            arc = ArcGeo(Ps=Pe, Pe=Ps, O=O, r=r)
            arc.reverse()
            return arc