Skip to content

Shape Struct/Classes partial system#72

Merged
SoloByte merged 23 commits intomainfrom
shapes-file-restructure
Jun 26, 2025
Merged

Shape Struct/Classes partial system#72
SoloByte merged 23 commits intomainfrom
shapes-file-restructure

Conversation

@SoloByte
Copy link
Collaborator

Summary of Changes

  • Created Geometry Namespace
    All shape- and geometry-related files have been moved into a new Geometry namespace 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

    • The Drawing namespace in StaticLib has been removed. All related files are now located under the Geometry namespace.
    • Drawing classes specific to a shape type have been moved to the corresponding shape type’s namespace.
    • Generic drawing classes remain in the root of the Geometry namespace.
  • Collision System Relocation
    The CollisionSystem namespace has been moved from Core to Geometry for better cohesion.

  • Collider Classes Update
    Collider classes specific to certain shape types have been relocated to their respective shape type namespaces.

SoloByte added 20 commits June 25, 2025 08:06
…, 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.
- LineOverlap.cs static functions moved to LineOverlapStatic.cs
- LineClosestPoint.cs static functions moved to LineClosestPointStatic.cs
- RayOverlap.cs static functions moved to RayOverlapStatic.cs
- RayClosestPoint.cs static functions moved to RayOverlapStatic.cs
…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.
- CollisionSystem namespace moved from Core to Geometry.
- All *Collider types for shapes moved to the respective shape namespace in Geometry namespace. (RectCollider was moved from CollisionSystem to Rect namespace, for instance)
…, 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.
@SoloByte SoloByte self-assigned this Jun 25, 2025
@SoloByte SoloByte requested a review from Copilot June 26, 2025 05:02

This comment was marked as outdated.

…hapeEngine/Geometry/Rect is now ShapeEngine/Geometry/RectDef, for instance.
@SoloByte SoloByte requested a review from Copilot June 26, 2025 06:13

This comment was marked as outdated.

@SoloByte SoloByte requested a review from Copilot June 26, 2025 06:47

This comment was marked as outdated.

Refactor: All occurrences of 1e-10 replaced with ShapeMath.EpsilonF.
@SoloByte SoloByte requested a review from Copilot June 26, 2025 06:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Geometry root 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 Segments type but there is no using 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);
Copy link

Copilot AI Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copilot uses AI. Check for mistakes.
@SoloByte SoloByte merged commit a8c2bc7 into main Jun 26, 2025
7 checks passed
@SoloByte SoloByte deleted the shapes-file-restructure branch June 26, 2025 07:05
@SoloByte SoloByte added this to the 5.0 milestone Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants