Merged
Conversation
…, CollisionPoint.cs to ShapeEngine/Core/CollisionHandler namespace. Refactor: Moved all Shape support classes from ShapeEngine/Core/Shapes to ShapeEngine/Geometry. Refactor: Moved all Shapes to new namespace in ShapeEngine/Geometry/* (Rect was moved to Geometry/Rect, Circle was moved to Geometry/Circle, and so on) Refactor: Some small cleanup regarding namespaces in other files.
…d Intersection functions moved to static classes.
…oint, and Intersection functions moved to static classes." This reverts commit 3dbddc7.
…parate partial structs.
… Math region moved to partial struct files.
…peEngine/Geometry. Shape-specific drawing classes like ShapeLineDrawing, ShapeRectDrawing, etc. were moved into the respective shape namespaces. Refactor: Most ShapeDrawing classes were renamed by removing the "Shape" at the start. ShapeRectDrawing was renamed to RectDrawing, for instance.
…t, Math, and Transform functions to partial struct files in Geometry.Triangle namespace.
… Math, and Transform functions to partial struct files in Geometry.Circle namespace.
…ath, and Transform functions to partial struct files in Geometry.Quad namespace.
…I, Margins, Split, Collision, Math, and Transform functions to partial struct files in Geometry.Rect namespace.
…t, Math, and Transform functions to partial struct files in Geometry.Segments namespace. (from Geometry.Segment namespace)
… partial struct files in Geometry.Points namespace.
…, Math, Static, Clipping, ConvexHull, and Transform functions to partial struct files in Geometry.Polygon namespace.
…t, Math, and Transform functions to partial struct files in Geometry.Polyline namespace.
…hapeEngine/Geometry/Rect is now ShapeEngine/Geometry/RectDef, for instance.
Refactor: All occurrences of 1e-10 replaced with ShapeMath.EpsilonF.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR reorganizes shape and collision code into a new ShapeEngine.Geometry namespace, splits large shape classes into partial files, and refactors drawing and collision system locations for better modularity.
- Introduce
ShapeEngine.Geometryroot and dedicated sub-namespaces per shape type - Split monolithic shape classes (e.g.,
Line) into multiple partial files (intersection, drawing, closest-point, collider, etc.) - Move drawing and collision logic into the new namespace structure and update imports
Reviewed Changes
Copilot reviewed 132 out of 277 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ShapeEngine/Geometry/IShape.cs | Updated imports and moved IShape interface to ShapeEngine.Geometry |
| ShapeEngine/Geometry/LineDef/LineIntersection.cs | Added static IntersectLine… helper methods for line intersections |
| ShapeEngine/Geometry/LineDef/LineIntersectShape.cs | Added partial IntersectShape overloads to dispatch by shape type |
| ShapeEngine/Geometry/LineDef/LineDrawing.cs | Refactored line drawing to use SegmentDrawing in Geometry namespace |
| ShapeEngine/Geometry/LineDef/LineCollider.cs | Relocated line collider to Geometry.LineDef |
| ShapeEngine/Geometry/LineDef/LineClosestPointStatic.cs | Added static closest-point methods for lines |
| ShapeEngine/Geometry/LineDef/LineClosestPoint.cs | Added instance closest-point methods for lines |
| ShapeEngine/Geometry/LineDef/Line.cs | Original Line struct split into partial definitions |
| ShapeEngine/Geometry/LineCapType.cs | Moved LineCapType enum to ShapeEngine.Geometry |
| ShapeEngine/Geometry/GappedDrawing.cs | Refactored gapped-outline drawing into Geometry namespace |
| ShapeEngine/Geometry/CustomDrawing.cs | Renamed and refactored custom drawing utilities |
| ShapeEngine/Geometry/CollisionSystem/SpatialHash.cs | Relocated spatial hash to Geometry.CollisionSystem |
| ShapeEngine/Geometry/CollisionSystem/* | Updated all collision system types to Geometry.CollisionSystem |
| ShapeEngine/Geometry/CircleDef/* | Moved circle definitions, intersection, overlap, drawing, and math helpers into Geometry.CircleDef |
| ShapeEngine/Geometry/FractureInfo.cs, FractureHelper.cs | Moved fracture types to ShapeEngine.Geometry |
Comments suppressed due to low confidence (1)
ShapeEngine/Geometry/IShape.cs:9
- The IShape interface references the
Segmentstype but there is nousing ShapeEngine.Geometry.SegmentsDef;import. Add that using directive to avoid missing reference errors.
using ShapeEngine.Geometry.TriangleDef;
| /// </remarks> | ||
| public int IntersectShape(Segment s, ref CollisionPoints points) | ||
| { | ||
| var cp = IntersectLineSegment(Point, Direction, s.Start, s.End); |
There was a problem hiding this comment.
This overload omits the segment's normal, so the returned CollisionPoint.Normal may be incorrect. Use the overload that includes s.Normal (i.e., IntersectLineSegment(Point, Direction, s.Start, s.End, s.Normal)).
Suggested change
| var cp = IntersectLineSegment(Point, Direction, s.Start, s.End); | |
| var cp = IntersectLineSegment(Point, Direction, s.Start, s.End, s.Normal); |
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.
Summary of Changes
Created
GeometryNamespaceAll shape- and geometry-related files have been moved into a new
Geometrynamespace to improve organization and modularity.Shape Type Namespaces
Each shape type now has its own dedicated namespace within
Geometry. This separation enhances code clarity and maintainability.Split Large Shape Classes
Large shape structs/classes (e.g.,
Rect.cs, formerly 4500+ lines) have been split into multiple partial files. This makes the codebase more manageable and easier to navigate.Refactored Drawing Logic
Drawingnamespace inStaticLibhas been removed. All related files are now located under theGeometrynamespace.Geometrynamespace.Collision System Relocation
The
CollisionSystemnamespace has been moved fromCoretoGeometryfor better cohesion.Collider Classes Update
Collider classes specific to certain shape types have been relocated to their respective shape type namespaces.