Skip to content

Shapes#22

Merged
DomCR merged 13 commits into
masterfrom
shapes
Jun 9, 2026
Merged

Shapes#22
DomCR merged 13 commits into
masterfrom
shapes

Conversation

@DomCR

@DomCR DomCR commented Jun 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

DomCR added 13 commits June 2, 2026 13:16
Added a new `Circle2D` struct to the `CSMath.Geometry` namespace,
including properties for `Center` and `Radius`. Implemented
constructors for initialization and a `FindIntersections` method
to compute intersection points with a `Line2D`. Updated
`CSMath.projitems` to include `Circle2D.cs` and added necessary
`using` directives for dependencies.
Introduced the `Arc2D` struct to represent circular arcs in 2D space,
including methods for line intersections and angle containment.

Enhanced the `Circle2D` struct by adding XML documentation, cleaning
up imports, improving the `FindIntersections` method, and adding
constructor overloads for flexibility.

Updated `MathHelper` with new utility methods (`IsAngleInRange`,
`NormalizeAngleRadians`) and improved `FixZero` functionality.

Added comprehensive unit tests for `Circle2D` in `Circle2DTests.cs`
to validate constructors and intersection logic under various
scenarios.

Improved overall code readability and maintainability with
documentation and refactoring.
Enhanced the `Arc2D` struct with the following changes:
- Added XML documentation for properties and methods.
- Renamed `ContainsAngleProjection` to `InAngularRange` for clarity.
- Refactored `GetIntersections` to use `InAngularRange` and improve precision.
- Added extensive unit tests in `Arc2DTests.cs` to validate:
  - Constructor behavior and property access.
  - Intersection logic for various scenarios, including edge cases.
  - `InAngularRange` functionality for points in and out of range.
- Improved test coverage for wrap-around arcs, small arcs, and offset centers.
- Added necessary `using` directives in test files.

These changes improve code readability, maintainability, and reliability.
Added XML documentation for the `Slope` property in `Line2D.cs` and attempted to fix its implementation, though the calculation issue remains unresolved. Removed an outdated comment in `Line3D.cs`. Updated `IsAngleInRange` in `MathHelper.cs` to include a `precision` parameter with a default value of `Epsilon` and adjusted its logic to account for tolerance, improving robustness in range checks.
Added Segment2D struct with intersection logic and equality checks. Made ILine<T> properties read-only. Improved Line2D slope calculation, equality, and hash code. Enhanced LineExtensions with better type safety and documentation. Updated Arc2D and MathHelper for consistency and clarity. Included Segment2D.cs in project file.
Renamed all test methods and calls from GetIntersections to FindIntersections in Arc2DTests.cs for consistency with the updated method name.
Added XML documentation to Line2D and its members for better clarity. Implemented GetHashCode() for proper hashing. Introduced PointInLine(double lambda) to compute points along the line.
Introduced Segment3D struct in CSMath.Geometry to represent 3D line segments. Implements ILine<XYZ> and IEquatable<Segment3D>, with methods for equality, intersection, and hash code. Updated project file to include Segment3D.cs.
Introduce FromPoints and FromSegment methods to Line2D and Line3D for easier line creation from points or segments. Add XML documentation for these methods. Move GetHashCode override in Line2D without changing its logic.
@DomCR DomCR merged commit 7829a26 into master Jun 9, 2026
2 checks passed
@DomCR DomCR deleted the shapes branch June 9, 2026 09:24
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.

1 participant