···
from drawsvg.widgets import DrawingWidget
336
-
import hyperbolic.poincare.shapes as hyper # python3 -m pip install hyperbolic
336
+
import hyperbolic.poincare as hyper # python3 -m pip install hyperbolic
from hyperbolic import euclid
339
-
# Patch the hyperbolic package for drawsvg version 2
340
-
patch = lambda m: lambda self, **kw: m(self, draw, **kw)
341
-
hyper.Circle.to_drawables = patch(hyper.Circle.toDrawables)
342
-
hyper.Line.to_drawables = patch(hyper.Line.toDrawables)
343
-
euclid.Arc.Arc.drawToPath = lambda self, path, includeM=True, includeL=False: path.arc(self.cx, self.cy, self.r, self.startDeg, self.endDeg, cw=not self.cw, include_m=includeM, include_l=includeL)
d = draw.Drawing(2, 2, origin='center', context=draw.Context(invert_y=True))
···
if (x1, y1) == (x2, y2): continue
359
-
p1 = hyper.Point.fromEuclid(x1, y1)
360
-
p2 = hyper.Point.fromEuclid(x2, y2)
361
-
if p1.distanceTo(p2) <= 2:
362
-
line = hyper.Line.fromPoints(*p1, *p2, segment=True)
353
+
p1 = hyper.Point.from_euclid(x1, y1)
354
+
p2 = hyper.Point.from_euclid(x2, y2)
355
+
if p1.distance_to(p2) <= 2:
356
+
line = hyper.Line.from_points(*p1, *p2, segment=True)
group.draw(line, hwidth=0.2, fill='white')
365
-
p = hyper.Point.fromEuclid(x, y)
366
-
group.draw(hyper.Circle.fromCenterRadius(p, 0.1),
359
+
p = hyper.Point.from_euclid(x, y)
360
+
group.draw(hyper.Circle.from_center_radius(p, 0.1),