-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arithmetic methods support for
Angle
(#16)
This introduces several arithmetic functions in `Angle` to increase readability and developer experience. ### Instance methods - `Angle#+`: adds two angles' values and returns an angle - `Angle#-`: subtracts two angles' values and returns an angle - `Angle#sin`: returns the numeric value (ratio) of the sine of the angle - `Angle#cos`: returns the numeric value (ratio) of the cosine of the angle - `Angle#tan`: returns the numeric value (ratio) of the tangent of the angle ###Class methods - `Angle::asin`: returns a new angle from the radians of a inverse sine ratio - `Angle::acos`: returns a new angle from the radians of a inverse cosine ratio - `Angle::atan`: returns a new angle from the radians of a inverse tangent ratio ### Examples ```rb angle_1 = Astronoby::Angle.as_radians(described_class::PI) angle_2 = Astronoby::Angle.as_degrees(45) new_angle = angle_1 + angle_2 new_angle.degrees # => 225 Astronoby::Angle.as_radians(Math::PI / 6).sin # => ~ 0.5 angle = Astronoby::Angle.atan(1) angle.radians # => ~ π÷4 ```
- Loading branch information
1 parent
30edbd0
commit ecd3d2d
Showing
12 changed files
with
209 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.