MathHelper refactor - #26
Merged
Merged
Conversation
Added 'absolute' parameter to NormalizeAngle, NormalizeAngleRadians, and RadToDeg for flexible negative angle handling. Updated XML docs and extended unit tests to cover both absolute and non-absolute scenarios.
Added and reorganized unit tests for `IsEqual`, `IsZero`, and angle normalization methods, covering custom thresholds and both absolute/non-absolute cases. Refactored `NormalizeAngleRadians` for improved handling of negative angles and multiples of `TwoPI`, and updated XML documentation.
Corrected test expectations for IsEqual and NormalizeAngle. Added IsNegative(double) method. Updated NormalizeAngle to handle negative 360 values when absolute is false.
Extracted shared normalization logic from `NormalizeAngle` and `NormalizeAngleRadians` into a new private `normalizeAngle` method. This reduces code duplication and improves maintainability.
Replaced direct equality checks with IsZero() in IsPerpendicular and IsZero methods for better floating-point accuracy. Added a test case to MathHelperTests to verify that large, nearly equal numbers are not considered equal.
3 tasks
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.
Description
Refactor the class structure and fixes some bugs.