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

Fix problems regarding the Slicer's Box #2972

Merged
merged 11 commits into from
Jan 14, 2022
Merged

Fix problems regarding the Slicer's Box #2972

merged 11 commits into from
Jan 14, 2022

Conversation

sgpearse
Copy link
Collaborator

Fixes #2971 and #2968.

#2969 is still a work in progress, but my work on it will be based on top of these two fixes.

@clyne clyne requested review from StasJ and clyne January 12, 2022 20:55
@sgpearse sgpearse changed the title 2968 slice box Fix problems regarding the Slicer's Box Jan 12, 2022
@StasJ StasJ self-requested a review January 13, 2022 00:15
lib/render/SliceRenderer.cpp Show resolved Hide resolved
lib/render/SliceRenderer.cpp Outdated Show resolved Hide resolved
lib/vdc/SliceGridAlongPlane.cpp Outdated Show resolved Hide resolved
@sgpearse
Copy link
Collaborator Author

@clyne and @StasJ - here's some context to my strategy for these bugs. I've added a summary of this in SliceGridAlongPlane.h.

The SliceRenderer was crashing when the Box and plane did not intersect. This was happening because the returned 2D grid was only being sampled within the bounds of the current Box. When the plane and Box did not intersect the returned grid would be invalid, causing a crash.

One option was to add logic in the SliceRenderer to handle this special case, however this option would require every renderer using SliceGridAlongPlane() to handle it as well.

The alternative I chose was to have SliceGridAlongPlane() return a valid grid in this case. The returned grid would be sampled along a given plane, and would have missingValues at points that do not lie within the Box. The Slice and Contour logic would be simplified by letting them operate on the returned grid in the same way, whether there are valid values or not.

Note that I am using the domain extents gathered from the DataMgr, and the Box extents from RenderParams. I'm not using the extents gathered from the 3D grid because those can be in disagreement with the DataMgr and RenderParams. This occurs due to roundoff whenever the Grid's extents are reduced, which incrementally reduces the Grid's dimension lengths.

Hope that makes sense.

@sgpearse sgpearse requested a review from clyne January 13, 2022 17:55
@clyne clyne merged commit f9d3615 into main Jan 14, 2022
@clyne clyne deleted the 2968_sliceBox branch January 14, 2022 01:28
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

Successfully merging this pull request may close these issues.

Slice crash
3 participants