Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line with thousands of points does not work #188

Closed
arximboldi opened this issue Mar 15, 2021 · 6 comments
Closed

Line with thousands of points does not work #188

arximboldi opened this issue Mar 15, 2021 · 6 comments

Comments

@arximboldi
Copy link

Hi!

I'm trying to plot lines with potentially millions of points. However the plot breaks just after a few thousands.

I've tried plotting the spiral from #41 #40, like this:

            ImPlot::PlotLineG(
                "spiral",
                [](void*, int idx) -> ImPlotPoint {
                    float r = 0.9f;             // outer radius
                    float a = 0;                // inner radius
                    float b = 0.05f;            // incerement per rev
                    float n = (r - a) / b;      // number  of revolutions
                    double th = 2 * n * M_PI;   // angle
                    float Th = float(th * idx / (1000000 - 1));
                    return ImPlotPoint(0.5f + (a + b * Th / (2.0f * (float)M_PI)) * cosf(Th),
                                       0.5f + (a + b * Th / (2.0f * (float)M_PI)) * sinf(Th));
                },
                nullptr, 1000000);

And nothing shows. In fact, the crosshair and other markers "disappear", as if the plot simply got broken:

Screenshot from 2021-03-15 19-56-47

You can see leyend, crosshairs etc ar missing, and only part of the spiral is drawn, a tiny blue line on the right edge.

What do you think is causing this issue?

@arximboldi arximboldi changed the title Line with millions of points does not work Line with thousands of points does not work Mar 15, 2021
@arximboldi
Copy link
Author

Btw, this line has a million points, but this can already be reproduced with a few thousands points sadly :(

@arximboldi
Copy link
Author

The screenshot above was not centered, here is a screenshot of the plot, centered, and with only 100000 points, which already reproduces it:
Screenshot from 2021-03-15 20-05-54

You can see that only the center of the spiral is visible: somehow it starts drawing, and at some point it "breaks"...

@epezent
Copy link
Owner

epezent commented Mar 15, 2021

Please read the Special Notes section of the README and report back if neither of the fixes resolve the issue.

@arximboldi
Copy link
Author

Ohhhh I missed that! Thank's for the super-quick response. I'll take a look tomorrow and report back if it doesn't work.

@epezent
Copy link
Owner

epezent commented Mar 15, 2021

No problem!

@arximboldi
Copy link
Author

I can confirm that the suggested solution worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants