Fix cross-section cut marker positions in composite render#11
Open
dirlligafu wants to merge 1 commit into
Open
Fix cross-section cut marker positions in composite render#11dirlligafu wants to merge 1 commit into
dirlligafu wants to merge 1 commit into
Conversation
The dashed cut lines were positioned by applying raw fractional positions to the padded view bbox (pad_frac=0.05 by default). Since the model content starts 5% inside the padded area on each side, markers were stretched across the full padded span rather than the model's actual extent -- making the outermost intervals visibly narrower than the interior ones. Fix: remap each fraction from content-space to padded-bbox-space before drawing, using the unpadded bbox width as the reference. All N+1 intervals are now equal, and each marker lands at exactly k/(N+1) of the model's actual depth. Closes 6wheel#10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this fixes
When N cross-section cuts are requested, the composite render divides the model into N+1 intervals with dashed marker lines. The outermost intervals (before cut 1 and after cut N) were measurably narrower than the interior ones, causing the markers to not coincide with the actual section positions.
Root cause
In compose_image(), fracs_for_view was applied against the padded view bbox (pad_frac=0.05 by default). The model content starts 5% inside the padded area on each side, so the markers were stretched across the full padded span instead of the model's actual extent.
Fix
Remap each fraction from content-space to padded-bbox-space before drawing, using the unpadded bbox as reference. All N+1 intervals are now equal, and each marker lands at exactly k/(N+1) of the model's actual depth.
Fixes #10.
Screenshots
All sections are now of equal size:

Section 1 now matches the profile image

