diff --git a/src/BRepMesh/BRepMesh_GeomTool.hxx b/src/BRepMesh/BRepMesh_GeomTool.hxx index 4887246d3f..a2b45e4181 100644 --- a/src/BRepMesh/BRepMesh_GeomTool.hxx +++ b/src/BRepMesh/BRepMesh_GeomTool.hxx @@ -28,7 +28,11 @@ class gp_Pnt; class gp_Pnt2d; class gp_Dir; -//! Tool class intended to obtain parameters based on shape geometry. +//! Tool class accumulating common geometrical functions as well as +//! functionality using shape geometry to produce data necessary for +//! tessellation. +//! General aim is to calculate discretization points for the given +//! curve or iso curve of surface according to the specified parameters. class BRepMesh_GeomTool { public: @@ -131,17 +135,20 @@ public: public: //! @name static API - //! @param theSurface surface the nomal should be found for. + //! Computes normal to the given surface at the specified + //! position in parametric space. + //! @param theSurface surface the normal should be found for. //! @param theParamU U parameter in parametric space of the surface. //! @param theParamV V parameter in parametric space of the surface. //! @param[out] thePoint 3d point corresponding to the given parameters. //! @param[out] theNormal normal vector at the point specified by the parameters. //! @return FALSE if the normal can not be computed, TRUE elsewhere. - static Standard_Boolean Normal(const Handle(BRepAdaptor_HSurface)& theSurface, - const Standard_Real theParamU, - const Standard_Real theParamV, - gp_Pnt& thePoint, - gp_Dir& theNormal); + Standard_EXPORT static Standard_Boolean Normal( + const Handle(BRepAdaptor_HSurface)& theSurface, + const Standard_Real theParamU, + const Standard_Real theParamV, + gp_Pnt& thePoint, + gp_Dir& theNormal); //! Checks intersection between two lines defined by two points. //! @param theStartPnt1 start point of first line. @@ -152,12 +159,13 @@ public: //! @name static API //! @param[out] theParamOnSegment parameters of intersection point //! corresponding to first and second segment. //! @return status of intersection check. - static IntFlag IntLinLin(const gp_XY& theStartPnt1, - const gp_XY& theEndPnt1, - const gp_XY& theStartPnt2, - const gp_XY& theEndPnt2, - gp_XY& theIntPnt, - Standard_Real (&theParamOnSegment)[2]); + Standard_EXPORT static IntFlag IntLinLin( + const gp_XY& theStartPnt1, + const gp_XY& theEndPnt1, + const gp_XY& theStartPnt2, + const gp_XY& theEndPnt2, + gp_XY& theIntPnt, + Standard_Real (&theParamOnSegment)[2]); //! Checks intersection between the two segments. //! Checks that intersection point lies within ranges of both segments. @@ -173,13 +181,14 @@ public: //! @name static API //! if FALSE returns NoIntersection flag. //! @param[out] theIntPnt point of intersection. //! @return status of intersection check. - static IntFlag IntSegSeg(const gp_XY& theStartPnt1, - const gp_XY& theEndPnt1, - const gp_XY& theStartPnt2, - const gp_XY& theEndPnt2, - const Standard_Boolean isConsiderEndPointTouch, - const Standard_Boolean isConsiderPointOnSegment, - gp_Pnt2d& theIntPnt); + Standard_EXPORT static IntFlag IntSegSeg( + const gp_XY& theStartPnt1, + const gp_XY& theEndPnt1, + const gp_XY& theStartPnt2, + const gp_XY& theEndPnt2, + const Standard_Boolean isConsiderEndPointTouch, + const Standard_Boolean isConsiderPointOnSegment, + gp_Pnt2d& theIntPnt); private: diff --git a/src/BRepMesh/BRepMesh_WireInterferenceChecker.hxx b/src/BRepMesh/BRepMesh_WireInterferenceChecker.hxx index bdc866ba6f..1bfac79f15 100644 --- a/src/BRepMesh/BRepMesh_WireInterferenceChecker.hxx +++ b/src/BRepMesh/BRepMesh_WireInterferenceChecker.hxx @@ -71,16 +71,6 @@ public: private: - //! Classifies the point in case of coincidence of two vectors. - //! @param thePoint1 the start point of a segment (base point). - //! @param thePoint2 the end point of a segment. - //! @param thePointToCheck the point to classify. - //! @return zero value if point is out of segment and non zero value - //! if point is between the first and the second point of segment. - static Standard_Integer classifyPoint (const gp_XY& thePoint1, - const gp_XY& thePoint2, - const gp_XY& thePointToCheck); - //! Assignment operator. void operator =(const BRepMesh_WireInterferenceChecker& /*theOther*/) { diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 62008a795d..245fe29d85 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -3126,6 +3126,85 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI, return 0; } +//======================================================================= +//function : OCC25547 +//purpose : +//======================================================================= +#include +#include +#include +#include +#include +#include +static Standard_Integer OCC25547( + Draw_Interpretor& theDI, + Standard_Integer /*argc*/, + const char ** /*argv*/) +{ + // The general aim of this test is to prevent linkage errors due to missed + // Standard_EXPORT attribute for static methods. + + // However, start checking the main functionality at first. + const Standard_Real aFirstP = 0., aLastP = M_PI; + Handle(Geom_Circle) aCircle = new Geom_Circle(gp_Ax2(gp::Origin(), gp::DZ()), 10); + Handle(Geom_TrimmedCurve) aHalf = new Geom_TrimmedCurve(aCircle, aFirstP, aLastP); + TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aHalf); + BRepAdaptor_Curve aAdaptor(aEdge); + BRepMesh_GeomTool aGeomTool(aAdaptor, aFirstP, aLastP, 0.1, 0.5); + + if (aGeomTool.NbPoints() == 0) + { + theDI << "Error. BRepMesh_GeomTool failed to discretize an arc.\n"; + return 1; + } + + // Test static methods. + TopoDS_Face aFace = BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ())); + BRepAdaptor_Surface aSurf(aFace); + Handle(BRepAdaptor_HSurface) aHSurf = new BRepAdaptor_HSurface(aSurf); + + gp_Pnt aPnt; + gp_Dir aNormal; + if (!BRepMesh_GeomTool::Normal(aHSurf, 10., 10., aPnt, aNormal)) + { + theDI << "Error. BRepMesh_GeomTool failed to take a normal of surface.\n"; + return 1; + } + + gp_XY aRefPnts[4] = { + gp_XY(-10., -10.), gp_XY(10., 10.), + gp_XY(-10., 10.), gp_XY(10., -10.) + }; + + gp_Pnt2d aIntPnt; + Standard_Real aParams[2]; + BRepMesh_GeomTool::IntFlag aIntFlag = BRepMesh_GeomTool::IntLinLin( + aRefPnts[0], aRefPnts[1], aRefPnts[2], aRefPnts[3], + aIntPnt.ChangeCoord(), aParams); + + Standard_Real aDiff = aIntPnt.Distance(gp::Origin2d()); + if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion()) + { + theDI << "Error. BRepMesh_GeomTool failed to intersect two lines.\n"; + return 1; + } + + aIntFlag = BRepMesh_GeomTool::IntSegSeg( + aRefPnts[0], aRefPnts[1], aRefPnts[2], aRefPnts[3], + Standard_False, Standard_False, aIntPnt); + + aDiff = aIntPnt.Distance(gp::Origin2d()); + if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion()) + { + theDI << "Error. BRepMesh_GeomTool failed to intersect two segments.\n"; + return 1; + } + + + theDI << "Test complete\n"; + return 0; +} + void QABugs::Commands_19(Draw_Interpretor& theCommands) { const char *group = "QABugs"; @@ -3187,5 +3266,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC25348", "OCC25348", __FILE__, OCC25348, group); theCommands.Add ("OCC25413", "OCC25413 shape", __FILE__, OCC25413, group); theCommands.Add ("OCC25446", "OCC25446 res b1 b2 op", __FILE__, OCC25446, group); + theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group); return; } diff --git a/tests/bugs/mesh/bug25547 b/tests/bugs/mesh/bug25547 new file mode 100755 index 0000000000..3a89bd5f04 --- /dev/null +++ b/tests/bugs/mesh/bug25547 @@ -0,0 +1,11 @@ +puts "=========" +puts "CR25547" +puts "=========" +puts "" +############################################### +# static class mehtods not exported in BrepMesh_GeomTool +############################################### + +pload QAcommands + +OCC25547