-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
LineGlyphRepresentation to connect widget handles #2899
base: master
Are you sure you want to change the base?
Conversation
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.
why not derive from vtkGlyphRepresentation ?
I'm not sure about the SegmentedLineRepresentation. How about LineGlyphRepresentation ?
I did not see how Did I miss some nice feature GlyphRepresntation would have helped with? |
You indeed would have had to overwrite I do not think it's a problem to repeat the point iteration in each mixin function, it does not change the order of magnitude. Each mixin are small enough to be readable. I've been thinking that it would be nice if your polyline had "joints" between each segment. This could be done by adding spheres (of diameter the same as the line thickness) at each point handle. You would need however 2 glyphmappers though. |
Ah, setting the center on the cylander glyph means we don't have to compute the center of the segments. Good tip. If there was a 1 to 1 state mixin to PolyData array relationship, GlyphRepresentation seems helpful. In this case, OriginMixin makes 3 arrays, (position, orientation, scale.) Regarding joints, should we keep this simple and ask the using Widgets to use |
Where did you see that OriginMixin makes 3 arrays ?
Good idea, can you update your example to demonstrate that, that will make the screenshot more appealing. |
Incopreated finetjul's GlyphRepresentation rewrite from here Added sphere joints to the example. |
Sources/Widgets/Representations/LineGlyphRepresentation/example/index.js
Show resolved
Hide resolved
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.
LGTM
With center offset, don't have to position glyph in center of segment, just position at state origin.
Add handle representations to example.
Not sure we want to burden the repo with this niche, possibly duplicate code, but tossing this out there.
Context
I wanted to click on a segment of the PolyLineWidget and insert a handle in the middle of the line.
https://discourse.vtk.org/t/picking-tube-between-points-of-polylinewidget/12154
Results
Ran with @finetjul suggestion to use a Glyph mapper with cylanders to connect the points of a line. Can get the index of the cylander from WidgetManager
const insertHandleIndex = widgetManager.getSelections()[0].getProperties().compositeID + 1;
Using in VolView
Kitware/VolView#396
Changes
Adds a WidgetRepresentation based on PolyLineRepresentation. Adds example.
PR and Code Checklist
npm run reformat
to have correctly formatted codeTesting