0025547: static class mehtods not exported in BrepMesh_GeomTool
authoroan <oan@opencascade.com>
Thu, 11 Dec 2014 13:14:38 +0000 (16:14 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 11 Dec 2014 13:15:45 +0000 (16:15 +0300)
Test case for issue CR25547

src/BRepMesh/BRepMesh_GeomTool.hxx
src/BRepMesh/BRepMesh_WireInterferenceChecker.hxx
src/QABugs/QABugs_19.cxx
tests/bugs/mesh/bug25547 [new file with mode: 0755]

index 4887246..a2b45e4 100644 (file)
@@ -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:
 
index bdc866b..1bfac79 100644 (file)
@@ -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*/)
   {
index 62008a7..245fe29 100755 (executable)
@@ -3126,6 +3126,85 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
   return 0;
 }
 
+//=======================================================================
+//function : OCC25547
+//purpose  :
+//=======================================================================
+#include <BRepMesh_GeomTool.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepAdaptor_Surface.hxx>
+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 (executable)
index 0000000..3a89bd5
--- /dev/null
@@ -0,0 +1,11 @@
+puts "========="
+puts "CR25547"
+puts "========="
+puts ""
+###############################################
+# static class mehtods not exported in BrepMesh_GeomTool
+###############################################
+
+pload QAcommands
+
+OCC25547