Skip to content

feat(geometry): add face_towards to 2D isometries#1605

Open
wilmerdooley wants to merge 1 commit into
dimforge:mainfrom
wilmerdooley:oss/issue-492
Open

feat(geometry): add face_towards to 2D isometries#1605
wilmerdooley wants to merge 1 commit into
dimforge:mainfrom
wilmerdooley:oss/issue-492

Conversation

@wilmerdooley

Copy link
Copy Markdown

This adds a face_towards constructor for 2D isometries (Isometry2 and IsometryMatrix2) that mirrors the existing 3D behavior. The new method builds an isometry from an eye point and a target point, mapping the local x axis to the view direction and the origin to eye, which is useful for orienting objects toward a target in 2D.

A deprecated new_observer_frame alias is also provided on the 2D types for consistency with the 3D naming, and the rustdoc section in isometry.rs is updated to list the new constructor.

Resolves #492

Changes

  • Add Isometry2::face_towards and IsometryMatrix2::face_towards in src/geometry/isometry_construction.rs, computing the rotation from atan2(dy, dx) between eye and target.
  • Add deprecated new_observer_frame aliases on both 2D isometry types, delegating to face_towards.
  • Update the 2D construction section in the Isometry rustdoc to mention face_towards.
  • Add a proptest in tests/geometry/isometry.rs covering both 2D types, verifying that the origin maps to eye and the x axis maps to the normalized view direction.

Signed-off-by: wilmerdooley <wilmerdooley1@gmail.com>
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.

Add a new_observer_frame for 2D transformations too.

1 participant