refactor: break the Python wrapping code in universe/ to different files by shape dimension#704
Conversation
* Create a new file `wrap_shape0d.cpp` to house wrapping code for 0-D geometry entity. * Move the C++ wrapper classes `WrapPoint3d` and `WrapPointPad` from file `wrap_World.cpp` to `wrap_shape0d.cpp`. Claude code prompt: Extract WrapPoint3d and WrapPointPad from wrap_World.cpp to a new file wrap_shape0d.cpp
* Create a new file `wrap_shape1d.cpp` to house wrapping code for 1-D geometry entity. * Move the C++ wrapper classes `WrapSegment3d` and `WrapSegmentPad` from file `wrap_World.cpp` to `wrap_shape1d.cpp`. Claude code command: * Extract `WrapSegment3d` and `WrapSegmentPad` from `wrap_World.cpp` to a new file `wrap_shape1d.cpp`
* Move the C++ wrapper classes `WrapBezier3d` and `WrapCurvePad` from file `wrap_World.cpp` to `wrap_shape1d.cpp`. Claude code command: * Extract `WrapBezier3d` and `WrapCurvePad` from the file `wrap_World.cpp` to `wrap_shape1d.cpp`
* Move the C++ wrapper classes `WrapTriangle3d` and `WrapTrianglePad` from file `wrap_World.cpp` to `wrap_polygon.cpp`. Claude code command: * Extract `WrapTriangle3d` and `WrapTrianglePad` from `wrap_World.cpp` to `wrap_polygon.cpp`
* Create a new file `wrap_shape3d.cpp` to house wrapping code for 3-D geometry entity. * Move the C++ wrapper class `WrapBoundBox3d` from file `wrap_World.cpp` to `wrap_shapd3d.cpp`. Claude code command: * Extract `WrapBoundBox3d` from `wrap_World.cpp` to a new file `wrap_shape3d.cpp`
Add 3 member functions to `WrapPolygonPad`: `wrap_management()`, `wrap_accessor()`, `wrap_search()`. Claude code prompt: * In `wrap_polygon.cpp`, refactor `WrapPolygonPad` like `WrapTrianglePad`
* Move wrappers for the functions `calc_bernstein_polynomial()` and `interpolate_bernstein()` from `wrap_bernstein.cpp` to `wrap_shape0d.cpp`
c95c59d to
c27f9f7
Compare
| WrapBezier3d<double>::commit(mod, "Bezier3dFp64", "Bezier3dFp64"); | ||
| WrapCurvePad<float>::commit(mod, "CurvePadFp32", "CurvePadFp32"); | ||
| WrapCurvePad<double>::commit(mod, "CurvePadFp64", "CurvePadFp64"); | ||
| WrapWorld<float>::commit(mod, "WorldFp32", "WorldFp32"); |
There was a problem hiding this comment.
Leave only WrapWorld in this file wrap_World.cpp.
| namespace python | ||
| { | ||
|
|
||
| template <typename T> |
There was a problem hiding this comment.
WrapPoint3d,WrapPointPadare moved towrap_shape0d.cppWrapSegment3d,WrapSegmentPad,WrapBezier3d,WrapCurvePadare moved towrap_shape1d.cppWrapTriangle3d,WrapTrianglePadare moved towrap_shape2d.cppWrapBoundBox3dis moved towrap_shape3d.cpp
There was a problem hiding this comment.
In this file wrap_shape0d.cpp:
WrapPoint3d,WrapPointPadare moved fromwrap_World.cpp- "
calc_bernstein_polynomial", "interpolate_bernstein" are moved from wrap_berstein.cpp`
There was a problem hiding this comment.
In this file wrap_shape1d.cpp, WrapSegment3d, WrapSegmentPad, WrapBezier3d, WrapCurvePad are moved from wrap_World.cpp
There was a problem hiding this comment.
This file wrap_shape2d.cpp is renamed from wrap_polygon.cpp.
WrapPolygon,WrapPolygonPad,TrapezoidPad,WrapTrapezoidalDecomposerremain.WrapTriangle3d,WrapTrianglePadare moved fromwrap_World.cpp.
There was a problem hiding this comment.
In this file wrap_shape3d.cpp, WrapBoundBox3d is moved from wrap_World.cpp
|
@tigercosmos @c1ydehhx please take a look. I may merge later soon since this simple renaming is clearly what I want. If there are points to be addressed I may use this PR or a future one. |
Note
Moving code across files results in the massive size in diff line count in this PR.
Reorganize the Python wrapping code in
universe/pymod/into 5 files:wrap_shape0d.cpp: Code that are not for shape.WrapPoint3d,WrapPointPad.wrap_shape1d.cpp: One-dimensional geometry entities.WrapSegment3d,WrapSegmentPad.WrapBezier3d,WrapCurvePad.wrap_shape2d.cpp: Two-dimensional geometry entities.WrapTriangle3d,WrapTrianglePad.WrapPolygon,WrapPolygonPad.WrapTrapezoidPad.WrapTrapezoidalDecomposer.wrap_shape3d.cpp: Three-dimensional geometry entities.WrapBoundBox3d.wrap_World.cpp: The containerWorld.WrapWorld.Note
Do not mistaken the spatial dimension of shapes with the dimension of coordinate system (the postfix in
Point3d,Segment3d, etc.)Comments are provided to guide the review.
Tip
The prompts used through clion claude plugin, chronologically, are:
WrapPoint3dandWrapPointPadfromwrap_World.cppto a new filewrap_shape0d.cppWrapSegment3dandWrapSegmentPadfromwrap_World.cppto a new filewrap_shape1d.cppWrapBezier3dandWrapCurvePadfrom the filewrap_World.cpptowrap_shape1d.cppWrapTriangle3dandWrapTrianglePadfromwrap_World.cpptowrap_polygon.cppWrapBoundBox3dfromwrap_World.cppto a new filewrap_shape3d.cppwrap_polygon.cpp, refactorWrapPolygonPadlikeWrapTrianglePad