Giter VIP home page Giter VIP logo

Comments (17)

sergeyn avatar sergeyn commented on May 17, 2024

Any comments about this issue ? It'd be nice to know your ideas on further developments in this area (if any)

from implot.

epezent avatar epezent commented on May 17, 2024

Hi @sergeyn , sorry for the slow reply and not addressing open PRs. I've been busy with other work and hope I can get to them soon.

Regarding this issue, I think this falls under the need to (optionally) downsample user data. For example, see the documentation for pyqtgraph:

downsampleMethod ‘subsample’: Downsample by taking the first of N samples. This method is fastest and least accurate. ‘mean’: Downsample by taking the mean of N samples. ‘peak’: Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower.

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

But I'm not sure how exactly does this addresses the issue. The problem is that points at the same place from neighbor line segments don't end up at the same spot. With dense rendering like I do problem just becomes obvious, it will not go away if you perform a reduction, unless you reduce everything to one line of course.
I mean that something like this: https://github.com/mattdesl/extrude-polyline needs to get implemented to properly draw connected segments.

from implot.

epezent avatar epezent commented on May 17, 2024

Well, downsampling reduces the chance that you have many points hitting a single pixel, I suppose.

Regarding connected segments: If I'm not mistaken, this is what ImGui's AddPolyline does by default (I can't remember for sure, perhaps I'm wrong). Can you swap out ImPlot's implementation with a call to this function and see if it improves?

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

Will try , thanks. I'm honestly not that familiar imgui internals yet. Another way I am thinking about is to push actual line strips to gpu. This would reduce amount of data generated and you get thin connected lines without much effort.
The default line rendering you have is for performance reasons, correct ? I could further significantly optimize line rendering but I don't feel like investing time into a method which doesn't produce accurate result.

from implot.

epezent avatar epezent commented on May 17, 2024

I agree that we could get optimizations by bypassing ImGui and going straight to the GPU, but I'm hesitant to support that right now since it would be a massive undertaking to handle all the potential backends (we'd essentially have to provide an implementation for every example backend ImGui does).

from implot.

epezent avatar epezent commented on May 17, 2024

@sergeyn , could you post some screenshots of what exactly is happening here. I'm curious.

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

image

from implot.

epezent avatar epezent commented on May 17, 2024

@sergeyn , I'm testing your PR. Can you provide the code for the plot above?

from implot.

sergeyn avatar sergeyn commented on May 17, 2024
         [](void*, int idx) {
            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 ImVec2(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);```

Note that when plot completely gets culled away, you may see garbage on screen (same as you have in your master currently), which is fixed by [this](https://github.com/ocornut/imgui/pull/3232)  PR. It's not a problem of plot rendering.

from implot.

epezent avatar epezent commented on May 17, 2024

Fixed in #41

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

May I ask how exactly is this fixed ?
As you can see on the image - here almost every other pixel is missing.
image

from implot.

epezent avatar epezent commented on May 17, 2024

Apologies, I misremembered the issue. I thought this one was related to the spiral truncating.

Yes, this does seem to still be an issue. As I said before, I think the best solution for this is to down sample the data with the user's permission.

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

from implot.

epezent avatar epezent commented on May 17, 2024

Out of curiosity, what sort of data are you trying to plot where this is a real issue?

from implot.

sergeyn avatar sergeyn commented on May 17, 2024

time series with possibility for extreme zoom-outs. I simple want them to look nice.

from implot.

epezent avatar epezent commented on May 17, 2024

I'm closing this issue because:

  1. We are never going to support mitered edges...the cost is just too high
  2. Downsampling, as you said, should NOT be default, and it's actually quite simple to implement using the existing offsetting and striding features. An example of this can be seen in the new Time Formatting demo, where 31,622,400 points are dynamically downsampled and plotted:

time-zoom

from implot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.