Foundation Classes, gp - Mark 2D geometry APIs noexcept/constexpr#796
Merged
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom Nov 2, 2025
Merged
Conversation
Annotate numerous gp 2D classes (gp_Pnt2d, gp_Vec2d, gp_Dir2d, gp_Ax2d, gp_Ax22d, gp_Lin2d, gp_Circ2d, gp_Elips2d, gp_Hypr2d, gp_Parab2d, gp_Trsf2d) with noexcept and add constexpr to trivial/constexpr-friendly accessors and constructors. Update corresponding inline/implementation functions to match. This documents no-throw guarantees and enables more compile-time evaluation.
…2D gp headers and remove unused variable Reflow long parameter lists and expand single-line inline function bodies (IsDirect, Rotate, Translate, etc.) across gp_Circ2d, gp_Elips2d, gp_Hypr2d, gp_Lin2d and gp_Parab2d headers for consistent style and readability. Remove an unused local gp_Lin2d from GeomInt_IntSS_1.cxx.
… methods Remove noexcept from Rotate/Rotated, Scale/Scaled, Transform/Transformed in gp_Circ2d, gp_Elips2d, gp_Hypr2d and gp_Parab2d to align declarations with definitions and allow proper error propagation from transformation operations.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the 2D geometry classes in the gp package by adding noexcept specifications to document no-throw guarantees and constexpr qualifiers to enable compile-time evaluation of trivial accessors and constructors. The changes systematically apply these modern C++ annotations across multiple 2D geometry types (gp_Pnt2d, gp_Vec2d, gp_Dir2d, gp_Ax2d, gp_Ax22d, gp_Lin2d, gp_Circ2d, gp_Elips2d, gp_Hypr2d, gp_Parab2d, gp_Trsf2d).
Key Changes
- Added
noexceptto transformation and mirroring methods across all 2D geometry classes - Added
constexprto trivial getters, setters, and simple computational methods where applicable - Removed an unused variable declaration in GeomInt_IntSS_1.cxx
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ModelingAlgorithms/TKGeomAlgo/GeomInt/GeomInt_IntSS_1.cxx | Removed unused gp_Lin2d aL variable declaration |
| src/FoundationClasses/TKMath/gp/gp_Vec2d.hxx | Added noexcept to Transform method |
| src/FoundationClasses/TKMath/gp/gp_Vec2d.cxx | Added noexcept to Transform method implementation |
| src/FoundationClasses/TKMath/gp/gp_Trsf2d.hxx | Added noexcept to SetMirror methods |
| src/FoundationClasses/TKMath/gp/gp_Trsf2d.cxx | Added noexcept to SetMirror method implementation |
| src/FoundationClasses/TKMath/gp/gp_Pnt2d.hxx | Added noexcept to Mirror, Mirrored, and Transform methods |
| src/FoundationClasses/TKMath/gp/gp_Pnt2d.cxx | Added noexcept to Mirror, Mirrored, and Transform implementations |
| src/FoundationClasses/TKMath/gp/gp_Parab2d.hxx | Added noexcept/constexpr to constructors, accessors, and transformation methods |
| src/FoundationClasses/TKMath/gp/gp_Parab2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Lin2d.hxx | Added noexcept/constexpr to constructors, accessors, and transformation methods |
| src/FoundationClasses/TKMath/gp/gp_Lin2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Hypr2d.hxx | Added noexcept/constexpr to constructors, accessors, and transformation methods |
| src/FoundationClasses/TKMath/gp/gp_Hypr2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Elips2d.hxx | Added noexcept/constexpr to constructors, accessors, and transformation methods |
| src/FoundationClasses/TKMath/gp/gp_Elips2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Dir2d.hxx | Added noexcept to Mirror, Mirrored, and Transform methods |
| src/FoundationClasses/TKMath/gp/gp_Dir2d.cxx | Added noexcept to Mirror, Mirrored, and Transform implementations |
| src/FoundationClasses/TKMath/gp/gp_Circ2d.hxx | Added noexcept/constexpr to constructors, accessors, and transformation methods |
| src/FoundationClasses/TKMath/gp/gp_Circ2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Ax2d.hxx | Added noexcept to Mirror and Mirrored methods |
| src/FoundationClasses/TKMath/gp/gp_Ax2d.cxx | Added noexcept to Mirror and Mirrored implementations |
| src/FoundationClasses/TKMath/gp/gp_Ax22d.hxx | Added noexcept to Mirror, Mirrored, and Transform methods |
| src/FoundationClasses/TKMath/gp/gp_Ax22d.cxx | Added noexcept to Mirror and Mirrored implementations |
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.
Annotate numerous gp 2D classes (gp_Pnt2d, gp_Vec2d, gp_Dir2d, gp_Ax2d, gp_Ax22d,
gp_Lin2d, gp_Circ2d, gp_Elips2d, gp_Hypr2d, gp_Parab2d, gp_Trsf2d) with
noexcept and add constexpr to trivial/constexpr-friendly accessors and
constructors. Update corresponding inline/implementation functions to match.
This documents no-throw guarantees and enables more compile-time evaluation.