Exemple #1
0
 def __init__(self, A, B, options):
     A, B = (CC(A), CC(B))
     if A.imag() < 0:
         raise ValueError("%s is not a valid point in the UHP model" % (A))
     if B.imag() < 0:
         raise ValueError("%s is not a valid point in the UHP model" % (B))
     self.path = []
     self._hyperbolic_arc(A, B, True)
     BezierPath.__init__(self, self.path, options)
     self.A, self.B = (A, B)
 def __init__(self, A, B, options):
     A, B = (CC(A), CC(B))
     if A.imag()<0:
         raise ValueError("%s is not a valid point in the UHP model"%(A))
     if B.imag()<0:
         raise ValueError("%s is not a valid point in the UHP model"%(B))
     self.path = []
     self._hyperbolic_arc(A, B, True);
     BezierPath.__init__(self, self.path, options)
     self.A, self.B = (A, B)
Exemple #3
0
    def __init__(self, A, B, C, options):
        """
        Initialize HyperbolicTriangle:

        Examples::

            sage: from sage.plot.hyperbolic_triangle import HyperbolicTriangle
            sage: print HyperbolicTriangle(0, 1/2, I, {})
            Hyperbolic triangle (0.000000000000000, 0.500000000000000, 1.00000000000000*I)

        """
        A, B, C = (CC(A), CC(B), CC(C))
        self.path = []
        sides = options.pop('sides', [1, 2, 3])
        verbose = options.pop('verbose', 0)
        sides.sort()
        if sides == [1]:
            if verbose > 0:
                print "Drawing A - B!"
            self._hyperbolic_arc(A, B, True)
        elif sides == [2]:
            if verbose > 0:
                print "Drawing B - C!"
            self._hyperbolic_arc(B, C, True)
        elif sides == [3]:
            if verbose > 0:
                print "Drawing C - A!"
            self._hyperbolic_arc(C, A, True)
        elif sides == [1, 2]:
            if verbose > 0:
                print "Drawing A - B! & B - C!"
            self._hyperbolic_arc(A, B, True)
            self._hyperbolic_arc(B, C, False)
        elif sides == [1, 3]:
            if verbose > 0:
                print "Drawing C - A! & A - B"
            self._hyperbolic_arc(C, A, True)
            self._hyperbolic_arc(A, B, False)
        elif sides == [2, 3]:
            if verbose > 0:
                print "Drawing B - C! & C - A"
            self._hyperbolic_arc(B, C, True)
            self._hyperbolic_arc(C, A, False)
        else:
            self._hyperbolic_arc(A, B, True)
            self._hyperbolic_arc(B, C, False)
            self._hyperbolic_arc(C, A, False)

        BezierPath.__init__(self, self.path, options)
        self.A, self.B, self.C = (A, B, C)
        self._pts = [A, B, C]
Exemple #4
0
    def __init__(self, A, B, C, options):
        """
        Initialize HyperbolicTriangle:

        Examples::

            sage: from sage.plot.hyperbolic_triangle import HyperbolicTriangle
            sage: print HyperbolicTriangle(0, 1/2, I, {})
            Hyperbolic triangle (0.000000000000000, 0.500000000000000, 1.00000000000000*I)

        """
        A, B, C = (CC(A), CC(B), CC(C))
        self.path = []
        sides = options.pop('sides',[1,2,3])
        verbose=options.pop('verbose',0)
        sides.sort()
        if sides == [1]:
            if verbose>0:
                print "Drawing A - B!"
            self._hyperbolic_arc(A, B, True);
        elif sides == [2]:
            if verbose>0:
                print "Drawing B - C!"                
            self._hyperbolic_arc(B, C, True);
        elif sides == [3]:
            if verbose>0:
                print "Drawing C - A!"                
            self._hyperbolic_arc(C, A, True);
        elif sides == [1,2]:
            if verbose>0:
                print "Drawing A - B! & B - C!"
            self._hyperbolic_arc(A, B, True);
            self._hyperbolic_arc(B, C, False);
        elif sides == [1,3]:
            if verbose>0:
                print "Drawing C - A! & A - B"
            self._hyperbolic_arc(C, A,True)
            self._hyperbolic_arc(A, B, False)
        elif sides == [2,3]:
            if verbose>0:
                print "Drawing B - C! & C - A"
            self._hyperbolic_arc(B, C,True)
            self._hyperbolic_arc(C, A, False)            
        else:
            self._hyperbolic_arc(A, B,True)            
            self._hyperbolic_arc(B, C,False)
            self._hyperbolic_arc(C, A, False)            
            
        BezierPath.__init__(self, self.path, options)
        self.A, self.B, self.C = (A, B, C)
        self._pts = [A,B,C]
Exemple #5
0
    def __init__(self, A, B, C, options):
        """
        Initialize HyperbolicTriangle:

        Examples::
        
            sage: from sage.plot.hyperbolic_triangle import HyperbolicTriangle
            sage: print HyperbolicTriangle(0, 1/2, I, {})
            Hyperbolic triangle (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
        """
        A, B, C = (CC(A), CC(B), CC(C))
        self.path = []
        self._hyperbolic_arc(A, B, True)
        self._hyperbolic_arc(B, C)
        self._hyperbolic_arc(C, A)
        BezierPath.__init__(self, self.path, options)
        self.A, self.B, self.C = (A, B, C)
Exemple #6
0
    def __init__(self, A, B, C, options):
        """
        Initialize HyperbolicTriangle:

        Examples::

            sage: from sage.plot.hyperbolic_triangle import HyperbolicTriangle
            sage: print HyperbolicTriangle(0, 1/2, I, {})
            Hyperbolic triangle (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
        """
        A, B, C = (CC(A), CC(B), CC(C))
        self.path = []
        self._hyperbolic_arc(A, B, True);
        self._hyperbolic_arc(B, C);
        self._hyperbolic_arc(C, A);
        BezierPath.__init__(self, self.path, options)
        self.A, self.B, self.C = (A, B, C)
Exemple #7
0
    def __init__(self, pts, options):
        """
        Initialize HyperbolicPolygon.

        EXAMPLES::

            sage: from sage.plot.hyperbolic_polygon import HyperbolicPolygon
            sage: print HyperbolicPolygon([0, 1/2, I], {})
            Hyperbolic polygon (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
        """
        pts = [CC(_) for _ in pts]
        self.path = []
        self._hyperbolic_arc(pts[0], pts[1], True)
        for i in range(1, len(pts) - 1):
            self._hyperbolic_arc(pts[i], pts[i + 1])
        self._hyperbolic_arc(pts[-1], pts[0])
        BezierPath.__init__(self, self.path, options)
        self._pts = pts
Exemple #8
0
    def __init__(self, pts, options):
        """
        Initialize HyperbolicPolygon.

        EXAMPLES::

            sage: from sage.plot.hyperbolic_polygon import HyperbolicPolygon
            sage: print(HyperbolicPolygon([0, 1/2, I], {}))
            Hyperbolic polygon (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
        """
        pts = [CC(_) for _ in pts]
        self.path = []
        self._hyperbolic_arc(pts[0], pts[1], True)
        for i in range(1, len(pts) - 1):
            self._hyperbolic_arc(pts[i], pts[i + 1])
        self._hyperbolic_arc(pts[-1], pts[0])
        BezierPath.__init__(self, self.path, options)
        self._pts = pts
Exemple #9
0
 def __init__(self, A, B, options):
     A, B = (CC(A), CC(B))
     self.path = []
     self._hyperbolic_arc(A, B, True)
     BezierPath.__init__(self, self.path, options)
     self.A, self.B = (A, B)
Exemple #10
0
 def __init__(self, A, B, options):
     A, B = (CC(A), CC(B))
     self.path = []
     self._hyperbolic_arc(A, B, True);
     BezierPath.__init__(self, self.path, options)
     self.A, self.B = (A, B)