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

[BUG] Narrow peaks can exceed plot area #347

Closed
Tracked by #380
TomDeRybel opened this issue May 3, 2022 · 4 comments
Closed
Tracked by #380

[BUG] Narrow peaks can exceed plot area #347

TomDeRybel opened this issue May 3, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@TomDeRybel
Copy link

TomDeRybel commented May 3, 2022

Describe the bug
The line drawing seems to have an overshoot issue for very narrow peaks. These overshoots can reach beyond the drawing area.

Some examples of the observed behavior:

  • Very narrow peaks can exceed the drawing area, as shown in the screenshot. (35Hz peak)
  • Very narrow peaks within the drawing area can generate artifacts where the displayed peak exceeds the data points. Note that no Y-data is larger than +30 dB, yet the peak goes higher. (1600Hz peak)
  • When the peak is a few pixels wide, it nicely clips (or perhaps does not trigger the overshoot issue) (250Hz peak)
  • I am not sure the specified line width remains respected for these sharp peaks (could also be due to aliasing).

To Reproduce
Plot data with very narrow peaks that exceed the plot area. The peaks have to be steep enough that they are but a pixel wide or so when rendered. The attached code example includes data that illustrates these issues.

Version Information
plotters: git version
fltk: 1.3.6

Screenshot_20220506_101251

plotters_doodle.zip

@TomDeRybel TomDeRybel added the bug Something isn't working label May 3, 2022
@Feng23
Copy link
Collaborator

Feng23 commented May 4, 2022

Thank you for creating the issue! Could you share some minimal reproducible example code? That would help us debug.

@TomDeRybel
Copy link
Author

I have added a working, minimal example project, as well as updated the description with additional information and observations.
Thank you for looking into this!

38 added a commit that referenced this issue Jun 27, 2022
This bug was caused by the default rasterizer plolygonize a path
line with stroke width later than 1. When angle is too small, the
polygon vertex might be very far away from the center line.

In SVG rasterizer, this vertex will be dropped - but our rasterizer lack
of this type of check.

This change implemented the check, when distance between the line vertex
the coresponding plolygon vertex on the outter side is larger than 2
times of the stroke width - Then we cap the polygon.
@38
Copy link
Member

38 commented Jun 27, 2022

Hi there, I've pushed a fix. Could you please confirm this is fixed. Thanks!

Feel free to reopen it if the fix doesn't work.

@38 38 closed this as completed Jun 27, 2022
@TomDeRybel
Copy link
Author

Thank you for your work! I can confirm that the issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants