Skip to content

Add oblique (axonometric) projection - #91

Merged
bjmorgan merged 6 commits into
mainfrom
feature/oblique-recut
Aug 17, 2026
Merged

Add oblique (axonometric) projection#91
bjmorgan merged 6 commits into
mainfrom
feature/oblique-recut

Conversation

@bjmorgan

Copy link
Copy Markdown
Owner

Adds an oblique (axonometric) parallel projection as a third Projection variant, alongside Orthographic and Perspective. Set view.projection = Oblique(angle, foreshortening) to draw the third axis receding at an angle — depth without perspective distortion — where foreshortening is 1.0 for cavalier, 0.5 for cabinet, 0.0 for 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)), so rotation stays a true rotation. The shear is defined once, as a linear screen_matrix on 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 consolidated project_camera path, and the axis triad through screen_matrix directly.

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 existing max_magnification hook, so _scene_extent is unchanged.

Orthographic and perspective output is bit-for-bit unchanged. Supersedes the earlier oblique attempt.

Copilot AI lite review requested due to automatic review settings August 17, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.
Copilot AI review requested due to automatic review settings August 17, 2026 13:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bjmorgan
bjmorgan merged commit cc52f98 into main Aug 17, 2026
5 checks passed
@bjmorgan
bjmorgan deleted the feature/oblique-recut branch August 17, 2026 13:48
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.

2 participants