1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Coding - Geom package Copy optimisation (#645)

- Adds copy constructors for 9 geometry classes (Bezier/BSpline curves and surfaces, offset curves and surfaces in both 2D and 3D)
- Updates Copy() methods to use the new copy constructors instead of recreating objects through standard constructors
- Includes comprehensive test coverage for all new copy constructors
This commit is contained in:
Pasukhin Dmitry
2025-07-26 17:38:46 +01:00
committed by GitHub
parent 1434cd7da3
commit 0eb86fb05a
29 changed files with 1407 additions and 70 deletions

View File

@@ -119,6 +119,25 @@ Geom2d_BezierCurve::Geom2d_BezierCurve(const TColgp_Array1OfPnt2d& Poles,
//=================================================================================================
Geom2d_BezierCurve::Geom2d_BezierCurve(const Geom2d_BezierCurve& theOther)
: rational(theOther.rational),
closed(theOther.closed),
maxderivinv(theOther.maxderivinv),
maxderivinvok(Standard_False)
{
// Deep copy all data arrays without validation
poles = new TColgp_HArray1OfPnt2d(theOther.poles->Lower(), theOther.poles->Upper());
poles->ChangeArray1() = theOther.poles->Array1();
if (!theOther.weights.IsNull())
{
weights = new TColStd_HArray1OfReal(theOther.weights->Lower(), theOther.weights->Upper());
weights->ChangeArray1() = theOther.weights->Array1();
}
}
//=================================================================================================
void Geom2d_BezierCurve::Increase(const Standard_Integer Deg)
{
if (Deg == Degree())
@@ -665,13 +684,7 @@ void Geom2d_BezierCurve::Resolution(const Standard_Real ToleranceUV, Standard_Re
Handle(Geom2d_Geometry) Geom2d_BezierCurve::Copy() const
{
Handle(Geom2d_BezierCurve) C;
if (IsRational())
C = new Geom2d_BezierCurve(poles->Array1(), weights->Array1());
else
C = new Geom2d_BezierCurve(poles->Array1());
return C;
return new Geom2d_BezierCurve(*this);
}
//=================================================================================================