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,404 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-plot
|
|
2
|
+
# sage.doctest: needs sage.symbolic
|
|
3
|
+
r"""
|
|
4
|
+
Arcs in hyperbolic geometry
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Hartmut Monien (2011 - 08)
|
|
9
|
+
|
|
10
|
+
Three models of the hyperbolic plane are implemented:
|
|
11
|
+
Upper Half Plane, Poincaré Disk, and Klein Disk, each
|
|
12
|
+
with its different domain and metric tensor.
|
|
13
|
+
|
|
14
|
+
.. RUBRIC:: Upper half plane (UHP)
|
|
15
|
+
|
|
16
|
+
In this model, hyperbolic points are described by two coordinates, which
|
|
17
|
+
we will represent by a complex number in the domain
|
|
18
|
+
|
|
19
|
+
.. MATH::
|
|
20
|
+
|
|
21
|
+
H = \{ z \in \CC \mid \Im(z)>0 \}
|
|
22
|
+
|
|
23
|
+
with the corresponding metric tensor
|
|
24
|
+
|
|
25
|
+
.. MATH::
|
|
26
|
+
|
|
27
|
+
ds^2 = \frac{dzd\bar{z}}{\Im(z)^2}.
|
|
28
|
+
|
|
29
|
+
.. RUBRIC:: Poincaré disk (PD)
|
|
30
|
+
|
|
31
|
+
In this model, hyperbolic points are described by two coordinates, which we
|
|
32
|
+
will represent by a complex number within the unit circle, having therefore
|
|
33
|
+
the following domain
|
|
34
|
+
|
|
35
|
+
.. MATH::
|
|
36
|
+
|
|
37
|
+
D = \{ z \in \CC \mid \lvert z \rvert < 1\}
|
|
38
|
+
|
|
39
|
+
with the corresponding metric tensor
|
|
40
|
+
|
|
41
|
+
.. MATH::
|
|
42
|
+
|
|
43
|
+
ds^2 = 4 \frac{dzd\bar{z}}{(1-\lvert z \rvert^2)^2}.
|
|
44
|
+
|
|
45
|
+
.. RUBRIC:: Klein disk (KM)
|
|
46
|
+
|
|
47
|
+
In this model, the domain is again complex numbers within the unit circle as
|
|
48
|
+
in the Poincaré disk model, but the corresponding metric tensor is different:
|
|
49
|
+
|
|
50
|
+
.. MATH::
|
|
51
|
+
|
|
52
|
+
ds^2 = \frac{dzd\bar{z}}{1-\lvert z \rvert^2}
|
|
53
|
+
+ \frac{(z \cdot dz)^2}{(1-\lvert z \rvert^2)^2}.
|
|
54
|
+
|
|
55
|
+
.. SEEALSO::
|
|
56
|
+
|
|
57
|
+
:mod:`sage.geometry.hyperbolic_space.hyperbolic_geodesic`
|
|
58
|
+
|
|
59
|
+
REFERENCES:
|
|
60
|
+
|
|
61
|
+
For additional models of the hyperbolic plane and its relationship
|
|
62
|
+
see [CFKP1997]_. For a more detailed explanation on hyperbolic arcs
|
|
63
|
+
see [Sta1993]_.
|
|
64
|
+
"""
|
|
65
|
+
# *****************************************************************************
|
|
66
|
+
# Copyright (C) 2011 Hartmut Monien <monien@th.physik.uni-bonn.de>,
|
|
67
|
+
# 2015 Stefan Kraemer <skraemer@th.physik.uni-bonn.de>
|
|
68
|
+
# 2016 Javier Honrubia <jhonrubia6@uned.es>
|
|
69
|
+
#
|
|
70
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
71
|
+
#
|
|
72
|
+
# This code is distributed in the hope that it will be useful,
|
|
73
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
74
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
75
|
+
# General Public License for more details.
|
|
76
|
+
#
|
|
77
|
+
# The full text of the GPL is available at:
|
|
78
|
+
#
|
|
79
|
+
# https://www.gnu.org/licenses/
|
|
80
|
+
# *****************************************************************************
|
|
81
|
+
|
|
82
|
+
from sage.plot.bezier_path import BezierPath
|
|
83
|
+
from sage.plot.circle import circle
|
|
84
|
+
from sage.misc.decorators import options, rename_keyword
|
|
85
|
+
from sage.rings.cc import CC
|
|
86
|
+
from sage.geometry.hyperbolic_space.hyperbolic_constants import EPSILON
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class HyperbolicArcCore(BezierPath):
|
|
90
|
+
"""
|
|
91
|
+
Base class for Hyperbolic arcs and hyperbolic polygons in the
|
|
92
|
+
hyperbolic plane.
|
|
93
|
+
|
|
94
|
+
The Upper Half Model, Poincaré Disk Model, and Klein Disk model
|
|
95
|
+
are supported.
|
|
96
|
+
"""
|
|
97
|
+
def _bezier_path(self, z0, z1, model, first=False):
|
|
98
|
+
"""
|
|
99
|
+
Construct a bezier path from a given arc object and store it
|
|
100
|
+
in the ``path`` attribute.
|
|
101
|
+
|
|
102
|
+
INPUT:
|
|
103
|
+
|
|
104
|
+
- ``z0``, ``z1`` -- the points of the arc
|
|
105
|
+
- ``model`` -- an model for the hyperbolic arc
|
|
106
|
+
|
|
107
|
+
TESTS::
|
|
108
|
+
|
|
109
|
+
sage: from sage.plot.hyperbolic_arc import HyperbolicArc
|
|
110
|
+
sage: HyperbolicArc(0, 1/2+I*sqrt(3)/2, "UHP", {}) # indirect doctest
|
|
111
|
+
Hyperbolic arc (0.000000000000000, 0.500000000000000 + 0.866025403784439*I)
|
|
112
|
+
"""
|
|
113
|
+
import numpy as np
|
|
114
|
+
from sage.rings.infinity import infinity
|
|
115
|
+
EPSILON = 10 ** -5
|
|
116
|
+
|
|
117
|
+
arc0 = model.get_geodesic(z0, z1).plot()[0]
|
|
118
|
+
|
|
119
|
+
if isinstance(arc0, BezierPath):
|
|
120
|
+
points = arc0.vertices
|
|
121
|
+
else:
|
|
122
|
+
points = arc0.bezier_path()[0].vertices
|
|
123
|
+
if (
|
|
124
|
+
((z0.is_infinity() or z0 == infinity)
|
|
125
|
+
and abs(CC(points[0][0], points[0][1]) - z1) < EPSILON)
|
|
126
|
+
or ((z1.is_infinity() or z1 == infinity)
|
|
127
|
+
and abs(CC(points[1][0], points[1][1]) - z0) < EPSILON)
|
|
128
|
+
or (abs(CC(points[0][0], points[0][1]) - z0) >= EPSILON
|
|
129
|
+
and not (z0.is_infinity() or z0 == infinity or z1.is_infinity()
|
|
130
|
+
or z1 == infinity))
|
|
131
|
+
):
|
|
132
|
+
points = np.flipud(points) # order is important
|
|
133
|
+
|
|
134
|
+
if first:
|
|
135
|
+
self.path.append(points[0:4]) # if it is a line it will append only two control points
|
|
136
|
+
if isinstance(arc0, BezierPath):
|
|
137
|
+
self.last_plotted = "line"
|
|
138
|
+
else:
|
|
139
|
+
N = 4
|
|
140
|
+
# Add new triplets
|
|
141
|
+
while N < len(points):
|
|
142
|
+
self.path.append(points[N: N + 3])
|
|
143
|
+
N += 3
|
|
144
|
+
self.last_plotted = "arc"
|
|
145
|
+
else:
|
|
146
|
+
# the first point is equal to the last of the previous arc
|
|
147
|
+
points = np.delete(points, 0, 0)
|
|
148
|
+
N = 0
|
|
149
|
+
if isinstance(arc0, BezierPath):
|
|
150
|
+
self.path.append(points[0:1])
|
|
151
|
+
self.last_plotted = "line"
|
|
152
|
+
elif self.last_plotted == "line": # actual segment is an arc
|
|
153
|
+
# Add new triplets
|
|
154
|
+
while N < len(points):
|
|
155
|
+
self.path.append(points[N: N + 3])
|
|
156
|
+
N += 3
|
|
157
|
+
self.last_plotted = "arc"
|
|
158
|
+
else:
|
|
159
|
+
# Complete the last tuple of control points
|
|
160
|
+
tail = self.path[-1]
|
|
161
|
+
ltail = len(tail)
|
|
162
|
+
while ltail < 3:
|
|
163
|
+
self.path[-1].append(points[N])
|
|
164
|
+
ltail += 1
|
|
165
|
+
N += 1
|
|
166
|
+
# Add new triplets
|
|
167
|
+
while N < len(points):
|
|
168
|
+
self.path.append(points[N: N + 3])
|
|
169
|
+
N += 3
|
|
170
|
+
self.last_plotted = "arc"
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class HyperbolicArc(HyperbolicArcCore):
|
|
174
|
+
r"""
|
|
175
|
+
Primitive class for hyberbolic arc type.
|
|
176
|
+
|
|
177
|
+
See ``hyperbolic_arc?`` for information about plotting a hyperbolic
|
|
178
|
+
arc in the complex plane.
|
|
179
|
+
|
|
180
|
+
INPUT:
|
|
181
|
+
|
|
182
|
+
- ``A``, ``B`` -- end points of the hyperbolic arc
|
|
183
|
+
- ``model`` -- the hyperbolic model used, which is one of the following:
|
|
184
|
+
|
|
185
|
+
* ``'UHP'`` -- upper half plane
|
|
186
|
+
* ``'PD'`` -- Poincaré disk
|
|
187
|
+
* ``'KM'`` -- Klein disk
|
|
188
|
+
|
|
189
|
+
TESTS::
|
|
190
|
+
|
|
191
|
+
sage: from sage.plot.hyperbolic_arc import HyperbolicArc
|
|
192
|
+
sage: HyperbolicArc(0, 1/2+I*sqrt(3)/2, "UHP", {})
|
|
193
|
+
Hyperbolic arc (0.000000000000000, 0.500000000000000 + 0.866025403784439*I)
|
|
194
|
+
"""
|
|
195
|
+
def __init__(self, A, B, model, options):
|
|
196
|
+
"""
|
|
197
|
+
Initialize ``self``.
|
|
198
|
+
|
|
199
|
+
EXAMPLES::
|
|
200
|
+
|
|
201
|
+
sage: from sage.plot.hyperbolic_arc import HyperbolicArc
|
|
202
|
+
sage: arc = HyperbolicArc(0, 1/2+I*sqrt(3)/2, "UHP", {})
|
|
203
|
+
sage: TestSuite(arc).run(skip='_test_pickling') # no equality implemented
|
|
204
|
+
"""
|
|
205
|
+
if model == "HM":
|
|
206
|
+
raise ValueError("the hyperboloid model is not supported")
|
|
207
|
+
from sage.geometry.hyperbolic_space.hyperbolic_interface import HyperbolicPlane
|
|
208
|
+
HP = HyperbolicPlane()
|
|
209
|
+
M = getattr(HP, model)()
|
|
210
|
+
self.A = CC(A)
|
|
211
|
+
self.B = CC(B)
|
|
212
|
+
self.model = model
|
|
213
|
+
M.point_test(self.A)
|
|
214
|
+
M.point_test(self.B)
|
|
215
|
+
self.path = []
|
|
216
|
+
self._bezier_path(self.A, self.B, M, True)
|
|
217
|
+
BezierPath.__init__(self, self.path, options)
|
|
218
|
+
|
|
219
|
+
def _repr_(self):
|
|
220
|
+
"""
|
|
221
|
+
String representation of HyperbolicArc.
|
|
222
|
+
|
|
223
|
+
TESTS::
|
|
224
|
+
|
|
225
|
+
sage: from sage.plot.hyperbolic_arc import HyperbolicArc
|
|
226
|
+
sage: HyperbolicArc(0, 1/2+I*sqrt(3)/2, "UHP", {})
|
|
227
|
+
Hyperbolic arc (0.000000000000000, 0.500000000000000 + 0.866025403784439*I)
|
|
228
|
+
"""
|
|
229
|
+
return f"Hyperbolic arc ({self.A}, {self.B})"
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@rename_keyword(color='rgbcolor')
|
|
233
|
+
@options(alpha=1, fill=False, thickness=1, rgbcolor='blue', zorder=2, linestyle='solid')
|
|
234
|
+
def hyperbolic_arc(a, b, model='UHP', **options):
|
|
235
|
+
r"""
|
|
236
|
+
Plot an arc from ``a`` to ``b`` in hyperbolic plane.
|
|
237
|
+
|
|
238
|
+
INPUT:
|
|
239
|
+
|
|
240
|
+
- ``a``, ``b`` -- complex numbers connected by a hyperbolic arc
|
|
241
|
+
|
|
242
|
+
- ``model`` -- (default: ``'UHP'``) hyperbolic model used,
|
|
243
|
+
which is one of the following:
|
|
244
|
+
|
|
245
|
+
* ``'UHP'`` -- upper half plane
|
|
246
|
+
* ``'PD'`` -- Poincaré disk
|
|
247
|
+
* ``'KM'`` -- Klein disk
|
|
248
|
+
* ``'HM'`` -- hyperboloid model
|
|
249
|
+
|
|
250
|
+
OPTIONS:
|
|
251
|
+
|
|
252
|
+
- ``alpha`` -- (default: 1)
|
|
253
|
+
|
|
254
|
+
- ``thickness`` -- (default: 1)
|
|
255
|
+
|
|
256
|
+
- ``rgbcolor`` -- (default: ``'blue'``)
|
|
257
|
+
|
|
258
|
+
- ``linestyle`` -- (default: ``'solid'``) the style of the line, which
|
|
259
|
+
is one of ``'dashed'``, ``'dotted'``, ``'solid'``, ``'dashdot'``,
|
|
260
|
+
or ``'--'``, ``':'``, ``'-'``, ``'-.'``, respectively
|
|
261
|
+
|
|
262
|
+
EXAMPLES:
|
|
263
|
+
|
|
264
|
+
Show a hyperbolic arc from `0` to `1`::
|
|
265
|
+
|
|
266
|
+
sage: hyperbolic_arc(0, 1)
|
|
267
|
+
Graphics object consisting of 1 graphics primitive
|
|
268
|
+
|
|
269
|
+
.. PLOT::
|
|
270
|
+
|
|
271
|
+
sphinx_plot(hyperbolic_arc(0,1))
|
|
272
|
+
|
|
273
|
+
Show a hyperbolic arc from `1/2` to `i` with a red thick line::
|
|
274
|
+
|
|
275
|
+
sage: hyperbolic_arc(0.5, I,color='red', thickness=2)
|
|
276
|
+
Graphics object consisting of 1 graphics primitive
|
|
277
|
+
|
|
278
|
+
.. PLOT::
|
|
279
|
+
|
|
280
|
+
sphinx_plot(hyperbolic_arc(0.5, I, color='red', thickness=2))
|
|
281
|
+
|
|
282
|
+
Show a hyperbolic arc from `1+i` to `1+2i` with dashed line::
|
|
283
|
+
|
|
284
|
+
sage: hyperbolic_arc(1+I, 1+2*I, linestyle='dashed', color='green')
|
|
285
|
+
Graphics object consisting of 1 graphics primitive
|
|
286
|
+
|
|
287
|
+
.. PLOT::
|
|
288
|
+
|
|
289
|
+
sphinx_plot(hyperbolic_arc(CC(1,1), CC(1,2), linestyle='dashed', color='green'))
|
|
290
|
+
|
|
291
|
+
::
|
|
292
|
+
|
|
293
|
+
sage: hyperbolic_arc(-1+I, 1+2*I, linestyle='--', color='orange')
|
|
294
|
+
Graphics object consisting of 1 graphics primitive
|
|
295
|
+
|
|
296
|
+
.. PLOT::
|
|
297
|
+
|
|
298
|
+
sphinx_plot(hyperbolic_arc(CC(-1,1), CC(1,2), linestyle='dashed'))
|
|
299
|
+
|
|
300
|
+
Show a hyperbolic arc from a `1+i` to infinity::
|
|
301
|
+
|
|
302
|
+
sage: hyperbolic_arc(1 + I, infinity, color='brown')
|
|
303
|
+
Graphics object consisting of 1 graphics primitive
|
|
304
|
+
|
|
305
|
+
.. PLOT::
|
|
306
|
+
|
|
307
|
+
from sage.rings.infinity import infinity
|
|
308
|
+
sphinx_plot(hyperbolic_arc(CC(1,1), infinity, color='brown'))
|
|
309
|
+
|
|
310
|
+
We can also plot hyperbolic arcs in other models.
|
|
311
|
+
|
|
312
|
+
We show a hyperbolic arc from `i` to `-1` in red, another hyperbolic arc
|
|
313
|
+
from `e^{i\pi/3}` to `0.6 \cdot e^{i 3\pi/4}` with dashed style in green,
|
|
314
|
+
and finally a hyperbolic arc from `-0.5+0.5i` to `0.5-0.5i` together
|
|
315
|
+
with the disk frontier in the Poincaré disk model::
|
|
316
|
+
|
|
317
|
+
sage: z1 = CC(0,1)
|
|
318
|
+
sage: z2 = CC(-1,0)
|
|
319
|
+
sage: z3 = CC((cos(pi/3),sin(pi/3)))
|
|
320
|
+
sage: z4 = CC((0.6*cos(3*pi/4),0.6*sin(3*pi/4)))
|
|
321
|
+
sage: z5 = CC(-0.5,0.5)
|
|
322
|
+
sage: z6 = CC(0.5,-0.5)
|
|
323
|
+
sage: a1 = hyperbolic_arc(z1, z2, model='PD', color='red')
|
|
324
|
+
sage: a2 = hyperbolic_arc(z3, z4, model='PD', color='green')
|
|
325
|
+
sage: a3 = hyperbolic_arc(z5, z6, model='PD', linestyle='--')
|
|
326
|
+
sage: a1 + a2 + a3
|
|
327
|
+
Graphics object consisting of 6 graphics primitives
|
|
328
|
+
|
|
329
|
+
.. PLOT::
|
|
330
|
+
|
|
331
|
+
z1 = CC(0,1)
|
|
332
|
+
z2 = CC(-1,0)
|
|
333
|
+
z3 = CC((cos(pi/3),sin(pi/3)))
|
|
334
|
+
z4 = CC((0.6*cos(3*pi/4),0.6*sin(3*pi/4)))
|
|
335
|
+
z5 = CC(-0.5,0.5)
|
|
336
|
+
z6 = CC(0.5,-0.5)
|
|
337
|
+
a1 = hyperbolic_arc(z1, z2, model='PD', color='red')
|
|
338
|
+
a2 = hyperbolic_arc(z3, z4, model='PD', color='green')
|
|
339
|
+
a3 = hyperbolic_arc(z5, z6, model='PD', linestyle='--')
|
|
340
|
+
P = a1 + a2 + a3
|
|
341
|
+
sphinx_plot(P)
|
|
342
|
+
|
|
343
|
+
We show the arcs defined by the same endpoints in the Klein disk
|
|
344
|
+
model (note that these are *not* the image of those arcs when
|
|
345
|
+
changing between the models)::
|
|
346
|
+
|
|
347
|
+
sage: a1 = hyperbolic_arc(z1, z2, model='KM', color='red')
|
|
348
|
+
sage: a2 = hyperbolic_arc(z3, z4, model='KM', color='green')
|
|
349
|
+
sage: a3 = hyperbolic_arc(z5, z6, model='KM', linestyle='--')
|
|
350
|
+
sage: a1 + a2 + a3
|
|
351
|
+
Graphics object consisting of 6 graphics primitives
|
|
352
|
+
|
|
353
|
+
.. PLOT::
|
|
354
|
+
|
|
355
|
+
z1 = CC(0,1)
|
|
356
|
+
z2 = CC(-1,0)
|
|
357
|
+
z3 = CC((cos(pi/3),sin(pi/3)))
|
|
358
|
+
z4 = CC((0.6*cos(3*pi/4),0.6*sin(3*pi/4)))
|
|
359
|
+
z5 = CC(-0.5,0.5)
|
|
360
|
+
z6 = CC(0.5,-0.5)
|
|
361
|
+
a1 = hyperbolic_arc(z1, z2, model='KM', color='red')
|
|
362
|
+
a2 = hyperbolic_arc(z3, z4, model='KM', color='green')
|
|
363
|
+
a3 = hyperbolic_arc(z5, z6, model='KM', linestyle='--')
|
|
364
|
+
P = a1 + a2 + a3
|
|
365
|
+
sphinx_plot(P)
|
|
366
|
+
|
|
367
|
+
Show a hyperbolic arc from `(1,2,\sqrt(6))` to `(-2,-3,\sqrt(14))`
|
|
368
|
+
in the hyperboloid model::
|
|
369
|
+
|
|
370
|
+
sage: a = (1,2,sqrt(6))
|
|
371
|
+
sage: b = (-2,-3,sqrt(14))
|
|
372
|
+
sage: hyperbolic_arc(a, b, model='HM')
|
|
373
|
+
Graphics3d Object
|
|
374
|
+
|
|
375
|
+
.. PLOT::
|
|
376
|
+
|
|
377
|
+
a = (1,2,sqrt(6))
|
|
378
|
+
b = (-2,-3,sqrt(14))
|
|
379
|
+
sphinx_plot(hyperbolic_arc(a, b, model='HM'))
|
|
380
|
+
"""
|
|
381
|
+
from sage.plot.graphics import Graphics
|
|
382
|
+
|
|
383
|
+
g = Graphics()
|
|
384
|
+
g._set_extra_kwds(g._extract_kwds_for_show(options))
|
|
385
|
+
if model == "HM":
|
|
386
|
+
# since KM is 3d we can not use HyperbolicArc class we plot it directly
|
|
387
|
+
# and we also handle the hyperbolic_polygon in direct way
|
|
388
|
+
from sage.geometry.hyperbolic_space.hyperbolic_interface import HyperbolicPlane
|
|
389
|
+
|
|
390
|
+
# Check for valid points
|
|
391
|
+
if a[2] < 0 or a[0]**2+a[1]**2-a[2]**2 + 1 > EPSILON:
|
|
392
|
+
raise ValueError(f"{a} is not a valid point in the HM model")
|
|
393
|
+
if b[2] < 0 or b[0]**2+b[1]**2-b[2]**2 + 1 > EPSILON:
|
|
394
|
+
raise ValueError(f"{b} is not a valid point in the HM model")
|
|
395
|
+
|
|
396
|
+
HM = HyperbolicPlane().HM()
|
|
397
|
+
geodesic = HM.get_geodesic(a, b)
|
|
398
|
+
g = g + geodesic.plot(show_hyperboloid=True, graphics_options=options)
|
|
399
|
+
else:
|
|
400
|
+
g.add_primitive(HyperbolicArc(a, b, model, options))
|
|
401
|
+
if model == "PD" or model == "KM":
|
|
402
|
+
g = g + circle((0, 0), 1, axes=False, color='black')
|
|
403
|
+
g.set_aspect_ratio(1)
|
|
404
|
+
return g
|