Add oblique (axonometric) projection - #91
Merged
Merged
Conversation
Address the PR review: - Add Oblique.__post_init__ rejecting a non-finite angle and a non-finite or negative foreshortening, with a rejection test. This is the same silent-degenerate guard Perspective carries and look_along gained in #90: a non-finite parameter otherwise builds a NaN screen matrix that poisons every drawn position with an obscure, far-from-cause crash. A foreshortening is the length of a unit step, so negative is rejected; angle alone controls the receding direction. - Test the axes-widget inset factor (the screen matrix's spectral norm -- 1.0 for the non-oblique modes, sqrt(1+f^2) for oblique) and that it bounds the sheared tips. - Correct the screen-frame comments: the projection is not a plain drop of z under perspective; the batch's 2D positions come from the projected xy, not camera space; the axes comment labelled a rotation-only line as also applying the screen matrix. Note in the ABC that screen_matrix is the linear part only and does not reproduce to_screen under Perspective.
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.
Adds an oblique (axonometric) parallel projection as a third
Projectionvariant, alongsideOrthographicandPerspective. Setview.projection = Oblique(angle, foreshortening)to draw the third axis receding at an angle — depth without perspective distortion — whereforeshorteningis1.0for cavalier,0.5for cabinet,0.0for orthographic.An oblique projection is the existing orthonormal camera plus a depth-proportional shear applied at the camera-to-screen boundary (
x' = x - f*z*cos(angle),y' = y - f*z*sin(angle)), sorotationstays a true rotation. The shear is defined once, as a linearscreen_matrixon the projection (identity for the parallel-in-plane and perspective modes), and every screen-mapped object consumes it: atoms, bonds, and cell edges through the existing consolidatedproject_camerapath, and the axis triad throughscreen_matrixdirectly.Bond end-cap junction geometry moves into a screen-aligned frame (
ViewState.screen_frame) where the projection is a plain drop of depth, so caps attach at the drawn silhouette rather than the atom centre under the shear; this is an exact passthrough for the other modes. The viewport allowance for the shear (sqrt(1 + f^2)) falls out of the existingmax_magnificationhook, so_scene_extentis unchanged.Orthographic and perspective output is bit-for-bit unchanged. Supersedes the earlier oblique attempt.