From 6f6660d0d6b4a39b23c6cff8723e849da5bdf2b3 Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Tue, 10 Mar 2026 16:49:55 +0000 Subject: [PATCH] Modeling Data - Unify LProp packages into template classes in TKGeomBase (#1156) Consolidate duplicated local property computation classes (GeomLProp_CLProps, Geom2dLProp_CLProps2d, LProp3d_CLProps, BRepLProp_CLProps, HLRBRep_CLProps and their SLProps counterparts) into unified C++ template classes GeomLProp_CLPropsBase and GeomLProp_SLProps with policy-based access (DirectAccess/ToolAccess). Move LProp, GeomLProp, and GProp packages from TKG2d/TKG3d to TKGeomBase. Remove Geom2dLProp and LProp3d packages entirely. Merge Geom2dLProp_CurAndInf2d into GeomLProp_CurAndInf2d. Preserve backward-compatible type aliases (using declarations) for all previously existing class names. Shared algorithm logic extracted into LProp_CurveUtils and LProp_SurfaceUtils namespaces. 2D curve analysis helpers (FuncCurExt2d, FuncCurNul2d, NumericCurInf2d) converted to header-only .pxx implementations under GeomLProp. Update all dependent code (LocalAnalysis, BRepFill, ChFi3d, Geom2dHatch, GeomPlate, ProjLib, HLRBRep, DrawTrSurf, etc.) to use new template instantiations. Migrate GTests from TKG2d to TKGeomBase with updated class names. --- .../TKDraw/DrawTrSurf/DrawTrSurf_Curve2d.cxx | 8 +- .../GeomliteTest_CurveCommands.cxx | 11 +- .../TKBO/BOPAlgo/BOPAlgo_WireSplitter_1.cxx | 4 +- .../TKBool/BRepFill/BRepFill_OffsetWire.cxx | 4 +- .../TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx | 10 +- .../Geom2dHatch/Geom2dHatch_Intersector.cxx | 4 +- .../LocalAnalysis_CurveContinuity.hxx | 2 +- .../LocalAnalysis_SurfaceContinuity.hxx | 2 +- .../TKHLR/HLRBRep/FILES.cmake | 2 - .../TKHLR/HLRBRep/HLRBRep_CLProps.cxx | 173 ---------- .../TKHLR/HLRBRep/HLRBRep_CLProps.hxx | 111 +----- .../TKHLR/HLRBRep/HLRBRep_CLPropsATool.hxx | 1 + .../TKHLR/HLRBRep/HLRBRep_SLProps.cxx | 280 ---------------- .../TKHLR/HLRBRep/HLRBRep_SLProps.hxx | 156 +-------- .../BRepClass/BRepClass_Intersector.cxx | 4 +- .../TKTopAlgo/Bisector/Bisector_BisecCC.cxx | 2 +- .../TKTopAlgo/Bisector/Bisector_BisecPC.cxx | 2 +- .../TKTopAlgo/MAT2d/MAT2d_CutCurve.cxx | 4 +- .../TKBRep/BRepLProp/BRepLProp_CLProps.cxx | 173 ---------- .../TKBRep/BRepLProp/BRepLProp_CLProps.hxx | 105 +----- .../TKBRep/BRepLProp/BRepLProp_SLProps.cxx | 281 ---------------- .../TKBRep/BRepLProp/BRepLProp_SLProps.hxx | 155 +-------- src/ModelingData/TKBRep/BRepLProp/FILES.cmake | 2 - src/ModelingData/TKG2d/GTests/FILES.cmake | 4 - .../TKG2d/Geom2dLProp/FILES.cmake | 17 - .../Geom2dLProp/Geom2dLProp_CLProps2d.cxx | 173 ---------- .../Geom2dLProp/Geom2dLProp_CLProps2d.hxx | 129 ------- .../Geom2dLProp/Geom2dLProp_Curve2dTool.cxx | 86 ----- .../Geom2dLProp/Geom2dLProp_Curve2dTool.hxx | 78 ----- .../Geom2dLProp/Geom2dLProp_FuncCurExt.cxx | 128 ------- .../Geom2dLProp/Geom2dLProp_FuncCurExt.hxx | 54 --- .../Geom2dLProp/Geom2dLProp_FuncCurNul.cxx | 85 ----- .../Geom2dLProp/Geom2dLProp_FuncCurNul.hxx | 49 --- .../Geom2dLProp_NumericCurInf2d.cxx | 131 -------- .../Geom2dLProp_NumericCurInf2d.hxx | 63 ---- src/ModelingData/TKG2d/PACKAGES.cmake | 2 - .../TKG3d/Geom/Geom_OffsetSurface.cxx | 13 +- .../TKG3d/GeomLProp/GeomLProp_CLProps.cxx | 173 ---------- .../TKG3d/GeomLProp/GeomLProp_CLProps.hxx | 128 ------- .../TKG3d/GeomLProp/GeomLProp_SLProps.cxx | 281 ---------------- .../TKG3d/GeomLProp/GeomLProp_SLProps.hxx | 174 ---------- src/ModelingData/TKG3d/LProp3d/FILES.cmake | 9 - .../TKG3d/LProp3d/LProp3d_CLProps.cxx | 172 ---------- .../TKG3d/LProp3d/LProp3d_CLProps.hxx | 121 ------- .../TKG3d/LProp3d/LProp3d_SLProps.cxx | 280 ---------------- .../TKG3d/LProp3d/LProp3d_SLProps.hxx | 158 --------- src/ModelingData/TKG3d/PACKAGES.cmake | 3 - .../{TKG3d => TKGeomBase}/GProp/FILES.cmake | 0 .../{TKG3d => TKGeomBase}/GProp/GProp.cxx | 0 .../{TKG3d => TKGeomBase}/GProp/GProp.hxx | 0 .../GProp/GProp_CelGProps.cxx | 0 .../GProp/GProp_CelGProps.hxx | 0 .../GProp/GProp_GProps.cxx | 0 .../GProp/GProp_GProps.hxx | 0 .../GProp/GProp_PEquation.hxx | 0 .../GProp/GProp_PGProps.hxx | 0 .../GProp/GProp_PrincipalProps.cxx | 0 .../GProp/GProp_PrincipalProps.hxx | 0 .../GProp/GProp_SelGProps.cxx | 0 .../GProp/GProp_SelGProps.hxx | 0 .../GProp/GProp_UndefinedAxis.hxx | 0 .../GProp/GProp_ValueType.hxx | 0 .../GProp/GProp_VelGProps.cxx | 0 .../GProp/GProp_VelGProps.hxx | 0 .../TKGeomBase/GTests/FILES.cmake | 4 + .../GTests/GeomLProp_CLProps2d_Test.cxx} | 84 ++--- .../GTests/GeomLProp_CurAndInf2d_Test.cxx} | 56 ++-- .../GTests/LProp_AnalyticCurInf_Test.cxx | 0 .../GTests/LProp_CurAndInf_Test.cxx | 0 .../GeomLProp/FILES.cmake | 8 +- .../GeomLProp/GeomLProp.cxx | 0 .../GeomLProp/GeomLProp.hxx | 0 .../GeomLProp/GeomLProp_CLProps.hxx | 225 +++++++++++++ .../GeomLProp/GeomLProp_CurAndInf2d.cxx} | 58 ++-- .../GeomLProp/GeomLProp_CurAndInf2d.hxx} | 12 +- .../GeomLProp/GeomLProp_FuncCurExt2d.pxx | 152 +++++++++ .../GeomLProp/GeomLProp_FuncCurNul2d.pxx | 103 ++++++ .../GeomLProp/GeomLProp_NumericCurInf2d.pxx | 135 ++++++++ .../GeomLProp/GeomLProp_SLProps.hxx | 317 ++++++++++++++++++ .../GeomLProp/GeomLProp_SurfaceUtils.hxx} | 106 +----- .../{TKG2d => TKGeomBase}/LProp/FILES.cmake | 5 +- .../LProp/LProp_AnalyticCurInf.cxx | 0 .../LProp/LProp_AnalyticCurInf.hxx | 0 .../LProp/LProp_BadContinuity.hxx | 0 .../LProp/LProp_CIType.hxx | 0 .../TKGeomBase/LProp/LProp_CLProps3d.hxx | 25 ++ .../LProp/LProp_CurAndInf.cxx | 0 .../LProp/LProp_CurAndInf.hxx | 0 .../LProp/LProp_CurveUtils.hxx} | 3 + .../LProp/LProp_NotDefined.hxx | 0 .../TKGeomBase/LProp/LProp_SLProps3d.hxx | 25 ++ .../LProp/LProp_Status.hxx | 0 src/ModelingData/TKGeomBase/PACKAGES.cmake | 3 + .../ProjLib/ProjLib_ProjectOnPlane.cxx | 10 +- 94 files changed, 1177 insertions(+), 4161 deletions(-) delete mode 100644 src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.cxx delete mode 100644 src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.cxx delete mode 100644 src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.cxx delete mode 100644 src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/FILES.cmake delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.hxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.hxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.hxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.hxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.cxx delete mode 100644 src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.hxx delete mode 100644 src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.cxx delete mode 100644 src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.hxx delete mode 100644 src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.cxx delete mode 100644 src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.hxx delete mode 100644 src/ModelingData/TKG3d/LProp3d/FILES.cmake delete mode 100644 src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.cxx delete mode 100644 src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.hxx delete mode 100644 src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.cxx delete mode 100644 src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.hxx rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/FILES.cmake (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_CelGProps.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_CelGProps.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_GProps.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_GProps.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_PEquation.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_PGProps.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_PrincipalProps.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_PrincipalProps.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_SelGProps.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_SelGProps.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_UndefinedAxis.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_ValueType.hxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_VelGProps.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GProp/GProp_VelGProps.hxx (100%) rename src/ModelingData/{TKG2d/GTests/Geom2dLProp_CLProps2d_Test.cxx => TKGeomBase/GTests/GeomLProp_CLProps2d_Test.cxx} (66%) rename src/ModelingData/{TKG2d/GTests/Geom2dLProp_CurAndInf2d_Test.cxx => TKGeomBase/GTests/GeomLProp_CurAndInf2d_Test.cxx} (76%) rename src/ModelingData/{TKG2d => TKGeomBase}/GTests/LProp_AnalyticCurInf_Test.cxx (100%) rename src/ModelingData/{TKG2d => TKGeomBase}/GTests/LProp_CurAndInf_Test.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GeomLProp/FILES.cmake (54%) rename src/ModelingData/{TKG3d => TKGeomBase}/GeomLProp/GeomLProp.cxx (100%) rename src/ModelingData/{TKG3d => TKGeomBase}/GeomLProp/GeomLProp.hxx (100%) create mode 100644 src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CLProps.hxx rename src/ModelingData/{TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx => TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.cxx} (75%) rename src/ModelingData/{TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.hxx => TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.hxx} (91%) create mode 100644 src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurExt2d.pxx create mode 100644 src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurNul2d.pxx create mode 100644 src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_NumericCurInf2d.pxx create mode 100644 src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SLProps.hxx rename src/ModelingData/{TKG2d/LProp/LProp_SurfaceUtils.pxx => TKGeomBase/GeomLProp/GeomLProp_SurfaceUtils.hxx} (82%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/FILES.cmake (81%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_AnalyticCurInf.cxx (100%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_AnalyticCurInf.hxx (100%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_BadContinuity.hxx (100%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_CIType.hxx (100%) create mode 100644 src/ModelingData/TKGeomBase/LProp/LProp_CLProps3d.hxx rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_CurAndInf.cxx (100%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_CurAndInf.hxx (100%) rename src/ModelingData/{TKG2d/LProp/LProp_CurveUtils.pxx => TKGeomBase/LProp/LProp_CurveUtils.hxx} (99%) rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_NotDefined.hxx (100%) create mode 100644 src/ModelingData/TKGeomBase/LProp/LProp_SLProps3d.hxx rename src/ModelingData/{TKG2d => TKGeomBase}/LProp/LProp_Status.hxx (100%) diff --git a/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Curve2d.cxx b/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Curve2d.cxx index 5ca5680e61..9e3729edad 100644 --- a/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Curve2d.cxx +++ b/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Curve2d.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -147,9 +147,9 @@ void DrawTrSurf_Curve2d::DrawOn(Draw_Display& dis) const int intrv, nbintv = C2d.NbIntervals(GeomAbs_CN); NCollection_Array1 TI(1, nbintv + 1); C2d.Intervals(TI, GeomAbs_CN); - double Resolution = 1.0e-9, Curvature; - Geom2dLProp_CLProps2d LProp(curv, 2, Resolution); - gp_Pnt2d P1, P2; + double Resolution = 1.0e-9, Curvature; + GeomLProp_CLProps2d LProp(curv, 2, Resolution); + gp_Pnt2d P1, P2; for (intrv = 1; intrv <= nbintv; intrv++) { diff --git a/src/Draw/TKTopTest/GeomliteTest/GeomliteTest_CurveCommands.cxx b/src/Draw/TKTopTest/GeomliteTest/GeomliteTest_CurveCommands.cxx index ff8f6e021b..97742a5235 100644 --- a/src/Draw/TKTopTest/GeomliteTest/GeomliteTest_CurveCommands.cxx +++ b/src/Draw/TKTopTest/GeomliteTest/GeomliteTest_CurveCommands.cxx @@ -55,8 +55,7 @@ #include #include -#include -#include +#include #include #include @@ -1217,8 +1216,8 @@ static int minmaxcurandinf(Draw_Interpretor& di, int argc, const char** argv) if (C1.IsNull()) return 1; - Draw_Color Couleur; - Geom2dLProp_CurAndInf2d Sommets; + Draw_Color Couleur; + GeomLProp_CurAndInf2d Sommets; Sommets.PerformCurExt(C1); if (Sommets.IsDone() && !Sommets.IsEmpty()) @@ -1242,7 +1241,7 @@ static int minmaxcurandinf(Draw_Interpretor& di, int argc, const char** argv) dout.Flush(); } - Geom2dLProp_CurAndInf2d Sommets2; + GeomLProp_CurAndInf2d Sommets2; Sommets2.PerformInf(C1); if (Sommets2.IsDone() && !Sommets2.IsEmpty()) @@ -1407,7 +1406,7 @@ static int localprop(Draw_Interpretor& di, int argc, const char** argv) } else { - Geom2dLProp_CLProps2d Prop(C2d, 2, Precision::Confusion()); + GeomLProp_CLProps2d Prop(C2d, 2, Precision::Confusion()); Prop.SetParameter(U); occ::handle drp = new Draw_Marker2D(Prop.Value(), Draw_Plus, Draw_vert); dout << drp; diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index 7794b7f436..f583efb74a 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -794,7 +794,7 @@ double Angle2D(const TopoDS_Vertex& aV, aType = aGAC2D.GetType(); if (aType != GeomAbs_Line) { - Geom2dLProp_CLProps2d LProp(aC2D, aTV, 2, Precision::PConfusion()); + GeomLProp_CLProps2d LProp(aC2D, aTV, 2, Precision::PConfusion()); if (LProp.IsTangentDefined()) { double R = LProp.Curvature(); diff --git a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_OffsetWire.cxx b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_OffsetWire.cxx index 01a540338b..c037eb741e 100644 --- a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_OffsetWire.cxx @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -2531,7 +2531,7 @@ static void CheckBadEdges(const TopoDS_Face& Spine, gp_Pnt2d P, Pc; gp_Dir2d N; - Geom2dLProp_CLProps2d aCLProps(G2d, 2, eps); + GeomLProp_CLProps2d aCLProps(G2d, 2, eps); aCLProps.SetParameter(f); if (!aCLProps.IsTangentDefined()) diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx index 47d4e10985..7eccb11661 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx @@ -66,7 +66,7 @@ #include #include #include -#include +#include #include #include #include @@ -504,10 +504,10 @@ static void CalculBatten(const occ::handle& ASurf, bool isplane; bool anglebig = false; isplane = ASurf->GetType() == GeomAbs_Plane; - gp_Dir2d dir1(xdir, ydir); - Geom2dLProp_CLProps2d CL1(curv2d1, picicplus, 1, 1.e-4); - Geom2dLProp_CLProps2d CL2(curv2d2, picplusic, 1, 1.e-4); - gp_Dir2d dir3, dir4; + gp_Dir2d dir1(xdir, ydir); + GeomLProp_CLProps2d CL1(curv2d1, picicplus, 1, 1.e-4); + GeomLProp_CLProps2d CL2(curv2d2, picplusic, 1, 1.e-4); + gp_Dir2d dir3, dir4; CL1.Tangent(dir3); CL2.Tangent(dir4); if (inverseic) diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Intersector.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Intersector.cxx index 34f2c2d7ce..aab53ebbd4 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Intersector.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Intersector.cxx @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -74,7 +74,7 @@ void Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E, double& C) const { // double f,l; - Geom2dLProp_CLProps2d Prop(E.Curve(), U, 2, Precision::PConfusion()); + GeomLProp_CLProps2d Prop(E.Curve(), U, 2, Precision::PConfusion()); if (!Prop.IsTangentDefined()) return; diff --git a/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_CurveContinuity.hxx b/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_CurveContinuity.hxx index 3347321ba6..6b351b758b 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_CurveContinuity.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_CurveContinuity.hxx @@ -24,7 +24,7 @@ #include #include class Geom_Curve; -class GeomLProp_CLProps; +#include //! This class gives tools to check local continuity C0 //! C1 C2 G1 G2 between two points situated on two curves diff --git a/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_SurfaceContinuity.hxx b/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_SurfaceContinuity.hxx index 9580574314..9714dfb652 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_SurfaceContinuity.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/LocalAnalysis/LocalAnalysis_SurfaceContinuity.hxx @@ -25,7 +25,7 @@ #include class Geom_Surface; class Geom2d_Curve; -class GeomLProp_SLProps; +#include //! This class gives tools to check local continuity C0 //! C1 C2 G1 G2 between two points situated on two surfaces diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/FILES.cmake b/src/ModelingAlgorithms/TKHLR/HLRBRep/FILES.cmake index 002829e444..bb2da074cb 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/FILES.cmake +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/FILES.cmake @@ -20,7 +20,6 @@ set(OCCT_HLRBRep_FILES HLRBRep_CInter.hxx HLRBRep_CInter_0.cxx HLRBRep_CLProps.hxx - HLRBRep_CLProps.cxx HLRBRep_CLPropsATool.hxx HLRBRep_CLPropsATool.lxx HLRBRep_Curve.cxx @@ -83,7 +82,6 @@ set(OCCT_HLRBRep_FILES HLRBRep_ShapeToHLR.cxx HLRBRep_ShapeToHLR.hxx HLRBRep_SLProps.hxx - HLRBRep_SLProps.cxx HLRBRep_SLPropsATool.hxx HLRBRep_SLPropsATool.lxx HLRBRep_Surface.cxx diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.cxx deleted file mode 100644 index 8818192ac5..0000000000 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.cxx +++ /dev/null @@ -1,173 +0,0 @@ -// Created on: 1992-10-14 -// Created by: Christophe MARION -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include -#include - -#include - -using Access = LProp_CurveUtils::ToolAccess; - -//================================================================================================= - -HLRBRep_CLProps::HLRBRep_CLProps(const HLRBRep_Curve*& C, - const double U, - const int N, - const double Resolution) - : myCurve(C), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "HLRBRep_CLProps::HLRBRep_CLProps()"); - SetParameter(U); -} - -//================================================================================================= - -HLRBRep_CLProps::HLRBRep_CLProps(const HLRBRep_Curve*& C, const int N, const double Resolution) - : myCurve(C), - myU(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "HLRBRep_CLProps::HLRBRep_CLProps()"); -} - -//================================================================================================= - -HLRBRep_CLProps::HLRBRep_CLProps(const int N, const double Resolution) - : myCurve(nullptr), - myU(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "HLRBRep_CLProps() - invalid input"); -} - -//================================================================================================= - -void HLRBRep_CLProps::SetParameter(const double U) -{ - LProp_CurveUtils::SetParameter(myCurve, - U, - myU, - myDerOrder, - myPnt, - myDerivArr, - myTangentStatus); -} - -//================================================================================================= - -void HLRBRep_CLProps::SetCurve(const HLRBRep_Curve*& C) -{ - myCurve = C; - myCN = 4; -} - -//================================================================================================= - -const gp_Pnt2d& HLRBRep_CLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec2d& HLRBRep_CLProps::D1() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec2d& HLRBRep_CLProps::D2() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec2d& HLRBRep_CLProps::D3() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); -} - -//================================================================================================= - -bool HLRBRep_CLProps::IsTangentDefined() -{ - return LProp_CurveUtils::IsTangentDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrder, - myTangentStatus); -} - -//================================================================================================= - -void HLRBRep_CLProps::Tangent(gp_Dir2d& D) -{ - LProp_CurveUtils::Tangent(*this, - myCurve, - myU, - myDerivArr, - myPnt, - mySignificantFirstDerivativeOrder, - D); -} - -//================================================================================================= - -double HLRBRep_CLProps::Curvature() -{ - return LProp_CurveUtils::Curvature(*this, - myDerivArr[0], - myDerivArr[1], - myLinTol, - mySignificantFirstDerivativeOrder, - myCurvature); -} - -//================================================================================================= - -void HLRBRep_CLProps::Normal(gp_Dir2d& N) -{ - LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); -} - -//================================================================================================= - -void HLRBRep_CLProps::CentreOfCurvature(gp_Pnt2d& P) -{ - LProp_CurveUtils::CentreOfCurvature(*this, - myPnt, - myDerivArr[0], - myDerivArr[1], - myLinTol, - myCurvature, - P); -} diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.hxx index c5feda65f9..aa7e9e4f66 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLProps.hxx @@ -17,108 +17,15 @@ #ifndef _HLRBRep_CLProps_HeaderFile #define _HLRBRep_CLProps_HeaderFile -#include -#include +#include +#include +#include -#include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class gp_Vec2d; -class gp_Pnt2d; -class gp_Dir2d; -class HLRBRep_CLPropsATool; -class HLRBRep_Curve; - -class HLRBRep_CLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, const int N, const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, - const double U, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT HLRBRep_CLProps(const int N, const double Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const double U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const HLRBRep_Curve*& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt2d& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT bool IsTangentDefined(); - - //! output the tangent direction - Standard_EXPORT void Tangent(gp_Dir2d& D); - - //! Returns the curvature. - Standard_EXPORT double Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir2d& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt2d& P); - -private: - const HLRBRep_Curve* myCurve; - double myU; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt2d myPnt; - gp_Vec2d myDerivArr[3]; - gp_Dir2d myTangent; - double myCurvature = 0.0; - LProp_Status myTangentStatus; - int mySignificantFirstDerivativeOrder = 0; -}; +//! Alias for 2D curve local properties using HLRBRep_Curve with ToolAccess. +using HLRBRep_CLProps = GeomLProp_CLPropsBase>; #endif // _HLRBRep_CLProps_HeaderFile diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLPropsATool.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLPropsATool.hxx index 4f9099d8a6..d539fccac2 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLPropsATool.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CLPropsATool.hxx @@ -22,6 +22,7 @@ #include #include +class HLRBRep_Curve; class gp_Pnt2d; class gp_Vec2d; diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.cxx deleted file mode 100644 index 24cc478216..0000000000 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.cxx +++ /dev/null @@ -1,280 +0,0 @@ -// Created on: 1992-10-14 -// Created by: Christophe MARION -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_SurfaceUtils::ToolAccess; - -//================================================================================================= - -HLRBRep_SLProps::HLRBRep_SLProps(const HLRBRep_SurfacePtr& S, - const double U, - const double V, - const int N, - const double Resolution) - : mySurf(S), - myDerOrder(N), - myCN(4), - myLinTol(Resolution) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "HLRBRep_SLProps::HLRBRep_SLProps()"); - SetParameters(U, V); -} - -//================================================================================================= - -HLRBRep_SLProps::HLRBRep_SLProps(const HLRBRep_SurfacePtr& S, const int N, const double Resolution) - : mySurf(S), - myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "HLRBRep_SLProps::HLRBRep_SLProps()"); -} - -//================================================================================================= - -HLRBRep_SLProps::HLRBRep_SLProps(const int N, const double Resolution) - : mySurf(nullptr), - myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "HLRBRep_SLProps::HLRBRep_SLProps() bad level"); -} - -//================================================================================================= - -void HLRBRep_SLProps::SetSurface(const HLRBRep_SurfacePtr& S) -{ - mySurf = S; - myCN = 4; -} - -//================================================================================================= - -void HLRBRep_SLProps::SetParameters(const double U, const double V) -{ - LProp_SurfaceUtils::SetParameters(mySurf, - U, - V, - myU, - myV, - myDerOrder, - myPnt, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myUTangentStatus, - myVTangentStatus, - myNormalStatus, - myCurvatureStatus); -} - -//================================================================================================= - -const gp_Pnt& HLRBRep_SLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& HLRBRep_SLProps::D1U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1u); -} - -//================================================================================================= - -const gp_Vec& HLRBRep_SLProps::D1V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1v); -} - -//================================================================================================= - -const gp_Vec& HLRBRep_SLProps::D2U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2u); -} - -//================================================================================================= - -const gp_Vec& HLRBRep_SLProps::D2V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2v); -} - -//================================================================================================= - -const gp_Vec& HLRBRep_SLProps::DUV() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myDuv); -} - -//================================================================================================= - -bool HLRBRep_SLProps::IsTangentUDefined() -{ - return LProp_SurfaceUtils::IsTangentUDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderU, - myUTangentStatus); -} - -//================================================================================================= - -void HLRBRep_SLProps::TangentU(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentU(*this, - mySurf, - myU, - myV, - myD1u, - myD2u, - mySignificantFirstDerivativeOrderU, - D); -} - -//================================================================================================= - -bool HLRBRep_SLProps::IsTangentVDefined() -{ - return LProp_SurfaceUtils::IsTangentVDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderV, - myVTangentStatus); -} - -//================================================================================================= - -void HLRBRep_SLProps::TangentV(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentV(*this, - mySurf, - myU, - myV, - myD1v, - myD2v, - mySignificantFirstDerivativeOrderV, - D); -} - -//================================================================================================= - -bool HLRBRep_SLProps::IsNormalDefined() -{ - return LProp_SurfaceUtils::IsNormalDefined(myD1u, myD1v, myLinTol, myNormal, myNormalStatus); -} - -//================================================================================================= - -const gp_Dir& HLRBRep_SLProps::Normal() -{ - return LProp_SurfaceUtils::Normal(*this, myNormal); -} - -//================================================================================================= - -bool HLRBRep_SLProps::IsCurvatureDefined() -{ - return LProp_SurfaceUtils::IsCurvatureDefined(*this, - myCN, - myDerOrder, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myNormal, - myMinCurv, - myMaxCurv, - myDirMinCurv, - myDirMaxCurv, - myMeanCurv, - myGausCurv, - myCurvatureStatus); -} - -//================================================================================================= - -bool HLRBRep_SLProps::IsUmbilic() -{ - return LProp_SurfaceUtils::IsUmbilic(*this, myMaxCurv, myMinCurv); -} - -//================================================================================================= - -double HLRBRep_SLProps::MaxCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMaxCurv); -} - -//================================================================================================= - -double HLRBRep_SLProps::MinCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMinCurv); -} - -//================================================================================================= - -void HLRBRep_SLProps::CurvatureDirections(gp_Dir& Max, gp_Dir& Min) -{ - LProp_SurfaceUtils::CurvatureDirections(*this, myDirMaxCurv, myDirMinCurv, Max, Min); -} - -//================================================================================================= - -double HLRBRep_SLProps::MeanCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMeanCurv); -} - -//================================================================================================= - -double HLRBRep_SLProps::GaussianCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myGausCurv); -} diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.hxx index 3c6999493a..fd5fcc2b57 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLProps.hxx @@ -17,158 +17,12 @@ #ifndef _HLRBRep_SLProps_HeaderFile #define _HLRBRep_SLProps_HeaderFile -#include -#include - +#include +#include #include -#include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class HLRBRep_SLPropsATool; -class gp_Pnt; -class gp_Vec; -class gp_Dir; -class HLRBRep_SLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the surface - //! for the parameter values (, ). - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, or 2). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT HLRBRep_SLProps(const HLRBRep_SurfacePtr& S, - const double U, - const double V, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and . - Standard_EXPORT HLRBRep_SLProps(const HLRBRep_SurfacePtr& S, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and and the surface. - //! the surface can have an empty constructor. - Standard_EXPORT HLRBRep_SLProps(const int N, const double Resolution); - - //! Initializes the local properties of the surface S - //! for the new surface. - Standard_EXPORT void SetSurface(const HLRBRep_SurfacePtr& S); - - //! Initializes the local properties of the surface S - //! for the new parameter values (, ). - Standard_EXPORT void SetParameters(const double U, const double V); - - //! Returns the point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first U derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1U(); - - //! Returns the first V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1V(); - - //! Returns the second U derivatives - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2U(); - - //! Returns the second V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2V(); - - //! Returns the second UV cross-derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& DUV(); - - //! returns True if the U tangent is defined. - //! For example, the tangent is not defined if the - //! two first U derivatives are null. - Standard_EXPORT bool IsTangentUDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentU(gp_Dir& D); - - //! returns if the V tangent is defined. - //! For example, the tangent is not defined if the - //! two first V derivatives are null. - Standard_EXPORT bool IsTangentVDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentV(gp_Dir& D); - - //! Tells if the normal is defined. - Standard_EXPORT bool IsNormalDefined(); - - //! Returns the normal direction. - Standard_EXPORT const gp_Dir& Normal(); - - //! returns True if the curvature is defined. - Standard_EXPORT bool IsCurvatureDefined(); - - //! returns True if the point is umbilic (i.e. if the - //! curvature is constant). - Standard_EXPORT bool IsUmbilic(); - - //! Returns the maximum curvature - Standard_EXPORT double MaxCurvature(); - - //! Returns the minimum curvature - Standard_EXPORT double MinCurvature(); - - //! Returns the direction of the maximum and minimum curvature - //! and - Standard_EXPORT void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD); - - //! Returns the mean curvature. - Standard_EXPORT double MeanCurvature(); - - //! Returns the Gaussian curvature - Standard_EXPORT double GaussianCurvature(); - -private: - HLRBRep_SurfacePtr mySurf; - double myU; - double myV; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myD1u; - gp_Vec myD1v; - gp_Vec myD2u; - gp_Vec myD2v; - gp_Vec myDuv; - gp_Dir myNormal; - double myMinCurv = 0.0; - double myMaxCurv = 0.0; - gp_Dir myDirMinCurv; - gp_Dir myDirMaxCurv; - double myMeanCurv = 0.0; - double myGausCurv = 0.0; - int mySignificantFirstDerivativeOrderU = 0; - int mySignificantFirstDerivativeOrderV = 0; - LProp_Status myUTangentStatus; - LProp_Status myVTangentStatus; - LProp_Status myNormalStatus; - LProp_Status myCurvatureStatus; -}; +//! Alias for surface local properties using HLRBRep_SurfacePtr with ToolAccess. +using HLRBRep_SLProps = + GeomLProp_SLPropsBase>; #endif // _HLRBRep_SLProps_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Intersector.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Intersector.cxx index 3a9c0afe78..7bd60928d3 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Intersector.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Intersector.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -450,7 +450,7 @@ void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E, { double fpar, lpar; occ::handle aPCurve = BRep_Tool::CurveOnSurface(E.Edge(), E.Face(), fpar, lpar); - Geom2dLProp_CLProps2d Prop(aPCurve, U, 2, Precision::PConfusion()); + GeomLProp_CLProps2d Prop(aPCurve, U, 2, Precision::PConfusion()); C = 0.; if (Prop.IsTangentDefined()) diff --git a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx index 730e828200..d34f53f635 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecPC.cxx b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecPC.cxx index 6baca6ef3a..7b75e81bb5 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecPC.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecPC.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ModelingAlgorithms/TKTopAlgo/MAT2d/MAT2d_CutCurve.cxx b/src/ModelingAlgorithms/TKTopAlgo/MAT2d/MAT2d_CutCurve.cxx index 2106190798..1ce90fe898 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/MAT2d/MAT2d_CutCurve.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/MAT2d/MAT2d_CutCurve.cxx @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ void MAT2d_CutCurve::Perform(const occ::handle& C) { theCurves.Clear(); - Geom2dLProp_CurAndInf2d Sommets; + GeomLProp_CurAndInf2d Sommets; occ::handle TrimC; double UF, UL, UC; gp_Pnt2d PF, PL, PC; diff --git a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.cxx b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.cxx deleted file mode 100644 index 717a4fcd60..0000000000 --- a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.cxx +++ /dev/null @@ -1,173 +0,0 @@ -// Created on: 1994-02-24 -// Created by: Laurent BOURESCHE -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_CurveUtils::DirectAccess; - -//================================================================================================= - -BRepLProp_CLProps::BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const double U, - const int N, - const double Resolution) - : myCurve(C), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "BRepLProp_CLProps::BRepLProp_CLProps()"); - SetParameter(U); -} - -//================================================================================================= - -BRepLProp_CLProps::BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const int N, - const double Resolution) - : myCurve(C), - myU(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "BRepLProp_CLProps::BRepLProp_CLProps()"); -} - -//================================================================================================= - -BRepLProp_CLProps::BRepLProp_CLProps(const int N, const double Resolution) - : myU(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "BRepLProp_CLProps() - invalid input"); -} - -//================================================================================================= - -void BRepLProp_CLProps::SetParameter(const double U) -{ - LProp_CurveUtils::SetParameter(myCurve, - U, - myU, - myDerOrder, - myPnt, - myDerivArr, - myTangentStatus); -} - -//================================================================================================= - -void BRepLProp_CLProps::SetCurve(const BRepAdaptor_Curve& C) -{ - myCurve = C; - myCN = 4; -} - -//================================================================================================= - -const gp_Pnt& BRepLProp_CLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& BRepLProp_CLProps::D1() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_CLProps::D2() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_CLProps::D3() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); -} - -//================================================================================================= - -bool BRepLProp_CLProps::IsTangentDefined() -{ - return LProp_CurveUtils::IsTangentDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrder, - myTangentStatus); -} - -//================================================================================================= - -void BRepLProp_CLProps::Tangent(gp_Dir& D) -{ - LProp_CurveUtils::Tangent(*this, - myCurve, - myU, - myDerivArr, - myPnt, - mySignificantFirstDerivativeOrder, - D); -} - -//================================================================================================= - -double BRepLProp_CLProps::Curvature() -{ - return LProp_CurveUtils::Curvature(*this, - myDerivArr[0], - myDerivArr[1], - myLinTol, - mySignificantFirstDerivativeOrder, - myCurvature); -} - -//================================================================================================= - -void BRepLProp_CLProps::Normal(gp_Dir& N) -{ - LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); -} - -//================================================================================================= - -void BRepLProp_CLProps::CentreOfCurvature(gp_Pnt& P) -{ - LProp_CurveUtils::CentreOfCurvature(*this, - myPnt, - myDerivArr[0], - myDerivArr[1], - myLinTol, - myCurvature, - P); -} diff --git a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.hxx b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.hxx index ffd4ed9dce..67b4648519 100644 --- a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.hxx +++ b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_CLProps.hxx @@ -17,109 +17,10 @@ #ifndef _BRepLProp_CLProps_HeaderFile #define _BRepLProp_CLProps_HeaderFile -#include -#include - #include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class BRepAdaptor_Curve; -class gp_Vec; -class gp_Pnt; -class gp_Dir; +#include -class BRepLProp_CLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const double U, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT BRepLProp_CLProps(const int N, const double Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const double U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const BRepAdaptor_Curve& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT bool IsTangentDefined(); - - //! output the tangent direction - Standard_EXPORT void Tangent(gp_Dir& D); - - //! Returns the curvature. - Standard_EXPORT double Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt& P); - -private: - BRepAdaptor_Curve myCurve; - double myU; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myDerivArr[3]; - gp_Dir myTangent; - double myCurvature = 0.0; - LProp_Status myTangentStatus; - int mySignificantFirstDerivativeOrder = 0; -}; +//! Alias for curve local properties using BRepAdaptor_Curve. +using BRepLProp_CLProps = GeomLProp_CLPropsBase; #endif // _BRepLProp_CLProps_HeaderFile diff --git a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.cxx b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.cxx deleted file mode 100644 index 46761564e0..0000000000 --- a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.cxx +++ /dev/null @@ -1,281 +0,0 @@ -// Created on: 1994-02-24 -// Created by: Laurent BOURESCHE -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_SurfaceUtils::DirectAccess; - -//================================================================================================= - -BRepLProp_SLProps::BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const double U, - const double V, - const int N, - const double Resolution) - : mySurf(S), - myDerOrder(N), - myCN(4), - myLinTol(Resolution) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "BRepLProp_SLProps::BRepLProp_SLProps()"); - SetParameters(U, V); -} - -//================================================================================================= - -BRepLProp_SLProps::BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const int N, - const double Resolution) - : mySurf(S), - myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "BRepLProp_SLProps::BRepLProp_SLProps()"); -} - -//================================================================================================= - -BRepLProp_SLProps::BRepLProp_SLProps(const int N, const double Resolution) - : myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "BRepLProp_SLProps::BRepLProp_SLProps() bad level"); -} - -//================================================================================================= - -void BRepLProp_SLProps::SetSurface(const BRepAdaptor_Surface& S) -{ - mySurf = S; - myCN = 4; -} - -//================================================================================================= - -void BRepLProp_SLProps::SetParameters(const double U, const double V) -{ - LProp_SurfaceUtils::SetParameters(mySurf, - U, - V, - myU, - myV, - myDerOrder, - myPnt, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myUTangentStatus, - myVTangentStatus, - myNormalStatus, - myCurvatureStatus); -} - -//================================================================================================= - -const gp_Pnt& BRepLProp_SLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& BRepLProp_SLProps::D1U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1u); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_SLProps::D1V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1v); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_SLProps::D2U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2u); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_SLProps::D2V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2v); -} - -//================================================================================================= - -const gp_Vec& BRepLProp_SLProps::DUV() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myDuv); -} - -//================================================================================================= - -bool BRepLProp_SLProps::IsTangentUDefined() -{ - return LProp_SurfaceUtils::IsTangentUDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderU, - myUTangentStatus); -} - -//================================================================================================= - -void BRepLProp_SLProps::TangentU(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentU(*this, - mySurf, - myU, - myV, - myD1u, - myD2u, - mySignificantFirstDerivativeOrderU, - D); -} - -//================================================================================================= - -bool BRepLProp_SLProps::IsTangentVDefined() -{ - return LProp_SurfaceUtils::IsTangentVDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderV, - myVTangentStatus); -} - -//================================================================================================= - -void BRepLProp_SLProps::TangentV(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentV(*this, - mySurf, - myU, - myV, - myD1v, - myD2v, - mySignificantFirstDerivativeOrderV, - D); -} - -//================================================================================================= - -bool BRepLProp_SLProps::IsNormalDefined() -{ - return LProp_SurfaceUtils::IsNormalDefined(myD1u, myD1v, myLinTol, myNormal, myNormalStatus); -} - -//================================================================================================= - -const gp_Dir& BRepLProp_SLProps::Normal() -{ - return LProp_SurfaceUtils::Normal(*this, myNormal); -} - -//================================================================================================= - -bool BRepLProp_SLProps::IsCurvatureDefined() -{ - return LProp_SurfaceUtils::IsCurvatureDefined(*this, - myCN, - myDerOrder, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myNormal, - myMinCurv, - myMaxCurv, - myDirMinCurv, - myDirMaxCurv, - myMeanCurv, - myGausCurv, - myCurvatureStatus); -} - -//================================================================================================= - -bool BRepLProp_SLProps::IsUmbilic() -{ - return LProp_SurfaceUtils::IsUmbilic(*this, myMaxCurv, myMinCurv); -} - -//================================================================================================= - -double BRepLProp_SLProps::MaxCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMaxCurv); -} - -//================================================================================================= - -double BRepLProp_SLProps::MinCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMinCurv); -} - -//================================================================================================= - -void BRepLProp_SLProps::CurvatureDirections(gp_Dir& Max, gp_Dir& Min) -{ - LProp_SurfaceUtils::CurvatureDirections(*this, myDirMaxCurv, myDirMinCurv, Max, Min); -} - -//================================================================================================= - -double BRepLProp_SLProps::MeanCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMeanCurv); -} - -//================================================================================================= - -double BRepLProp_SLProps::GaussianCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myGausCurv); -} diff --git a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.hxx b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.hxx index 28b12c6cce..a3de40a10a 100644 --- a/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.hxx +++ b/src/ModelingData/TKBRep/BRepLProp/BRepLProp_SLProps.hxx @@ -17,159 +17,10 @@ #ifndef _BRepLProp_SLProps_HeaderFile #define _BRepLProp_SLProps_HeaderFile -#include -#include - #include -#include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class BRepAdaptor_Surface; -class BRepLProp_SurfaceTool; -class gp_Pnt; -class gp_Vec; -class gp_Dir; +#include -class BRepLProp_SLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the surface - //! for the parameter values (, ). - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, or 2). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const double U, - const double V, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and . - Standard_EXPORT BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and and the surface. - //! the surface can have an empty constructor. - Standard_EXPORT BRepLProp_SLProps(const int N, const double Resolution); - - //! Initializes the local properties of the surface S - //! for the new surface. - Standard_EXPORT void SetSurface(const BRepAdaptor_Surface& S); - - //! Initializes the local properties of the surface S - //! for the new parameter values (, ). - Standard_EXPORT void SetParameters(const double U, const double V); - - //! Returns the point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first U derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1U(); - - //! Returns the first V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1V(); - - //! Returns the second U derivatives - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2U(); - - //! Returns the second V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2V(); - - //! Returns the second UV cross-derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& DUV(); - - //! returns True if the U tangent is defined. - //! For example, the tangent is not defined if the - //! two first U derivatives are null. - Standard_EXPORT bool IsTangentUDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentU(gp_Dir& D); - - //! returns if the V tangent is defined. - //! For example, the tangent is not defined if the - //! two first V derivatives are null. - Standard_EXPORT bool IsTangentVDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentV(gp_Dir& D); - - //! Tells if the normal is defined. - Standard_EXPORT bool IsNormalDefined(); - - //! Returns the normal direction. - Standard_EXPORT const gp_Dir& Normal(); - - //! returns True if the curvature is defined. - Standard_EXPORT bool IsCurvatureDefined(); - - //! returns True if the point is umbilic (i.e. if the - //! curvature is constant). - Standard_EXPORT bool IsUmbilic(); - - //! Returns the maximum curvature - Standard_EXPORT double MaxCurvature(); - - //! Returns the minimum curvature - Standard_EXPORT double MinCurvature(); - - //! Returns the direction of the maximum and minimum curvature - //! and - Standard_EXPORT void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD); - - //! Returns the mean curvature. - Standard_EXPORT double MeanCurvature(); - - //! Returns the Gaussian curvature - Standard_EXPORT double GaussianCurvature(); - -private: - BRepAdaptor_Surface mySurf; - double myU; - double myV; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myD1u; - gp_Vec myD1v; - gp_Vec myD2u; - gp_Vec myD2v; - gp_Vec myDuv; - gp_Dir myNormal; - double myMinCurv = 0.0; - double myMaxCurv = 0.0; - gp_Dir myDirMinCurv; - gp_Dir myDirMaxCurv; - double myMeanCurv = 0.0; - double myGausCurv = 0.0; - int mySignificantFirstDerivativeOrderU = 0; - int mySignificantFirstDerivativeOrderV = 0; - LProp_Status myUTangentStatus; - LProp_Status myVTangentStatus; - LProp_Status myNormalStatus; - LProp_Status myCurvatureStatus; -}; +//! Alias for surface local properties using BRepAdaptor_Surface. +using BRepLProp_SLProps = GeomLProp_SLPropsBase; #endif // _BRepLProp_SLProps_HeaderFile diff --git a/src/ModelingData/TKBRep/BRepLProp/FILES.cmake b/src/ModelingData/TKBRep/BRepLProp/FILES.cmake index d5b4fbdc21..d18c4ef5d8 100644 --- a/src/ModelingData/TKBRep/BRepLProp/FILES.cmake +++ b/src/ModelingData/TKBRep/BRepLProp/FILES.cmake @@ -5,9 +5,7 @@ set(OCCT_BRepLProp_FILES BRepLProp.cxx BRepLProp.hxx BRepLProp_CLProps.hxx - BRepLProp_CLProps.cxx BRepLProp_SLProps.hxx - BRepLProp_SLProps.cxx BRepLProp_SurfaceTool.cxx BRepLProp_SurfaceTool.hxx ) diff --git a/src/ModelingData/TKG2d/GTests/FILES.cmake b/src/ModelingData/TKG2d/GTests/FILES.cmake index 106aeae91e..31142c84bd 100644 --- a/src/ModelingData/TKG2d/GTests/FILES.cmake +++ b/src/ModelingData/TKG2d/GTests/FILES.cmake @@ -35,8 +35,4 @@ set(OCCT_TKG2d_GTests_FILES Geom2dGridEval_Hyperbola_Test.cxx Geom2dGridEval_Parabola_Test.cxx Geom2dHash_CurveHasher_Test.cxx - Geom2dLProp_CLProps2d_Test.cxx - Geom2dLProp_CurAndInf2d_Test.cxx - LProp_AnalyticCurInf_Test.cxx - LProp_CurAndInf_Test.cxx ) diff --git a/src/ModelingData/TKG2d/Geom2dLProp/FILES.cmake b/src/ModelingData/TKG2d/Geom2dLProp/FILES.cmake deleted file mode 100644 index 3358016c5a..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/FILES.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# Source files for Geom2dLProp package -set(OCCT_Geom2dLProp_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") - -set(OCCT_Geom2dLProp_FILES - Geom2dLProp_CLProps2d.hxx - Geom2dLProp_CLProps2d.cxx - Geom2dLProp_CurAndInf2d.cxx - Geom2dLProp_CurAndInf2d.hxx - Geom2dLProp_Curve2dTool.cxx - Geom2dLProp_Curve2dTool.hxx - Geom2dLProp_FuncCurExt.cxx - Geom2dLProp_FuncCurExt.hxx - Geom2dLProp_FuncCurNul.cxx - Geom2dLProp_FuncCurNul.hxx - Geom2dLProp_NumericCurInf2d.cxx - Geom2dLProp_NumericCurInf2d.hxx -) diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.cxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.cxx deleted file mode 100644 index ea5d7298f6..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.cxx +++ /dev/null @@ -1,173 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_CurveUtils::DirectAccess; - -//================================================================================================= - -Geom2dLProp_CLProps2d::Geom2dLProp_CLProps2d(const occ::handle& C, - const double U, - const int N, - const double Resolution) - : myCurve(C), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "Geom2dLProp_CLProps2d::Geom2dLProp_CLProps2d()"); - SetParameter(U); -} - -//================================================================================================= - -Geom2dLProp_CLProps2d::Geom2dLProp_CLProps2d(const occ::handle& C, - const int N, - const double Resolution) - : myCurve(C), - myU(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "Geom2dLProp_CLProps2d::Geom2dLProp_CLProps2d()"); -} - -//================================================================================================= - -Geom2dLProp_CLProps2d::Geom2dLProp_CLProps2d(const int N, const double Resolution) - : myU(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "Geom2dLProp_CLProps2d() - invalid input"); -} - -//================================================================================================= - -void Geom2dLProp_CLProps2d::SetParameter(const double U) -{ - LProp_CurveUtils::SetParameter(myCurve, - U, - myU, - myDerOrder, - myPnt, - myDerivArr, - myTangentStatus); -} - -//================================================================================================= - -void Geom2dLProp_CLProps2d::SetCurve(const occ::handle& C) -{ - myCurve = C; - myCN = 4; -} - -//================================================================================================= - -const gp_Pnt2d& Geom2dLProp_CLProps2d::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec2d& Geom2dLProp_CLProps2d::D1() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec2d& Geom2dLProp_CLProps2d::D2() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec2d& Geom2dLProp_CLProps2d::D3() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); -} - -//================================================================================================= - -bool Geom2dLProp_CLProps2d::IsTangentDefined() -{ - return LProp_CurveUtils::IsTangentDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrder, - myTangentStatus); -} - -//================================================================================================= - -void Geom2dLProp_CLProps2d::Tangent(gp_Dir2d& D) -{ - LProp_CurveUtils::Tangent(*this, - myCurve, - myU, - myDerivArr, - myPnt, - mySignificantFirstDerivativeOrder, - D); -} - -//================================================================================================= - -double Geom2dLProp_CLProps2d::Curvature() -{ - return LProp_CurveUtils::Curvature(*this, - myDerivArr[0], - myDerivArr[1], - myLinTol, - mySignificantFirstDerivativeOrder, - myCurvature); -} - -//================================================================================================= - -void Geom2dLProp_CLProps2d::Normal(gp_Dir2d& N) -{ - LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); -} - -//================================================================================================= - -void Geom2dLProp_CLProps2d::CentreOfCurvature(gp_Pnt2d& P) -{ - LProp_CurveUtils::CentreOfCurvature(*this, - myPnt, - myDerivArr[0], - myDerivArr[1], - myLinTol, - myCurvature, - P); -} diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.hxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.hxx deleted file mode 100644 index 02e51f8d0d..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CLProps2d.hxx +++ /dev/null @@ -1,129 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Geom2dLProp_CLProps2d_HeaderFile -#define _Geom2dLProp_CLProps2d_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class Geom2d_Curve; -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class gp_Vec2d; -class gp_Pnt2d; -class gp_Dir2d; -class Geom2dLProp_Curve2dTool; - -class Geom2dLProp_CLProps2d -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT Geom2dLProp_CLProps2d(const occ::handle& C, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT Geom2dLProp_CLProps2d(const occ::handle& C, - const double U, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT Geom2dLProp_CLProps2d(const int N, const double Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const double U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const occ::handle& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt2d& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec2d& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT bool IsTangentDefined(); - - //! output the tangent direction - Standard_EXPORT void Tangent(gp_Dir2d& D); - - //! Returns the curvature. - Standard_EXPORT double Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir2d& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt2d& P); - -private: - occ::handle myCurve; - double myU; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt2d myPnt; - gp_Vec2d myDerivArr[3]; - gp_Dir2d myTangent; - double myCurvature = 0.0; - LProp_Status myTangentStatus; - int mySignificantFirstDerivativeOrder = 0; -}; - -#endif // _Geom2dLProp_CLProps2d_HeaderFile diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx deleted file mode 100644 index fcb4652655..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx +++ /dev/null @@ -1,86 +0,0 @@ -// Created on: 1992-08-18 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include - -void Geom2dLProp_Curve2dTool::Value(const occ::handle& C, const double U, gp_Pnt2d& P) -{ - P = C->Value(U); -} - -void Geom2dLProp_Curve2dTool::D1(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1) -{ - C->D1(U, P, V1); -} - -void Geom2dLProp_Curve2dTool::D2(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2) -{ - C->D2(U, P, V1, V2); -} - -void Geom2dLProp_Curve2dTool::D3(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) -{ - C->D3(U, P, V1, V2, V3); -} - -int Geom2dLProp_Curve2dTool::Continuity(const occ::handle& C) -{ - GeomAbs_Shape s = C->Continuity(); - switch (s) - { - case GeomAbs_C0: - return 0; - case GeomAbs_C1: - return 1; - case GeomAbs_C2: - return 2; - case GeomAbs_C3: - return 3; - case GeomAbs_G1: - return 0; - case GeomAbs_G2: - return 0; - case GeomAbs_CN: - return 3; - }; - return 0; -} - -double Geom2dLProp_Curve2dTool::FirstParameter(const occ::handle& C) -{ - return C->FirstParameter(); -} - -double Geom2dLProp_Curve2dTool::LastParameter(const occ::handle& C) -{ - return C->LastParameter(); -} diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.hxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.hxx deleted file mode 100644 index 5cecf5ec1f..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_Curve2dTool.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Geom2dLProp_Curve2dTool_HeaderFile -#define _Geom2dLProp_Curve2dTool_HeaderFile - -#include -#include -#include - -#include -class Geom2d_Curve; -class gp_Pnt2d; -class gp_Vec2d; - -class Geom2dLProp_Curve2dTool -{ -public: - DEFINE_STANDARD_ALLOC - - //! Computes the point

of parameter on the curve . - Standard_EXPORT static void Value(const occ::handle& C, - const double U, - gp_Pnt2d& P); - - //! Computes the point

and first derivative of - //! parameter on the curve . - Standard_EXPORT static void D1(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1); - - //! Computes the point

, the first derivative and second - //! derivative of parameter on the curve . - Standard_EXPORT static void D2(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2); - - //! Computes the point

, the first derivative , the - //! second derivative and third derivative of - //! parameter on the curve . - Standard_EXPORT static void D3(const occ::handle& C, - const double U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3); - - //! returns the order of continuity of the curve . - //! returns 1 : first derivative only is computable - //! returns 2 : first and second derivative only are computable. - //! returns 3 : first, second and third are computable. - Standard_EXPORT static int Continuity(const occ::handle& C); - - //! returns the first parameter bound of the curve. - Standard_EXPORT static double FirstParameter(const occ::handle& C); - - //! returns the last parameter bound of the curve. - //! FirstParameter must be less than LastParameter. - Standard_EXPORT static double LastParameter(const occ::handle& C); -}; - -#endif // _Geom2dLProp_Curve2dTool_HeaderFile diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.cxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.cxx deleted file mode 100644 index efaf848910..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.cxx +++ /dev/null @@ -1,128 +0,0 @@ -// Created on: 1994-09-06 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include - -//================================================================================================= - -Geom2dLProp_FuncCurExt::Geom2dLProp_FuncCurExt(const occ::handle& C, const double Tol) - : theCurve(C) -{ - epsX = Tol; -} - -//============================================================================= -// function : Value -// purpose : KC = (V1^V2.Z) / ||V1||^3 with V1 tangent and V2 second derivative. -// F = d KC/ dU. -//============================================================================= -bool Geom2dLProp_FuncCurExt::Value(const double X, double& F) -{ - gp_Pnt2d P1; - gp_Vec2d V1, V2, V3; - - Geom2dLProp_Curve2dTool::D3(theCurve, X, P1, V1, V2, V3); - double CPV1V2 = V1.Crossed(V2); - double CPV1V3 = V1.Crossed(V3); - double V1V2 = V1.Dot(V2); - double V1V1 = V1.SquareMagnitude(); - double NV1 = std::sqrt(V1V1); - double V13 = V1V1 * NV1; - double V15 = V13 * V1V1; - - if (V15 < gp::Resolution()) - { - return false; - } - F = CPV1V3 / V13 - 3 * CPV1V2 * V1V2 / V15; - - return true; -} - -//================================================================================================= - -bool Geom2dLProp_FuncCurExt::Derivative(const double X, double& D) -{ - double F; - return Values(X, F, D); -} - -//================================================================================================= - -bool Geom2dLProp_FuncCurExt::Values(const double X, double& F, double& D) -{ - double F2; - double Dx = epsX / 100.; - - if (X + Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) - { - Dx = -Dx; - } - - Value(X, F); - Value(X + Dx, F2); - D = (F2 - F) / Dx; - - return true; -} - -//============================================================================= -// function : IsMinKC -// purpose : Tests if the parameter corresponds to a minimum of the radius of curvature -// by comparison with a nearby point. -//============================================================================= -bool Geom2dLProp_FuncCurExt::IsMinKC(const double X) const -{ - gp_Pnt2d P1; - gp_Vec2d V1, V2, V3; - double Dx = epsX; - double KC, KP; - - Geom2dLProp_Curve2dTool::D3(theCurve, X, P1, V1, V2, V3); - double CPV1V2 = V1.Crossed(V2); - double V1V1 = V1.SquareMagnitude(); - double NV1 = std::sqrt(V1V1); - double V13 = V1V1 * NV1; - - if (V13 < gp::Resolution()) - { - return false; - } - - KC = CPV1V2 / V13; - - if (X + Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) - { - Dx = -Dx; - } - - Geom2dLProp_Curve2dTool::D3(theCurve, X + Dx, P1, V1, V2, V3); - CPV1V2 = V1.Crossed(V2); - V1V1 = V1.SquareMagnitude(); - NV1 = std::sqrt(V1V1); - V13 = V1V1 * NV1; - - if (V13 < gp::Resolution()) - { - return false; - } - KP = CPV1V2 / V13; - - return std::abs(KC) > std::abs(KP); -} diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.hxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.hxx deleted file mode 100644 index 037432b2ba..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurExt.hxx +++ /dev/null @@ -1,54 +0,0 @@ -// Created on: 1994-09-02 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Geom2dLProp_FuncCurExt_HeaderFile -#define _Geom2dLProp_FuncCurExt_HeaderFile - -#include -#include -#include - -#include -class Geom2d_Curve; - -//! Function used to find the extremas of curvature in 2d. -class Geom2dLProp_FuncCurExt : public math_FunctionWithDerivative -{ -public: - DEFINE_STANDARD_ALLOC - - Standard_EXPORT Geom2dLProp_FuncCurExt(const occ::handle& C, const double Tol); - - //! Returns the value for the variable . - Standard_EXPORT bool Value(const double X, double& F) override; - - //! Returns the derivative for the variable . - Standard_EXPORT bool Derivative(const double X, double& D) override; - - //! Returns the value of the function and the derivative - //! for the variable . - Standard_EXPORT bool Values(const double X, double& F, double& D) override; - - //! True if Param corresponds to a minus - //! of the radius of curvature. - Standard_EXPORT bool IsMinKC(const double Param) const; - -private: - occ::handle theCurve; - double epsX; -}; - -#endif // _Geom2dLProp_FuncCurExt_HeaderFile diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.cxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.cxx deleted file mode 100644 index 379c075b8a..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// Created on: 1994-09-05 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include - -//================================================================================================= - -Geom2dLProp_FuncCurNul::Geom2dLProp_FuncCurNul(const occ::handle& C) - : theCurve(C) -{ -} - -//============================================================================= -// function : Value -// purpose : F = (V1^V2.Z)/||V1||*||V2|| -//============================================================================= -bool Geom2dLProp_FuncCurNul::Value(const double X, double& F) -{ - double D; - return Values(X, F, D); -} - -//================================================================================================= - -bool Geom2dLProp_FuncCurNul::Derivative(const double X, double& D) -{ - double F; - return Values(X, F, D); -} - -//============================================================================= -// function : Values -// purpose : F = (V1^V2.Z)/||V1||*||V2|| -//============================================================================= -bool Geom2dLProp_FuncCurNul::Values(const double X, double& F, double& D) -{ - gp_Pnt2d P1; - gp_Vec2d V1, V2, V3; - Geom2dLProp_Curve2dTool::D3(theCurve, X, P1, V1, V2, V3); - double CP1 = V1.Crossed(V2); - double CP2 = V1.Crossed(V3); - double V1V2 = V1.Dot(V2); - double V2V3 = V2.Dot(V3); - double NV1 = V1.Magnitude(); - double NV2 = V2.Magnitude(); - - F = 0.; - D = 0.; - - /* - if (std::abs(CP1) < 1.e-4) { - return true; - } else */ - - if (NV2 < 1.e-4) - { - return true; - } - else if (NV1 * NV2 < gp::Resolution()) - { - return false; - } - else - { - F = CP1 / (NV1 * NV2); - D = (CP2 - CP1 * V1V2 / (NV1 * NV1) - CP1 * V2V3 / (NV2 * NV2)) / (NV1 * NV2); - } - return true; -} diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.hxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.hxx deleted file mode 100644 index 4d5ab33e4b..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_FuncCurNul.hxx +++ /dev/null @@ -1,49 +0,0 @@ -// Created on: 1994-09-02 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Geom2dLProp_FuncCurNul_HeaderFile -#define _Geom2dLProp_FuncCurNul_HeaderFile - -#include -#include -#include - -#include -class Geom2d_Curve; - -//! Function used to find the inflections in 2d. -class Geom2dLProp_FuncCurNul : public math_FunctionWithDerivative -{ -public: - DEFINE_STANDARD_ALLOC - - Standard_EXPORT Geom2dLProp_FuncCurNul(const occ::handle& C); - - //! Returns the value for the variable . - Standard_EXPORT bool Value(const double X, double& F) override; - - //! Returns the derivative for the variable - Standard_EXPORT bool Derivative(const double X, double& D) override; - - //! Returns the value of the function and the derivative - //! for the variable . - Standard_EXPORT bool Values(const double X, double& F, double& D) override; - -private: - occ::handle theCurve; -}; - -#endif // _Geom2dLProp_FuncCurNul_HeaderFile diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.cxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.cxx deleted file mode 100644 index ad22d2f1c7..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.cxx +++ /dev/null @@ -1,131 +0,0 @@ -// Created on: 1994-09-05 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================================= - -Geom2dLProp_NumericCurInf2d::Geom2dLProp_NumericCurInf2d() - : isDone(false) -{ -} - -//================================================================================================= - -void Geom2dLProp_NumericCurInf2d::PerformCurExt(const occ::handle& C, - LProp_CurAndInf& Result) -{ - PerformCurExt(C, - Geom2dLProp_Curve2dTool::FirstParameter(C), - Geom2dLProp_Curve2dTool::LastParameter(C), - Result); -} - -//================================================================================================= - -void Geom2dLProp_NumericCurInf2d::PerformCurExt(const occ::handle& C, - const double UMin, - const double UMax, - LProp_CurAndInf& Result) -{ - isDone = true; - - double EpsH = 1.e-4 * (UMax - UMin); - constexpr double Tol = Precision::PConfusion(); - - // The first search is done with a rather large tolerance - // because the function derivative is estimated rather roughly. - - Geom2dLProp_FuncCurExt F(C, EpsH); - int NbSamples = 100; - bool SolType; - - math_FunctionRoots SolRoot(F, UMin, UMax, NbSamples, EpsH, EpsH, EpsH); - - if (SolRoot.IsDone()) - { - for (int j = 1; j <= SolRoot.NbSolutions(); j++) - { - double Param = SolRoot.Value(j); - // la solution est affinee. - math_BracketedRoot BS(F, Param - EpsH, Param + EpsH, Tol); - if (BS.IsDone()) - { - Param = BS.Root(); - } - SolType = F.IsMinKC(Param); - Result.AddExtCur(Param, SolType); - } - } - else - { - isDone = false; - } -} - -//================================================================================================= - -void Geom2dLProp_NumericCurInf2d::PerformInf(const occ::handle& C, - LProp_CurAndInf& Result) -{ - PerformInf(C, - Geom2dLProp_Curve2dTool::FirstParameter(C), - Geom2dLProp_Curve2dTool::LastParameter(C), - Result); -} - -//================================================================================================= - -void Geom2dLProp_NumericCurInf2d::PerformInf(const occ::handle& C, - const double UMin, - const double UMax, - LProp_CurAndInf& Result) -{ - isDone = true; - Geom2dLProp_FuncCurNul F(C); - double EpsX = 1.e-6; - double EpsF = 1.e-6; - int NbSamples = 30; - - math_FunctionRoots SolRoot(F, UMin, UMax, NbSamples, EpsX, EpsF, EpsX); - - if (SolRoot.IsDone()) - { - for (int j = 1; j <= SolRoot.NbSolutions(); j++) - { - Result.AddInflection(SolRoot.Value(j)); - } - } - else - { - isDone = false; - } -} - -//================================================================================================= - -bool Geom2dLProp_NumericCurInf2d::IsDone() const -{ - return isDone; -} diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.hxx b/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.hxx deleted file mode 100644 index bc5bd0602a..0000000000 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_NumericCurInf2d.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Created on: 1994-09-02 -// Created by: Yves FRICAUD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Geom2dLProp_NumericCurInf2d_HeaderFile -#define _Geom2dLProp_NumericCurInf2d_HeaderFile - -#include -#include -#include - -class Geom2d_Curve; -class LProp_CurAndInf; - -//! Computes the locals extremas of curvature and the -//! inflections of a bounded curve in 2d. -class Geom2dLProp_NumericCurInf2d -{ -public: - DEFINE_STANDARD_ALLOC - - Standard_EXPORT Geom2dLProp_NumericCurInf2d(); - - //! Computes the locals extremas of curvature. - Standard_EXPORT void PerformCurExt(const occ::handle& C, LProp_CurAndInf& Result); - - //! Computes the inflections. - Standard_EXPORT void PerformInf(const occ::handle& C, LProp_CurAndInf& Result); - - //! Computes the locals extremas of curvature. - //! in the interval of parameters [UMin,UMax]. - Standard_EXPORT void PerformCurExt(const occ::handle& C, - const double UMin, - const double UMax, - LProp_CurAndInf& Result); - - //! Computes the inflections in the interval of - //! parameters [UMin,UMax]. - Standard_EXPORT void PerformInf(const occ::handle& C, - const double UMin, - const double UMax, - LProp_CurAndInf& Result); - - //! True if the solutions are found. - Standard_EXPORT bool IsDone() const; - -private: - bool isDone; -}; - -#endif // _Geom2dLProp_NumericCurInf2d_HeaderFile diff --git a/src/ModelingData/TKG2d/PACKAGES.cmake b/src/ModelingData/TKG2d/PACKAGES.cmake index f22570041f..a244181ddc 100644 --- a/src/ModelingData/TKG2d/PACKAGES.cmake +++ b/src/ModelingData/TKG2d/PACKAGES.cmake @@ -1,9 +1,7 @@ # Auto-generated list of packages for TKG2d toolkit set(OCCT_TKG2d_LIST_OF_PACKAGES Geom2d - LProp Adaptor2d - Geom2dLProp Geom2dAdaptor Geom2dHash Geom2dGridEval diff --git a/src/ModelingData/TKG3d/Geom/Geom_OffsetSurface.cxx b/src/ModelingData/TKG3d/Geom/Geom_OffsetSurface.cxx index 663ea89c34..9b2cc99706 100644 --- a/src/ModelingData/TKG3d/Geom/Geom_OffsetSurface.cxx +++ b/src/ModelingData/TKG3d/Geom/Geom_OffsetSurface.cxx @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -604,10 +603,16 @@ occ::handle Geom_OffsetSurface::UIso(const double UU) const if (aGAsurf.GetType() == GeomAbs_SurfaceOfExtrusion) { occ::handle aL = basisSurf->UIso(UU); - GeomLProp_SLProps aSurfProps(basisSurf, UU, 0., 2, Precision::Confusion()); - gp_Vec aDir; - aDir = aSurfProps.Normal(); + gp_Pnt aP; + gp_Vec aD1U, aD1V; + basisSurf->D1(UU, 0., aP, aD1U, aD1V); + gp_Vec aDir = aD1U.Crossed(aD1V); + if (aDir.SquareMagnitude() < gp::Resolution()) + { + return aL; + } + aDir.Normalize(); aDir *= offsetValue; aL->Translate(aDir); diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.cxx b/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.cxx deleted file mode 100644 index fafdabe858..0000000000 --- a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.cxx +++ /dev/null @@ -1,173 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_CurveUtils::DirectAccess; - -//================================================================================================= - -GeomLProp_CLProps::GeomLProp_CLProps(const occ::handle& C, - const double U, - const int N, - const double Resolution) - : myCurve(C), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()"); - SetParameter(U); -} - -//================================================================================================= - -GeomLProp_CLProps::GeomLProp_CLProps(const occ::handle& C, - const int N, - const double Resolution) - : myCurve(C), - myU(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()"); -} - -//================================================================================================= - -GeomLProp_CLProps::GeomLProp_CLProps(const int N, const double Resolution) - : myU(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps() - invalid input"); -} - -//================================================================================================= - -void GeomLProp_CLProps::SetParameter(const double U) -{ - LProp_CurveUtils::SetParameter(myCurve, - U, - myU, - myDerOrder, - myPnt, - myDerivArr, - myTangentStatus); -} - -//================================================================================================= - -void GeomLProp_CLProps::SetCurve(const occ::handle& C) -{ - myCurve = C; - myCN = 4; -} - -//================================================================================================= - -const gp_Pnt& GeomLProp_CLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& GeomLProp_CLProps::D1() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_CLProps::D2() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_CLProps::D3() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); -} - -//================================================================================================= - -bool GeomLProp_CLProps::IsTangentDefined() -{ - return LProp_CurveUtils::IsTangentDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrder, - myTangentStatus); -} - -//================================================================================================= - -void GeomLProp_CLProps::Tangent(gp_Dir& D) -{ - LProp_CurveUtils::Tangent(*this, - myCurve, - myU, - myDerivArr, - myPnt, - mySignificantFirstDerivativeOrder, - D); -} - -//================================================================================================= - -double GeomLProp_CLProps::Curvature() -{ - return LProp_CurveUtils::Curvature(*this, - myDerivArr[0], - myDerivArr[1], - myLinTol, - mySignificantFirstDerivativeOrder, - myCurvature); -} - -//================================================================================================= - -void GeomLProp_CLProps::Normal(gp_Dir& N) -{ - LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); -} - -//================================================================================================= - -void GeomLProp_CLProps::CentreOfCurvature(gp_Pnt& P) -{ - LProp_CurveUtils::CentreOfCurvature(*this, - myPnt, - myDerivArr[0], - myDerivArr[1], - myLinTol, - myCurvature, - P); -} diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.hxx b/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.hxx deleted file mode 100644 index ea51cf790d..0000000000 --- a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_CLProps.hxx +++ /dev/null @@ -1,128 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _GeomLProp_CLProps_HeaderFile -#define _GeomLProp_CLProps_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class Geom_Curve; -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class gp_Vec; -class gp_Pnt; -class gp_Dir; - -class GeomLProp_CLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT GeomLProp_CLProps(const occ::handle& C, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT GeomLProp_CLProps(const occ::handle& C, - const double U, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT GeomLProp_CLProps(const int N, const double Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const double U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const occ::handle& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT bool IsTangentDefined(); - - //! output the tangent direction . - Standard_EXPORT void Tangent(gp_Dir& D); - - //! Returns the curvature. - Standard_EXPORT double Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt& P); - -private: - occ::handle myCurve; - double myU; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myDerivArr[3]; - gp_Dir myTangent; - double myCurvature = 0.0; - LProp_Status myTangentStatus; - int mySignificantFirstDerivativeOrder = 0; -}; - -#endif // _GeomLProp_CLProps_HeaderFile diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.cxx b/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.cxx deleted file mode 100644 index 2887f39d9d..0000000000 --- a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.cxx +++ /dev/null @@ -1,281 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_SurfaceUtils::DirectAccess; - -//================================================================================================= - -GeomLProp_SLProps::GeomLProp_SLProps(const occ::handle& S, - const double U, - const double V, - const int N, - const double Resolution) - : mySurf(S), - myDerOrder(N), - myCN(4), - myLinTol(Resolution) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "GeomLProp_SLProps::GeomLProp_SLProps()"); - SetParameters(U, V); -} - -//================================================================================================= - -GeomLProp_SLProps::GeomLProp_SLProps(const occ::handle& S, - const int N, - const double Resolution) - : mySurf(S), - myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "GeomLProp_SLProps::GeomLProp_SLProps()"); -} - -//================================================================================================= - -GeomLProp_SLProps::GeomLProp_SLProps(const int N, const double Resolution) - : myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "GeomLProp_SLProps::GeomLProp_SLProps() bad level"); -} - -//================================================================================================= - -void GeomLProp_SLProps::SetSurface(const occ::handle& S) -{ - mySurf = S; - myCN = 4; -} - -//================================================================================================= - -void GeomLProp_SLProps::SetParameters(const double U, const double V) -{ - LProp_SurfaceUtils::SetParameters(mySurf, - U, - V, - myU, - myV, - myDerOrder, - myPnt, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myUTangentStatus, - myVTangentStatus, - myNormalStatus, - myCurvatureStatus); -} - -//================================================================================================= - -const gp_Pnt& GeomLProp_SLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& GeomLProp_SLProps::D1U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1u); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_SLProps::D1V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1v); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_SLProps::D2U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2u); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_SLProps::D2V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2v); -} - -//================================================================================================= - -const gp_Vec& GeomLProp_SLProps::DUV() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myDuv); -} - -//================================================================================================= - -bool GeomLProp_SLProps::IsTangentUDefined() -{ - return LProp_SurfaceUtils::IsTangentUDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderU, - myUTangentStatus); -} - -//================================================================================================= - -void GeomLProp_SLProps::TangentU(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentU(*this, - mySurf, - myU, - myV, - myD1u, - myD2u, - mySignificantFirstDerivativeOrderU, - D); -} - -//================================================================================================= - -bool GeomLProp_SLProps::IsTangentVDefined() -{ - return LProp_SurfaceUtils::IsTangentVDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderV, - myVTangentStatus); -} - -//================================================================================================= - -void GeomLProp_SLProps::TangentV(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentV(*this, - mySurf, - myU, - myV, - myD1v, - myD2v, - mySignificantFirstDerivativeOrderV, - D); -} - -//================================================================================================= - -bool GeomLProp_SLProps::IsNormalDefined() -{ - return LProp_SurfaceUtils::IsNormalDefined(myD1u, myD1v, myLinTol, myNormal, myNormalStatus); -} - -//================================================================================================= - -const gp_Dir& GeomLProp_SLProps::Normal() -{ - return LProp_SurfaceUtils::Normal(*this, myNormal); -} - -//================================================================================================= - -bool GeomLProp_SLProps::IsCurvatureDefined() -{ - return LProp_SurfaceUtils::IsCurvatureDefined(*this, - myCN, - myDerOrder, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myNormal, - myMinCurv, - myMaxCurv, - myDirMinCurv, - myDirMaxCurv, - myMeanCurv, - myGausCurv, - myCurvatureStatus); -} - -//================================================================================================= - -bool GeomLProp_SLProps::IsUmbilic() -{ - return LProp_SurfaceUtils::IsUmbilic(*this, myMaxCurv, myMinCurv); -} - -//================================================================================================= - -double GeomLProp_SLProps::MaxCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMaxCurv); -} - -//================================================================================================= - -double GeomLProp_SLProps::MinCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMinCurv); -} - -//================================================================================================= - -void GeomLProp_SLProps::CurvatureDirections(gp_Dir& Max, gp_Dir& Min) -{ - LProp_SurfaceUtils::CurvatureDirections(*this, myDirMaxCurv, myDirMinCurv, Max, Min); -} - -//================================================================================================= - -double GeomLProp_SLProps::MeanCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMeanCurv); -} - -//================================================================================================= - -double GeomLProp_SLProps::GaussianCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myGausCurv); -} diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.hxx b/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.hxx deleted file mode 100644 index 6c37f71b05..0000000000 --- a/src/ModelingData/TKG3d/GeomLProp/GeomLProp_SLProps.hxx +++ /dev/null @@ -1,174 +0,0 @@ -// Created on: 1992-03-26 -// Created by: Herve LEGRAND -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _GeomLProp_SLProps_HeaderFile -#define _GeomLProp_SLProps_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -class Geom_Surface; -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class gp_Pnt; -class gp_Vec; -class gp_Dir; - -class GeomLProp_SLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the surface - //! for the parameter values (, ). - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, or 2). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT GeomLProp_SLProps(const occ::handle& S, - const double U, - const double V, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and . - Standard_EXPORT GeomLProp_SLProps(const occ::handle& S, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and and the surface. - //! the surface can have an empty constructor. - Standard_EXPORT GeomLProp_SLProps(const int N, const double Resolution); - - //! Initializes the local properties of the surface S - //! for the new surface. - Standard_EXPORT void SetSurface(const occ::handle& S); - - //! Initializes the local properties of the surface S - //! for the new parameter values (, ). - Standard_EXPORT void SetParameters(const double U, const double V); - - //! Returns the point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first U derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1U(); - - //! Returns the first V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1V(); - - //! Returns the second U derivatives - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2U(); - - //! Returns the second V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2V(); - - //! Returns the second UV cross-derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& DUV(); - - //! returns True if the U tangent is defined. - //! For example, the tangent is not defined if the - //! two first U derivatives are null. - Standard_EXPORT bool IsTangentUDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentU(gp_Dir& D); - - //! returns if the V tangent is defined. - //! For example, the tangent is not defined if the - //! two first V derivatives are null. - Standard_EXPORT bool IsTangentVDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentV(gp_Dir& D); - - //! Tells if the normal is defined. - Standard_EXPORT bool IsNormalDefined(); - - //! Returns the normal direction. - Standard_EXPORT const gp_Dir& Normal(); - - //! returns True if the curvature is defined. - Standard_EXPORT bool IsCurvatureDefined(); - - //! returns True if the point is umbilic (i.e. if the - //! curvature is constant). - Standard_EXPORT bool IsUmbilic(); - - //! Returns the maximum curvature - Standard_EXPORT double MaxCurvature(); - - //! Returns the minimum curvature - Standard_EXPORT double MinCurvature(); - - //! Returns the direction of the maximum and minimum curvature - //! and - Standard_EXPORT void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD); - - //! Returns the mean curvature. - Standard_EXPORT double MeanCurvature(); - - //! Returns the Gaussian curvature - Standard_EXPORT double GaussianCurvature(); - -private: - occ::handle mySurf; - double myU; - double myV; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myD1u; - gp_Vec myD1v; - gp_Vec myD2u; - gp_Vec myD2v; - gp_Vec myDuv; - gp_Dir myNormal; - double myMinCurv = 0.0; - double myMaxCurv = 0.0; - gp_Dir myDirMinCurv; - gp_Dir myDirMaxCurv; - double myMeanCurv = 0.0; - double myGausCurv = 0.0; - int mySignificantFirstDerivativeOrderU = 0; - int mySignificantFirstDerivativeOrderV = 0; - LProp_Status myUTangentStatus; - LProp_Status myVTangentStatus; - LProp_Status myNormalStatus; - LProp_Status myCurvatureStatus; -}; - -#endif // _GeomLProp_SLProps_HeaderFile diff --git a/src/ModelingData/TKG3d/LProp3d/FILES.cmake b/src/ModelingData/TKG3d/LProp3d/FILES.cmake deleted file mode 100644 index 48e4c2e971..0000000000 --- a/src/ModelingData/TKG3d/LProp3d/FILES.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# Source files for LProp3d package -set(OCCT_LProp3d_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") - -set(OCCT_LProp3d_FILES - LProp3d_CLProps.hxx - LProp3d_CLProps.cxx - LProp3d_SLProps.hxx - LProp3d_SLProps.cxx -) diff --git a/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.cxx b/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.cxx deleted file mode 100644 index 9df1acbd50..0000000000 --- a/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.cxx +++ /dev/null @@ -1,172 +0,0 @@ -// Created on: 2002-08-02 -// Created by: Alexander KARTOMIN (akm) -// Copyright (c) 2002-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_CurveUtils::DirectAccess; - -//================================================================================================= - -LProp3d_CLProps::LProp3d_CLProps(const occ::handle& C, - const double U, - const int N, - const double Resolution) - : myCurve(C), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "LProp3d_CLProps::LProp3d_CLProps()"); - SetParameter(U); -} - -//================================================================================================= - -LProp3d_CLProps::LProp3d_CLProps(const occ::handle& C, - const int N, - const double Resolution) - : myCurve(C), - myU(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "LProp3d_CLProps::LProp3d_CLProps()"); -} - -//================================================================================================= - -LProp3d_CLProps::LProp3d_CLProps(const int N, const double Resolution) - : myU(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myTangentStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 3, "LProp3d_CLProps() - invalid input"); -} - -//================================================================================================= - -void LProp3d_CLProps::SetParameter(const double U) -{ - LProp_CurveUtils::SetParameter(myCurve, - U, - myU, - myDerOrder, - myPnt, - myDerivArr, - myTangentStatus); -} - -//================================================================================================= - -void LProp3d_CLProps::SetCurve(const occ::handle& C) -{ - myCurve = C; - myCN = 4; -} - -//================================================================================================= - -const gp_Pnt& LProp3d_CLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& LProp3d_CLProps::D1() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& LProp3d_CLProps::D2() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); -} - -//================================================================================================= - -const gp_Vec& LProp3d_CLProps::D3() -{ - return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); -} - -//================================================================================================= - -bool LProp3d_CLProps::IsTangentDefined() -{ - return LProp_CurveUtils::IsTangentDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrder, - myTangentStatus); -} - -//================================================================================================= - -void LProp3d_CLProps::Tangent(gp_Dir& D) -{ - LProp_CurveUtils::Tangent(*this, - myCurve, - myU, - myDerivArr, - myPnt, - mySignificantFirstDerivativeOrder, - D); -} - -//================================================================================================= - -double LProp3d_CLProps::Curvature() -{ - return LProp_CurveUtils::Curvature(*this, - myDerivArr[0], - myDerivArr[1], - myLinTol, - mySignificantFirstDerivativeOrder, - myCurvature); -} - -//================================================================================================= - -void LProp3d_CLProps::Normal(gp_Dir& N) -{ - LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); -} - -//================================================================================================= - -void LProp3d_CLProps::CentreOfCurvature(gp_Pnt& P) -{ - LProp_CurveUtils::CentreOfCurvature(*this, - myPnt, - myDerivArr[0], - myDerivArr[1], - myLinTol, - myCurvature, - P); -} diff --git a/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.hxx b/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.hxx deleted file mode 100644 index a698feb868..0000000000 --- a/src/ModelingData/TKG3d/LProp3d/LProp3d_CLProps.hxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 2002-08-02 -// Created by: Alexander KARTOMIN (akm) -// Copyright (c) 2002-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _LProp3d_CLProps_HeaderFile -#define _LProp3d_CLProps_HeaderFile - -#include -#include -#include -#include -#include - -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class gp_Vec; -class gp_Pnt; -class gp_Dir; - -class LProp3d_CLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT LProp3d_CLProps(const occ::handle& C, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT LProp3d_CLProps(const occ::handle& C, - const double U, - const int N, - const double Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT LProp3d_CLProps(const int N, const double Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const double U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const occ::handle& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT bool IsTangentDefined(); - - //! output the tangent direction - Standard_EXPORT void Tangent(gp_Dir& D); - - //! Returns the curvature. - Standard_EXPORT double Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt& P); - -private: - occ::handle myCurve; - double myU; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myDerivArr[3]; - gp_Dir myTangent; - double myCurvature = 0.0; - LProp_Status myTangentStatus; - int mySignificantFirstDerivativeOrder = 0; -}; - -#endif // _LProp3d_CLProps_HeaderFile diff --git a/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.cxx b/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.cxx deleted file mode 100644 index bb99b6d5d5..0000000000 --- a/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.cxx +++ /dev/null @@ -1,280 +0,0 @@ -// Created on: 2002-08-02 -// Created by: Alexander KARTOMIN (akm) -// Copyright (c) 2002-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include - -using Access = LProp_SurfaceUtils::DirectAccess; - -//================================================================================================= - -LProp3d_SLProps::LProp3d_SLProps(const occ::handle& S, - const double U, - const double V, - const int N, - const double Resolution) - : mySurf(S), - myDerOrder(N), - myCN(4), - myLinTol(Resolution) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "LProp3d_SLProps::LProp3d_SLProps()"); - SetParameters(U, V); -} - -//================================================================================================= - -LProp3d_SLProps::LProp3d_SLProps(const occ::handle& S, - const int N, - const double Resolution) - : mySurf(S), - myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(4), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "LProp3d_SLProps::LProp3d_SLProps()"); -} - -//================================================================================================= - -LProp3d_SLProps::LProp3d_SLProps(const int N, const double Resolution) - : myU(RealLast()), - myV(RealLast()), - myDerOrder(N), - myCN(0), - myLinTol(Resolution), - myUTangentStatus(LProp_Undecided), - myVTangentStatus(LProp_Undecided), - myNormalStatus(LProp_Undecided), - myCurvatureStatus(LProp_Undecided) -{ - Standard_OutOfRange_Raise_if(N < 0 || N > 2, "LProp3d_SLProps::LProp3d_SLProps() bad level"); -} - -//================================================================================================= - -void LProp3d_SLProps::SetSurface(const occ::handle& S) -{ - mySurf = S; - myCN = 4; -} - -//================================================================================================= - -void LProp3d_SLProps::SetParameters(const double U, const double V) -{ - LProp_SurfaceUtils::SetParameters(mySurf, - U, - V, - myU, - myV, - myDerOrder, - myPnt, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myUTangentStatus, - myVTangentStatus, - myNormalStatus, - myCurvatureStatus); -} - -//================================================================================================= - -const gp_Pnt& LProp3d_SLProps::Value() const -{ - return myPnt; -} - -//================================================================================================= - -const gp_Vec& LProp3d_SLProps::D1U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1u); -} - -//================================================================================================= - -const gp_Vec& LProp3d_SLProps::D1V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1v); -} - -//================================================================================================= - -const gp_Vec& LProp3d_SLProps::D2U() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2u); -} - -//================================================================================================= - -const gp_Vec& LProp3d_SLProps::D2V() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2v); -} - -//================================================================================================= - -const gp_Vec& LProp3d_SLProps::DUV() -{ - return LProp_SurfaceUtils::EnsureSurfDeriv< - Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myDuv); -} - -//================================================================================================= - -bool LProp3d_SLProps::IsTangentUDefined() -{ - return LProp_SurfaceUtils::IsTangentUDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderU, - myUTangentStatus); -} - -//================================================================================================= - -void LProp3d_SLProps::TangentU(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentU(*this, - mySurf, - myU, - myV, - myD1u, - myD2u, - mySignificantFirstDerivativeOrderU, - D); -} - -//================================================================================================= - -bool LProp3d_SLProps::IsTangentVDefined() -{ - return LProp_SurfaceUtils::IsTangentVDefined(*this, - myCN, - myLinTol, - mySignificantFirstDerivativeOrderV, - myVTangentStatus); -} - -//================================================================================================= - -void LProp3d_SLProps::TangentV(gp_Dir& D) -{ - LProp_SurfaceUtils::TangentV(*this, - mySurf, - myU, - myV, - myD1v, - myD2v, - mySignificantFirstDerivativeOrderV, - D); -} - -//================================================================================================= - -bool LProp3d_SLProps::IsNormalDefined() -{ - return LProp_SurfaceUtils::IsNormalDefined(myD1u, myD1v, myLinTol, myNormal, myNormalStatus); -} - -//================================================================================================= - -const gp_Dir& LProp3d_SLProps::Normal() -{ - return LProp_SurfaceUtils::Normal(*this, myNormal); -} - -//================================================================================================= - -bool LProp3d_SLProps::IsCurvatureDefined() -{ - return LProp_SurfaceUtils::IsCurvatureDefined(*this, - myCN, - myDerOrder, - myD1u, - myD1v, - myD2u, - myD2v, - myDuv, - myNormal, - myMinCurv, - myMaxCurv, - myDirMinCurv, - myDirMaxCurv, - myMeanCurv, - myGausCurv, - myCurvatureStatus); -} - -//================================================================================================= - -bool LProp3d_SLProps::IsUmbilic() -{ - return LProp_SurfaceUtils::IsUmbilic(*this, myMaxCurv, myMinCurv); -} - -//================================================================================================= - -double LProp3d_SLProps::MaxCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMaxCurv); -} - -//================================================================================================= - -double LProp3d_SLProps::MinCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMinCurv); -} - -//================================================================================================= - -void LProp3d_SLProps::CurvatureDirections(gp_Dir& Max, gp_Dir& Min) -{ - LProp_SurfaceUtils::CurvatureDirections(*this, myDirMaxCurv, myDirMinCurv, Max, Min); -} - -//================================================================================================= - -double LProp3d_SLProps::MeanCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myMeanCurv); -} - -//================================================================================================= - -double LProp3d_SLProps::GaussianCurvature() -{ - return LProp_SurfaceUtils::RequireCurvature(*this, myGausCurv); -} diff --git a/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.hxx b/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.hxx deleted file mode 100644 index c6d1f3c845..0000000000 --- a/src/ModelingData/TKG3d/LProp3d/LProp3d_SLProps.hxx +++ /dev/null @@ -1,158 +0,0 @@ -// Created on: 2002-08-02 -// Created by: Alexander KARTOMIN (akm) -// Copyright (c) 2002-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _LProp3d_SLProps_HeaderFile -#define _LProp3d_SLProps_HeaderFile - -#include -#include - -class LProp3d_SLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the surface - //! for the parameter values (, ). - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, or 2). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT LProp3d_SLProps(const occ::handle& S, - const double U, - const double V, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and . - Standard_EXPORT LProp3d_SLProps(const occ::handle& S, - const int N, - const double Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and and the surface. - //! the surface can have an empty constructor. - Standard_EXPORT LProp3d_SLProps(const int N, const double Resolution); - - //! Initializes the local properties of the surface S - //! for the new surface. - Standard_EXPORT void SetSurface(const occ::handle& S); - - //! Initializes the local properties of the surface S - //! for the new parameter values (, ). - Standard_EXPORT void SetParameters(const double U, const double V); - - //! Returns the point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first U derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1U(); - - //! Returns the first V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1V(); - - //! Returns the second U derivatives - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2U(); - - //! Returns the second V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2V(); - - //! Returns the second UV cross-derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& DUV(); - - //! returns True if the U tangent is defined. - //! For example, the tangent is not defined if the - //! two first U derivatives are null. - Standard_EXPORT bool IsTangentUDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentU(gp_Dir& D); - - //! returns if the V tangent is defined. - //! For example, the tangent is not defined if the - //! two first V derivatives are null. - Standard_EXPORT bool IsTangentVDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentV(gp_Dir& D); - - //! Tells if the normal is defined. - Standard_EXPORT bool IsNormalDefined(); - - //! Returns the normal direction. - Standard_EXPORT const gp_Dir& Normal(); - - //! returns True if the curvature is defined. - Standard_EXPORT bool IsCurvatureDefined(); - - //! returns True if the point is umbilic (i.e. if the - //! curvature is constant). - Standard_EXPORT bool IsUmbilic(); - - //! Returns the maximum curvature - Standard_EXPORT double MaxCurvature(); - - //! Returns the minimum curvature - Standard_EXPORT double MinCurvature(); - - //! Returns the direction of the maximum and minimum curvature - //! and - Standard_EXPORT void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD); - - //! Returns the mean curvature. - Standard_EXPORT double MeanCurvature(); - - //! Returns the Gaussian curvature - Standard_EXPORT double GaussianCurvature(); - -private: - occ::handle mySurf; - double myU; - double myV; - int myDerOrder; - int myCN; - double myLinTol; - gp_Pnt myPnt; - gp_Vec myD1u; - gp_Vec myD1v; - gp_Vec myD2u; - gp_Vec myD2v; - gp_Vec myDuv; - gp_Dir myNormal; - double myMinCurv = 0.0; - double myMaxCurv = 0.0; - gp_Dir myDirMinCurv; - gp_Dir myDirMaxCurv; - double myMeanCurv = 0.0; - double myGausCurv = 0.0; - int mySignificantFirstDerivativeOrderU = 0; - int mySignificantFirstDerivativeOrderV = 0; - LProp_Status myUTangentStatus; - LProp_Status myVTangentStatus; - LProp_Status myNormalStatus; - LProp_Status myCurvatureStatus; -}; - -#endif // _LProp3d_SLProps_HeaderFile diff --git a/src/ModelingData/TKG3d/PACKAGES.cmake b/src/ModelingData/TKG3d/PACKAGES.cmake index 537e911b71..19bc01cd11 100644 --- a/src/ModelingData/TKG3d/PACKAGES.cmake +++ b/src/ModelingData/TKG3d/PACKAGES.cmake @@ -3,12 +3,9 @@ set(OCCT_TKG3d_LIST_OF_PACKAGES Geom GeomAdaptor AdvApprox - GeomLProp Adaptor3d - LProp3d TopAbs GeomGridEval - GProp GeomHash GeomEval ) diff --git a/src/ModelingData/TKG3d/GProp/FILES.cmake b/src/ModelingData/TKGeomBase/GProp/FILES.cmake similarity index 100% rename from src/ModelingData/TKG3d/GProp/FILES.cmake rename to src/ModelingData/TKGeomBase/GProp/FILES.cmake diff --git a/src/ModelingData/TKG3d/GProp/GProp.cxx b/src/ModelingData/TKGeomBase/GProp/GProp.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp.hxx b/src/ModelingData/TKGeomBase/GProp/GProp.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_CelGProps.cxx b/src/ModelingData/TKGeomBase/GProp/GProp_CelGProps.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_CelGProps.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp_CelGProps.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_CelGProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_CelGProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_CelGProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_CelGProps.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_GProps.cxx b/src/ModelingData/TKGeomBase/GProp/GProp_GProps.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_GProps.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp_GProps.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_GProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_GProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_GProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_GProps.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_PEquation.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_PEquation.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_PEquation.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_PEquation.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_PGProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_PGProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_PGProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_PGProps.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_PrincipalProps.cxx b/src/ModelingData/TKGeomBase/GProp/GProp_PrincipalProps.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_PrincipalProps.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp_PrincipalProps.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_PrincipalProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_PrincipalProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_PrincipalProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_PrincipalProps.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_SelGProps.cxx b/src/ModelingData/TKGeomBase/GProp/GProp_SelGProps.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_SelGProps.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp_SelGProps.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_SelGProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_SelGProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_SelGProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_SelGProps.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_UndefinedAxis.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_UndefinedAxis.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_ValueType.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_ValueType.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_ValueType.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_ValueType.hxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_VelGProps.cxx b/src/ModelingData/TKGeomBase/GProp/GProp_VelGProps.cxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_VelGProps.cxx rename to src/ModelingData/TKGeomBase/GProp/GProp_VelGProps.cxx diff --git a/src/ModelingData/TKG3d/GProp/GProp_VelGProps.hxx b/src/ModelingData/TKGeomBase/GProp/GProp_VelGProps.hxx similarity index 100% rename from src/ModelingData/TKG3d/GProp/GProp_VelGProps.hxx rename to src/ModelingData/TKGeomBase/GProp/GProp_VelGProps.hxx diff --git a/src/ModelingData/TKGeomBase/GTests/FILES.cmake b/src/ModelingData/TKGeomBase/GTests/FILES.cmake index 4f0548f823..d0e2319156 100644 --- a/src/ModelingData/TKGeomBase/GTests/FILES.cmake +++ b/src/ModelingData/TKGeomBase/GTests/FILES.cmake @@ -36,4 +36,8 @@ set(OCCT_TKGeomBase_GTests_FILES gce_MakeCylinder_Test.cxx gce_MakeElips_Test.cxx gce_MakeHypr_Test.cxx + GeomLProp_CLProps2d_Test.cxx + GeomLProp_CurAndInf2d_Test.cxx + LProp_AnalyticCurInf_Test.cxx + LProp_CurAndInf_Test.cxx ) diff --git a/src/ModelingData/TKG2d/GTests/Geom2dLProp_CLProps2d_Test.cxx b/src/ModelingData/TKGeomBase/GTests/GeomLProp_CLProps2d_Test.cxx similarity index 66% rename from src/ModelingData/TKG2d/GTests/Geom2dLProp_CLProps2d_Test.cxx rename to src/ModelingData/TKGeomBase/GTests/GeomLProp_CLProps2d_Test.cxx index 2ea307c954..73527253f3 100644 --- a/src/ModelingData/TKG2d/GTests/Geom2dLProp_CLProps2d_Test.cxx +++ b/src/ModelingData/TKGeomBase/GTests/GeomLProp_CLProps2d_Test.cxx @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -28,7 +28,7 @@ #include -class Geom2dLProp_CLProps2dTest : public ::testing::Test +class GeomLProp_CLProps2dTest : public ::testing::Test { protected: void SetUp() override @@ -51,18 +51,18 @@ protected: occ::handle myEllipse; }; -TEST_F(Geom2dLProp_CLProps2dTest, Circle_Value) +TEST_F(GeomLProp_CLProps2dTest, Circle_Value) { - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); const gp_Pnt2d& aPnt = aProps.Value(); EXPECT_NEAR(aPnt.X(), 5.0, Precision::Confusion()); EXPECT_NEAR(aPnt.Y(), 0.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_SetParameter) +TEST_F(GeomLProp_CLProps2dTest, Circle_SetParameter) { - Geom2dLProp_CLProps2d aProps(myCircle, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 2, Precision::Confusion()); aProps.SetParameter(M_PI / 2.0); const gp_Pnt2d& aPnt = aProps.Value(); @@ -70,16 +70,16 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_SetParameter) EXPECT_NEAR(aPnt.Y(), 5.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_TangentDefined) +TEST_F(GeomLProp_CLProps2dTest, Circle_TangentDefined) { - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); EXPECT_TRUE(aProps.IsTangentDefined()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_TangentAtZero) +TEST_F(GeomLProp_CLProps2dTest, Circle_TangentAtZero) { // At U=0 on a circle, the tangent should point in +Y direction - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); gp_Dir2d aTangent; aProps.Tangent(aTangent); @@ -87,19 +87,19 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_TangentAtZero) EXPECT_NEAR(aTangent.Y(), 1.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_Curvature) +TEST_F(GeomLProp_CLProps2dTest, Circle_Curvature) { // Curvature of a circle of radius R is 1/R - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); const double aCurvature = aProps.Curvature(); EXPECT_NEAR(aCurvature, 1.0 / 5.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_CurvatureConstant) +TEST_F(GeomLProp_CLProps2dTest, Circle_CurvatureConstant) { // Curvature on a circle should be the same at every point - Geom2dLProp_CLProps2d aProps(myCircle, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 2, Precision::Confusion()); for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0) { @@ -108,10 +108,10 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_CurvatureConstant) } } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_Normal) +TEST_F(GeomLProp_CLProps2dTest, Circle_Normal) { // Normal at U=0 on a circle centered at origin should point inward (-X) - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); gp_Dir2d aNormal; aProps.Normal(aNormal); @@ -123,10 +123,10 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_Normal) Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_CentreOfCurvature) +TEST_F(GeomLProp_CLProps2dTest, Circle_CentreOfCurvature) { // Centre of curvature of a circle is its center - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); gp_Pnt2d aCenter; aProps.CentreOfCurvature(aCenter); @@ -134,9 +134,9 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_CentreOfCurvature) EXPECT_NEAR(aCenter.Y(), 0.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Circle_CentreOfCurvature_AtPiHalf) +TEST_F(GeomLProp_CLProps2dTest, Circle_CentreOfCurvature_AtPiHalf) { - Geom2dLProp_CLProps2d aProps(myCircle, M_PI / 2.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myCircle, M_PI / 2.0, 2, Precision::Confusion()); gp_Pnt2d aCenter; aProps.CentreOfCurvature(aCenter); @@ -144,15 +144,15 @@ TEST_F(Geom2dLProp_CLProps2dTest, Circle_CentreOfCurvature_AtPiHalf) EXPECT_NEAR(aCenter.Y(), 0.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Line_TangentDefined) +TEST_F(GeomLProp_CLProps2dTest, Line_TangentDefined) { - Geom2dLProp_CLProps2d aProps(myLine, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myLine, 0.0, 2, Precision::Confusion()); EXPECT_TRUE(aProps.IsTangentDefined()); } -TEST_F(Geom2dLProp_CLProps2dTest, Line_Tangent) +TEST_F(GeomLProp_CLProps2dTest, Line_Tangent) { - Geom2dLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); gp_Dir2d aTangent; aProps.Tangent(aTangent); @@ -160,48 +160,48 @@ TEST_F(Geom2dLProp_CLProps2dTest, Line_Tangent) EXPECT_NEAR(aTangent.Y(), 0.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Line_CurvatureIsZero) +TEST_F(GeomLProp_CLProps2dTest, Line_CurvatureIsZero) { - Geom2dLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); - const double aCurvature = aProps.Curvature(); + GeomLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); + const double aCurvature = aProps.Curvature(); EXPECT_NEAR(aCurvature, 0.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, Line_CentreOfCurvature_Throws) +TEST_F(GeomLProp_CLProps2dTest, Line_CentreOfCurvature_Throws) { // Centre of curvature is not defined for a line (zero curvature) - Geom2dLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); - gp_Pnt2d aCenter; + GeomLProp_CLProps2d aProps(myLine, 5.0, 2, Precision::Confusion()); + gp_Pnt2d aCenter; EXPECT_THROW(aProps.CentreOfCurvature(aCenter), LProp_NotDefined); } -TEST_F(Geom2dLProp_CLProps2dTest, Ellipse_CurvatureAtMajorVertex) +TEST_F(GeomLProp_CLProps2dTest, Ellipse_CurvatureAtMajorVertex) { // At U=0, ellipse is at major vertex. Curvature = b^2/a^3 for a=10, b=5 // but actually for parametric ellipse, curvature at end of major axis = b^2/(a^2) * (1/a) // = b^2/a^2 * 1/a ... let's compute it properly: // Curvature at parameter 0 for ellipse(a,b) = a/b^2 // Actually: radius of curvature at major vertex = b^2/a, so curvature = a/b^2 - Geom2dLProp_CLProps2d aProps(myEllipse, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myEllipse, 0.0, 2, Precision::Confusion()); const double aCurvature = aProps.Curvature(); const double aExpected = 10.0 / (5.0 * 5.0); // a/b^2 = 10/25 = 0.4 EXPECT_NEAR(aCurvature, aExpected, 1e-6); } -TEST_F(Geom2dLProp_CLProps2dTest, Ellipse_CurvatureAtMinorVertex) +TEST_F(GeomLProp_CLProps2dTest, Ellipse_CurvatureAtMinorVertex) { // At U=PI/2, ellipse is at minor vertex. Curvature = b/a^2 - Geom2dLProp_CLProps2d aProps(myEllipse, M_PI / 2.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myEllipse, M_PI / 2.0, 2, Precision::Confusion()); const double aCurvature = aProps.Curvature(); const double aExpected = 5.0 / (10.0 * 10.0); // b/a^2 = 5/100 = 0.05 EXPECT_NEAR(aCurvature, aExpected, 1e-6); } -TEST_F(Geom2dLProp_CLProps2dTest, SetCurve) +TEST_F(GeomLProp_CLProps2dTest, SetCurve) { - Geom2dLProp_CLProps2d aProps(myEllipse, 0.0, 2, Precision::Confusion()); + GeomLProp_CLProps2d aProps(myEllipse, 0.0, 2, Precision::Confusion()); aProps.SetCurve(myCircle); aProps.SetParameter(0.0); @@ -209,20 +209,20 @@ TEST_F(Geom2dLProp_CLProps2dTest, SetCurve) EXPECT_NEAR(aPnt.X(), 5.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, D1_Circle) +TEST_F(GeomLProp_CLProps2dTest, D1_Circle) { - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); - const gp_Vec2d& aD1 = aProps.D1(); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + const gp_Vec2d& aD1 = aProps.D1(); // First derivative at U=0 on circle(R=5) is (0, 5) EXPECT_NEAR(aD1.X(), 0.0, Precision::Confusion()); EXPECT_NEAR(aD1.Y(), 5.0, Precision::Confusion()); } -TEST_F(Geom2dLProp_CLProps2dTest, D2_Circle) +TEST_F(GeomLProp_CLProps2dTest, D2_Circle) { - Geom2dLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); - const gp_Vec2d& aD2 = aProps.D2(); + GeomLProp_CLProps2d aProps(myCircle, 0.0, 2, Precision::Confusion()); + const gp_Vec2d& aD2 = aProps.D2(); // Second derivative at U=0 on circle(R=5) is (-5, 0) EXPECT_NEAR(aD2.X(), -5.0, Precision::Confusion()); diff --git a/src/ModelingData/TKG2d/GTests/Geom2dLProp_CurAndInf2d_Test.cxx b/src/ModelingData/TKGeomBase/GTests/GeomLProp_CurAndInf2d_Test.cxx similarity index 76% rename from src/ModelingData/TKG2d/GTests/Geom2dLProp_CurAndInf2d_Test.cxx rename to src/ModelingData/TKGeomBase/GTests/GeomLProp_CurAndInf2d_Test.cxx index 86f9295e5f..e4ca5c2acf 100644 --- a/src/ModelingData/TKG2d/GTests/Geom2dLProp_CurAndInf2d_Test.cxx +++ b/src/ModelingData/TKGeomBase/GTests/GeomLProp_CurAndInf2d_Test.cxx @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ #include -class Geom2dLProp_CurAndInf2dTest : public ::testing::Test +class GeomLProp_CurAndInf2dTest : public ::testing::Test { protected: void SetUp() override @@ -56,48 +56,48 @@ protected: occ::handle myParabola; }; -TEST_F(Geom2dLProp_CurAndInf2dTest, Circle_Perform_NoInflections) +TEST_F(GeomLProp_CurAndInf2dTest, Circle_Perform_NoInflections) { // A circle has constant curvature: no inflections or extrema - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.Perform(myCircle); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 0); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Circle_PerformInf_NoInflections) +TEST_F(GeomLProp_CurAndInf2dTest, Circle_PerformInf_NoInflections) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformInf(myCircle); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 0); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Circle_PerformCurExt_NoExtrema) +TEST_F(GeomLProp_CurAndInf2dTest, Circle_PerformCurExt_NoExtrema) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myCircle); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 0); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformCurExt_HasExtrema) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_PerformCurExt_HasExtrema) { // An ellipse has 4 curvature extrema: // 2 maxima (at ends of minor axis) and 2 minima (at ends of major axis) - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myEllipse); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 4); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Types) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Types) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myEllipse); ASSERT_TRUE(aAnalyzer.IsDone()); @@ -118,9 +118,9 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Types) EXPECT_EQ(aNbMax, 2); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Parameters) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Parameters) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myEllipse); ASSERT_TRUE(aAnalyzer.IsDone()); @@ -133,20 +133,20 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformCurExt_Parameters) } } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_PerformInf_NoInflections) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_PerformInf_NoInflections) { // An ellipse is a convex curve, so it has no inflection points - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformInf(myEllipse); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 0); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_Perform_CombinedResult) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_Perform_CombinedResult) { // Perform computes both inflections and curvature extrema - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.Perform(myEllipse); EXPECT_TRUE(aAnalyzer.IsDone()); @@ -154,11 +154,11 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_Perform_CombinedResult) EXPECT_EQ(aAnalyzer.NbPoints(), 4); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_CurvatureExtremaAtExpectedParameters) +TEST_F(GeomLProp_CurAndInf2dTest, Ellipse_CurvatureExtremaAtExpectedParameters) { // For an ellipse with major axis along X: // Curvature extrema at U = 0, PI/2, PI, 3*PI/2 - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myEllipse); ASSERT_TRUE(aAnalyzer.IsDone()); @@ -171,9 +171,9 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Ellipse_CurvatureExtremaAtExpectedParameters } } -TEST_F(Geom2dLProp_CurAndInf2dTest, Hyperbola_PerformCurExt_VertexOnly) +TEST_F(GeomLProp_CurAndInf2dTest, Hyperbola_PerformCurExt_VertexOnly) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myHyperbola); ASSERT_TRUE(aAnalyzer.IsDone()); @@ -182,18 +182,18 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Hyperbola_PerformCurExt_VertexOnly) EXPECT_EQ(aAnalyzer.Type(1), LProp_MinCur); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Hyperbola_PerformInf_NoInflections) +TEST_F(GeomLProp_CurAndInf2dTest, Hyperbola_PerformInf_NoInflections) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformInf(myHyperbola); EXPECT_TRUE(aAnalyzer.IsDone()); EXPECT_EQ(aAnalyzer.NbPoints(), 0); } -TEST_F(Geom2dLProp_CurAndInf2dTest, Parabola_PerformCurExt_VertexOnly) +TEST_F(GeomLProp_CurAndInf2dTest, Parabola_PerformCurExt_VertexOnly) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myParabola); ASSERT_TRUE(aAnalyzer.IsDone()); @@ -202,9 +202,9 @@ TEST_F(Geom2dLProp_CurAndInf2dTest, Parabola_PerformCurExt_VertexOnly) EXPECT_EQ(aAnalyzer.Type(1), LProp_MinCur); } -TEST_F(Geom2dLProp_CurAndInf2dTest, PerformInf_ClearsPreviousExtrema) +TEST_F(GeomLProp_CurAndInf2dTest, PerformInf_ClearsPreviousExtrema) { - Geom2dLProp_CurAndInf2d aAnalyzer; + GeomLProp_CurAndInf2d aAnalyzer; aAnalyzer.PerformCurExt(myEllipse); ASSERT_TRUE(aAnalyzer.IsDone()); diff --git a/src/ModelingData/TKG2d/GTests/LProp_AnalyticCurInf_Test.cxx b/src/ModelingData/TKGeomBase/GTests/LProp_AnalyticCurInf_Test.cxx similarity index 100% rename from src/ModelingData/TKG2d/GTests/LProp_AnalyticCurInf_Test.cxx rename to src/ModelingData/TKGeomBase/GTests/LProp_AnalyticCurInf_Test.cxx diff --git a/src/ModelingData/TKG2d/GTests/LProp_CurAndInf_Test.cxx b/src/ModelingData/TKGeomBase/GTests/LProp_CurAndInf_Test.cxx similarity index 100% rename from src/ModelingData/TKG2d/GTests/LProp_CurAndInf_Test.cxx rename to src/ModelingData/TKGeomBase/GTests/LProp_CurAndInf_Test.cxx diff --git a/src/ModelingData/TKG3d/GeomLProp/FILES.cmake b/src/ModelingData/TKGeomBase/GeomLProp/FILES.cmake similarity index 54% rename from src/ModelingData/TKG3d/GeomLProp/FILES.cmake rename to src/ModelingData/TKGeomBase/GeomLProp/FILES.cmake index 8254367b36..a2595c1d53 100644 --- a/src/ModelingData/TKG3d/GeomLProp/FILES.cmake +++ b/src/ModelingData/TKGeomBase/GeomLProp/FILES.cmake @@ -5,7 +5,11 @@ set(OCCT_GeomLProp_FILES GeomLProp.cxx GeomLProp.hxx GeomLProp_CLProps.hxx - GeomLProp_CLProps.cxx + GeomLProp_CurAndInf2d.cxx + GeomLProp_CurAndInf2d.hxx + GeomLProp_FuncCurExt2d.pxx + GeomLProp_FuncCurNul2d.pxx + GeomLProp_NumericCurInf2d.pxx GeomLProp_SLProps.hxx - GeomLProp_SLProps.cxx + GeomLProp_SurfaceUtils.hxx ) diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp.cxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp.cxx similarity index 100% rename from src/ModelingData/TKG3d/GeomLProp/GeomLProp.cxx rename to src/ModelingData/TKGeomBase/GeomLProp/GeomLProp.cxx diff --git a/src/ModelingData/TKG3d/GeomLProp/GeomLProp.hxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp.hxx similarity index 100% rename from src/ModelingData/TKG3d/GeomLProp/GeomLProp.hxx rename to src/ModelingData/TKGeomBase/GeomLProp/GeomLProp.hxx diff --git a/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CLProps.hxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CLProps.hxx new file mode 100644 index 0000000000..1555fe60b6 --- /dev/null +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CLProps.hxx @@ -0,0 +1,225 @@ +// Created on: 1992-03-26 +// Created by: Herve LEGRAND +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_CLProps_HeaderFile +#define _GeomLProp_CLProps_HeaderFile + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//! Implementation class for computing local properties of a curve: +//! point, derivatives up to order 3, tangent, curvature, normal, +//! and centre of curvature. +//! Parameterized by geometric types (Pnt/Vec/Dir) and curve type. +//! @tparam Pnt the point type (gp_Pnt for 3D, gp_Pnt2d for 2D) +//! @tparam Vec the vector type (gp_Vec for 3D, gp_Vec2d for 2D) +//! @tparam Dir the direction type (gp_Dir for 3D, gp_Dir2d for 2D) +//! @tparam CurveType the curve storage type +//! @tparam Access the access policy for evaluating curve derivatives +template +class GeomLProp_CLPropsBase +{ +public: + DEFINE_STANDARD_ALLOC + + //! Initializes the local properties of the curve + //! The current point and the derivatives are + //! computed at the same time, which allows an + //! optimization of the computation time. + //! indicates the maximum number of derivations to + //! be done (0, 1, 2 or 3). For example, to compute + //! only the tangent, N should be equal to 1. + //! is the linear tolerance (it is used to test + //! if a vector is null). + GeomLProp_CLPropsBase(const CurveType& C, const int N, const double Resolution) + : myCurve(C), + myU(RealLast()), + myDerOrder(N), + myCN(4), + myLinTol(Resolution), + myTangentStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()"); + } + + //! Same as previous constructor but here the parameter is + //! set to the value . + //! All the computations done will be related to and . + GeomLProp_CLPropsBase(const CurveType& C, const double U, const int N, const double Resolution) + : myCurve(C), + myDerOrder(N), + myCN(4), + myLinTol(Resolution), + myTangentStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()"); + SetParameter(U); + } + + //! Same as previous constructor but here the parameter is + //! set to the value and the curve is set + //! with SetCurve. + //! the curve can have a empty constructor + //! All the computations done will be related to and + //! when the functions "set" will be done. + GeomLProp_CLPropsBase(const int N, const double Resolution) + : myCurve{}, + myU(RealLast()), + myDerOrder(N), + myCN(0), + myLinTol(Resolution), + myTangentStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps() - invalid input"); + } + + //! Initializes the local properties of the curve + //! for the parameter value . + void SetParameter(const double U) + { + LProp_CurveUtils::SetParameter(myCurve, + U, + myU, + myDerOrder, + myPnt, + myDerivArr, + myTangentStatus); + } + + //! Initializes the local properties of the curve + //! for the new curve. + void SetCurve(const CurveType& C) + { + myCurve = C; + myCN = 4; + } + + //! Returns the Point. + const Pnt& Value() const { return myPnt; } + + //! Returns the first derivative. + //! The derivative is computed if it has not been yet. + const Vec& D1() + { + return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr); + } + + //! Returns the second derivative. + //! The derivative is computed if it has not been yet. + const Vec& D2() + { + return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr); + } + + //! Returns the third derivative. + //! The derivative is computed if it has not been yet. + const Vec& D3() + { + return LProp_CurveUtils::EnsureDeriv(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr); + } + + //! Returns True if the tangent is defined. + //! For example, the tangent is not defined if the + //! three first derivatives are all null. + bool IsTangentDefined() + { + return LProp_CurveUtils::IsTangentDefined(*this, + myCN, + myLinTol, + mySignificantFirstDerivativeOrder, + myTangentStatus); + } + + //! output the tangent direction . + void Tangent(Dir& D) + { + LProp_CurveUtils::Tangent(*this, + myCurve, + myU, + myDerivArr, + myPnt, + mySignificantFirstDerivativeOrder, + D); + } + + //! Returns the curvature. + double Curvature() + { + return LProp_CurveUtils::Curvature(*this, + myDerivArr[0], + myDerivArr[1], + myLinTol, + mySignificantFirstDerivativeOrder, + myCurvature); + } + + //! Returns the normal direction . + void Normal(Dir& N) + { + LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N); + } + + //! Returns the centre of curvature

. + void CentreOfCurvature(Pnt& P) + { + LProp_CurveUtils::CentreOfCurvature(*this, + myPnt, + myDerivArr[0], + myDerivArr[1], + myLinTol, + myCurvature, + P); + } + +private: + CurveType myCurve; + double myU; + int myDerOrder; + int myCN; + double myLinTol; + Pnt myPnt; + Vec myDerivArr[3]; + double myCurvature = 0.0; + LProp_Status myTangentStatus; + int mySignificantFirstDerivativeOrder = 0; +}; + +//! Default 3D curve local properties class using occ::handle. +using GeomLProp_CLProps = GeomLProp_CLPropsBase>; + +//! Default 2D curve local properties class using occ::handle. +using GeomLProp_CLProps2d = + GeomLProp_CLPropsBase>; + +#endif // _GeomLProp_CLProps_HeaderFile diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.cxx similarity index 75% rename from src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx rename to src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.cxx index bbe0d242e0..521bf18388 100644 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.cxx @@ -15,45 +15,45 @@ // commercial license or contractual agreement. #include -#include -#include +#include +#include #include #include //================================================================================================= -Geom2dLProp_CurAndInf2d::Geom2dLProp_CurAndInf2d() - : isDone(false) +GeomLProp_CurAndInf2d::GeomLProp_CurAndInf2d() + : myIsDone(false) { } //================================================================================================= -void Geom2dLProp_CurAndInf2d::Perform(const occ::handle& C) +void GeomLProp_CurAndInf2d::Perform(const occ::handle& C) { Clear(); - isDone = true; + myIsDone = true; performCurExt(C); performInf(C); } //================================================================================================= -void Geom2dLProp_CurAndInf2d::PerformCurExt(const occ::handle& C) +void GeomLProp_CurAndInf2d::PerformCurExt(const occ::handle& C) { Clear(); - isDone = true; + myIsDone = true; performCurExt(C); } //================================================================================================= -void Geom2dLProp_CurAndInf2d::performCurExt(const occ::handle& theCurve) +void GeomLProp_CurAndInf2d::performCurExt(const occ::handle& theCurve) { - Geom2dAdaptor_Curve anAdaptor(theCurve); - LProp_AnalyticCurInf anAnalyticInf; - Geom2dLProp_NumericCurInf2d aNumericInf; - const GeomAbs_CurveType aCurveType = anAdaptor.GetType(); + Geom2dAdaptor_Curve anAdaptor(theCurve); + LProp_AnalyticCurInf anAnalyticInf; + GeomLProp_NumericCurInf2d aNumericInf; + const GeomAbs_CurveType aCurveType = anAdaptor.GetType(); switch (aCurveType) { @@ -83,11 +83,11 @@ void Geom2dLProp_CurAndInf2d::performCurExt(const occ::handle& the if (anAdaptor.Continuity() >= GeomAbs_C3) { aNumericInf.PerformCurExt(theCurve, *this); - isDone = aNumericInf.IsDone(); + myIsDone = aNumericInf.IsDone(); } else { - isDone = true; + myIsDone = true; const int aNbIntervals = anAdaptor.NbIntervals(GeomAbs_C3); NCollection_Array1 aParams(1, aNbIntervals + 1); anAdaptor.Intervals(aParams, GeomAbs_C3); @@ -96,7 +96,7 @@ void Geom2dLProp_CurAndInf2d::performCurExt(const occ::handle& the aNumericInf.PerformCurExt(theCurve, aParams(i), aParams(i + 1), *this); if (!aNumericInf.IsDone()) { - isDone = false; + myIsDone = false; } } } @@ -104,7 +104,7 @@ void Geom2dLProp_CurAndInf2d::performCurExt(const occ::handle& the default: { aNumericInf.PerformCurExt(theCurve, *this); - isDone = aNumericInf.IsDone(); + myIsDone = aNumericInf.IsDone(); } break; } @@ -112,20 +112,20 @@ void Geom2dLProp_CurAndInf2d::performCurExt(const occ::handle& the //================================================================================================= -void Geom2dLProp_CurAndInf2d::PerformInf(const occ::handle& C) +void GeomLProp_CurAndInf2d::PerformInf(const occ::handle& C) { Clear(); - isDone = true; + myIsDone = true; performInf(C); } //================================================================================================= -void Geom2dLProp_CurAndInf2d::performInf(const occ::handle& theCurve) +void GeomLProp_CurAndInf2d::performInf(const occ::handle& theCurve) { - Geom2dAdaptor_Curve anAdaptor(theCurve); - const GeomAbs_CurveType aCurveType = anAdaptor.GetType(); - Geom2dLProp_NumericCurInf2d aNumericInf; + Geom2dAdaptor_Curve anAdaptor(theCurve); + const GeomAbs_CurveType aCurveType = anAdaptor.GetType(); + GeomLProp_NumericCurInf2d aNumericInf; switch (aCurveType) { @@ -143,11 +143,11 @@ void Geom2dLProp_CurAndInf2d::performInf(const occ::handle& theCur if (anAdaptor.Continuity() >= GeomAbs_C3) { aNumericInf.PerformInf(theCurve, *this); - isDone = aNumericInf.IsDone(); + myIsDone = aNumericInf.IsDone(); } else { - isDone = true; + myIsDone = true; const int aNbIntervals = anAdaptor.NbIntervals(GeomAbs_C3); NCollection_Array1 aParams(1, aNbIntervals + 1); anAdaptor.Intervals(aParams, GeomAbs_C3); @@ -157,7 +157,7 @@ void Geom2dLProp_CurAndInf2d::performInf(const occ::handle& theCur aNumericInf.PerformInf(theCurve, aParams(i), aParams(i + 1), *this); if (!aNumericInf.IsDone()) { - isDone = false; + myIsDone = false; } } } @@ -165,7 +165,7 @@ void Geom2dLProp_CurAndInf2d::performInf(const occ::handle& theCur default: { aNumericInf.PerformInf(theCurve, *this); - isDone = aNumericInf.IsDone(); + myIsDone = aNumericInf.IsDone(); } break; } @@ -173,7 +173,7 @@ void Geom2dLProp_CurAndInf2d::performInf(const occ::handle& theCur //================================================================================================= -bool Geom2dLProp_CurAndInf2d::IsDone() const +bool GeomLProp_CurAndInf2d::IsDone() const { - return isDone; + return myIsDone; } diff --git a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.hxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.hxx similarity index 91% rename from src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.hxx rename to src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.hxx index 175e86cffa..24fa0e5478 100644 --- a/src/ModelingData/TKG2d/Geom2dLProp/Geom2dLProp_CurAndInf2d.hxx +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_CurAndInf2d.hxx @@ -14,8 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _Geom2dLProp_CurAndInf2d_HeaderFile -#define _Geom2dLProp_CurAndInf2d_HeaderFile +#ifndef _GeomLProp_CurAndInf2d_HeaderFile +#define _GeomLProp_CurAndInf2d_HeaderFile #include #include @@ -32,7 +32,7 @@ class Geom2d_Curve; //! - defining the curve to be analyzed //! - implementing the computation algorithms //! - consulting the results. -class Geom2dLProp_CurAndInf2d : public LProp_CurAndInf +class GeomLProp_CurAndInf2d : public LProp_CurAndInf { public: DEFINE_STANDARD_ALLOC @@ -41,7 +41,7 @@ public: //! Note: The curve on which the local properties are //! computed is defined using one of the following //! functions: Perform, PerformCurExt or PerformInf. - Standard_EXPORT Geom2dLProp_CurAndInf2d(); + Standard_EXPORT GeomLProp_CurAndInf2d(); //! For the curve C, Computes both the //! inflection points and the maximum and minimum curvatures. @@ -74,7 +74,7 @@ private: //! Internal implementation of inflection computation (no Clear). void performInf(const occ::handle& theCurve); - bool isDone; + bool myIsDone; }; -#endif // _Geom2dLProp_CurAndInf2d_HeaderFile +#endif // _GeomLProp_CurAndInf2d_HeaderFile diff --git a/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurExt2d.pxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurExt2d.pxx new file mode 100644 index 0000000000..c16886d041 --- /dev/null +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurExt2d.pxx @@ -0,0 +1,152 @@ +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_FuncCurExt2d_HeaderFile +#define _GeomLProp_FuncCurExt2d_HeaderFile + +#include +#include +#include + +//! Function used to find the extremas of curvature in 2d. +//! Computes the derivative of the curvature function: +//! KC = (V1 ^ V2).Z / ||V1||^3 +//! where V1 is the tangent and V2 is the second derivative. +//! The function value is F = dKC/dU, and its roots correspond +//! to curvature extrema. +class GeomLProp_FuncCurExt2d : public math_FunctionWithDerivative +{ +public: + //! Initializes the function with the curve and the tolerance + //! used for numerical differentiation. + //! @param theCurve [in] the 2D curve to analyze + //! @param theTol [in] the parametric tolerance for finite differences + GeomLProp_FuncCurExt2d(const occ::handle& theCurve, const double theTol) + : myCurve(theCurve), + myEpsX(theTol) + { + } + + //! Computes the value of dKC/dU at parameter theU. + //! @param theU [in] the curve parameter + //! @param theF [out] the function value + //! @return false if the first derivative is degenerate + bool Value(const double theU, double& theF) override + { + gp_Pnt2d aPnt; + gp_Vec2d aDeriv1, aDeriv2, aDeriv3; + + myCurve->D3(theU, aPnt, aDeriv1, aDeriv2, aDeriv3); + const double aCross12 = aDeriv1.Crossed(aDeriv2); + const double aCross13 = aDeriv1.Crossed(aDeriv3); + const double aDot12 = aDeriv1.Dot(aDeriv2); + const double aSqNorm1 = aDeriv1.SquareMagnitude(); + const double aNorm1 = std::sqrt(aSqNorm1); + const double aNorm1Cb = aSqNorm1 * aNorm1; // ||V1||^3 + const double aNorm1Pow5 = aNorm1Cb * aSqNorm1; // ||V1||^5 + + if (aNorm1Pow5 < gp::Resolution()) + { + return false; + } + theF = aCross13 / aNorm1Cb - 3.0 * aCross12 * aDot12 / aNorm1Pow5; + return true; + } + + //! Computes the derivative of the function at parameter theU + //! using finite differences. + //! @param theU [in] the curve parameter + //! @param theD [out] the derivative value + //! @return true on success + bool Derivative(const double theU, double& theD) override + { + double aF; + return Values(theU, aF, theD); + } + + //! Computes both function value and its derivative at parameter theU. + //! The derivative is estimated by forward (or backward) finite difference. + //! @param theU [in] the curve parameter + //! @param theF [out] the function value + //! @param theD [out] the derivative value + //! @return true on success + bool Values(const double theU, double& theF, double& theD) override + { + double aFNext; + double aDeltaU = myEpsX / 100.0; + + if (theU + aDeltaU > myCurve->LastParameter()) + { + aDeltaU = -aDeltaU; + } + + if (!Value(theU, theF) || !Value(theU + aDeltaU, aFNext)) + { + return false; + } + theD = (aFNext - theF) / aDeltaU; + return true; + } + + //! Tests if the parameter corresponds to a minimum of the radius + //! of curvature by comparing the curvature at theU with a nearby point. + //! @param theU [in] the curve parameter to test + //! @return true if |KC(theU)| > |KC(theU + eps)|, i.e. local curvature maximum + bool IsMinKC(const double theU) const + { + gp_Pnt2d aPnt; + gp_Vec2d aDeriv1, aDeriv2, aDeriv3; + double aDeltaU = myEpsX; + + // Compute curvature at theU. + myCurve->D3(theU, aPnt, aDeriv1, aDeriv2, aDeriv3); + double aCross12 = aDeriv1.Crossed(aDeriv2); + double aSqNorm1 = aDeriv1.SquareMagnitude(); + double aNorm1 = std::sqrt(aSqNorm1); + double aNorm1Cb = aSqNorm1 * aNorm1; + + if (aNorm1Cb < gp::Resolution()) + { + return false; + } + + const double aCurvCurr = aCross12 / aNorm1Cb; + + if (theU + aDeltaU > myCurve->LastParameter()) + { + aDeltaU = -aDeltaU; + } + + // Compute curvature at the probe point. + myCurve->D3(theU + aDeltaU, aPnt, aDeriv1, aDeriv2, aDeriv3); + aCross12 = aDeriv1.Crossed(aDeriv2); + aSqNorm1 = aDeriv1.SquareMagnitude(); + aNorm1 = std::sqrt(aSqNorm1); + aNorm1Cb = aSqNorm1 * aNorm1; + + if (aNorm1Cb < gp::Resolution()) + { + return false; + } + const double aCurvProbe = aCross12 / aNorm1Cb; + + return std::abs(aCurvCurr) > std::abs(aCurvProbe); + } + +private: + occ::handle myCurve; //!< The analyzed curve. + double myEpsX; //!< Parametric tolerance for finite differences. +}; + +#endif // _GeomLProp_FuncCurExt2d_HeaderFile diff --git a/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurNul2d.pxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurNul2d.pxx new file mode 100644 index 0000000000..5ead914c9e --- /dev/null +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_FuncCurNul2d.pxx @@ -0,0 +1,103 @@ +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_FuncCurNul2d_HeaderFile +#define _GeomLProp_FuncCurNul2d_HeaderFile + +#include +#include +#include + +//! Function used to find the inflection points of a 2D curve. +//! Computes the normalized curvature function: +//! F = (V1 ^ V2).Z / (||V1|| * ||V2||) +//! where V1 is the tangent and V2 is the second derivative. +//! The roots of F correspond to inflection points. +class GeomLProp_FuncCurNul2d : public math_FunctionWithDerivative +{ +public: + //! Initializes the function with the curve to analyze. + //! @param theCurve [in] the 2D curve + GeomLProp_FuncCurNul2d(const occ::handle& theCurve) + : myCurve(theCurve) + { + } + + //! Computes the function value at parameter theU. + //! @param theU [in] the curve parameter + //! @param theF [out] the function value + //! @return true on success + bool Value(const double theU, double& theF) override + { + double aD; + return Values(theU, theF, aD); + } + + //! Computes the derivative of the function at parameter theU. + //! @param theU [in] the curve parameter + //! @param theD [out] the derivative value + //! @return true on success + bool Derivative(const double theU, double& theD) override + { + double aF; + return Values(theU, aF, theD); + } + + //! Computes both function value and its derivative at parameter theU. + //! The derivative is computed analytically from: + //! F = (V1 ^ V2) / (||V1|| * ||V2||) + //! F' = ((V1 ^ V3) - F*(V1.V2/||V1||^2) - F*(V2.V3/||V2||^2)) / (||V1||*||V2||) + //! @param theU [in] the curve parameter + //! @param theF [out] the function value + //! @param theD [out] the derivative value + //! @return false if the derivative magnitudes are degenerate + bool Values(const double theU, double& theF, double& theD) override + { + gp_Pnt2d aPnt; + gp_Vec2d aDeriv1, aDeriv2, aDeriv3; + myCurve->D3(theU, aPnt, aDeriv1, aDeriv2, aDeriv3); + const double aCross12 = aDeriv1.Crossed(aDeriv2); + const double aCross13 = aDeriv1.Crossed(aDeriv3); + const double aDot12 = aDeriv1.Dot(aDeriv2); + const double aDot23 = aDeriv2.Dot(aDeriv3); + const double aNorm1 = aDeriv1.Magnitude(); + const double aNorm2 = aDeriv2.Magnitude(); + + theF = 0.0; + theD = 0.0; + + if (aNorm2 < 1.e-4) + { + return true; + } + else if (aNorm1 * aNorm2 < gp::Resolution()) + { + return false; + } + else + { + const double aNormProd = aNorm1 * aNorm2; + theF = aCross12 / aNormProd; + theD = + (aCross13 - aCross12 * aDot12 / (aNorm1 * aNorm1) - aCross12 * aDot23 / (aNorm2 * aNorm2)) + / aNormProd; + } + return true; + } + +private: + occ::handle myCurve; //!< The analyzed curve. +}; + +#endif // _GeomLProp_FuncCurNul2d_HeaderFile diff --git a/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_NumericCurInf2d.pxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_NumericCurInf2d.pxx new file mode 100644 index 0000000000..d0086902f9 --- /dev/null +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_NumericCurInf2d.pxx @@ -0,0 +1,135 @@ +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_NumericCurInf2d_HeaderFile +#define _GeomLProp_NumericCurInf2d_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +//! Computes the local extremas of curvature and the inflection points +//! of a bounded 2D curve using numeric root-finding methods. +//! Uses GeomLProp_FuncCurExt2d for curvature extrema and +//! GeomLProp_FuncCurNul2d for inflection points. +class GeomLProp_NumericCurInf2d +{ +public: + GeomLProp_NumericCurInf2d() + : myIsDone(false) + { + } + + //! Computes the local extremas of curvature over the full parameter range. + //! @param theCurve [in] the 2D curve to analyze + //! @param theResult [in,out] container for curvature extrema parameters + void PerformCurExt(const occ::handle& theCurve, LProp_CurAndInf& theResult) + { + PerformCurExt(theCurve, theCurve->FirstParameter(), theCurve->LastParameter(), theResult); + } + + //! Computes the local extremas of curvature in [theUMin, theUMax]. + //! Roots of dKC/dU are found using math_FunctionRoots (sampling + bisection), + //! then refined with math_BracketedRoot. + //! @param theCurve [in] the 2D curve to analyze + //! @param theUMin [in] the start of the parameter interval + //! @param theUMax [in] the end of the parameter interval + //! @param theResult [in,out] container for curvature extrema parameters + void PerformCurExt(const occ::handle& theCurve, + const double theUMin, + const double theUMax, + LProp_CurAndInf& theResult) + { + myIsDone = true; + + const double anEpsH = 1.e-4 * (theUMax - theUMin); + constexpr double aTol = Precision::PConfusion(); + constexpr int aNbSamples = 100; + + GeomLProp_FuncCurExt2d aFunc(theCurve, anEpsH); + math_FunctionRoots aRootFinder(aFunc, theUMin, theUMax, aNbSamples, anEpsH, anEpsH, anEpsH); + + if (aRootFinder.IsDone()) + { + for (int j = 1; j <= aRootFinder.NbSolutions(); j++) + { + double aParam = aRootFinder.Value(j); + // Refine the root with bracketed bisection. + math_BracketedRoot aRefinement(aFunc, aParam - anEpsH, aParam + anEpsH, aTol); + if (aRefinement.IsDone()) + { + aParam = aRefinement.Root(); + } + const bool isMinRadius = aFunc.IsMinKC(aParam); + theResult.AddExtCur(aParam, isMinRadius); + } + } + else + { + myIsDone = false; + } + } + + //! Computes the inflection points over the full parameter range. + //! @param theCurve [in] the 2D curve to analyze + //! @param theResult [in,out] container for inflection point parameters + void PerformInf(const occ::handle& theCurve, LProp_CurAndInf& theResult) + { + PerformInf(theCurve, theCurve->FirstParameter(), theCurve->LastParameter(), theResult); + } + + //! Computes the inflection points in [theUMin, theUMax]. + //! Inflection points are roots of the normalized curvature function. + //! @param theCurve [in] the 2D curve to analyze + //! @param theUMin [in] the start of the parameter interval + //! @param theUMax [in] the end of the parameter interval + //! @param theResult [in,out] container for inflection point parameters + void PerformInf(const occ::handle& theCurve, + const double theUMin, + const double theUMax, + LProp_CurAndInf& theResult) + { + myIsDone = true; + GeomLProp_FuncCurNul2d aFunc(theCurve); + constexpr double anEpsX = 1.e-6; + constexpr double anEpsF = 1.e-6; + constexpr int aNbSamples = 30; + + math_FunctionRoots aRootFinder(aFunc, theUMin, theUMax, aNbSamples, anEpsX, anEpsF, anEpsX); + + if (aRootFinder.IsDone()) + { + for (int j = 1; j <= aRootFinder.NbSolutions(); j++) + { + theResult.AddInflection(aRootFinder.Value(j)); + } + } + else + { + myIsDone = false; + } + } + + //! Returns true if the last computation was successful. + bool IsDone() const { return myIsDone; } + +private: + bool myIsDone; //!< Status of the last computation. +}; + +#endif // _GeomLProp_NumericCurInf2d_HeaderFile diff --git a/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SLProps.hxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SLProps.hxx new file mode 100644 index 0000000000..9c24a11236 --- /dev/null +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SLProps.hxx @@ -0,0 +1,317 @@ +// Created on: 1992-03-26 +// Created by: Herve LEGRAND +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_SLProps_HeaderFile +#define _GeomLProp_SLProps_HeaderFile + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +//! Template class for computing local properties of a 3D surface: +//! point, first and second derivatives, tangent directions, normal, +//! and curvature analysis (max, min, mean, Gaussian). +//! @tparam SurfaceType the surface storage type (e.g. occ::handle, +//! BRepAdaptor_Surface, occ::handle, HLRBRep_SurfacePtr) +//! @tparam Access the access policy for evaluating surface derivatives +template +class GeomLProp_SLPropsBase +{ +public: + DEFINE_STANDARD_ALLOC + + //! Initializes the local properties of the surface + //! for the parameter values (, ). + //! The current point and the derivatives are + //! computed at the same time, which allows an + //! optimization of the computation time. + //! indicates the maximum number of derivations to + //! be done (0, 1, or 2). For example, to compute + //! only the tangent, N should be equal to 1. + //! is the linear tolerance (it is used to test + //! if a vector is null). + GeomLProp_SLPropsBase(const SurfaceType& S, + const double U, + const double V, + const int N, + const double Resolution) + : mySurf(S), + myU(RealLast()), + myV(RealLast()), + myDerOrder(N), + myCN(4), + myLinTol(Resolution), + myUTangentStatus(LProp_Undecided), + myVTangentStatus(LProp_Undecided), + myNormalStatus(LProp_Undecided), + myCurvatureStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 2, "GeomLProp_SLPropsBase::GeomLProp_SLPropsBase()"); + SetParameters(U, V); + } + + //! idem as previous constructor but without setting the value + //! of parameters and . + GeomLProp_SLPropsBase(const SurfaceType& S, const int N, const double Resolution) + : mySurf(S), + myU(RealLast()), + myV(RealLast()), + myDerOrder(N), + myCN(4), + myLinTol(Resolution), + myUTangentStatus(LProp_Undecided), + myVTangentStatus(LProp_Undecided), + myNormalStatus(LProp_Undecided), + myCurvatureStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 2, "GeomLProp_SLPropsBase::GeomLProp_SLPropsBase()"); + } + + //! idem as previous constructor but without setting the value + //! of parameters and and the surface. + //! the surface can have an empty constructor. + GeomLProp_SLPropsBase(const int N, const double Resolution) + : mySurf{}, + myU(RealLast()), + myV(RealLast()), + myDerOrder(N), + myCN(0), + myLinTol(Resolution), + myUTangentStatus(LProp_Undecided), + myVTangentStatus(LProp_Undecided), + myNormalStatus(LProp_Undecided), + myCurvatureStatus(LProp_Undecided) + { + Standard_OutOfRange_Raise_if(N < 0 || N > 2, + "GeomLProp_SLPropsBase::GeomLProp_SLPropsBase() bad level"); + } + + //! Initializes the local properties of the surface S + //! for the new surface. + void SetSurface(const SurfaceType& S) + { + mySurf = S; + myCN = 4; + } + + //! Initializes the local properties of the surface S + //! for the new parameter values (, ). + void SetParameters(const double U, const double V) + { + LProp_SurfaceUtils::SetParameters(mySurf, + U, + V, + myU, + myV, + myDerOrder, + myPnt, + myD1u, + myD1v, + myD2u, + myD2v, + myDuv, + myUTangentStatus, + myVTangentStatus, + myNormalStatus, + myCurvatureStatus); + } + + //! Returns the point. + const gp_Pnt& Value() const { return myPnt; } + + //! Returns the first U derivative. + //! The derivative is computed if it has not been yet. + const gp_Vec& D1U() + { + return LProp_SurfaceUtils::EnsureSurfDeriv< + Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1u); + } + + //! Returns the first V derivative. + //! The derivative is computed if it has not been yet. + const gp_Vec& D1V() + { + return LProp_SurfaceUtils::EnsureSurfDeriv< + Access>(mySurf, myU, myV, myDerOrder, 1, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD1v); + } + + //! Returns the second U derivatives + //! The derivative is computed if it has not been yet. + const gp_Vec& D2U() + { + return LProp_SurfaceUtils::EnsureSurfDeriv< + Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2u); + } + + //! Returns the second V derivative. + //! The derivative is computed if it has not been yet. + const gp_Vec& D2V() + { + return LProp_SurfaceUtils::EnsureSurfDeriv< + Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myD2v); + } + + //! Returns the second UV cross-derivative. + //! The derivative is computed if it has not been yet. + const gp_Vec& DUV() + { + return LProp_SurfaceUtils::EnsureSurfDeriv< + Access>(mySurf, myU, myV, myDerOrder, 2, myPnt, myD1u, myD1v, myD2u, myD2v, myDuv, myDuv); + } + + //! returns True if the U tangent is defined. + //! For example, the tangent is not defined if the + //! two first U derivatives are null. + bool IsTangentUDefined() + { + return LProp_SurfaceUtils::IsTangentUDefined(*this, + myCN, + myLinTol, + mySignificantFirstDerivativeOrderU, + myUTangentStatus); + } + + //! Returns the tangent direction on the iso-V. + void TangentU(gp_Dir& D) + { + LProp_SurfaceUtils::TangentU(*this, + mySurf, + myU, + myV, + myD1u, + myD2u, + mySignificantFirstDerivativeOrderU, + D); + } + + //! returns if the V tangent is defined. + //! For example, the tangent is not defined if the + //! two first V derivatives are null. + bool IsTangentVDefined() + { + return LProp_SurfaceUtils::IsTangentVDefined(*this, + myCN, + myLinTol, + mySignificantFirstDerivativeOrderV, + myVTangentStatus); + } + + //! Returns the tangent direction on the iso-V. + void TangentV(gp_Dir& D) + { + LProp_SurfaceUtils::TangentV(*this, + mySurf, + myU, + myV, + myD1v, + myD2v, + mySignificantFirstDerivativeOrderV, + D); + } + + //! Tells if the normal is defined. + bool IsNormalDefined() + { + return LProp_SurfaceUtils::IsNormalDefined(myD1u, myD1v, myLinTol, myNormal, myNormalStatus); + } + + //! Returns the normal direction. + const gp_Dir& Normal() { return LProp_SurfaceUtils::Normal(*this, myNormal); } + + //! returns True if the curvature is defined. + bool IsCurvatureDefined() + { + return LProp_SurfaceUtils::IsCurvatureDefined(*this, + myCN, + myDerOrder, + myD1u, + myD1v, + myD2u, + myD2v, + myDuv, + myNormal, + myMinCurv, + myMaxCurv, + myDirMinCurv, + myDirMaxCurv, + myMeanCurv, + myGausCurv, + myCurvatureStatus); + } + + //! returns True if the point is umbilic (i.e. if the + //! curvature is constant). + bool IsUmbilic() { return LProp_SurfaceUtils::IsUmbilic(*this, myMaxCurv, myMinCurv); } + + //! Returns the maximum curvature + double MaxCurvature() { return LProp_SurfaceUtils::RequireCurvature(*this, myMaxCurv); } + + //! Returns the minimum curvature + double MinCurvature() { return LProp_SurfaceUtils::RequireCurvature(*this, myMinCurv); } + + //! Returns the direction of the maximum and minimum curvature + //! and + void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD) + { + LProp_SurfaceUtils::CurvatureDirections(*this, myDirMaxCurv, myDirMinCurv, MaxD, MinD); + } + + //! Returns the mean curvature. + double MeanCurvature() { return LProp_SurfaceUtils::RequireCurvature(*this, myMeanCurv); } + + //! Returns the Gaussian curvature + double GaussianCurvature() { return LProp_SurfaceUtils::RequireCurvature(*this, myGausCurv); } + +private: + SurfaceType mySurf; + double myU; + double myV; + int myDerOrder; + int myCN; + double myLinTol; + gp_Pnt myPnt; + gp_Vec myD1u; + gp_Vec myD1v; + gp_Vec myD2u; + gp_Vec myD2v; + gp_Vec myDuv; + gp_Dir myNormal; + double myMinCurv = 0.0; + double myMaxCurv = 0.0; + gp_Dir myDirMinCurv; + gp_Dir myDirMaxCurv; + double myMeanCurv = 0.0; + double myGausCurv = 0.0; + int mySignificantFirstDerivativeOrderU = 0; + int mySignificantFirstDerivativeOrderV = 0; + LProp_Status myUTangentStatus; + LProp_Status myVTangentStatus; + LProp_Status myNormalStatus; + LProp_Status myCurvatureStatus; +}; + +//! Default surface local properties class using occ::handle. +using GeomLProp_SLProps = GeomLProp_SLPropsBase>; + +#endif // _GeomLProp_SLProps_HeaderFile diff --git a/src/ModelingData/TKG2d/LProp/LProp_SurfaceUtils.pxx b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SurfaceUtils.hxx similarity index 82% rename from src/ModelingData/TKG2d/LProp/LProp_SurfaceUtils.pxx rename to src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SurfaceUtils.hxx index 11f3985071..a7a1bc0aa7 100644 --- a/src/ModelingData/TKG2d/LProp/LProp_SurfaceUtils.pxx +++ b/src/ModelingData/TKGeomBase/GeomLProp/GeomLProp_SurfaceUtils.hxx @@ -11,8 +11,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _LProp_SurfaceUtils_HeaderFile -#define _LProp_SurfaceUtils_HeaderFile +#ifndef _GeomLProp_SurfaceUtils_HeaderFile +#define _GeomLProp_SurfaceUtils_HeaderFile #include #include @@ -246,6 +246,7 @@ inline bool FindSurfTangentOrder(const gp_Vec& theD1, } } + theStatus = LProp_Undefined; return false; } @@ -403,6 +404,10 @@ inline bool ComputeSurfCurvatures(const gp_Vec& theD1u, if (aMaxABC < RealEpsilon()) { // Umbilic point + if (aG < RealEpsilon()) + { + return false; + } theMinCurv = aN / aG; theMaxCurv = theMinCurv; theDirMin = gp_Dir(theD1u); @@ -477,22 +482,6 @@ inline bool ComputeSurfCurvatures(const gp_Vec& theD1u, // ==================== Higher-Level Method Wrappers ==================== //! SetParameters: sets parameters, evaluates derivatives, resets all statuses. -//! @param[in,out] theSurf surface object -//! @param[in] theU U parameter value -//! @param[in] theV V parameter value -//! @param[out] theStoredU stored U parameter field -//! @param[out] theStoredV stored V parameter field -//! @param[in] theDerOrder current derivative order -//! @param[out] thePnt evaluated point -//! @param[out] theD1u first U derivative -//! @param[out] theD1v first V derivative -//! @param[out] theD2u second U derivative -//! @param[out] theD2v second V derivative -//! @param[out] theDuv mixed UV derivative -//! @param[out] theUTanSt U tangent status -//! @param[out] theVTanSt V tangent status -//! @param[out] theNormSt normal status -//! @param[out] theCurvSt curvature status template void SetParameters(Surface& theSurf, double theU, @@ -522,19 +511,6 @@ void SetParameters(Surface& theSurf, } //! Ensure surface derivatives up to the required order. Returns the specified result field. -//! @param[in,out] theSurf surface object -//! @param[in] theU U parameter value -//! @param[in] theV V parameter value -//! @param[in,out] theDerOrder current derivative order (upgraded if needed) -//! @param[in] theRequired required derivative order -//! @param[out] thePnt evaluated point -//! @param[out] theD1u first U derivative -//! @param[out] theD1v first V derivative -//! @param[out] theD2u second U derivative -//! @param[out] theD2v second V derivative -//! @param[out] theDuv mixed UV derivative -//! @param[in] theResult reference to the specific derivative field to return -//! @return const reference to theResult template const gp_Vec& EnsureSurfDeriv(Surface& theSurf, double theU, @@ -559,12 +535,6 @@ const gp_Vec& EnsureSurfDeriv(Surface& theSurf, } //! IsTangentUDefined: checks U tangent status, then searches via D1U/D2U. -//! @param[in,out] theProps SLProps object -//! @param[in] theCN continuity order -//! @param[in] theLinTol linear tolerance -//! @param[out] theSigOrder order of first significant derivative -//! @param[in,out] theTanStatus U tangent status field -//! @return true if U tangent is defined template bool IsTangentUDefined(Props& theProps, int theCN, @@ -585,12 +555,6 @@ bool IsTangentUDefined(Props& theProps, } //! IsTangentVDefined: checks V tangent status, then searches via D1V/D2V. -//! @param[in,out] theProps SLProps object -//! @param[in] theCN continuity order -//! @param[in] theLinTol linear tolerance -//! @param[out] theSigOrder order of first significant derivative -//! @param[in,out] theTanStatus V tangent status field -//! @return true if V tangent is defined template bool IsTangentVDefined(Props& theProps, int theCN, @@ -611,14 +575,6 @@ bool IsTangentVDefined(Props& theProps, } //! TangentU: checks IsTangentUDefined, then computes U tangent direction. -//! @param[in,out] theProps SLProps object -//! @param[in,out] theSurf surface object -//! @param[in] theU current U parameter -//! @param[in] theV current V parameter -//! @param[in] theD1u first U derivative -//! @param[in] theD2u second U derivative -//! @param[in] theSigOrder order of first significant derivative -//! @param[out] theDir computed tangent direction template void TangentU(Props& theProps, Surface& theSurf, @@ -635,14 +591,6 @@ void TangentU(Props& theProps, } //! TangentV: checks IsTangentVDefined, then computes V tangent direction. -//! @param[in,out] theProps SLProps object -//! @param[in,out] theSurf surface object -//! @param[in] theU current U parameter -//! @param[in] theV current V parameter -//! @param[in] theD1v first V derivative -//! @param[in] theD2v second V derivative -//! @param[in] theSigOrder order of first significant derivative -//! @param[out] theDir computed tangent direction template void TangentV(Props& theProps, Surface& theSurf, @@ -659,12 +607,6 @@ void TangentV(Props& theProps, } //! IsNormalDefined: checks normal status, then computes via CSLib. -//! @param[in] theD1u first U derivative -//! @param[in] theD1v first V derivative -//! @param[in] theLinTol linear tolerance -//! @param[out] theNormal computed normal direction -//! @param[in,out] theNormStatus normal status field -//! @return true if normal is defined inline bool IsNormalDefined(const gp_Vec& theD1u, const gp_Vec& theD1v, double theLinTol, @@ -685,9 +627,6 @@ inline bool IsNormalDefined(const gp_Vec& theD1u, } //! Normal: checks IsNormalDefined (via theProps), then returns normal. -//! @param[in,out] theProps SLProps object -//! @param[in] theNormal normal direction field -//! @return const reference to theNormal template const gp_Dir& Normal(Props& theProps, const gp_Dir& theNormal) { @@ -698,23 +637,6 @@ const gp_Dir& Normal(Props& theProps, const gp_Dir& theNormal) //! IsCurvatureDefined: full check including continuity, normal, tangents, and curvature //! computation. -//! @param[in,out] theProps SLProps object -//! @param[in] theCN continuity order -//! @param[in,out] theDerOrder current derivative order -//! @param[in] theD1u first U derivative -//! @param[in] theD1v first V derivative -//! @param[in] theD2u second U derivative -//! @param[in] theD2v second V derivative -//! @param[in] theDuv mixed UV derivative -//! @param[in] theNormal surface normal -//! @param[out] theMinCurv minimum principal curvature -//! @param[out] theMaxCurv maximum principal curvature -//! @param[out] theDirMin direction of minimum curvature -//! @param[out] theDirMax direction of maximum curvature -//! @param[out] theMeanCurv mean curvature -//! @param[out] theGausCurv Gaussian curvature -//! @param[in,out] theCurvStatus curvature status field -//! @return true if curvature is defined template bool IsCurvatureDefined(Props& theProps, int theCN, @@ -775,9 +697,6 @@ bool IsCurvatureDefined(Props& theProps, } //! Require curvature to be defined, throw if not. Returns the given value. -//! @param[in,out] theProps SLProps object -//! @param[in] theValue curvature value to return -//! @return theValue if curvature is defined template double RequireCurvature(Props& theProps, double theValue) { @@ -787,10 +706,6 @@ double RequireCurvature(Props& theProps, double theValue) } //! IsUmbilic: checks curvature, then compares min/max. -//! @param[in,out] theProps SLProps object -//! @param[in] theMaxCurv maximum curvature value -//! @param[in] theMinCurv minimum curvature value -//! @return true if the point is umbilic template bool IsUmbilic(Props& theProps, double theMaxCurv, double theMinCurv) { @@ -800,11 +715,6 @@ bool IsUmbilic(Props& theProps, double theMaxCurv, double theMinCurv) } //! CurvatureDirections: checks curvature, then returns max/min directions. -//! @param[in,out] theProps SLProps object -//! @param[in] theDirMax direction of maximum curvature field -//! @param[in] theDirMin direction of minimum curvature field -//! @param[out] theMax output maximum curvature direction -//! @param[out] theMin output minimum curvature direction template void CurvatureDirections(Props& theProps, const gp_Dir& theDirMax, @@ -820,4 +730,4 @@ void CurvatureDirections(Props& theProps, } // namespace LProp_SurfaceUtils -#endif // _LProp_SurfaceUtils_HeaderFile +#endif // _GeomLProp_SurfaceUtils_HeaderFile diff --git a/src/ModelingData/TKG2d/LProp/FILES.cmake b/src/ModelingData/TKGeomBase/LProp/FILES.cmake similarity index 81% rename from src/ModelingData/TKG2d/LProp/FILES.cmake rename to src/ModelingData/TKGeomBase/LProp/FILES.cmake index df446d75a0..d3799242d5 100644 --- a/src/ModelingData/TKG2d/LProp/FILES.cmake +++ b/src/ModelingData/TKGeomBase/LProp/FILES.cmake @@ -6,10 +6,11 @@ set(OCCT_LProp_FILES LProp_AnalyticCurInf.hxx LProp_BadContinuity.hxx LProp_CIType.hxx + LProp_CLProps3d.hxx LProp_CurAndInf.cxx LProp_CurAndInf.hxx - LProp_CurveUtils.pxx + LProp_CurveUtils.hxx LProp_NotDefined.hxx - LProp_SurfaceUtils.pxx + LProp_SLProps3d.hxx LProp_Status.hxx ) diff --git a/src/ModelingData/TKG2d/LProp/LProp_AnalyticCurInf.cxx b/src/ModelingData/TKGeomBase/LProp/LProp_AnalyticCurInf.cxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_AnalyticCurInf.cxx rename to src/ModelingData/TKGeomBase/LProp/LProp_AnalyticCurInf.cxx diff --git a/src/ModelingData/TKG2d/LProp/LProp_AnalyticCurInf.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_AnalyticCurInf.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_AnalyticCurInf.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_AnalyticCurInf.hxx diff --git a/src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_BadContinuity.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_BadContinuity.hxx diff --git a/src/ModelingData/TKG2d/LProp/LProp_CIType.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_CIType.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_CIType.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_CIType.hxx diff --git a/src/ModelingData/TKGeomBase/LProp/LProp_CLProps3d.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_CLProps3d.hxx new file mode 100644 index 0000000000..af2940cba2 --- /dev/null +++ b/src/ModelingData/TKGeomBase/LProp/LProp_CLProps3d.hxx @@ -0,0 +1,25 @@ +// Created on: 2002-08-02 +// Created by: Alexander KARTOMIN (akm) +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _LProp_CLProps3d_HeaderFile +#define _LProp_CLProps3d_HeaderFile + +#include +#include + +//! Alias for curve local properties using Adaptor3d_Curve interface. +using LProp_CLProps3d = GeomLProp_CLPropsBase>; + +#endif // _LProp_CLProps3d_HeaderFile diff --git a/src/ModelingData/TKG2d/LProp/LProp_CurAndInf.cxx b/src/ModelingData/TKGeomBase/LProp/LProp_CurAndInf.cxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_CurAndInf.cxx rename to src/ModelingData/TKGeomBase/LProp/LProp_CurAndInf.cxx diff --git a/src/ModelingData/TKG2d/LProp/LProp_CurAndInf.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_CurAndInf.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_CurAndInf.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_CurAndInf.hxx diff --git a/src/ModelingData/TKG2d/LProp/LProp_CurveUtils.pxx b/src/ModelingData/TKGeomBase/LProp/LProp_CurveUtils.hxx similarity index 99% rename from src/ModelingData/TKG2d/LProp/LProp_CurveUtils.pxx rename to src/ModelingData/TKGeomBase/LProp/LProp_CurveUtils.hxx index 06e9729014..c1ab8f4f82 100644 --- a/src/ModelingData/TKG2d/LProp/LProp_CurveUtils.pxx +++ b/src/ModelingData/TKGeomBase/LProp/LProp_CurveUtils.hxx @@ -359,6 +359,9 @@ bool IsTangentDefined(Props& theProps, case 3: aV = theProps.D3(); break; + default: + theTanStatus = LProp_Undefined; + return false; } if (aV.SquareMagnitude() > aTolSq) { diff --git a/src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_NotDefined.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_NotDefined.hxx diff --git a/src/ModelingData/TKGeomBase/LProp/LProp_SLProps3d.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_SLProps3d.hxx new file mode 100644 index 0000000000..209c292ebf --- /dev/null +++ b/src/ModelingData/TKGeomBase/LProp/LProp_SLProps3d.hxx @@ -0,0 +1,25 @@ +// Created on: 2002-08-02 +// Created by: Alexander KARTOMIN (akm) +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _LProp_SLProps3d_HeaderFile +#define _LProp_SLProps3d_HeaderFile + +#include +#include + +//! Alias for surface local properties using Adaptor3d_Surface interface. +using LProp_SLProps3d = GeomLProp_SLPropsBase>; + +#endif // _LProp_SLProps3d_HeaderFile diff --git a/src/ModelingData/TKG2d/LProp/LProp_Status.hxx b/src/ModelingData/TKGeomBase/LProp/LProp_Status.hxx similarity index 100% rename from src/ModelingData/TKG2d/LProp/LProp_Status.hxx rename to src/ModelingData/TKGeomBase/LProp/LProp_Status.hxx diff --git a/src/ModelingData/TKGeomBase/PACKAGES.cmake b/src/ModelingData/TKGeomBase/PACKAGES.cmake index 22a6274e02..e1d22afe51 100644 --- a/src/ModelingData/TKGeomBase/PACKAGES.cmake +++ b/src/ModelingData/TKGeomBase/PACKAGES.cmake @@ -23,4 +23,7 @@ set(OCCT_TKGeomBase_LIST_OF_PACKAGES GC GCE2d gce + LProp + GeomLProp + GProp ) diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectOnPlane.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectOnPlane.cxx index 2d465196a2..3fd03a4bb4 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectOnPlane.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectOnPlane.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include @@ -268,7 +268,7 @@ class ProjLib_MaxCurvature : public math_Function { public: - ProjLib_MaxCurvature(LProp3d_CLProps& theProps) + ProjLib_MaxCurvature(LProp_CLProps3d& theProps) : myProps(&theProps) { } @@ -281,7 +281,7 @@ public: } private: - LProp3d_CLProps* myProps; + LProp_CLProps3d* myProps; }; //=====================================================================// @@ -1381,7 +1381,7 @@ bool ProjLib_ProjectOnPlane::BuildParabolaByApex(occ::handle& theGeo // copy of instance; occ::handle aProjCrv = ShallowCopy(); myType = aCurType; - LProp3d_CLProps aProps(aProjCrv, 2, Precision::Confusion()); + LProp_CLProps3d aProps(aProjCrv, 2, Precision::Confusion()); ProjLib_MaxCurvature aMaxCur(aProps); math_BrentMinimum aSolver(Precision::PConfusion()); aSolver.Perform(aMaxCur, -10. * aF, 0., 10. * aF); @@ -1439,7 +1439,7 @@ bool ProjLib_ProjectOnPlane::BuildHyperbolaByApex(occ::handle& theGe occ::handle aProjCrv = ShallowCopy(); myType = aCurType; // Searching hyperbola apex as point with maximal curvature - LProp3d_CLProps aProps(aProjCrv, 2, Precision::Confusion()); + LProp_CLProps3d aProps(aProjCrv, 2, Precision::Confusion()); ProjLib_MaxCurvature aMaxCur(aProps); math_BrentMinimum aSolver(Precision::PConfusion()); aSolver.Perform(aMaxCur, -5., 0., 5.);