GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implement PolygonSelector by almarklein · Pull Request #837 · fastplotlib/fastplotlib

Conversation

@almarklein

@almarklein almarklein commented May 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator
  • Get it to draw a polygon.
  • Triangulation.
  • Selection.
  • Decide on interaction model.
image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar and claydugo reacted with rocket emoji
All reactions
  • 🚀 2 reactions
almarklein added 2 commits May 26, 2025 22:58
@almarklein
Implement PolygonSelector
46ccae3
@almarklein
Add triangulation
ee2ae10
@ivoflipse

ivoflipse commented May 27, 2025

Copy link
Copy Markdown

Next up, add morphing 😎

almarklein reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@almarklein

almarklein commented May 27, 2025

Copy link
Copy Markdown
Collaborator Author

add morphing

That's worthy of a separate lib :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ivoflipse

ivoflipse commented May 27, 2025

Copy link
Copy Markdown

You already have gfxmorph 🤣

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

almarklein added 7 commits June 3, 2025 10:59
@almarklein
Improve interaction
a1baea6
@almarklein
Add example
0604e1e
@almarklein
More robust triangularion
f8d01ee
@almarklein
tweaks
91779e3
@almarklein
apply limiy
b20d5a8
@almarklein
avoid artifact
3de437b
@almarklein
add get_selected_data
d3bab84
@almarklein

almarklein commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator Author

This is nearly done, but the ux needs some thought and work. I'm thinking something like this:

  • User clicks points to create the polygon. Optionally start with existing polygon.
  • Once created, vertices can be dragged.
  • Clicking on an edge will split it in two, creating an extra vertex.
  • Double-clicking on inside the polygon will delete and let the user create a new polygon.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jun 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This is nearly done, but the ux needs some thought and work. I'm thinking something like this:

  • User clicks points to create the polygon. Optionally start with existing polygon.
  • Once created, vertices can be dragged.
  • Clicking on an edge will split it in two, creating an extra vertex.

All this sounds good to me!

  • Double-clicking on inside the polygon will delete and let the user create a new polygon.

I think this should be explicitly called, or via imgui right click menu. Or clicking on the fill area selects the polygon and presing the "Del" key deletes it.

almarklein reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@almarklein almarklein mentioned this pull request Jun 29, 2025
POC: event handling using await pygfx/rendercanvas#98
Closed
almarklein added 4 commits July 3, 2025 16:47
@almarklein
wip interaction
79c4952
@almarklein
Progress on interaction
44e2b06
@almarklein
Allow restarting and setting the polygon selection
9c4dccc
@almarklein
cleanuo
24b7707
@almarklein

almarklein commented Jul 4, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator Author

Interaction done! Slightly different than I said earlier:

  • Can initialize the tool with an initial selection.
  • If the initial selection is empty, enter polygon creation mode.
  • Can also call start_new_polygon() to clear the current polygon and draw a new one.
  • When creating a new polygon, clicking adds a vertex. Clicking on the first vertex again will finish the polygon.
  • When created, the vertices can be dragged. When dragged on top of a neighbouring polygon, it will be deleted.
  • When clicking/dragging on a line, a new vertex is inserted.

edit: in the above, a snapping visualization is applied to help the user understand that the vertex will be "merged" with the vertex under the mouse.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@almarklein
cleanup
cb7ddf8
@almarklein
almarklein marked this pull request as ready for review July 4, 2025 12:41
@almarklein
almarklein requested review from clewis7 and kushalkolar as code owners July 4, 2025 12:41
@almarklein

almarklein commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator Author

I just learned about bermuda, a triangulation lib implemented in Rust, a spin-off of the Napari project. We could try and see if it helps here. It would mean an extra dependency, so maybe not use it unless we need it. But we can at least do some quick benchmarks and add a note, so that in case we do need more speed, we know how to get it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar
kushalkolar requested changes Jul 23, 2025
View reviewed changes
Comment thread fastplotlib/graphics/features/_selection_features.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/image.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/line.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Outdated
self.geometry,
pygfx.PointsMaterial(size=vertex_size, color=vertex_color, pick_write=True),
)
self._points.local.z = 0.01 # move it slightly towards the camera

@kushalkolar kushalkolar Jul 23, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do this often! Is 0.01 the best way to do it? I usually do 0.5

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@almarklein almarklein Aug 27, 2025

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the other z-values in your scene, and on the camera depth range settings. From what I understand FPL has layers that are 1.0 apart. I'll change the value above to 0.1; still close to it's original "layer".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jul 23, 2025

Copy link
Copy Markdown
Member

Sorry for the delay in reviewing this, awesome work thanks a lot! 🥳 🥳 . Some minor comments and questions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar kushalkolar mentioned this pull request Jul 29, 2025
Allow use of add_*_selector methods in ScatterGraphic #883
Closed
almarklein and others added 2 commits August 27, 2025 16:26
@almarklein @kushalkolar
Update fastplotlib/graphics/selectors/_polygon.py
593ce4d
Co-authored-by: Kushal Kolar <[email protected]>
@almarklein
Merge branch 'main' into poly-select
2d88470
almarklein added 4 commits August 28, 2025 09:32
@almarklein
address reviewer comments
ec51a95
@almarklein
allow dragging the whole polygon
03b43a9
@almarklein
fix snapping
a89e143
@almarklein
Add note to Bermuda lib
9c7e380
@almarklein

almarklein commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator Author

I addressed all comments.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@almarklein

almarklein commented Sep 2, 2025

Copy link
Copy Markdown
Collaborator Author

Need to tweak alpha_mode for the worldObjects used in the selectors, but I propose we first merge this (if you're happy), and then in #873 I make those adjustments.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Sep 3, 2025

Copy link
Copy Markdown
Member

Thanks! I was traveling this weekend so it slipped through.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar
kushalkolar approved these changes Sep 3, 2025
View reviewed changes
@kushalkolar
kushalkolar merged commit 0293fa3 into main Sep 3, 2025
@almarklein

almarklein commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks! I was traveling this weekend so it slipped through.

No problem. My comment was mainly to suggest a sensible order of merging the prs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@almarklein
almarklein deleted the poly-select branch September 3, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kushalkolar kushalkolar kushalkolar approved these changes
@clewis7 clewis7 Awaiting requested review from clewis7 clewis7 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@almarklein @ivoflipse @kushalkolar
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.