Skip to content

Commit

Permalink
Work around asy cylinder3dbox bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jul 3, 2021
1 parent ad526d1 commit 9a503da
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions mathics/format/asy.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,22 @@ def cylinder3dbox(self, **options) -> str:
asy = ""
i = 0
while i < len(self.points) / 2:
asy += "draw(surface(cylinder({0}, {1}, {2}, {3})), rgb({2},{3},{4}));".format(
tuple(self.points[i * 2].pos()[0]),
self.radius,
# distance between start and end
(
(self.points[i * 2][0][0] - self.points[i * 2 + 1][0][0]) ** 2
+ (self.points[i * 2][0][1] - self.points[i * 2 + 1][0][1]) ** 2
+ (self.points[i * 2][0][2] - self.points[i * 2 + 1][0][2]) ** 2
try:
asy += "draw(surface(cylinder({0}, {1}, {2}, {3})), rgb({2},{3},{4}));".format(
tuple(self.points[i * 2].pos()[0]),
self.radius,
# distance between start and end
(
(self.points[i * 2][0][0] - self.points[i * 2 + 1][0][0]) ** 2
+ (self.points[i * 2][0][1] - self.points[i * 2 + 1][0][1]) ** 2
+ (self.points[i * 2][0][2] - self.points[i * 2 + 1][0][2]) ** 2
)
** 0.5,
(1, 1, 0), # FIXME: currently always drawing around the axis X+Y
*face_color[:3],
)
** 0.5,
(1, 1, 0), # FIXME: currently always drawing around the axis X+Y
*face_color[:3],
)
except: # noqa
pass

i += 1

Expand Down

0 comments on commit 9a503da

Please sign in to comment.