[cgma-dev] r1346 - cgm/trunk/geom/OCC

janehu at mcs.anl.gov janehu at mcs.anl.gov
Tue Oct 30 11:44:50 CDT 2007


Author: janehu
Date: 2007-10-30 11:44:50 -0500 (Tue, 30 Oct 2007)
New Revision: 1346

Modified:
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCCurve.hpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Added curve_interior_extrema to calculate the extrema corresponding to 3 primary direction. Also, it seems there's no extrema functions likein api_entity_extrema, so added a comment.

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2007-10-26 15:24:50 UTC (rev 1345)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2007-10-30 16:44:50 UTC (rev 1346)
@@ -49,6 +49,9 @@
 #include <BRep_Tool.hxx>
 #include <TopoDS.hxx>
 #include "GeomLProp_CurveTool.hxx"
+#include "GeomAPI_ExtremaCurveCurve.hxx"
+#include "Geom_Line.hxx"
+#include "GC_MakeLine.hxx"
 //#include "TopOpeBRep_ShapeIntersector.hxx"
 //#include "TopOpeBRep_Point2d.hxx"
 //#include "TopOpeBRep_EdgesIntersector.hxx"
@@ -290,24 +293,48 @@
   CubitSense& return_sense )
 {
   // Danilov: try to use GeomAPI_ExtremaCurveCurve
+  // Will do 3 primary directions seperately. 
   assert(0);
   
+  CubitVector x(1.0, 0.0, 0.0);
+  get_interior_extrema_in_direction(interior_points, x);
+  CubitVector y(0.0, 1.0, 0.0);
+  get_interior_extrema_in_direction(interior_points, y);
+  CubitVector z(0.0, 0.0, 1.0);
+  get_interior_extrema_in_direction(interior_points, z );
+ 
+  // Return sense is whatever the sense of this curve is.
+  TopAbs_Orientation sense = myTopoDSEdge->Orientation();
+  return_sense = (sense == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
+ 
+  return CUBIT_SUCCESS;
+}
+
+CubitStatus OCCCurve::get_interior_extrema_in_direction(
+		 	DLIList<CubitVector*>& interior_points,
+			CubitVector dir)
+{
+  //Create a straight line.
+  gp_Pnt origin(0.0, 0.0, 0.0);
+  gp_Dir adir(dir.x(), dir.y(), dir.z());
+  Handle(Geom_Line) line = GC_MakeLine(origin, adir);
+
   //get the Geom_Curve of the OCCCurve
   Standard_Real first;
   Standard_Real last;
   Handle(Geom_Curve) myCurve = BRep_Tool::Curve(*myTopoDSEdge, first, last);
-
-  //only when the curve's second derivative is computable, does it possibly
-  //have interior_extrema
-  if(1 == GeomLProp_CurveTool::Continuity(myCurve))
-    return CUBIT_SUCCESS;
- 
-  // Return sense is whatever the sense of this curve is.
-  return_sense = sense_;
   
+  GeomAPI_ExtremaCurveCurve extrema(myCurve, line);
+  int nPnt = extrema.NbExtrema();
+  for (int i = 1; i <= nPnt ; i++)
+  {
+    gp_Pnt P1, P2;
+    extrema.Points(i, P1, P2);
+    CubitVector* v = new CubitVector(P1.X(), P1.Y(), P1.Z());
+    interior_points.append(v);
+  }
   return CUBIT_SUCCESS;
-}
-
+}  
 //-------------------------------------------------------------------------
 // Purpose       : This function computes the point on the curve closest 
 //                 to the input location.  Optionally, it can also compute

Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp	2007-10-26 15:24:50 UTC (rev 1345)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp	2007-10-30 16:44:50 UTC (rev 1346)
@@ -180,6 +180,9 @@
     //-    delete these CubitVectors (or in the case of RefEdge, to make sure
     //-    that *it's* calling code knows that it should delete the CubitVectors)!
   
+  CubitStatus get_interior_extrema_in_direction(DLIList<CubitVector*>&,
+ 						CubitVector);
+
   virtual CubitStatus closest_point( CubitVector const& location, 
                                      CubitVector& closest_location,
                                      CubitVector* tangent_ptr = NULL,

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-10-26 15:24:50 UTC (rev 1345)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-10-30 16:44:50 UTC (rev 1346)
@@ -616,18 +616,20 @@
 
 //================================================================================
 // Description: Find extrema position on an entity list
-// Author     :
-// Date       :
+// Author     : Jane Hu
+// Date       : 10/30/07
 //================================================================================
 CubitStatus
-OCCQueryEngine::entity_extrema( DLIList<GeometryEntity*> &,
-                                  const CubitVector *,
-                                  const CubitVector *,
-                                  const CubitVector *,
-                                  CubitVector &,
-                                  GeometryEntity *& )
+OCCQueryEngine::entity_extrema( DLIList<GeometryEntity*> &ref_entity_list,
+                                  const CubitVector *dir1,
+                                  const CubitVector *dir2,
+                                  const CubitVector *dir3,
+                                  CubitVector &extrema,
+                                  GeometryEntity *&extrema_entity_ptr )
 {
-  PRINT_ERROR("Option not supported for mesh based geometry.\n");
+  //in Acis, the api_entity_extrema is used to calculate "possible 
+  //self-intersecting sweeping and to align lofting sections"
+  PRINT_ERROR("There's no such call in OCC correponding to Acis call."); 
   return CUBIT_FAILURE;
 }
 




More information about the cgma-dev mailing list