Foundation Classes, gp - Mark geometry APIs noexcept/constexpr#798
Merged
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom Nov 3, 2025
Merged
Conversation
Member
dpasukhi
commented
Nov 2, 2025
- Add noexcept to many small mutating and non-throwing methods (Mirror, Mirrored, SetMirror, SetTranslationPart, etc.) across gp classes.
- Annotate trivial getters, translators and small computations as constexpr where applicable (SetLocation/SetPosition, Area/Length/Radius/Volume, Axis/Location/Position accessors, Translate helpers).
- Update headers and source files to improve noexcept/constexpr conformance for gp geometry and math types, enabling better optimization and stronger exception-safety guarantees.
- Add noexcept to many small mutating and non-throwing methods (Mirror, Mirrored, SetMirror, SetTranslationPart, etc.) across gp classes. - Annotate trivial getters, translators and small computations as constexpr where applicable (SetLocation/SetPosition, Area/Length/Radius/Volume, Axis/Location/Position accessors, Translate helpers). - Update headers and source files to improve noexcept/constexpr conformance for gp geometry and math types, enabling better optimization and stronger exception-safety guarantees.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances exception-safety and compile-time optimization capabilities of the gp (geometry package) foundation classes by systematically adding noexcept and constexpr specifiers to appropriate methods.
Key Changes:
- Added
noexceptto non-throwing transformation methods (Mirror/Mirrored) across geometry classes - Added
constexprto trivial setters, getters, and computational methods where applicable - Marked simple translation and position-setting operations as
constexprfor compile-time evaluation
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gp_Vec.hxx/cxx | Added noexcept to Mirror/Mirrored methods |
| gp_Trsf.hxx/cxx | Added noexcept to SetMirror/SetTranslationPart, constexpr to SetTranslation |
| gp_Torus.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Translate methods |
| gp_Sphere.hxx/cxx | Added constexpr to setters/getters/Area/Volume, noexcept to Mirror/Translate |
| gp_Pnt.hxx/cxx | Added noexcept to all Mirror/Mirrored methods |
| gp_Pln.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Distance methods |
| gp_Parab.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Translate methods |
| gp_Mat.hxx/cxx | Added noexcept to SetDot method |
| gp_Lin.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Distance methods |
| gp_Hypr.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Translate methods |
| gp_Elips.hxx/cxx | Added constexpr to setters/getters/Area, noexcept to Mirror/Translate |
| gp_Dir.hxx/cxx | Added noexcept to all Mirror/Mirrored methods |
| gp_Cylinder.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Translate methods |
| gp_Cone.hxx/cxx | Added constexpr to setters/getters, noexcept to Mirror/Translate methods |
| gp_Circ.hxx/cxx | Added constexpr to setters/getters/Area/Length, noexcept to Mirror/Translate |
| gp_Ax3.hxx/cxx | Added noexcept to all Mirror/Mirrored methods |
| gp_Ax2.hxx/cxx | Added noexcept to Mirror/Mirrored methods |
| gp_Ax1.hxx/cxx | Added noexcept to all Mirror/Mirrored methods |
…lax Direct() Mark UReverse and VReverse as constexpr noexcept in gp_Cone, gp_Cylinder, gp_Pln, gp_Sphere and gp_Torus to allow compile-time evaluation and better optimization. Remove constexpr/noexcept from Direct() wrappers so their signature matches the underlying gp_Ax3::Direct() implementation.
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.