passagemath-plot 10.6.31rc3__cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-plot might be problematic. Click here for more details.
- passagemath_plot-10.6.31rc3.dist-info/METADATA +172 -0
- passagemath_plot-10.6.31rc3.dist-info/RECORD +81 -0
- passagemath_plot-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_plot-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_plot.libs/libgfortran-e1b7dfc8.so.5.0.0 +0 -0
- passagemath_plot.libs/libgsl-e3525837.so.28.0.0 +0 -0
- passagemath_plot.libs/libopenblasp-r0-4c5b64b1.3.29.so +0 -0
- sage/all__sagemath_plot.py +15 -0
- sage/ext_data/threejs/animation.css +195 -0
- sage/ext_data/threejs/animation.html +85 -0
- sage/ext_data/threejs/animation.js +273 -0
- sage/ext_data/threejs/fat_lines.js +48 -0
- sage/ext_data/threejs/threejs-version.txt +1 -0
- sage/ext_data/threejs/threejs_template.html +597 -0
- sage/interfaces/all__sagemath_plot.py +1 -0
- sage/interfaces/gnuplot.py +196 -0
- sage/interfaces/jmoldata.py +208 -0
- sage/interfaces/povray.py +56 -0
- sage/plot/all.py +42 -0
- sage/plot/animate.py +1796 -0
- sage/plot/arc.py +504 -0
- sage/plot/arrow.py +671 -0
- sage/plot/bar_chart.py +205 -0
- sage/plot/bezier_path.py +400 -0
- sage/plot/circle.py +435 -0
- sage/plot/colors.py +1606 -0
- sage/plot/complex_plot.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/complex_plot.pyx +1446 -0
- sage/plot/contour_plot.py +1792 -0
- sage/plot/density_plot.py +318 -0
- sage/plot/disk.py +373 -0
- sage/plot/ellipse.py +375 -0
- sage/plot/graphics.py +3580 -0
- sage/plot/histogram.py +354 -0
- sage/plot/hyperbolic_arc.py +404 -0
- sage/plot/hyperbolic_polygon.py +416 -0
- sage/plot/hyperbolic_regular_polygon.py +296 -0
- sage/plot/line.py +626 -0
- sage/plot/matrix_plot.py +629 -0
- sage/plot/misc.py +509 -0
- sage/plot/multigraphics.py +1294 -0
- sage/plot/plot.py +4183 -0
- sage/plot/plot3d/all.py +23 -0
- sage/plot/plot3d/base.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/base.pxd +12 -0
- sage/plot/plot3d/base.pyx +3378 -0
- sage/plot/plot3d/implicit_plot3d.py +659 -0
- sage/plot/plot3d/implicit_surface.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/implicit_surface.pyx +1453 -0
- sage/plot/plot3d/index_face_set.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/index_face_set.pxd +32 -0
- sage/plot/plot3d/index_face_set.pyx +1873 -0
- sage/plot/plot3d/introduction.py +131 -0
- sage/plot/plot3d/list_plot3d.py +649 -0
- sage/plot/plot3d/parametric_plot3d.py +1130 -0
- sage/plot/plot3d/parametric_surface.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/parametric_surface.pxd +12 -0
- sage/plot/plot3d/parametric_surface.pyx +893 -0
- sage/plot/plot3d/platonic.py +601 -0
- sage/plot/plot3d/plot3d.py +1442 -0
- sage/plot/plot3d/plot_field3d.py +162 -0
- sage/plot/plot3d/point_c.pxi +148 -0
- sage/plot/plot3d/revolution_plot3d.py +309 -0
- sage/plot/plot3d/shapes.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/shapes.pxd +22 -0
- sage/plot/plot3d/shapes.pyx +1382 -0
- sage/plot/plot3d/shapes2.py +1512 -0
- sage/plot/plot3d/tachyon.py +1779 -0
- sage/plot/plot3d/texture.py +453 -0
- sage/plot/plot3d/transform.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/plot/plot3d/transform.pxd +21 -0
- sage/plot/plot3d/transform.pyx +268 -0
- sage/plot/plot3d/tri_plot.py +589 -0
- sage/plot/plot_field.py +362 -0
- sage/plot/point.py +624 -0
- sage/plot/polygon.py +562 -0
- sage/plot/primitive.py +249 -0
- sage/plot/scatter_plot.py +199 -0
- sage/plot/step.py +85 -0
- sage/plot/streamline_plot.py +328 -0
- sage/plot/text.py +432 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-plot
|
|
2
|
+
# sage.doctest: needs sage.symbolic
|
|
3
|
+
"""
|
|
4
|
+
Polygons and triangles in hyperbolic geometry
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Hartmut Monien (2011-08)
|
|
9
|
+
- Vincent Delecroix (2014-11)
|
|
10
|
+
"""
|
|
11
|
+
# *****************************************************************************
|
|
12
|
+
# Copyright (C) 2011 Hartmut Monien <monien@th.physik.uni-bonn.de>,
|
|
13
|
+
# 2014 Vincent Delecroix <20100.delecroix@gmail.com>,
|
|
14
|
+
# 2015 Stefan Kraemer <skraemer@th.physik.uni-bonn.de>
|
|
15
|
+
# 2021 Javier Honrubia <jhonrubia6@alumno.uned.es
|
|
16
|
+
#
|
|
17
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
18
|
+
#
|
|
19
|
+
# This code is distributed in the hope that it will be useful,
|
|
20
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
22
|
+
# General Public License for more details.
|
|
23
|
+
#
|
|
24
|
+
# The full text of the GPL is available at:
|
|
25
|
+
#
|
|
26
|
+
# https://www.gnu.org/licenses/
|
|
27
|
+
# *****************************************************************************
|
|
28
|
+
|
|
29
|
+
from sage.plot.bezier_path import BezierPath
|
|
30
|
+
from sage.plot.circle import circle
|
|
31
|
+
from sage.misc.decorators import options, rename_keyword
|
|
32
|
+
from sage.rings.cc import CC
|
|
33
|
+
from sage.plot.hyperbolic_arc import HyperbolicArcCore
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class HyperbolicPolygon(HyperbolicArcCore):
|
|
37
|
+
"""
|
|
38
|
+
Primitive class for hyperbolic polygon type.
|
|
39
|
+
|
|
40
|
+
See ``hyperbolic_polygon?`` for information about plotting a hyperbolic
|
|
41
|
+
polygon in the complex plane.
|
|
42
|
+
|
|
43
|
+
INPUT:
|
|
44
|
+
|
|
45
|
+
- ``pts`` -- coordinates of the polygon (as complex numbers)
|
|
46
|
+
|
|
47
|
+
- ``options`` -- dictionary of valid plot options to pass to constructor
|
|
48
|
+
|
|
49
|
+
EXAMPLES:
|
|
50
|
+
|
|
51
|
+
Note that constructions should use :func:`hyperbolic_polygon` or
|
|
52
|
+
:func:`hyperbolic_triangle`::
|
|
53
|
+
|
|
54
|
+
sage: from sage.plot.hyperbolic_polygon import HyperbolicPolygon
|
|
55
|
+
sage: print(HyperbolicPolygon([0, 1/2, I], "UHP", {}))
|
|
56
|
+
Hyperbolic polygon (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
|
|
57
|
+
"""
|
|
58
|
+
def __init__(self, pts, model, options):
|
|
59
|
+
"""
|
|
60
|
+
Initialize HyperbolicPolygon.
|
|
61
|
+
|
|
62
|
+
EXAMPLES::
|
|
63
|
+
|
|
64
|
+
sage: from sage.plot.hyperbolic_polygon import HyperbolicPolygon
|
|
65
|
+
sage: HP = HyperbolicPolygon([0, 1/2, I], "UHP", {})
|
|
66
|
+
sage: TestSuite(HP).run(skip ='_test_pickling')
|
|
67
|
+
"""
|
|
68
|
+
if model == "HM":
|
|
69
|
+
raise ValueError("the hyperboloid model is not supported")
|
|
70
|
+
if not pts:
|
|
71
|
+
raise ValueError("cannot plot the empty polygon")
|
|
72
|
+
from sage.geometry.hyperbolic_space.hyperbolic_interface import HyperbolicPlane
|
|
73
|
+
HP = HyperbolicPlane()
|
|
74
|
+
M = getattr(HP, model)()
|
|
75
|
+
|
|
76
|
+
pts = [CC(p) for p in pts]
|
|
77
|
+
for p in pts:
|
|
78
|
+
M.point_test(p)
|
|
79
|
+
self.path = []
|
|
80
|
+
if model == "UHP":
|
|
81
|
+
if pts[0].is_infinity():
|
|
82
|
+
# Check for more than one Infinite vertex
|
|
83
|
+
if any(pts[i].is_infinity() for i in range(1, len(pts))):
|
|
84
|
+
raise ValueError("no more than one infinite vertex allowed")
|
|
85
|
+
else:
|
|
86
|
+
# If any Infinity vertex exist it must be the first
|
|
87
|
+
for i, p in enumerate(pts):
|
|
88
|
+
if p.is_infinity():
|
|
89
|
+
if any(pt.is_infinity() for pt in pts[i+1:]):
|
|
90
|
+
raise ValueError("no more than one infinite vertex allowed")
|
|
91
|
+
pts = pts[i:] + pts[:i]
|
|
92
|
+
break
|
|
93
|
+
|
|
94
|
+
self._bezier_path(pts[0], pts[1], M, True)
|
|
95
|
+
for i in range(1, len(pts) - 1):
|
|
96
|
+
self._bezier_path(pts[i], pts[i + 1], M, False)
|
|
97
|
+
self._bezier_path(pts[-1], pts[0], M, False)
|
|
98
|
+
self._pts = pts
|
|
99
|
+
BezierPath.__init__(self, self.path, options)
|
|
100
|
+
|
|
101
|
+
def _repr_(self):
|
|
102
|
+
"""
|
|
103
|
+
String representation of HyperbolicPolygon.
|
|
104
|
+
|
|
105
|
+
TESTS::
|
|
106
|
+
|
|
107
|
+
sage: from sage.plot.hyperbolic_polygon import HyperbolicPolygon
|
|
108
|
+
sage: HyperbolicPolygon([0, 1/2, I], "UHP", {})
|
|
109
|
+
Hyperbolic polygon (0.000000000000000, 0.500000000000000, 1.00000000000000*I)
|
|
110
|
+
"""
|
|
111
|
+
return "Hyperbolic polygon ({})".format(", ".join(map(str, self._pts)))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _winding_number(vertices, point):
|
|
115
|
+
r"""
|
|
116
|
+
Compute the winding number of the given point in the plane `z = 0`.
|
|
117
|
+
|
|
118
|
+
TESTS::
|
|
119
|
+
|
|
120
|
+
sage: from sage.plot.hyperbolic_polygon import _winding_number
|
|
121
|
+
sage: _winding_number([(0,0,4),(1,0,3),(1,1,2),(0,1,1)],(0.5,0.5,10))
|
|
122
|
+
1
|
|
123
|
+
sage: _winding_number([(0,0,4),(1,0,3),(1,1,2),(0,1,1)],(10,10,10))
|
|
124
|
+
0
|
|
125
|
+
"""
|
|
126
|
+
# Helper functions
|
|
127
|
+
def _intersects(start, end, y0):
|
|
128
|
+
if end[1] < start[1]:
|
|
129
|
+
start, end = end, start
|
|
130
|
+
return start[1] < y0 < end[1]
|
|
131
|
+
|
|
132
|
+
def _is_left(point, edge):
|
|
133
|
+
start, end = edge[0], edge[1]
|
|
134
|
+
if end[1] == start[1]:
|
|
135
|
+
return False
|
|
136
|
+
x_in = start[0] + (point[1] - start[1]) * (end[0] - start[0]) / (end[1] - start[1])
|
|
137
|
+
return x_in > point[0]
|
|
138
|
+
|
|
139
|
+
sides = []
|
|
140
|
+
wn = 0
|
|
141
|
+
sides = [[vertices[i], vertices[i + 1]] for i in range(len(vertices) - 1)
|
|
142
|
+
if _intersects(vertices[i], vertices[i + 1], point[1])]
|
|
143
|
+
|
|
144
|
+
if _intersects(vertices[-1], vertices[0], point[1]):
|
|
145
|
+
sides.append([vertices[-1], vertices[0]])
|
|
146
|
+
for side in sides:
|
|
147
|
+
if _is_left(point, side):
|
|
148
|
+
if side[1][1] > side[0][1]:
|
|
149
|
+
wn += 1
|
|
150
|
+
if side[1][1] < side[0][1]:
|
|
151
|
+
wn -= 1
|
|
152
|
+
return wn
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@rename_keyword(color='rgbcolor')
|
|
156
|
+
@options(alpha=1, fill=False, thickness=1, rgbcolor='blue', zorder=2, linestyle='solid')
|
|
157
|
+
def hyperbolic_polygon(pts, model='UHP', resolution=200, **options):
|
|
158
|
+
r"""
|
|
159
|
+
Return a hyperbolic polygon in the hyperbolic plane with vertices ``pts``.
|
|
160
|
+
|
|
161
|
+
Type ``?hyperbolic_polygon`` to see all options.
|
|
162
|
+
|
|
163
|
+
INPUT:
|
|
164
|
+
|
|
165
|
+
- ``pts`` -- list or tuple of complex numbers
|
|
166
|
+
|
|
167
|
+
OPTIONS:
|
|
168
|
+
|
|
169
|
+
- ``model`` -- (default: ``UHP``) Model used for hyperbolic plane
|
|
170
|
+
|
|
171
|
+
- ``alpha`` -- (default: 1)
|
|
172
|
+
|
|
173
|
+
- ``fill`` -- (default: ``False``)
|
|
174
|
+
|
|
175
|
+
- ``thickness`` -- (default: 1)
|
|
176
|
+
|
|
177
|
+
- ``rgbcolor`` -- (default: ``'blue'``)
|
|
178
|
+
|
|
179
|
+
- ``linestyle`` -- (default: ``'solid'``) the style of the line, which is
|
|
180
|
+
one of ``'dashed'``, ``'dotted'``, ``'solid'``, ``'dashdot'``, or
|
|
181
|
+
``'--'``, ``':'``, ``'-'``, ``'-.'``, respectively
|
|
182
|
+
|
|
183
|
+
EXAMPLES:
|
|
184
|
+
|
|
185
|
+
Show a hyperbolic polygon with coordinates `-1`, `3i`, `2+2i`, `1+i`::
|
|
186
|
+
|
|
187
|
+
sage: hyperbolic_polygon([-1,3*I,2+2*I,1+I])
|
|
188
|
+
Graphics object consisting of 1 graphics primitive
|
|
189
|
+
|
|
190
|
+
.. PLOT::
|
|
191
|
+
|
|
192
|
+
P = hyperbolic_polygon([-1,3*I,2+2*I,1+I])
|
|
193
|
+
sphinx_plot(P)
|
|
194
|
+
|
|
195
|
+
With more options::
|
|
196
|
+
|
|
197
|
+
sage: hyperbolic_polygon([-1,3*I,2+2*I,1+I], fill=True, color='red')
|
|
198
|
+
Graphics object consisting of 1 graphics primitive
|
|
199
|
+
|
|
200
|
+
.. PLOT::
|
|
201
|
+
|
|
202
|
+
sphinx_plot(hyperbolic_polygon([-1,3*I,2+2*I,1+I], fill=True, color='red'))
|
|
203
|
+
|
|
204
|
+
With a vertex at `\infty`::
|
|
205
|
+
|
|
206
|
+
sage: hyperbolic_polygon([-1,0,1,Infinity], color='green')
|
|
207
|
+
Graphics object consisting of 1 graphics primitive
|
|
208
|
+
|
|
209
|
+
.. PLOT::
|
|
210
|
+
|
|
211
|
+
from sage.rings.infinity import infinity
|
|
212
|
+
sphinx_plot(hyperbolic_polygon([-1,0,1,infinity], color='green'))
|
|
213
|
+
|
|
214
|
+
Poincare disc model is supported via the parameter ``model``.
|
|
215
|
+
Show a hyperbolic polygon in the Poincare disc model with coordinates
|
|
216
|
+
`1`, `i`, `-1`, `-i`::
|
|
217
|
+
|
|
218
|
+
sage: hyperbolic_polygon([1,I,-1,-I], model='PD', color='green')
|
|
219
|
+
Graphics object consisting of 2 graphics primitives
|
|
220
|
+
|
|
221
|
+
.. PLOT::
|
|
222
|
+
|
|
223
|
+
sphinx_plot(hyperbolic_polygon([1,I,-1,-I], model='PD', color='green'))
|
|
224
|
+
|
|
225
|
+
With more options::
|
|
226
|
+
|
|
227
|
+
sage: hyperbolic_polygon([1,I,-1,-I], model='PD', color='green', fill=True, linestyle='-')
|
|
228
|
+
Graphics object consisting of 2 graphics primitives
|
|
229
|
+
|
|
230
|
+
.. PLOT::
|
|
231
|
+
|
|
232
|
+
P = hyperbolic_polygon([1,I,-1,-I], model='PD', color='green', fill=True, linestyle='-')
|
|
233
|
+
sphinx_plot(P)
|
|
234
|
+
|
|
235
|
+
Klein model is also supported via the parameter ``model``.
|
|
236
|
+
Show a hyperbolic polygon in the Klein model with coordinates
|
|
237
|
+
`1`, `e^{i\pi/3}`, `e^{i2\pi/3}`, `-1`, `e^{i4\pi/3}`, `e^{i5\pi/3}`::
|
|
238
|
+
|
|
239
|
+
sage: p1 = 1
|
|
240
|
+
sage: p2 = (cos(pi/3), sin(pi/3))
|
|
241
|
+
sage: p3 = (cos(2*pi/3), sin(2*pi/3))
|
|
242
|
+
sage: p4 = -1
|
|
243
|
+
sage: p5 = (cos(4*pi/3), sin(4*pi/3))
|
|
244
|
+
sage: p6 = (cos(5*pi/3), sin(5*pi/3))
|
|
245
|
+
sage: hyperbolic_polygon([p1,p2,p3,p4,p5,p6], model='KM', fill=True, color='purple')
|
|
246
|
+
Graphics object consisting of 2 graphics primitives
|
|
247
|
+
|
|
248
|
+
.. PLOT::
|
|
249
|
+
|
|
250
|
+
p1=1
|
|
251
|
+
p2=(cos(pi/3),sin(pi/3))
|
|
252
|
+
p3=(cos(2*pi/3),sin(2*pi/3))
|
|
253
|
+
p4=-1
|
|
254
|
+
p5=(cos(4*pi/3),sin(4*pi/3))
|
|
255
|
+
p6=(cos(5*pi/3),sin(5*pi/3))
|
|
256
|
+
P = hyperbolic_polygon([p1,p2,p3,p4,p5,p6], model='KM', fill=True, color='purple')
|
|
257
|
+
sphinx_plot(P)
|
|
258
|
+
|
|
259
|
+
Hyperboloid model is supported partially, via the parameter ``model``.
|
|
260
|
+
Show a hyperbolic polygon in the hyperboloid model with coordinates
|
|
261
|
+
`(3,3,\sqrt(19))`, `(3,-3,\sqrt(19))`, `(-3,-3,\sqrt(19))`,
|
|
262
|
+
`(-3,3,\sqrt(19))`::
|
|
263
|
+
|
|
264
|
+
sage: pts = [(3,3,sqrt(19)),(3,-3,sqrt(19)),(-3,-3,sqrt(19)),(-3,3,sqrt(19))]
|
|
265
|
+
sage: hyperbolic_polygon(pts, model='HM')
|
|
266
|
+
Graphics3d Object
|
|
267
|
+
|
|
268
|
+
.. PLOT::
|
|
269
|
+
|
|
270
|
+
pts = [(3,3,sqrt(19)),(3,-3,sqrt(19)),(-3,-3,sqrt(19)),(-3,3,sqrt(19))]
|
|
271
|
+
P = hyperbolic_polygon(pts, model='HM')
|
|
272
|
+
sphinx_plot(P)
|
|
273
|
+
|
|
274
|
+
Filling a hyperbolic_polygon in hyperboloid model is possible although
|
|
275
|
+
jaggy. We show a filled hyperbolic polygon in the hyperboloid model
|
|
276
|
+
with coordinates `(1,1,\sqrt(3))`, `(0,2,\sqrt(5))`, `(2,0,\sqrt(5))`.
|
|
277
|
+
(The doctest is done at lower resolution than the picture below to
|
|
278
|
+
give a faster result.) ::
|
|
279
|
+
|
|
280
|
+
sage: pts = [(1,1,sqrt(3)), (0,2,sqrt(5)), (2,0,sqrt(5))]
|
|
281
|
+
sage: hyperbolic_polygon(pts, model='HM', resolution=50,
|
|
282
|
+
....: color='yellow', fill=True)
|
|
283
|
+
Graphics3d Object
|
|
284
|
+
|
|
285
|
+
.. PLOT::
|
|
286
|
+
|
|
287
|
+
pts = [(1,1,sqrt(3)),(0,2,sqrt(5)),(2,0,sqrt(5))]
|
|
288
|
+
P = hyperbolic_polygon(pts, model='HM', color='yellow', fill=True)
|
|
289
|
+
sphinx_plot(P)
|
|
290
|
+
"""
|
|
291
|
+
from sage.plot.all import Graphics
|
|
292
|
+
g = Graphics()
|
|
293
|
+
g._set_extra_kwds(g._extract_kwds_for_show(options))
|
|
294
|
+
|
|
295
|
+
if model == "HM":
|
|
296
|
+
from sage.geometry.hyperbolic_space.hyperbolic_interface import HyperbolicPlane
|
|
297
|
+
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
|
|
298
|
+
from sage.symbolic.ring import SR
|
|
299
|
+
HM = HyperbolicPlane().HM()
|
|
300
|
+
x, y, z = SR.var('x,y,z')
|
|
301
|
+
arc_points = []
|
|
302
|
+
for i in range(0, len(pts) - 1):
|
|
303
|
+
line = HM.get_geodesic(pts[i], pts[i + 1])
|
|
304
|
+
g = g + line.plot(color=options['rgbcolor'], thickness=options['thickness'])
|
|
305
|
+
arc_points = arc_points + line._plot_vertices(resolution)
|
|
306
|
+
line = HM.get_geodesic(pts[-1], pts[0])
|
|
307
|
+
g = g + line.plot(color=options['rgbcolor'], thickness=options['thickness'])
|
|
308
|
+
arc_points = arc_points + line._plot_vertices(resolution)
|
|
309
|
+
if options['fill']:
|
|
310
|
+
xlist = [p[0] for p in pts]
|
|
311
|
+
ylist = [p[1] for p in pts]
|
|
312
|
+
zlist = [p[2] for p in pts]
|
|
313
|
+
|
|
314
|
+
def region(x, y, z):
|
|
315
|
+
return _winding_number(arc_points, (x, y, z)) != 0
|
|
316
|
+
g = g + implicit_plot3d(x**2 + y**2 - z**2 == -1,
|
|
317
|
+
(x, min(xlist), max(xlist)),
|
|
318
|
+
(y, min(ylist), max(ylist)),
|
|
319
|
+
(z, 0, max(zlist)),
|
|
320
|
+
region=region,
|
|
321
|
+
plot_points=resolution,
|
|
322
|
+
color=options['rgbcolor']) # the less points the more jaggy the picture
|
|
323
|
+
else:
|
|
324
|
+
g.add_primitive(HyperbolicPolygon(pts, model, options))
|
|
325
|
+
if model == "PD" or model == "KM":
|
|
326
|
+
g = g + circle((0, 0), 1, rgbcolor='black')
|
|
327
|
+
g.set_aspect_ratio(1)
|
|
328
|
+
|
|
329
|
+
return g
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def hyperbolic_triangle(a, b, c, model='UHP', **options):
|
|
333
|
+
r"""
|
|
334
|
+
Return a hyperbolic triangle in the hyperbolic plane with
|
|
335
|
+
vertices ``(a,b,c)``.
|
|
336
|
+
|
|
337
|
+
Type ``?hyperbolic_polygon`` to see all options.
|
|
338
|
+
|
|
339
|
+
INPUT:
|
|
340
|
+
|
|
341
|
+
- ``a``, ``b``, ``c`` -- complex numbers in the upper half complex plane
|
|
342
|
+
|
|
343
|
+
OPTIONS:
|
|
344
|
+
|
|
345
|
+
- ``alpha`` -- (default: 1)
|
|
346
|
+
|
|
347
|
+
- ``fill`` -- (default: ``False``)
|
|
348
|
+
|
|
349
|
+
- ``thickness`` -- (default: 1)
|
|
350
|
+
|
|
351
|
+
- ``rgbcolor`` -- (default: ``'blue'``)
|
|
352
|
+
|
|
353
|
+
- ``linestyle`` -- (default: ``'solid'``) the style of the line, which is
|
|
354
|
+
one of ``'dashed'``, ``'dotted'``, ``'solid'``, ``'dashdot'``, or
|
|
355
|
+
``'--'``, ``':'``, ``'-'``, ``'-.'``, respectively
|
|
356
|
+
|
|
357
|
+
EXAMPLES:
|
|
358
|
+
|
|
359
|
+
Show a hyperbolic triangle with coordinates `0`, `1/2 + i\sqrt{3}/2` and
|
|
360
|
+
`-1/2 + i\sqrt{3}/2`::
|
|
361
|
+
|
|
362
|
+
sage: hyperbolic_triangle(0, -1/2+I*sqrt(3)/2, 1/2+I*sqrt(3)/2)
|
|
363
|
+
Graphics object consisting of 1 graphics primitive
|
|
364
|
+
|
|
365
|
+
.. PLOT::
|
|
366
|
+
|
|
367
|
+
P = hyperbolic_triangle(0, 0.5*(-1+I*sqrt(3)), 0.5*(1+I*sqrt(3)))
|
|
368
|
+
sphinx_plot(P)
|
|
369
|
+
|
|
370
|
+
A hyperbolic triangle with coordinates `0`, `1` and `2+i` and a dashed line::
|
|
371
|
+
|
|
372
|
+
sage: hyperbolic_triangle(0, 1, 2+i, fill=true, rgbcolor='red', linestyle='--')
|
|
373
|
+
Graphics object consisting of 1 graphics primitive
|
|
374
|
+
|
|
375
|
+
.. PLOT::
|
|
376
|
+
|
|
377
|
+
P = hyperbolic_triangle(0, 1, 2+i, fill=true, rgbcolor='red', linestyle='--')
|
|
378
|
+
sphinx_plot(P)
|
|
379
|
+
|
|
380
|
+
A hyperbolic triangle with a vertex at `\infty`::
|
|
381
|
+
|
|
382
|
+
sage: hyperbolic_triangle(-5,Infinity,5)
|
|
383
|
+
Graphics object consisting of 1 graphics primitive
|
|
384
|
+
|
|
385
|
+
.. PLOT::
|
|
386
|
+
|
|
387
|
+
from sage.rings.infinity import infinity
|
|
388
|
+
sphinx_plot(hyperbolic_triangle(-5,infinity,5))
|
|
389
|
+
|
|
390
|
+
It can also plot a hyperbolic triangle in the Poincaré disk model::
|
|
391
|
+
|
|
392
|
+
sage: z1 = CC((cos(pi/3),sin(pi/3)))
|
|
393
|
+
sage: z2 = CC((0.6*cos(3*pi/4),0.6*sin(3*pi/4)))
|
|
394
|
+
sage: z3 = 1
|
|
395
|
+
sage: hyperbolic_triangle(z1, z2, z3, model='PD', color='red')
|
|
396
|
+
Graphics object consisting of 2 graphics primitives
|
|
397
|
+
|
|
398
|
+
.. PLOT::
|
|
399
|
+
|
|
400
|
+
z1 = CC((cos(pi/3),sin(pi/3)))
|
|
401
|
+
z2 = CC((0.6*cos(3*pi/4),0.6*sin(3*pi/4)))
|
|
402
|
+
z3 = 1
|
|
403
|
+
P = hyperbolic_triangle(z1, z2, z3, model='PD', color='red')
|
|
404
|
+
sphinx_plot(P)
|
|
405
|
+
|
|
406
|
+
::
|
|
407
|
+
|
|
408
|
+
sage: hyperbolic_triangle(0.3+0.3*I, 0.8*I, -0.5-0.5*I, model='PD', color='magenta')
|
|
409
|
+
Graphics object consisting of 2 graphics primitives
|
|
410
|
+
|
|
411
|
+
.. PLOT::
|
|
412
|
+
|
|
413
|
+
P = hyperbolic_triangle(0.3+0.3*I, 0.8*I, -0.5-0.5*I, model='PD', color='magenta')
|
|
414
|
+
sphinx_plot(P)
|
|
415
|
+
"""
|
|
416
|
+
return hyperbolic_polygon((a, b, c), model, **options)
|