epezent / implot

Immediate Mode Plotting
MIT License
4.77k stars 528 forks source link

vertical asymptotes #47

Closed sonoro1234 closed 4 years ago

sonoro1234 commented 4 years ago

When plotting 1/x or similar it would be useful to have a vertical line appearing for infinite values. Does it make sense?

epezent commented 4 years ago

Makes sense, but I'm not sure how we'd approach it generically. Initial thought is to check if a point is infinite, and if so draw a line back to 0. But then this would look like crap if multiple or consecutive values were infinity, so there'd have to be some extra logic in there to deal with that. I'm somewhat resistant to adding more checks and logic to the line rendering functions for performance reasons. Do you have any thoughts on how it could be done efficiently?

Looks like MATLAB can draw asymptotes, but only when plotting a symbolic expression. https://www.mathworks.com/help/symbolic/find-asymptotes-critical-and-inflection-points.html

sonoro1234 commented 4 years ago

But then this would look like crap if multiple or consecutive values were infinity

It is not the typical case where asymptotes happen only for specific values

epezent commented 4 years ago

Valid point. It might be easier than I initially thought. I can possibly look at it in the near future. Feel free to submit a PR in the meantime.

epezent commented 4 years ago

After some thought, I don't think this is something we need to address right now. I'm closing the issue.