7
$\begingroup$

I work on Mathematica 11.0.0

I'm working on a ray tracing program and I need to visualize lightrays and their intersections. Everything works fine until today I tried to visualize two nearly parallel lightrays and their faraway intersecting point, this time, the Front-End simple crashed and stop responding. I found the problems lies in Graphics when rendering a long Line or Arrow with PlotRange setting.


Try this piece of code

Table[Graphics[{Line[{{0, 0}, {10^x, 0}}]}], {x, .5, 8, .5}]
Table[Graphics[{Line[{{0, 0}, {10^x, 0}}]}, PlotRange -> {{-1, 1}, {-1, 1}}], {x, .5, 8, .5}]

The first piece of code generate quite reasonable result, but the second seemingly don't: In the first few pictures, everything works fine, but in latter ones, the line shifted to the left side instead of right side, then when x keeps going larger, the whole line vanished:

error image

I found out the "magical limit of reversing" is 125334

and the "magical limit of disappearing" is 16049956 and things goes nasty near this place:

nasty

To my surprise, these are not power of 2, so I don't know what's going on here.

A easy way to fix it is adding a replacement rule to set those "overflowing" values to a reasonable one using graphics/.n_?NumericQ:>Clip[n,{-10000,10000}], but that's really low in efficiency and will tamper the data which is extremly unwanted if I want to extract some data from this image later on.


Well, while the first phenomenon is still bearable, the second surely is not!

Please save all your work before running this piece of code:

Graphics[{Dashed, Line[{{0, 0}, {1.*^6, 0}}]}, PlotRange -> {{-1, 1}, {-1, 1}}]

Front-End keeps running! I suspect this happen because Mathematica draw all dashed line segments first and then show us the portion in PlotRange. Those excessing line segments drawing crashes the Front-End.


So my problem is, why these happen and how can I solve it? Thanks a lot!

$\endgroup$
  • 2
    $\begingroup$ Looks like a bug, I'd report it to WRI $\endgroup$ – ktm Feb 11 '17 at 5:28
  • $\begingroup$ @user6014 I shall report it too. $\endgroup$ – Wjx Feb 11 '17 at 6:02
  • $\begingroup$ I get the same with versions 8.0.4, 10.4.1 and 11.0.0 on Win7 x64. It is a bug. $\endgroup$ – Alexey Popkov Feb 11 '17 at 12:58
  • $\begingroup$ Upgrade to 11.0.1. I don't see those problems with 11.0.1 on macOS. Now, the last bit of code still gives the FE fits, but not enough to crash, just a bit of unresponsiveness. $\endgroup$ – rcollyer Feb 12 '17 at 3:01
  • $\begingroup$ @rcollyer well, but the decrease in performance is disastrous when I draw thousands of these lines in my real application. But maybe I should upgrade my Mathematica to check whether it could solve the problem :) $\endgroup$ – Wjx Feb 12 '17 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.