diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx index fbfa44f75c..41f8d85b6c 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx @@ -990,12 +990,12 @@ void HLRBRep_Data::InitEdge(const Standard_Integer FI, BRepTopAdaptor_MapOfShape iFaceBack = iFaceData->Back(); iFaceSimp = iFaceData->Simple(); iFaceMinMax = &iFaceData->Wires()->MinMax(); - iFaceType = ((HLRBRep_Surface*)iFaceGeom)->GetType(); + iFaceType = iFaceGeom->GetType(); iFaceTest = !iFaceSimp; mySLProps.SetSurface(iFaceGeom); myIntersector.Load(iFaceGeom); - HLRBRep_Surface* p1 = (HLRBRep_Surface*)iFaceGeom; + HLRBRep_Surface* p1 = iFaceGeom; const BRepAdaptor_Surface& bras = p1->Surface(); const TopoDS_Face& topodsface = bras.Face(); @@ -1144,7 +1144,7 @@ void HLRBRep_Data::NextEdge(const Standard_Boolean skip) NextEdge(); return; } - if (((HLRBRep_Surface*)iFaceGeom)->IsAbove(iFaceBack, myLEGeom, (Standard_Real)myLETol)) + if (iFaceGeom->IsAbove(iFaceBack, myLEGeom, (Standard_Real)myLETol)) { NextEdge(); return; @@ -2109,19 +2109,19 @@ q1,(q2>32768)? (32768-q2) : q2,q&0x80008000); } wLim -= TolZ; Standard_Real PeriodU, PeriodV, UMin = 0., UMax = 0., VMin = 0., VMax = 0.; - if (((HLRBRep_Surface*)iFaceGeom)->IsUPeriodic()) + if (iFaceGeom->IsUPeriodic()) { - PeriodU = ((HLRBRep_Surface*)iFaceGeom)->UPeriod(); - UMin = ((HLRBRep_Surface*)iFaceGeom)->FirstUParameter(); - UMax = ((HLRBRep_Surface*)iFaceGeom)->LastUParameter(); + PeriodU = iFaceGeom->UPeriod(); + UMin = iFaceGeom->FirstUParameter(); + UMax = iFaceGeom->LastUParameter(); } else PeriodU = 0.; - if (((HLRBRep_Surface*)iFaceGeom)->IsVPeriodic()) + if (iFaceGeom->IsVPeriodic()) { - PeriodV = ((HLRBRep_Surface*)iFaceGeom)->VPeriod(); - VMin = ((HLRBRep_Surface*)iFaceGeom)->FirstVParameter(); - VMax = ((HLRBRep_Surface*)iFaceGeom)->LastVParameter(); + PeriodV = iFaceGeom->VPeriod(); + VMin = iFaceGeom->FirstVParameter(); + VMax = iFaceGeom->LastVParameter(); } else PeriodV = 0; @@ -2503,10 +2503,10 @@ Standard_Boolean HLRBRep_Data::SameVertex(const Standard_Boolean h1, const Stand Standard_Boolean HLRBRep_Data::IsBadFace() const { - if (iFaceGeom) + if (iFaceGeom != nullptr) { // check for garbage data - if periodic then bounds must not exceed period - HLRBRep_Surface* pGeom = (HLRBRep_Surface*)iFaceGeom; + HLRBRep_Surface* pGeom = iFaceGeom; if (pGeom->IsUPeriodic()) { Standard_Real aPeriod = pGeom->UPeriod(); diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.hxx index 31c6fc7621..8fd76bad55 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.hxx @@ -45,6 +45,7 @@ class BRepTopAdaptor_TopolTool; class gp_Dir2d; class HLRBRep_EdgeData; class HLRBRep_FaceData; +class HLRBRep_Surface; class IntRes2d_IntersectionPoint; class TableauRejection; @@ -241,7 +242,7 @@ private: HLRBRep_FaceIterator myFaceItr2; Standard_Integer iFace; HLRBRep_FaceData* iFaceData; - Standard_Address iFaceGeom; + HLRBRep_Surface* iFaceGeom; HLRAlgo_EdgesBlock::MinMaxIndices* iFaceMinMax; GeomAbs_SurfaceType iFaceType; Standard_Boolean iFaceBack; diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.cxx index 97e76fbadf..d393df6382 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.cxx @@ -38,10 +38,12 @@ #include "../../TKGeomAlgo/IntCurveSurface/IntCurveSurface_Inter.pxx" +#include + // Type aliases for readability using TheCurve = gp_Lin; using TheCurveTool = HLRBRep_LineTool; -using TheSurface = Standard_Address; +using TheSurface = HLRBRep_Surface*; using TheSurfaceTool = HLRBRep_SurfaceTool; using ThePolygon = HLRBRep_ThePolygonOfInterCSurf; using ThePolyhedron = HLRBRep_ThePolyhedronOfInterCSurf; @@ -56,7 +58,7 @@ HLRBRep_InterCSurf::HLRBRep_InterCSurf() {} //================================================================================================== -void HLRBRep_InterCSurf::DoSurface(const TheSurface& surface, +void HLRBRep_InterCSurf::DoSurface(TheSurface surface, const Standard_Real u0, const Standard_Real u1, const Standard_Real v0, @@ -77,7 +79,7 @@ void HLRBRep_InterCSurf::DoSurface(const TheSurface& surface, //================================================================================================== -void HLRBRep_InterCSurf::DoNewBounds(const TheSurface& surface, +void HLRBRep_InterCSurf::DoNewBounds(TheSurface surface, const Standard_Real u0, const Standard_Real u1, const Standard_Real v0, @@ -102,25 +104,25 @@ void HLRBRep_InterCSurf::DoNewBounds(const TheSurface& surface, //================================================================================================== -void HLRBRep_InterCSurf::Perform(const TheCurve& curve, const TheSurface& surface) +void HLRBRep_InterCSurf::Perform(const TheCurve& curve, TheSurface surface) { IntCurveSurface_InterImpl::Perform( curve, surface, done, [this]() { this->ResetFields(); }, - [this](const TheCurve& c, - const TheSurface& s, - Standard_Real u0, - Standard_Real v0, - Standard_Real u1, - Standard_Real v1) { this->Perform(c, s, u0, v0, u1, v1); }); + [this](const TheCurve& c, + TheSurface s, + Standard_Real u0, + Standard_Real v0, + Standard_Real u1, + Standard_Real v1) { this->Perform(c, s, u0, v0, u1, v1); }); } //================================================================================================== void HLRBRep_InterCSurf::Perform(const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, @@ -134,28 +136,28 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, V1, U2, V2, - [this](const auto& conic, - const TheCurve& c, - const TheSurface& s, - Standard_Real u1, - Standard_Real v1, - Standard_Real u2, - Standard_Real v2) { this->PerformConicSurf(conic, c, s, u1, v1, u2, v2); }, + [this](const auto& conic, + const TheCurve& c, + TheSurface s, + Standard_Real u1, + Standard_Real v1, + Standard_Real u2, + Standard_Real v2) { this->PerformConicSurf(conic, c, s, u1, v1, u2, v2); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, Standard_Real u1, Standard_Real v1, Standard_Real u2, Standard_Real v2) { this->InternalPerform(c, p, s, u1, v1, u2, v2); }, - [this](const TheCurve& c, const TheSurface& s) { this->InternalPerformCurveQuadric(c, s); }); + [this](const TheCurve& c, TheSurface s) { this->InternalPerformCurveQuadric(c, s); }); } //================================================================================================== void HLRBRep_InterCSurf::Perform(const TheCurve& curve, const ThePolygon& polygon, - const TheSurface& surface) + TheSurface surface) { IntCurveSurface_InterImpl:: PerformPolygon( @@ -164,7 +166,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, surface, done, [this]() { this->ResetFields(); }, - [this](const TheCurve& c, const ThePolygon& p, const TheSurface& s, const ThePolyhedron& ph) { + [this](const TheCurve& c, const ThePolygon& p, TheSurface s, const ThePolyhedron& ph) { this->Perform(c, p, s, ph); }); } @@ -172,7 +174,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, //================================================================================================== void HLRBRep_InterCSurf::Perform(const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const ThePolyhedron& polyhedron) { IntCurveSurface_InterImpl::PerformPolyhedronResetFields(); }, - [this](const TheCurve& c, const ThePolygon& p, const TheSurface& s, const ThePolyhedron& ph) { + [this](const TheCurve& c, const ThePolygon& p, TheSurface s, const ThePolyhedron& ph) { this->Perform(c, p, s, ph); }); } @@ -195,7 +197,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, void HLRBRep_InterCSurf::Perform(const TheCurve& curve, const ThePolygon& polygon, - const TheSurface& surface, + TheSurface surface, const ThePolyhedron& polyhedron) { IntCurveSurface_InterImpl::PerformPolygonPolyhedronResetFields(); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, const ThePolyhedron& ph, Standard_Real u1, Standard_Real v1, @@ -224,7 +226,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, void HLRBRep_InterCSurf::Perform(const TheCurve& curve, const ThePolygon& polygon, - const TheSurface& surface, + TheSurface surface, const ThePolyhedron& polyhedron, Bnd_BoundSortBox& BndBSB) { @@ -243,7 +245,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, [this]() { this->ResetFields(); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, const ThePolyhedron& ph, Standard_Real u1, Standard_Real v1, @@ -256,7 +258,7 @@ void HLRBRep_InterCSurf::Perform(const TheCurve& curve, void HLRBRep_InterCSurf::InternalPerform(const TheCurve& curve, const ThePolygon& polygon, - const TheSurface& surface, + TheSurface surface, const ThePolyhedron& polyhedron, const Standard_Real u0, const Standard_Real v0, @@ -289,7 +291,7 @@ void HLRBRep_InterCSurf::InternalPerform(const TheCurve& curve, void HLRBRep_InterCSurf::InternalPerform(const TheCurve& curve, const ThePolygon& polygon, - const TheSurface& surface, + TheSurface surface, const ThePolyhedron& polyhedron, const Standard_Real u0, const Standard_Real v0, @@ -318,8 +320,7 @@ void HLRBRep_InterCSurf::InternalPerform(const TheCurve& curve, //================================================================================================== -void HLRBRep_InterCSurf::InternalPerformCurveQuadric(const TheCurve& curve, - const TheSurface& surface) +void HLRBRep_InterCSurf::InternalPerformCurveQuadric(const TheCurve& curve, TheSurface surface) { IntCurveSurface_InterImpl::InternalPerformCurveQuadricAppendIntAna(c, s, ana); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, const ThePolyhedron& ph, Standard_Real u1, Standard_Real v1, @@ -407,7 +408,7 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Lin& Line, void HLRBRep_InterCSurf::PerformConicSurf(const gp_Circ& Circle, const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, @@ -422,12 +423,12 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Circ& Circle, V1, U2, V2, - [this](const TheCurve& c, const TheSurface& s, const IntAna_IntConicQuad& ana) { + [this](const TheCurve& c, TheSurface s, const IntAna_IntConicQuad& ana) { this->AppendIntAna(c, s, ana); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, Standard_Real u1, Standard_Real v1, Standard_Real u2, @@ -438,7 +439,7 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Circ& Circle, void HLRBRep_InterCSurf::PerformConicSurf(const gp_Elips& Ellipse, const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, @@ -453,12 +454,12 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Elips& Ellipse, V1, U2, V2, - [this](const TheCurve& c, const TheSurface& s, const IntAna_IntConicQuad& ana) { + [this](const TheCurve& c, TheSurface s, const IntAna_IntConicQuad& ana) { this->AppendIntAna(c, s, ana); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, Standard_Real u1, Standard_Real v1, Standard_Real u2, @@ -469,7 +470,7 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Elips& Ellipse, void HLRBRep_InterCSurf::PerformConicSurf(const gp_Parab& Parab, const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, @@ -488,12 +489,12 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Parab& Parab, V1, U2, V2, - [this](const TheCurve& c, const TheSurface& s, const IntAna_IntConicQuad& ana) { + [this](const TheCurve& c, TheSurface s, const IntAna_IntConicQuad& ana) { this->AppendIntAna(c, s, ana); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, const ThePolyhedron& ph, Standard_Real u1, Standard_Real v1, @@ -505,7 +506,7 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Parab& Parab, void HLRBRep_InterCSurf::PerformConicSurf(const gp_Hypr& Hypr, const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, @@ -524,12 +525,12 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Hypr& Hypr, V1, U2, V2, - [this](const TheCurve& c, const TheSurface& s, const IntAna_IntConicQuad& ana) { + [this](const TheCurve& c, TheSurface s, const IntAna_IntConicQuad& ana) { this->AppendIntAna(c, s, ana); }, [this](const TheCurve& c, const ThePolygon& p, - const TheSurface& s, + TheSurface s, const ThePolyhedron& ph, Standard_Real u1, Standard_Real v1, @@ -540,7 +541,7 @@ void HLRBRep_InterCSurf::PerformConicSurf(const gp_Hypr& Hypr, //================================================================================================== void HLRBRep_InterCSurf::AppendIntAna(const TheCurve& curve, - const TheSurface& surface, + TheSurface surface, const IntAna_IntConicQuad& intana_ConicQuad) { IntCurveSurface_InterImpl::AppendIntAna( @@ -555,7 +556,7 @@ void HLRBRep_InterCSurf::AppendIntAna(const TheCurve& curve, void HLRBRep_InterCSurf::AppendPoint(const TheCurve& curve, const Standard_Real lw, - const TheSurface& surface, + TheSurface surface, const Standard_Real su, const Standard_Real sv) { @@ -577,7 +578,7 @@ void HLRBRep_InterCSurf::AppendPoint(const TheCurve& curve, void HLRBRep_InterCSurf::AppendSegment(const TheCurve&, const Standard_Real, const Standard_Real, - const TheSurface&) + TheSurface) { // Not implemented } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.hxx index e772e756c5..d1b7e4f98b 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_InterCSurf.hxx @@ -23,25 +23,27 @@ #include #include #include + +class Bnd_BoundSortBox; +class Bnd_Box; +class gp_Circ; +class gp_Elips; +class gp_Hypr; class gp_Lin; +class gp_Parab; class HLRBRep_LineTool; +class HLRBRep_Surface; class HLRBRep_SurfaceTool; +class HLRBRep_TheCSFunctionOfInterCSurf; +class HLRBRep_TheExactInterCSurf; +class HLRBRep_TheInterferenceOfInterCSurf; class HLRBRep_ThePolygonOfInterCSurf; class HLRBRep_ThePolygonToolOfInterCSurf; class HLRBRep_ThePolyhedronOfInterCSurf; class HLRBRep_ThePolyhedronToolOfInterCSurf; -class HLRBRep_TheInterferenceOfInterCSurf; -class HLRBRep_TheCSFunctionOfInterCSurf; -class HLRBRep_TheExactInterCSurf; class HLRBRep_TheQuadCurvExactInterCSurf; class HLRBRep_TheQuadCurvFuncOfTheQuadCurvExactInterCSurf; -class Bnd_BoundSortBox; -class gp_Circ; -class gp_Elips; -class gp_Parab; -class gp_Hypr; class IntAna_IntConicQuad; -class Bnd_Box; class HLRBRep_InterCSurf : public IntCurveSurface_Intersection { @@ -53,156 +55,156 @@ public: //! Compute the Intersection between the curve and the //! surface - Standard_EXPORT void Perform(const gp_Lin& Curve, const Standard_Address& Surface); + Standard_EXPORT void Perform(const gp_Lin& theCurve, HLRBRep_Surface* theSurface); //! Compute the Intersection between the curve and //! the surface. The Curve is already sampled and - //! its polygon : is given. - Standard_EXPORT void Perform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& Polygon, - const Standard_Address& Surface); + //! its polygon : is given. + Standard_EXPORT void Perform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface); //! Compute the Intersection between the curve and //! the surface. The Curve is already sampled and - //! its polygon : is given. The Surface is - //! also sampled and is given. - Standard_EXPORT void Perform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& ThePolygon, - const Standard_Address& Surface, - const HLRBRep_ThePolyhedronOfInterCSurf& Polyhedron); + //! its polygon : is given. The Surface is + //! also sampled and is given. + Standard_EXPORT void Perform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface, + const HLRBRep_ThePolyhedronOfInterCSurf& thePolyhedron); //! Compute the Intersection between the curve and //! the surface. The Curve is already sampled and - //! its polygon : is given. The Surface is - //! also sampled and is given. - Standard_EXPORT void Perform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& ThePolygon, - const Standard_Address& Surface, - const HLRBRep_ThePolyhedronOfInterCSurf& Polyhedron, - Bnd_BoundSortBox& BndBSB); + //! its polygon : is given. The Surface is + //! also sampled and is given. + Standard_EXPORT void Perform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface, + const HLRBRep_ThePolyhedronOfInterCSurf& thePolyhedron, + Bnd_BoundSortBox& theBndBSB); //! Compute the Intersection between the curve and //! the surface. The Surface is already sampled and - //! its polyhedron : is given. - Standard_EXPORT void Perform(const gp_Lin& Curve, - const Standard_Address& Surface, - const HLRBRep_ThePolyhedronOfInterCSurf& Polyhedron); + //! its polyhedron : is given. + Standard_EXPORT void Perform(const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const HLRBRep_ThePolyhedronOfInterCSurf& thePolyhedron); protected: //! Compute the Intersection between the curve and the //! surface - Standard_EXPORT void Perform(const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U0, - const Standard_Real V0, - const Standard_Real U1, - const Standard_Real V1); + Standard_EXPORT void Perform(const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU0, + const double theV0, + const double theU1, + const double theV1); - Standard_EXPORT void InternalPerformCurveQuadric(const gp_Lin& Curve, - const Standard_Address& Surface); + Standard_EXPORT void InternalPerformCurveQuadric(const gp_Lin& theCurve, + HLRBRep_Surface* theSurface); - Standard_EXPORT void InternalPerform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& Polygon, - const Standard_Address& Surface, - const HLRBRep_ThePolyhedronOfInterCSurf& Polyhedron, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void InternalPerform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface, + const HLRBRep_ThePolyhedronOfInterCSurf& thePolyhedron, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void InternalPerform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& Polygon, - const Standard_Address& Surface, - const HLRBRep_ThePolyhedronOfInterCSurf& Polyhedron, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2, - Bnd_BoundSortBox& BSB); + Standard_EXPORT void InternalPerform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface, + const HLRBRep_ThePolyhedronOfInterCSurf& thePolyhedron, + const double theU1, + const double theV1, + const double theU2, + const double theV2, + Bnd_BoundSortBox& theBSB); - Standard_EXPORT void InternalPerform(const gp_Lin& Curve, - const HLRBRep_ThePolygonOfInterCSurf& Polygon, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void InternalPerform(const gp_Lin& theCurve, + const HLRBRep_ThePolygonOfInterCSurf& thePolygon, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void PerformConicSurf(const gp_Lin& Line, - const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void PerformConicSurf(const gp_Lin& theLine, + const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void PerformConicSurf(const gp_Circ& Circle, - const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void PerformConicSurf(const gp_Circ& theCircle, + const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void PerformConicSurf(const gp_Elips& Ellipse, - const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void PerformConicSurf(const gp_Elips& theEllipse, + const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void PerformConicSurf(const gp_Parab& Parab, - const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void PerformConicSurf(const gp_Parab& theParab, + const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void PerformConicSurf(const gp_Hypr& Hyper, - const gp_Lin& Curve, - const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void PerformConicSurf(const gp_Hypr& theHyper, + const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const double theU1, + const double theV1, + const double theU2, + const double theV2); - Standard_EXPORT void AppendIntAna(const gp_Lin& Curve, - const Standard_Address& Surface, - const IntAna_IntConicQuad& InterAna); + Standard_EXPORT void AppendIntAna(const gp_Lin& theCurve, + HLRBRep_Surface* theSurface, + const IntAna_IntConicQuad& theInterAna); - Standard_EXPORT void AppendPoint(const gp_Lin& Curve, - const Standard_Real w, - const Standard_Address& Surface, - const Standard_Real u, - const Standard_Real v); + Standard_EXPORT void AppendPoint(const gp_Lin& theCurve, + const double theW, + HLRBRep_Surface* theSurface, + const double theU, + const double theV); - Standard_EXPORT void AppendSegment(const gp_Lin& Curve, - const Standard_Real u0, - const Standard_Real u1, - const Standard_Address& Surface); + Standard_EXPORT void AppendSegment(const gp_Lin& theCurve, + const double theU0, + const double theU1, + HLRBRep_Surface* theSurface); private: - Standard_EXPORT void DoSurface(const Standard_Address& surface, - const Standard_Real u0, - const Standard_Real u1, - const Standard_Real v0, - const Standard_Real v1, - TColgp_Array2OfPnt& pntsOnSurface, - Bnd_Box& boxSurface, - Standard_Real& gap); + Standard_EXPORT void DoSurface(HLRBRep_Surface* theSurface, + const double theU0, + const double theU1, + const double theV0, + const double theV1, + TColgp_Array2OfPnt& thePntsOnSurface, + Bnd_Box& theBoxSurface, + double& theGap); - Standard_EXPORT void DoNewBounds(const Standard_Address& surface, - const Standard_Real u0, - const Standard_Real u1, - const Standard_Real v0, - const Standard_Real v1, - const TColgp_Array2OfPnt& pntsOnSurface, - const TColStd_Array1OfReal& X, - const TColStd_Array1OfReal& Y, - const TColStd_Array1OfReal& Z, - TColStd_Array1OfReal& Bounds); + Standard_EXPORT void DoNewBounds(HLRBRep_Surface* theSurface, + const double theU0, + const double theU1, + const double theV0, + const double theV1, + const TColgp_Array2OfPnt& thePntsOnSurface, + const TColStd_Array1OfReal& theX, + const TColStd_Array1OfReal& theY, + const TColStd_Array1OfReal& theZ, + TColStd_Array1OfReal& theBounds); }; #endif // _HLRBRep_InterCSurf_HeaderFile diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx index 28dfa5e38c..3ad2205db5 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,9 @@ static Standard_Integer NbIntersPointEtSegment = 0; //================================================================================================= HLRBRep_Intersector::HLRBRep_Intersector() - : myPolyhedron(NULL) + : myTypePerform(0), + mySurface(nullptr), + myPolyhedron(nullptr) { #ifdef PERF if (NbInters) @@ -86,28 +89,28 @@ HLRBRep_Intersector::HLRBRep_Intersector() //================================================================================================= -void HLRBRep_Intersector::Perform(const Standard_Address A1, - const Standard_Real da1, - const Standard_Real db1) +void HLRBRep_Intersector::Perform(HLRBRep_EdgeData* theEdge1, + const double theDa1, + const double theDb1) { #ifdef PERF NbIntersAuto++; #endif - HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*)A1)->Curve(); + HLRBRep_Curve* myC1 = theEdge1->Curve(); myTypePerform = 1; gp_Pnt2d pa, pb; //,pa1,pb1; - Standard_Real a, b, d, tol; + double a, b, d, tol; Standard_ShortReal ta, tb; - ((HLRBRep_EdgeData*)A1)->Status().Bounds(a, ta, b, tb); + theEdge1->Status().Bounds(a, ta, b, tb); d = b - a; - if (da1 != 0) - a = a + d * da1; - if (db1 != 0) - b = b - d * db1; + if (theDa1 != 0) + a = a + d * theDa1; + if (theDb1 != 0) + b = b - d * theDb1; myC1->D0(a, pa); myC1->D0(b, pb); a = myC1->Parameter2d(a); @@ -124,35 +127,35 @@ void HLRBRep_Intersector::Perform(const Standard_Address A1, //================================================================================================= -void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, - const Standard_Address A1, - const Standard_Real da1, - const Standard_Real db1, - const Standard_Integer /*nB*/, - const Standard_Address A2, - const Standard_Real da2, - const Standard_Real db2, - const Standard_Boolean EnBout) +void HLRBRep_Intersector::Perform(const int /*theNA*/, + HLRBRep_EdgeData* theEdge1, + const double theDa1, + const double theDb1, + const int /*theNB*/, + HLRBRep_EdgeData* theEdge2, + const double theDa2, + const double theDb2, + const bool theEnBout) { - // if(EnBout) { + // if(theEnBout) { // myTypePerform=43; // return; // } - HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*)A1)->Curve(); - HLRBRep_Curve* myC2 = ((HLRBRep_EdgeData*)A2)->Curve(); + HLRBRep_Curve* myC1 = theEdge1->Curve(); + HLRBRep_Curve* myC2 = theEdge2->Curve(); myTypePerform = 1; gp_Pnt2d pa1, pb1, pa2, pb2; gp_Vec2d va1, vb1, va2, vb2; - Standard_Real a1, b1, a2, b2, d, dd, tol, tol1, tol2; + double a1, b1, a2, b2, d, dd, tol, tol1, tol2; Standard_ShortReal ta, tb; // modified by jgv, 18.04.2016 for OCC27341 - // tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance()); - // tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance()); + // tol1 = theEdge1->Tolerance(); + // tol2 = theEdge2->Tolerance(); tol1 = Precision::Confusion(); tol2 = Precision::Confusion(); ////////////////////////////////////////// @@ -161,15 +164,15 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, else tol = tol2; - Standard_Boolean PasBon; - Standard_Real decalagea1 = 100.0; - Standard_Real decalagea2 = 100.0; - Standard_Real decalageb1 = 100.0; - Standard_Real decalageb2 = 100.0; + bool aPasBon; + double aDecalagea1 = 100.0; + double aDecalagea2 = 100.0; + double aDecalageb1 = 100.0; + double aDecalageb2 = 100.0; do { - PasBon = Standard_False; - ((HLRBRep_EdgeData*)A1)->Status().Bounds(a1, ta, b1, tb); //-- -> Parametres 3d + aPasBon = false; + theEdge1->Status().Bounds(a1, ta, b1, tb); //-- -> Parametres 3d Standard_Real mtol = tol; if (mtol < ta) mtol = ta; @@ -177,62 +180,62 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, mtol = tb; d = b1 - a1; - Standard_Real pdist = tol; + double pdist = tol; if (pdist < 0.0000001) pdist = 0.0000001; - if (da1 != 0) + if (theDa1 != 0) { - //-- a = a + d * da1; + //-- a = a + d * theDa1; myC1->D1(a1, pa1, va1); - Standard_Real qwe = va1.Magnitude(); + double qwe = va1.Magnitude(); if (qwe > 1e-12) { - dd = pdist * decalagea1 / qwe; + dd = pdist * aDecalagea1 / qwe; if (dd < d * 0.4) { a1 += dd; } else { - a1 += d * da1; - decalagea1 = -1; + a1 += d * theDa1; + aDecalagea1 = -1; } } else { - a1 += d * da1; - decalagea1 = -1; + a1 += d * theDa1; + aDecalagea1 = -1; } } - if (db1 != 0) + if (theDb1 != 0) { - //-- b = b - d * db1; + //-- b = b - d * theDb1; myC1->D1(b1, pb1, vb1); - Standard_Real qwe = vb1.Magnitude(); + double qwe = vb1.Magnitude(); if (qwe > 1e-12) { - dd = pdist * decalageb1 / qwe; + dd = pdist * aDecalageb1 / qwe; if (dd < d * 0.4) { b1 -= dd; } else { - b1 -= d * db1; - decalageb1 = -1; + b1 -= d * theDb1; + aDecalageb1 = -1; } } else { - b1 -= d * db1; - decalageb1 = -1; + b1 -= d * theDb1; + aDecalageb1 = -1; } } - // if(EnBout) { //-- ************************************************************ - // Standard_Real d=b1-a1; + // if(theEnBout) { //-- ************************************************************ + // double d=b1-a1; // a1+=d*0.45; // b1-=d*0.45; // } @@ -243,7 +246,7 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, a1 = myC1->Parameter2d(a1); b1 = myC1->Parameter2d(b1); - if (EnBout) + if (theEnBout) { ta = tb = -1.; } @@ -253,9 +256,9 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, if (tb > tol) tb = (Standard_ShortReal)tol; - IntRes2d_Domain D1(pa1, a1, (Standard_Real)ta, pb1, b1, (Standard_Real)tb); + IntRes2d_Domain D1(pa1, a1, (double)ta, pb1, b1, (double)tb); - ((HLRBRep_EdgeData*)A2)->Status().Bounds(a2, ta, b2, tb); + theEdge2->Status().Bounds(a2, ta, b2, tb); mtol = tol; if (mtol < ta) mtol = ta; @@ -264,58 +267,58 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, d = b2 - a2; - if (da2 != 0) + if (theDa2 != 0) { - //-- a = a + d * da2; - ((HLRBRep_Curve*)myC2)->D1(a2, pa2, va2); - Standard_Real qwe = va2.Magnitude(); + //-- a = a + d * theDa2; + myC2->D1(a2, pa2, va2); + double qwe = va2.Magnitude(); if (qwe > 1e-12) { - dd = pdist * decalagea2 / qwe; + dd = pdist * aDecalagea2 / qwe; if (dd < d * 0.4) { a2 += dd; } else { - a2 += d * da2; - decalagea2 = -1; + a2 += d * theDa2; + aDecalagea2 = -1; } } else { - a2 += d * da2; - decalagea2 = -1; + a2 += d * theDa2; + aDecalagea2 = -1; } } - if (db2 != 0) + if (theDb2 != 0) { - //-- b = b - d * db2; - ((HLRBRep_Curve*)myC2)->D1(b2, pb2, vb2); - Standard_Real qwe = vb2.Magnitude(); + //-- b = b - d * theDb2; + myC2->D1(b2, pb2, vb2); + double qwe = vb2.Magnitude(); if (qwe > 1e-12) { - dd = pdist * decalageb2 / qwe; + dd = pdist * aDecalageb2 / qwe; if (dd < d * 0.4) { b2 -= dd; } else { - b2 -= d * db2; - decalageb2 = -1; + b2 -= d * theDb2; + aDecalageb2 = -1; } } else { - b2 -= d * db2; - decalageb2 = -1; + b2 -= d * theDb2; + aDecalageb2 = -1; } } - // if(EnBout) { //-- ************************************************************ - // Standard_Real d=b2-a2; + // if(theEnBout) { //-- ************************************************************ + // double d=b2-a2; // a2+=d*0.45; // b2-=d*0.45; // } @@ -326,7 +329,7 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, a2 = myC2->Parameter2d(a2); b2 = myC2->Parameter2d(b2); - if (EnBout) + if (theEnBout) { ta = tb = -1.; } @@ -336,17 +339,17 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, if (tb > tol) tb = (Standard_ShortReal)tol; - IntRes2d_Domain D2(pa2, a2, (Standard_Real)ta, pb2, b2, (Standard_Real)tb); + IntRes2d_Domain D2(pa2, a2, (double)ta, pb2, b2, (double)tb); - if (EnBout) + if (theEnBout) { - Standard_Real a1a2 = (da1 || da2) ? pa1.Distance(pa2) : RealLast(); - Standard_Real a1b2 = (da1 || db2) ? pa1.Distance(pb2) : RealLast(); - Standard_Real b1a2 = (db1 || da2) ? pb1.Distance(pa2) : RealLast(); - Standard_Real b1b2 = (db1 || db2) ? pb1.Distance(pb2) : RealLast(); + double a1a2 = (theDa1 || theDa2) ? pa1.Distance(pa2) : RealLast(); + double a1b2 = (theDa1 || theDb2) ? pa1.Distance(pb2) : RealLast(); + double b1a2 = (theDb1 || theDa2) ? pb1.Distance(pa2) : RealLast(); + double b1b2 = (theDb1 || theDb2) ? pb1.Distance(pb2) : RealLast(); - Standard_Integer cote = 1; - Standard_Real mindist = a1a2; //-- cas 1 + int cote = 1; + double mindist = a1a2; //-- cas 1 if (mindist > a1b2) { mindist = a1b2; @@ -369,41 +372,41 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, if (mindist < tol * 1000) { - PasBon = Standard_True; + aPasBon = true; switch (cote) { case 1: { - decalagea1 *= 2; - decalagea2 *= 2; + aDecalagea1 *= 2; + aDecalagea2 *= 2; break; } case 2: { - decalagea1 *= 2; - decalageb2 *= 2; + aDecalagea1 *= 2; + aDecalageb2 *= 2; break; } case 3: { - decalageb1 *= 2; - decalagea2 *= 2; + aDecalageb1 *= 2; + aDecalagea2 *= 2; break; } default: { - decalageb1 *= 2; - decalageb2 *= 2; + aDecalageb1 *= 2; + aDecalageb2 *= 2; break; } } - if (decalagea1 < 0.0 || decalagea2 < 0.0 || decalageb1 < 0.0 || decalageb2 <= 0.0) + if (aDecalagea1 < 0.0 || aDecalagea2 < 0.0 || aDecalageb1 < 0.0 || aDecalageb2 <= 0.0) { - PasBon = Standard_False; + aPasBon = false; } } } - if (PasBon == Standard_False) + if (!aPasBon) { myIntersector.Perform(myC1, D1, myC2, D2, tol, tol); } - } while (PasBon); + } while (aPasBon); #ifdef PERF NbInters++; @@ -449,21 +452,21 @@ void HLRBRep_Intersector::Perform(const Standard_Integer /*nA*/, //================================================================================================= -void HLRBRep_Intersector::SimulateOnePoint(const Standard_Address A1, - const Standard_Real u, - const Standard_Address A2, - const Standard_Real v) +void HLRBRep_Intersector::SimulateOnePoint(HLRBRep_EdgeData* theEdge1, + const double theU, + HLRBRep_EdgeData* theEdge2, + const double theV) { #ifdef PERF NbIntersSimulate++; #endif - HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*)A1)->Curve(); - HLRBRep_Curve* myC2 = ((HLRBRep_EdgeData*)A2)->Curve(); + HLRBRep_Curve* myC1 = theEdge1->Curve(); + HLRBRep_Curve* myC2 = theEdge2->Curve(); - Standard_Real u3 = myC1->Parameter3d(u); - Standard_Real v3 = myC2->Parameter3d(v); - gp_Pnt2d P13, P23; - gp_Vec2d T13, T23; + double u3 = myC1->Parameter3d(theU); + double v3 = myC2->Parameter3d(theV); + gp_Pnt2d P13, P23; + gp_Vec2d T13, T23; myC1->D1(u3, P13, T13); myC2->D1(v3, P23, T23); @@ -473,27 +476,27 @@ void HLRBRep_Intersector::SimulateOnePoint(const Standard_Address A1, IntImpParGen::DetermineTransition(Pos1, T13, Tr1, Pos2, T23, Tr2, 0.0); myTypePerform = 0; - mySinglePoint.SetValues(P13, u, v, Tr1, Tr2, Standard_False); + mySinglePoint.SetValues(P13, theU, theV, Tr1, Tr2, false); } //================================================================================================= -void HLRBRep_Intersector::Load(Standard_Address& A) +void HLRBRep_Intersector::Load(HLRBRep_Surface* theSurface) { - mySurface = A; - if (myPolyhedron != NULL) + mySurface = theSurface; + if (myPolyhedron != nullptr) { delete myPolyhedron; - myPolyhedron = NULL; + myPolyhedron = nullptr; } } //================================================================================================= -void HLRBRep_Intersector::Perform(const gp_Lin& L, const Standard_Real P) +void HLRBRep_Intersector::Perform(const gp_Lin& L, const double P) { - myTypePerform = 2; - GeomAbs_SurfaceType typ = HLRBRep_SurfaceTool::GetType(mySurface); + myTypePerform = 2; + const GeomAbs_SurfaceType typ = HLRBRep_SurfaceTool::GetType(mySurface); switch (typ) { case GeomAbs_Plane: @@ -504,10 +507,10 @@ void HLRBRep_Intersector::Perform(const gp_Lin& L, const Standard_Real P) myCSIntersector.Perform(L, mySurface); break; default: { - if (myPolyhedron == NULL) + if (myPolyhedron == nullptr) { - Standard_Integer nbsu, nbsv; - Standard_Real u1, v1, u2, v2; + int nbsu, nbsv; + double u1, v1, u2, v2; u1 = HLRBRep_SurfaceTool::FirstUParameter(mySurface); v1 = HLRBRep_SurfaceTool::FirstVParameter(mySurface); u2 = HLRBRep_SurfaceTool::LastUParameter(mySurface); @@ -683,7 +686,7 @@ const IntCurveSurface_IntersectionSegment& HLRBRep_Intersector::CSSegment( void HLRBRep_Intersector::Destroy() { - if (myPolyhedron != NULL) + if (myPolyhedron != nullptr) delete myPolyhedron; } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.hxx index 9dc78dbafa..bad34da28d 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.hxx @@ -23,7 +23,10 @@ #include #include #include + class gp_Lin; +class HLRBRep_EdgeData; +class HLRBRep_Surface; class IntCurveSurface_IntersectionPoint; class IntRes2d_IntersectionSegment; class IntCurveSurface_IntersectionSegment; @@ -39,32 +42,32 @@ public: //! Performs the auto intersection of an edge. //! The edge domain is cut at start with da1*(b-a) and at end with db1*(b-a). - Standard_EXPORT void Perform(const Standard_Address A1, - const Standard_Real da1, - const Standard_Real db1); + Standard_EXPORT void Perform(HLRBRep_EdgeData* theEdge1, + const double theDa1, + const double theDb1); //! Performs the intersection between the two edges. //! The edges domains are cut at start with da*(b-a) and at end with db*(b-a). - Standard_EXPORT void Perform(const Standard_Integer nA, - const Standard_Address A1, - const Standard_Real da1, - const Standard_Real db1, - const Standard_Integer nB, - const Standard_Address A2, - const Standard_Real da2, - const Standard_Real db2, - const Standard_Boolean NoBound); + Standard_EXPORT void Perform(const int theNA, + HLRBRep_EdgeData* theEdge1, + const double theDa1, + const double theDb1, + const int theNB, + HLRBRep_EdgeData* theEdge2, + const double theDa2, + const double theDb2, + const bool theNoBound); - //! Create a single IntersectionPoint (U on A1) (V on A2) + //! Create a single IntersectionPoint (U on theEdge1) (V on theEdge2) //! The point is middle on both curves. - Standard_EXPORT void SimulateOnePoint(const Standard_Address A1, - const Standard_Real U, - const Standard_Address A2, - const Standard_Real V); + Standard_EXPORT void SimulateOnePoint(HLRBRep_EdgeData* theEdge1, + const double theU, + HLRBRep_EdgeData* theEdge2, + const double theV); - Standard_EXPORT void Load(Standard_Address& A); + Standard_EXPORT void Load(HLRBRep_Surface* theSurface); - Standard_EXPORT void Perform(const gp_Lin& L, const Standard_Real P); + Standard_EXPORT void Perform(const gp_Lin& theL, const double theP); Standard_EXPORT Standard_Boolean IsDone() const; @@ -87,10 +90,10 @@ public: private: IntRes2d_IntersectionPoint mySinglePoint; - Standard_Integer myTypePerform; + int myTypePerform; HLRBRep_CInter myIntersector; HLRBRep_InterCSurf myCSIntersector; - Standard_Address mySurface; + HLRBRep_Surface* mySurface; HLRBRep_ThePolyhedronOfInterCSurf* myPolyhedron; }; diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.hxx index fdd35b798b..2330574391 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.hxx @@ -50,6 +50,9 @@ public: //! Returns the 3D Surface. BRepAdaptor_Surface& Surface(); + //! Returns the 3D Surface (const version). + const BRepAdaptor_Surface& Surface() const; + //! Sets the 3D Surface to be projected. Standard_EXPORT void Surface(const TopoDS_Face& F); @@ -76,12 +79,12 @@ public: //! If necessary, breaks the surface in U intervals of //! continuity . And returns the number of //! intervals. - Standard_Integer NbUIntervals(const GeomAbs_Shape S); + Standard_Integer NbUIntervals(const GeomAbs_Shape S) const; //! If necessary, breaks the surface in V intervals of //! continuity . And returns the number of //! intervals. - Standard_Integer NbVIntervals(const GeomAbs_Shape S); + Standard_Integer NbVIntervals(const GeomAbs_Shape S) const; GeomAbs_Shape UIntervalContinuity() const; diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.lxx index 630726ff20..ad843bf107 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.lxx @@ -26,6 +26,13 @@ inline BRepAdaptor_Surface& HLRBRep_Surface::Surface() //================================================================================================= +inline const BRepAdaptor_Surface& HLRBRep_Surface::Surface() const +{ + return mySurf; +} + +//================================================================================================= + inline Standard_Real HLRBRep_Surface::FirstUParameter() const { return HLRBRep_BSurfaceTool::FirstUParameter(mySurf); @@ -68,14 +75,14 @@ inline GeomAbs_Shape HLRBRep_Surface::VContinuity() const //================================================================================================= -inline Standard_Integer HLRBRep_Surface::NbUIntervals(const GeomAbs_Shape S) +inline Standard_Integer HLRBRep_Surface::NbUIntervals(const GeomAbs_Shape S) const { return HLRBRep_BSurfaceTool::NbUIntervals(mySurf, S); } //================================================================================================= -inline Standard_Integer HLRBRep_Surface::NbVIntervals(const GeomAbs_Shape S) +inline Standard_Integer HLRBRep_Surface::NbVIntervals(const GeomAbs_Shape S) const { return HLRBRep_BSurfaceTool::NbVIntervals(mySurf, S); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx index e5ebc90a7a..e35c034feb 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx @@ -15,12 +15,14 @@ #include -#include +#include -Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S) +//================================================================================================= + +int HLRBRep_SurfaceTool::NbSamplesU(const HLRBRep_Surface* theSurf) { - Standard_Integer nbs; - GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface*)S)->GetType(); + int nbs; + const GeomAbs_SurfaceType typS = theSurf->GetType(); switch (typS) { case GeomAbs_Plane: { @@ -28,12 +30,12 @@ Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S) } break; case GeomAbs_BezierSurface: { - nbs = 3 + ((BRepAdaptor_Surface*)S)->NbUPoles(); + nbs = 3 + theSurf->NbUPoles(); } break; case GeomAbs_BSplineSurface: { - nbs = ((BRepAdaptor_Surface*)S)->NbUKnots(); - nbs *= ((BRepAdaptor_Surface*)S)->UDegree(); + nbs = theSurf->NbUKnots(); + nbs *= theSurf->UDegree(); if (nbs < 2) nbs = 2; } @@ -56,13 +58,15 @@ Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S) } break; } - return (nbs); + return nbs; } -Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S) +//================================================================================================= + +int HLRBRep_SurfaceTool::NbSamplesV(const HLRBRep_Surface* theSurf) { - Standard_Integer nbs; - GeomAbs_SurfaceType typS = ((BRepAdaptor_Surface*)S)->GetType(); + int nbs; + const GeomAbs_SurfaceType typS = theSurf->GetType(); switch (typS) { case GeomAbs_Plane: { @@ -70,12 +74,12 @@ Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S) } break; case GeomAbs_BezierSurface: { - nbs = 3 + ((BRepAdaptor_Surface*)S)->NbVPoles(); + nbs = 3 + theSurf->NbVPoles(); } break; case GeomAbs_BSplineSurface: { - nbs = ((BRepAdaptor_Surface*)S)->NbVKnots(); - nbs *= ((BRepAdaptor_Surface*)S)->VDegree(); + nbs = theSurf->NbVKnots(); + nbs *= theSurf->VDegree(); if (nbs < 2) nbs = 2; } @@ -95,43 +99,47 @@ Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S) } break; } - return (nbs); + return nbs; } -Standard_Integer HLRBRep_SurfaceTool::NbSamplesU(const Standard_Address S, - const Standard_Real u1, - const Standard_Real u2) +//================================================================================================= + +int HLRBRep_SurfaceTool::NbSamplesU(const HLRBRep_Surface* theSurf, + const double theU1, + const double theU2) { - Standard_Integer nbs = NbSamplesU(S); - Standard_Integer n = nbs; + int nbs = NbSamplesU(theSurf); + int n = nbs; if (nbs > 10) { - Standard_Real uf = FirstUParameter(S); - Standard_Real ul = LastUParameter(S); - n *= (Standard_Integer)((u2 - u1) / (uf - ul)); + const double uf = FirstUParameter(theSurf); + const double ul = LastUParameter(theSurf); + n *= (int)((theU2 - theU1) / (uf - ul)); if (n > nbs) n = nbs; if (n < 5) n = 5; } - return (n); + return n; } -Standard_Integer HLRBRep_SurfaceTool::NbSamplesV(const Standard_Address S, - const Standard_Real v1, - const Standard_Real v2) +//================================================================================================= + +int HLRBRep_SurfaceTool::NbSamplesV(const HLRBRep_Surface* theSurf, + const double theV1, + const double theV2) { - Standard_Integer nbs = NbSamplesV(S); - Standard_Integer n = nbs; + int nbs = NbSamplesV(theSurf); + int n = nbs; if (nbs > 10) { - Standard_Real vf = FirstVParameter(S); - Standard_Real vl = LastVParameter(S); - n *= (Standard_Integer)((v2 - v1) / (vf - vl)); + const double vf = FirstVParameter(theSurf); + const double vl = LastVParameter(theSurf); + n *= (int)((theV2 - theV1) / (vf - vl)); if (n > nbs) n = nbs; if (n < 5) n = 5; } - return (n); + return n; } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.hxx index 92cf46266c..66742bbdb6 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.hxx @@ -36,134 +36,142 @@ class gp_Pnt; class gp_Vec; class Geom_BezierSurface; class Geom_BSplineSurface; +class HLRBRep_Surface; class HLRBRep_SurfaceTool { public: DEFINE_STANDARD_ALLOC - static Standard_Real FirstUParameter(const Standard_Address S); + static double FirstUParameter(const HLRBRep_Surface* theSurf); - static Standard_Real FirstVParameter(const Standard_Address S); + static double FirstVParameter(const HLRBRep_Surface* theSurf); - static Standard_Real LastUParameter(const Standard_Address S); + static double LastUParameter(const HLRBRep_Surface* theSurf); - static Standard_Real LastVParameter(const Standard_Address S); + static double LastVParameter(const HLRBRep_Surface* theSurf); - static Standard_Integer NbUIntervals(const Standard_Address S, const GeomAbs_Shape Sh); + static int NbUIntervals(const HLRBRep_Surface* theSurf, const GeomAbs_Shape theSh); - static Standard_Integer NbVIntervals(const Standard_Address S, const GeomAbs_Shape Sh); + static int NbVIntervals(const HLRBRep_Surface* theSurf, const GeomAbs_Shape theSh); - static void UIntervals(const Standard_Address S, TColStd_Array1OfReal& T, const GeomAbs_Shape Sh); + static void UIntervals(const HLRBRep_Surface* theSurf, + TColStd_Array1OfReal& theT, + const GeomAbs_Shape theSh); - static void VIntervals(const Standard_Address S, TColStd_Array1OfReal& T, const GeomAbs_Shape Sh); + static void VIntervals(const HLRBRep_Surface* theSurf, + TColStd_Array1OfReal& theT, + const GeomAbs_Shape theSh); - //! If >= - static Handle(Adaptor3d_Surface) UTrim(const Standard_Address S, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + //! If >= + static Handle(Adaptor3d_Surface) UTrim(const HLRBRep_Surface* theSurf, + const double theFirst, + const double theLast, + const double theTol); - //! If >= - static Handle(Adaptor3d_Surface) VTrim(const Standard_Address S, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + //! If >= + static Handle(Adaptor3d_Surface) VTrim(const HLRBRep_Surface* theSurf, + const double theFirst, + const double theLast, + const double theTol); - static Standard_Boolean IsUClosed(const Standard_Address S); + static bool IsUClosed(const HLRBRep_Surface* theSurf); - static Standard_Boolean IsVClosed(const Standard_Address S); + static bool IsVClosed(const HLRBRep_Surface* theSurf); - static Standard_Boolean IsUPeriodic(const Standard_Address S); + static bool IsUPeriodic(const HLRBRep_Surface* theSurf); - static Standard_Real UPeriod(const Standard_Address S); + static double UPeriod(const HLRBRep_Surface* theSurf); - static Standard_Boolean IsVPeriodic(const Standard_Address S); + static bool IsVPeriodic(const HLRBRep_Surface* theSurf); - static Standard_Real VPeriod(const Standard_Address S); + static double VPeriod(const HLRBRep_Surface* theSurf); - static gp_Pnt Value(const Standard_Address S, const Standard_Real u, const Standard_Real v); + static gp_Pnt Value(const HLRBRep_Surface* theSurf, const double theU, const double theV); - static void D0(const Standard_Address S, const Standard_Real u, const Standard_Real v, gp_Pnt& P); + static void D0(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP); - static void D1(const Standard_Address S, - const Standard_Real u, - const Standard_Real v, - gp_Pnt& P, - gp_Vec& D1u, - gp_Vec& D1v); + static void D1(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V); - static void D2(const Standard_Address S, - const Standard_Real u, - const Standard_Real v, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV); + static void D2(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV); - static void D3(const Standard_Address S, - const Standard_Real u, - const Standard_Real v, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV, - gp_Vec& D3U, - gp_Vec& D3V, - gp_Vec& D3UUV, - gp_Vec& D3UVV); + static void D3(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV, + gp_Vec& theD3U, + gp_Vec& theD3V, + gp_Vec& theD3UUV, + gp_Vec& theD3UVV); - static gp_Vec DN(const Standard_Address S, - const Standard_Real u, - const Standard_Real v, - const Standard_Integer Nu, - const Standard_Integer Nv); + static gp_Vec DN(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + const int theNu, + const int theNv); - static Standard_Real UResolution(const Standard_Address S, const Standard_Real R3d); + static double UResolution(const HLRBRep_Surface* theSurf, const double theR3d); - static Standard_Real VResolution(const Standard_Address S, const Standard_Real R3d); + static double VResolution(const HLRBRep_Surface* theSurf, const double theR3d); - static GeomAbs_SurfaceType GetType(const Standard_Address S); + static GeomAbs_SurfaceType GetType(const HLRBRep_Surface* theSurf); - static gp_Pln Plane(const Standard_Address S); + static gp_Pln Plane(const HLRBRep_Surface* theSurf); - static gp_Cylinder Cylinder(const Standard_Address S); + static gp_Cylinder Cylinder(const HLRBRep_Surface* theSurf); - static gp_Cone Cone(const Standard_Address S); + static gp_Cone Cone(const HLRBRep_Surface* theSurf); - static gp_Torus Torus(const Standard_Address S); + static gp_Torus Torus(const HLRBRep_Surface* theSurf); - static gp_Sphere Sphere(const Standard_Address S); + static gp_Sphere Sphere(const HLRBRep_Surface* theSurf); - static Handle(Geom_BezierSurface) Bezier(const Standard_Address S); + static Handle(Geom_BezierSurface) Bezier(const HLRBRep_Surface* theSurf); - static Handle(Geom_BSplineSurface) BSpline(const Standard_Address S); + static Handle(Geom_BSplineSurface) BSpline(const HLRBRep_Surface* theSurf); - static gp_Ax1 AxeOfRevolution(const Standard_Address S); + static gp_Ax1 AxeOfRevolution(const HLRBRep_Surface* theSurf); - static gp_Dir Direction(const Standard_Address S); + static gp_Dir Direction(const HLRBRep_Surface* theSurf); - static Handle(Adaptor3d_Curve) BasisCurve(const Standard_Address S); + static Handle(Adaptor3d_Curve) BasisCurve(const HLRBRep_Surface* theSurf); - static Handle(Adaptor3d_Surface) BasisSurface(const Standard_Address S); + static Handle(Adaptor3d_Surface) BasisSurface(const HLRBRep_Surface* theSurf); - static Standard_Real OffsetValue(const Standard_Address S); + static double OffsetValue(const HLRBRep_Surface* theSurf); - Standard_EXPORT static Standard_Integer NbSamplesU(const Standard_Address S); + Standard_EXPORT static int NbSamplesU(const HLRBRep_Surface* theSurf); - Standard_EXPORT static Standard_Integer NbSamplesV(const Standard_Address S); + Standard_EXPORT static int NbSamplesV(const HLRBRep_Surface* theSurf); - Standard_EXPORT static Standard_Integer NbSamplesU(const Standard_Address S, - const Standard_Real u1, - const Standard_Real u2); + Standard_EXPORT static int NbSamplesU(const HLRBRep_Surface* theSurf, + const double theU1, + const double theU2); - Standard_EXPORT static Standard_Integer NbSamplesV(const Standard_Address S, - const Standard_Real v1, - const Standard_Real v2); + Standard_EXPORT static int NbSamplesV(const HLRBRep_Surface* theSurf, + const double theV1, + const double theV2); protected: private: diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.lxx index 4f21ee324e..2f5409ec40 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.lxx @@ -13,250 +13,259 @@ // 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 +#include +#include #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -inline Standard_Real HLRBRep_SurfaceTool::FirstUParameter(const Standard_Address Surf) +inline double HLRBRep_SurfaceTool::FirstUParameter(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)Surf)->FirstUParameter(); + return theSurf->FirstUParameter(); } -inline Standard_Real HLRBRep_SurfaceTool::FirstVParameter(const Standard_Address Surf) +inline double HLRBRep_SurfaceTool::FirstVParameter(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)Surf)->FirstVParameter(); + return theSurf->FirstVParameter(); } -inline Standard_Real HLRBRep_SurfaceTool::LastUParameter(const Standard_Address Surf) +inline double HLRBRep_SurfaceTool::LastUParameter(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)Surf)->LastUParameter(); + return theSurf->LastUParameter(); } -inline Standard_Real HLRBRep_SurfaceTool::LastVParameter(const Standard_Address Surf) +inline double HLRBRep_SurfaceTool::LastVParameter(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)Surf)->LastVParameter(); + return theSurf->LastVParameter(); } -inline Standard_Integer HLRBRep_SurfaceTool::NbUIntervals(const Standard_Address Surf, - const GeomAbs_Shape S) +inline int HLRBRep_SurfaceTool::NbUIntervals(const HLRBRep_Surface* theSurf, + const GeomAbs_Shape theSh) { - return ((BRepAdaptor_Surface*)Surf)->NbUIntervals(S); + return theSurf->NbUIntervals(theSh); } -inline Standard_Integer HLRBRep_SurfaceTool::NbVIntervals(const Standard_Address Surf, - const GeomAbs_Shape S) +inline int HLRBRep_SurfaceTool::NbVIntervals(const HLRBRep_Surface* theSurf, + const GeomAbs_Shape theSh) { - return ((BRepAdaptor_Surface*)Surf)->NbVIntervals(S); + return theSurf->NbVIntervals(theSh); } -inline void HLRBRep_SurfaceTool::UIntervals(const Standard_Address Surf, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape S) +inline void HLRBRep_SurfaceTool::UIntervals(const HLRBRep_Surface* theSurf, + TColStd_Array1OfReal& theTab, + const GeomAbs_Shape theSh) { - ((BRepAdaptor_Surface*)Surf)->UIntervals(Tab, S); + theSurf->Surface().UIntervals(theTab, theSh); } -inline void HLRBRep_SurfaceTool::VIntervals(const Standard_Address Surf, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape S) +inline void HLRBRep_SurfaceTool::VIntervals(const HLRBRep_Surface* theSurf, + TColStd_Array1OfReal& theTab, + const GeomAbs_Shape theSh) { - ((BRepAdaptor_Surface*)Surf)->VIntervals(Tab, S); + theSurf->Surface().VIntervals(theTab, theSh); } -inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::UTrim(const Standard_Address Surf, - const Standard_Real F, - const Standard_Real L, - const Standard_Real Tol) +inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::UTrim(const HLRBRep_Surface* theSurf, + const double theFirst, + const double theLast, + const double theTol) { - return ((BRepAdaptor_Surface*)Surf)->UTrim(F, L, Tol); + return theSurf->Surface().UTrim(theFirst, theLast, theTol); } -inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::VTrim(const Standard_Address Surf, - const Standard_Real F, - const Standard_Real L, - const Standard_Real Tol) +inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::VTrim(const HLRBRep_Surface* theSurf, + const double theFirst, + const double theLast, + const double theTol) { - return ((BRepAdaptor_Surface*)Surf)->VTrim(F, L, Tol); + return theSurf->Surface().VTrim(theFirst, theLast, theTol); } -inline Standard_Boolean HLRBRep_SurfaceTool::IsUClosed(const Standard_Address S) +inline bool HLRBRep_SurfaceTool::IsUClosed(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->IsUClosed(); + return theSurf->IsUClosed(); } -inline Standard_Boolean HLRBRep_SurfaceTool::IsVClosed(const Standard_Address S) +inline bool HLRBRep_SurfaceTool::IsVClosed(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->IsVClosed(); + return theSurf->IsVClosed(); } -inline Standard_Boolean HLRBRep_SurfaceTool::IsUPeriodic(const Standard_Address S) +inline bool HLRBRep_SurfaceTool::IsUPeriodic(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->IsUPeriodic(); + return theSurf->IsUPeriodic(); } -inline Standard_Real HLRBRep_SurfaceTool::UPeriod(const Standard_Address S) +inline double HLRBRep_SurfaceTool::UPeriod(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->UPeriod(); + return theSurf->UPeriod(); } -inline Standard_Boolean HLRBRep_SurfaceTool::IsVPeriodic(const Standard_Address S) +inline bool HLRBRep_SurfaceTool::IsVPeriodic(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->IsVPeriodic(); + return theSurf->IsVPeriodic(); } -inline Standard_Real HLRBRep_SurfaceTool::VPeriod(const Standard_Address S) +inline double HLRBRep_SurfaceTool::VPeriod(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->VPeriod(); + return theSurf->VPeriod(); } -inline gp_Pnt HLRBRep_SurfaceTool::Value(const Standard_Address S, - const Standard_Real U, - const Standard_Real V) +inline gp_Pnt HLRBRep_SurfaceTool::Value(const HLRBRep_Surface* theSurf, + const double theU, + const double theV) { - return ((BRepAdaptor_Surface*)S)->Value(U, V); + return theSurf->Surface().Value(theU, theV); } -inline void HLRBRep_SurfaceTool::D0(const Standard_Address S, - const Standard_Real U, - const Standard_Real V, - gp_Pnt& P) +inline void HLRBRep_SurfaceTool::D0(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP) { - ((BRepAdaptor_Surface*)S)->D0(U, V, P); + theSurf->Surface().D0(theU, theV, theP); } -inline void HLRBRep_SurfaceTool::D1(const Standard_Address S, - const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V) +inline void HLRBRep_SurfaceTool::D1(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V) { - ((BRepAdaptor_Surface*)S)->D1(U, V, P, D1U, D1V); + theSurf->Surface().D1(theU, theV, theP, theD1U, theD1V); } -inline void HLRBRep_SurfaceTool::D2(const Standard_Address S, - const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV) +inline void HLRBRep_SurfaceTool::D2(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV) { - ((BRepAdaptor_Surface*)S)->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV); + theSurf->Surface().D2(theU, theV, theP, theD1U, theD1V, theD2U, theD2V, theD2UV); } -inline void HLRBRep_SurfaceTool::D3(const Standard_Address S, - const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV, - gp_Vec& D3U, - gp_Vec& D3V, - gp_Vec& D3UUV, - gp_Vec& D3UVV) +inline void HLRBRep_SurfaceTool::D3(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV, + gp_Vec& theD3U, + gp_Vec& theD3V, + gp_Vec& theD3UUV, + gp_Vec& theD3UVV) { - ((BRepAdaptor_Surface*)S)->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV); + theSurf->Surface().D3(theU, + theV, + theP, + theD1U, + theD1V, + theD2U, + theD2V, + theD2UV, + theD3U, + theD3V, + theD3UUV, + theD3UVV); } -inline gp_Vec HLRBRep_SurfaceTool::DN(const Standard_Address S, - const Standard_Real U, - const Standard_Real V, - const Standard_Integer Nu, - const Standard_Integer Nv) +inline gp_Vec HLRBRep_SurfaceTool::DN(const HLRBRep_Surface* theSurf, + const double theU, + const double theV, + const int theNu, + const int theNv) { - return ((BRepAdaptor_Surface*)S)->DN(U, V, Nu, Nv); + return theSurf->Surface().DN(theU, theV, theNu, theNv); } -inline Standard_Real HLRBRep_SurfaceTool::UResolution(const Standard_Address S, - const Standard_Real R3d) +inline double HLRBRep_SurfaceTool::UResolution(const HLRBRep_Surface* theSurf, const double theR3d) { - return ((BRepAdaptor_Surface*)S)->UResolution(R3d); + return theSurf->Surface().UResolution(theR3d); } -inline Standard_Real HLRBRep_SurfaceTool::VResolution(const Standard_Address S, - const Standard_Real R3d) +inline double HLRBRep_SurfaceTool::VResolution(const HLRBRep_Surface* theSurf, const double theR3d) { - return ((BRepAdaptor_Surface*)S)->VResolution(R3d); + return theSurf->Surface().VResolution(theR3d); } -inline GeomAbs_SurfaceType HLRBRep_SurfaceTool::GetType(const Standard_Address S) +inline GeomAbs_SurfaceType HLRBRep_SurfaceTool::GetType(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->GetType(); + return theSurf->GetType(); } -inline gp_Pln HLRBRep_SurfaceTool::Plane(const Standard_Address S) +inline gp_Pln HLRBRep_SurfaceTool::Plane(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->Plane(); + return theSurf->Plane(); } -inline gp_Cylinder HLRBRep_SurfaceTool::Cylinder(const Standard_Address S) +inline gp_Cylinder HLRBRep_SurfaceTool::Cylinder(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->Cylinder(); + return theSurf->Cylinder(); } -inline gp_Cone HLRBRep_SurfaceTool::Cone(const Standard_Address S) +inline gp_Cone HLRBRep_SurfaceTool::Cone(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->Cone(); + return theSurf->Cone(); } -inline gp_Sphere HLRBRep_SurfaceTool::Sphere(const Standard_Address S) +inline gp_Sphere HLRBRep_SurfaceTool::Sphere(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->Sphere(); + return theSurf->Sphere(); } -inline gp_Torus HLRBRep_SurfaceTool::Torus(const Standard_Address S) +inline gp_Torus HLRBRep_SurfaceTool::Torus(const HLRBRep_Surface* theSurf) { - return ((BRepAdaptor_Surface*)S)->Torus(); + return theSurf->Torus(); } -inline Handle(Geom_BezierSurface) HLRBRep_SurfaceTool::Bezier(const Standard_Address S) +inline Handle(Geom_BezierSurface) HLRBRep_SurfaceTool::Bezier(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->Bezier()); + return theSurf->Surface().Bezier(); } -inline Handle(Geom_BSplineSurface) HLRBRep_SurfaceTool::BSpline(const Standard_Address S) +inline Handle(Geom_BSplineSurface) HLRBRep_SurfaceTool::BSpline(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->BSpline()); + return theSurf->Surface().BSpline(); } -inline gp_Ax1 HLRBRep_SurfaceTool::AxeOfRevolution(const Standard_Address S) +inline gp_Ax1 HLRBRep_SurfaceTool::AxeOfRevolution(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->AxeOfRevolution()); + return theSurf->Axis(); } -inline gp_Dir HLRBRep_SurfaceTool::Direction(const Standard_Address S) +inline gp_Dir HLRBRep_SurfaceTool::Direction(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->Direction()); + return theSurf->Surface().Direction(); } -inline Handle(Adaptor3d_Curve) HLRBRep_SurfaceTool::BasisCurve(const Standard_Address S) +inline Handle(Adaptor3d_Curve) HLRBRep_SurfaceTool::BasisCurve(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->BasisCurve()); + return theSurf->Surface().BasisCurve(); } -inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::BasisSurface(const Standard_Address S) +inline Handle(Adaptor3d_Surface) HLRBRep_SurfaceTool::BasisSurface(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->BasisSurface()); + return theSurf->Surface().BasisSurface(); } -inline Standard_Real HLRBRep_SurfaceTool::OffsetValue(const Standard_Address S) +inline double HLRBRep_SurfaceTool::OffsetValue(const HLRBRep_Surface* theSurf) { - return (((BRepAdaptor_Surface*)S)->OffsetValue()); + return theSurf->Surface().OffsetValue(); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf.hxx index c9e1ac4c43..6e680353c9 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf.hxx @@ -26,6 +26,7 @@ #include #include #include +class HLRBRep_Surface; class HLRBRep_SurfaceTool; class gp_Lin; class HLRBRep_LineTool; @@ -37,7 +38,7 @@ class HLRBRep_TheCSFunctionOfInterCSurf : public math_FunctionSetWithDerivatives public: DEFINE_STANDARD_ALLOC - Standard_EXPORT HLRBRep_TheCSFunctionOfInterCSurf(const Standard_Address& S, const gp_Lin& C); + Standard_EXPORT HLRBRep_TheCSFunctionOfInterCSurf(HLRBRep_Surface* const& S, const gp_Lin& C); Standard_EXPORT Standard_Integer NbVariables() const; @@ -53,13 +54,13 @@ public: Standard_EXPORT Standard_Real Root() const; - Standard_EXPORT const Standard_Address& AuxillarSurface() const; + Standard_EXPORT HLRBRep_Surface* const& AuxillarSurface() const; Standard_EXPORT const gp_Lin& AuxillarCurve() const; protected: private: - Standard_Address surface; + HLRBRep_Surface* surface; gp_Lin curve; gp_Pnt p; Standard_Real f; diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf_0.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf_0.cxx index 5e30347a93..f359a0487e 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf_0.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheCSFunctionOfInterCSurf_0.cxx @@ -21,9 +21,11 @@ #include #include #include +#include -#define ThePSurface Standard_Address -#define ThePSurface_hxx +// Use typedef instead of #define for correct const semantics with pointers +typedef HLRBRep_Surface* ThePSurface; +#define ThePSurface_hxx #define ThePSurfaceTool HLRBRep_SurfaceTool #define ThePSurfaceTool_hxx #define TheCurve gp_Lin diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheExactInterCSurf_0.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheExactInterCSurf_0.cxx index 379ff17a56..f1d0b4cd00 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheExactInterCSurf_0.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheExactInterCSurf_0.cxx @@ -24,9 +24,11 @@ #include #include #include +#include -#define ThePSurface Standard_Address -#define ThePSurface_hxx +// Use typedef instead of #define for correct const semantics with pointers +typedef HLRBRep_Surface* ThePSurface; +#define ThePSurface_hxx #define ThePSurfaceTool HLRBRep_SurfaceTool #define ThePSurfaceTool_hxx #define TheCurve gp_Lin diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.cxx index 05f783b3c1..5a3bd80ffc 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -32,14 +33,13 @@ namespace PolyUtils = IntCurveSurface_PolyhedronUtils; //================================================================================================== -HLRBRep_ThePolyhedronOfInterCSurf::HLRBRep_ThePolyhedronOfInterCSurf( - const Standard_Address& Surface, - const Standard_Integer nbdU, - const Standard_Integer nbdV, - const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2) +HLRBRep_ThePolyhedronOfInterCSurf::HLRBRep_ThePolyhedronOfInterCSurf(HLRBRep_Surface* Surface, + const Standard_Integer nbdU, + const Standard_Integer nbdV, + const Standard_Real u1, + const Standard_Real v1, + const Standard_Real u2, + const Standard_Real v2) : nbdeltaU((nbdU < 3) ? 3 : nbdU), nbdeltaV((nbdV < 3) ? 3 : nbdV), TheDeflection(Epsilon(100.)), @@ -55,7 +55,7 @@ HLRBRep_ThePolyhedronOfInterCSurf::HLRBRep_ThePolyhedronOfInterCSurf( //================================================================================================== HLRBRep_ThePolyhedronOfInterCSurf::HLRBRep_ThePolyhedronOfInterCSurf( - const Standard_Address& Surface, + HLRBRep_Surface* Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars) : nbdeltaU(Upars.Length() - 1), @@ -79,13 +79,13 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Destroy() //================================================================================================== -void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface, - const Standard_Real U0, - const Standard_Real V0, - const Standard_Real U1, - const Standard_Real V1) +void HLRBRep_ThePolyhedronOfInterCSurf::Init(HLRBRep_Surface* Surface, + const Standard_Real U0, + const Standard_Real V0, + const Standard_Real U1, + const Standard_Real V1) { - PolyUtils::InitUniform( + PolyUtils::InitUniform( Surface, U0, V0, @@ -100,7 +100,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface, TheBnd); Standard_Real tol = - PolyUtils::ComputeMaxDeflection(Surface, *this, @@ -109,7 +109,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface, FillBounding(); TheBorderDeflection = - PolyUtils::ComputeMaxBorderDeflection(Surface, + PolyUtils::ComputeMaxBorderDeflection(Surface, U0, V0, U1, @@ -120,11 +120,11 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface, //================================================================================================== -void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface, +void HLRBRep_ThePolyhedronOfInterCSurf::Init(HLRBRep_Surface* Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars) { - PolyUtils::InitWithParams( + PolyUtils::InitWithParams( Surface, Upars, Vpars, @@ -137,7 +137,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface TheBnd); Standard_Real tol = - PolyUtils::ComputeMaxDeflection(Surface, *this, @@ -146,7 +146,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface FillBounding(); TheBorderDeflection = - PolyUtils::ComputeMaxBorderDeflection( + PolyUtils::ComputeMaxBorderDeflection( Surface, Upars(Upars.Lower()), Vpars(Vpars.Lower()), @@ -159,14 +159,14 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(const Standard_Address& Surface //================================================================================================== Standard_Real HLRBRep_ThePolyhedronOfInterCSurf::DeflectionOnTriangle( - const Standard_Address& Surface, - const Standard_Integer Triang) const + HLRBRep_Surface* Surface, + const Standard_Integer Triang) const { Standard_Integer i1, i2, i3; Triangle(Triang, i1, i2, i3); Standard_Real u1, v1, u2, v2, u3, v3; gp_Pnt P1 = Point(i1, u1, v1), P2 = Point(i2, u2, v2), P3 = Point(i3, u3, v3); - return PolyUtils::DeflectionOnTriangle(Surface, + return PolyUtils::DeflectionOnTriangle(Surface, P1, P2, P3, diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.hxx index 92fc1a5733..58c15331bc 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ThePolyhedronOfInterCSurf.hxx @@ -26,6 +26,7 @@ #include #include class Standard_OutOfRange; +class HLRBRep_Surface; class HLRBRep_SurfaceTool; class gp_Pnt; class Bnd_Box; @@ -36,15 +37,15 @@ class HLRBRep_ThePolyhedronOfInterCSurf public: DEFINE_STANDARD_ALLOC - Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(const Standard_Address& Surface, - const Standard_Integer nbdU, - const Standard_Integer nbdV, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(HLRBRep_Surface* Surface, + const Standard_Integer nbdU, + const Standard_Integer nbdV, + const Standard_Real U1, + const Standard_Real V1, + const Standard_Real U2, + const Standard_Real V2); - Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(const Standard_Address& Surface, + Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(HLRBRep_Surface* Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars); @@ -54,8 +55,8 @@ public: Standard_EXPORT void DeflectionOverEstimation(const Standard_Real flec); - Standard_EXPORT Standard_Real DeflectionOnTriangle(const Standard_Address& Surface, - const Standard_Integer Index) const; + Standard_EXPORT Standard_Real DeflectionOnTriangle(HLRBRep_Surface* Surface, + const Standard_Integer Index) const; Standard_EXPORT void UMinSingularity(const Standard_Boolean Sing); @@ -160,13 +161,13 @@ public: Standard_EXPORT void Dump() const; protected: - Standard_EXPORT void Init(const Standard_Address& Surface, - const Standard_Real U1, - const Standard_Real V1, - const Standard_Real U2, - const Standard_Real V2); + Standard_EXPORT void Init(HLRBRep_Surface* Surface, + const Standard_Real U1, + const Standard_Real V1, + const Standard_Real U2, + const Standard_Real V2); - Standard_EXPORT void Init(const Standard_Address& Surface, + Standard_EXPORT void Init(HLRBRep_Surface* Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars); diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.cxx index c8a171276e..acb478a896 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.cxx @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -25,13 +26,13 @@ //================================================================================================== -HLRBRep_TheQuadCurvExactInterCSurf::HLRBRep_TheQuadCurvExactInterCSurf(const Standard_Address& S, - const gp_Lin& C) +HLRBRep_TheQuadCurvExactInterCSurf::HLRBRep_TheQuadCurvExactInterCSurf(HLRBRep_Surface* S, + const gp_Lin& C) : nbpnts(-1), nbintv(-1) { IntCurveSurface_QuadricCurveExactInterUtils::PerformIntersection< - Standard_Address, + HLRBRep_Surface*, HLRBRep_SurfaceTool, gp_Lin, HLRBRep_LineTool, diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.hxx index 425a7e0a43..5c38bdc733 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_TheQuadCurvExactInterCSurf.hxx @@ -23,6 +23,7 @@ #include #include +class HLRBRep_Surface; class HLRBRep_SurfaceTool; class gp_Lin; class HLRBRep_LineTool; @@ -35,7 +36,7 @@ public: //! Provides the signed distance function : Q(w) //! and its first derivative dQ(w)/dw - Standard_EXPORT HLRBRep_TheQuadCurvExactInterCSurf(const Standard_Address& S, const gp_Lin& C); + Standard_EXPORT HLRBRep_TheQuadCurvExactInterCSurf(HLRBRep_Surface* S, const gp_Lin& C); Standard_EXPORT Standard_Boolean IsDone() const;