feat(render): orient, straighten and let the chosen proportions win in the render geometry

Owner review 1, phase 4, package P1: the Core geometry behind the visual
crop (R5) and the orientation controls (R6).

- RenderGeometry: one warp stab⁻¹ · O⁻¹ · V with the crop and the keyframe
  centres in the view frame T (turned, mirrored, flipped, straightened);
  the output size comes from RenderSize, so a fixed preset adapts to the
  aspect (4K at 9:16 = 2160×3840) and AspectFromPreset is gone; the decode
  grows by the straighten cover zoom; ViewFor, ViewToFrame, EditableCrop
  and FootprintInView get their real bodies; a rotation that is not a
  quarter turn and an out-of-range straighten render as none or clamped,
  with their warnings.
- FrameOrientation: the cover zoom is taken on the pixel-centre extents,
  so every output pixel samples inside the frame (full alpha coverage at
  ±15°, never a smeared border).
- CropFrame: crops are written on the 12-decimal grid OrientationEdit
  remaps on, so four turns or two mirrors give back the same text; a
  stored crop is read value by value as the render reads it.
- Advisor: the aspect (and the horizon framing) is advised on the view
  turned by the camera (SequenceContext.Rotate/Flip, ForCamera); the
  analyser passes the project's camera.
- Self-test: proc.orient, proc.straighten, proc.portrait.
- Tests: exact pixel permutations for turns, mirror and flip, the
  orientation algebra, straighten against an analytic ramp and its full
  coverage, Create sizes, a crop keeping its content through every press,
  CropFrame move/resize/refit/rows, OrientationEdit round trips and its
  agreement with FrameOrientation, the turned-view advice, determinism.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 19:35:05 +01:00
1 parent e4364c4f25
commit bee66da63a
18 files changed
+1052 -67

No files matched your search

@@ -25,7 +25,8 @@ public sealed record FrameOrientation
FrameWidth = frameWidth;
FrameHeight = frameHeight;
(ViewWidth, ViewHeight) = turns % 2 == 1 ? (frameHeight, frameWidth) : (frameWidth, frameHeight);
CoverZoom = CoverZoomOf(straighten, ViewWidth, ViewHeight);
// On the pixel-centre extents, so every output pixel centre samples between frame pixel centres (full coverage).
CoverZoom = CoverZoomOf(straighten, int.Max(1, ViewWidth - 1), int.Max(1, ViewHeight - 1));
FrameToView = Straightening(1) * MirrorFlip() * QuarterTurns();
ViewToFrame = QuarterTurns().Invert() * MirrorFlip() * Straightening(-1);
}
@@ -52,7 +53,11 @@ public sealed record FrameOrientation
public int ViewHeight { get; }
/// <summary>The straighten's cover zoom c = cos|θ| + max(W'/H', H'/W')·sin|θ| (1 without straighten); never stored.</summary>
/// <summary>
/// The straighten's cover zoom c = cos|θ| + max(W'/H', H'/W')·sin|θ| (1 without straighten), never stored, taken on the
/// pixel-centre extents (W' − 1)×(H' − 1): the view's outermost pixel centres land on the frame's, so a resample needs no
/// sample outside the frame (with a transparent border, every pixel is fully covered).
/// </summary>
public double CoverZoom { get; }
/// <summary>Frame pixel-centre coordinates to view pixel-centre coordinates (O).</summary>