Merged
Conversation
…on handling - Introduced new feature `astro` in Cargo.toml to enable astronomical reference frames. - Added `astro.rs` module defining various astronomical reference frames (ICRS, Horizontal, Ecliptic, etc.) with inherent methods. - Enhanced `affn-derive` to support `#[frame(inherent)]` for generating inherent methods in derived frames. - Updated `Direction` and `Position` types to utilize raw angle constructors, improving flexibility and performance. - Refactored angular separation calculations in `Direction` and `Position` to use a more numerically stable Vincenty formula. - Adjusted tests to ensure proper serialization/deserialization of spherical directions and positions.
- Introduced `Rotation3`, `Translation3`, and `Isometry3` types for pure mathematical operations on 3D transformations. - Implemented allocation-free and inline-friendly operators that work with raw `f64` vectors and `XYZ<f64>`. - Added macro `impl_quantity_mul!` to generate multiplication implementations for unit-aware operations. - Created a `serde_utils` module with a utility function to check for zero-sized types. refactor: Enhance spherical coordinate conversions - Added utility functions `canonicalize_azimuth` and `canonicalize_polar` for angle normalization. - Refactored `Direction` and `Position` implementations to utilize new spherical conversion functions. - Improved handling of azimuth and polar angles to ensure valid ranges and prevent domain errors. test: Extend tests for new affine and spherical functionalities - Added comprehensive tests for `Rotation3` and `Translation3` operations, including unit-aware multiplication. - Updated tests for spherical direction and position to validate new canonicalization logic.
…matches in Position operations
…d_sub in Position
…for Position operations
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.
This pull request introduces a new "astro" feature to the crate, providing built-in support for astronomical reference frames (such as ICRS, Ecliptic, Galactic, etc.) with convenient, frame-specific constructors and getters for spherical coordinates. It also enhances the
affn-deriveprocedural macro to generate inherent methods (named constructors and accessors) for frames defined in the same crate asDirection/Position, and refines canonicalization behavior for direction creation. Several code and documentation improvements are included to support these changes.New "astro" feature and astronomical frames:
astrofeature toCargo.tomland implemented a newsrc/frames/astro.rsmodule containing standard astronomical frames (ICRS, Ecliptic, Galactic, Horizontal, ITRF, ECEF, etc.), each with appropriate spherical coordinate naming and documentation. These frames are feature-gated and only available when theastrofeature is enabled. [1] [2] [3] [4]Procedural macro enhancements:
affn-derivemacro to support a new#[frame(inherent)]attribute, which generates inherent named constructors and getters (e.g.,.ra(),.dec(),Direction::<ICRS>::new(ra, dec)) for frames defined in the same crate asDirection/Position. This includes parsing the new attribute, generating the relevant code, and updating documentation. [1] [2] [3] [4] [5] [6]API and canonicalization changes:
Deprecated the generic
Direction::<F>::new()constructor in favor of frame-specific constructors and madenew_raw()the primary generic constructor, clarifying its intended use and canonicalization responsibilities. Updated documentation and code examples accordingly. [1] [2] [3] [4]Fixed canonicalization in Cartesian-to-spherical conversion to ensure azimuth is always normalized to
[0°, 360°)by usingnew_raw()with explicit normalization.These changes make it much easier and safer to work with standard astronomical frames and their coordinate conventions, and provide a more ergonomic and discoverable API for users of the crate.