Skip to content

MathHelper refactor - #26

Merged
DomCR merged 9 commits into
masterfrom
MathHelper-refactor
Sep 9, 2026
Merged

DomCR merged 9 commits into
masterfrom
MathHelper-refactor

Conversation

@DomCR

@DomCR DomCR commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Description

Refactor the class structure and fixes some bugs.

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.
@DomCR DomCR added the bug Something isn't working label Sep 9, 2026
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.
@DomCR
DomCR merged commit 612e7db into master Sep 9, 2026
2 checks passed
@DomCR
DomCR deleted the MathHelper-refactor branch September 9, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant