mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-22 11:50:34 +05:00
Mantis issue 0021465: EDF 2067 GEOM: Extrusion along a path leads to a self-intersected shape. A fix by Peter Kurnev for GlueFaces algo.
This commit is contained in:
parent
47447fe1fa
commit
aa829b078e
@ -18,12 +18,10 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Gluer2_1.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <peter@PREFEX>
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Gluer2_1.cxx
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_Gluer2.hxx>
|
||||
|
||||
#include <gp_XYZ.hxx>
|
||||
@ -58,13 +56,12 @@
|
||||
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeBRepShapes
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS,
|
||||
TopoDS_Shape& theSnew)
|
||||
void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS,
|
||||
TopoDS_Shape& theSnew)
|
||||
{
|
||||
TopAbs_ShapeEnum aType;
|
||||
//
|
||||
@ -94,12 +91,13 @@ void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeFace
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
TopoDS_Face& theFnew)
|
||||
void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
TopoDS_Face& theFnew)
|
||||
{
|
||||
Standard_Boolean bIsToReverse, bIsUPeriodic;
|
||||
Standard_Integer iRet;
|
||||
Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
|
||||
TopAbs_Orientation aOrE;
|
||||
Handle(Geom_Surface) aS;
|
||||
@ -156,23 +154,30 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
//
|
||||
aEx=aE;
|
||||
if (myOrigins.IsBound(aE)) {
|
||||
aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE)));
|
||||
aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE)));
|
||||
}
|
||||
//
|
||||
if (!BRep_Tool::Degenerated(aEx)) {
|
||||
aEx.Orientation(TopAbs_FORWARD);
|
||||
if (bIsUPeriodic) {
|
||||
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
|
||||
}
|
||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
|
||||
//
|
||||
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aEx.Reverse();
|
||||
}
|
||||
aEx.Orientation(TopAbs_FORWARD);
|
||||
if (bIsUPeriodic) {
|
||||
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f
|
||||
iRet=GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext);
|
||||
if (iRet) {
|
||||
continue;
|
||||
}
|
||||
//BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t
|
||||
//
|
||||
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aEx.Reverse();
|
||||
}
|
||||
}
|
||||
else {
|
||||
aEx.Orientation(aE.Orientation());
|
||||
aEx.Orientation(aE.Orientation());
|
||||
}
|
||||
aBB.Add(aWr, aEx);
|
||||
}// for (; aItE.More(); aItE.Next()) {
|
||||
@ -183,10 +188,10 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeEdge
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||
TopoDS_Edge& aNewEdge)
|
||||
void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||
TopoDS_Edge& aNewEdge)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@ -218,15 +223,13 @@ void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||
aVR2.Orientation(TopAbs_REVERSED);
|
||||
//
|
||||
if (!bIsDE) {
|
||||
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
}
|
||||
else {
|
||||
Standard_Real aTol;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Edge E;
|
||||
//TopAbs_Orientation anOrE;
|
||||
//
|
||||
//anOrE=aE.Orientation();
|
||||
aTol=BRep_Tool::Tolerance(aE);
|
||||
//
|
||||
E=aEx;
|
||||
@ -243,10 +246,10 @@ void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeVertex
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV,
|
||||
TopoDS_Vertex& aNewVertex)
|
||||
void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV,
|
||||
TopoDS_Vertex& aNewVertex)
|
||||
{
|
||||
Standard_Integer aNbV;
|
||||
Standard_Real aTolV, aD, aDmax;
|
||||
@ -289,10 +292,10 @@ void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MapBRepShapes
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape& aS,
|
||||
TopTools_MapOfShape& aM)
|
||||
TopTools_MapOfShape& aM)
|
||||
{
|
||||
//Standard_Boolean bHasBRep;
|
||||
TopAbs_ShapeEnum aType;
|
||||
|
@ -18,98 +18,108 @@
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
--
|
||||
|
||||
-- File: GEOMAlgo_Tools.cdl
|
||||
-- Created: Mon Dec 6 11:26:02 2004
|
||||
-- Author: Peter KURNEV
|
||||
--
|
||||
class Tools from GEOMAlgo
|
||||
|
||||
---Purpose:
|
||||
class Tools from GEOMAlgo
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Surface from Geom,
|
||||
ShapeEnum from TopAbs,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Surface from Geom,
|
||||
ShapeEnum from TopAbs,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Shape from TopoDS,
|
||||
ListOfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
||||
Context from IntTools,
|
||||
IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo --qft
|
||||
|
||||
Context from IntTools,
|
||||
IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo --qft
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
IsCompositeShape(myclass;
|
||||
aS :Shape from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
is
|
||||
IsCompositeShape(myclass;
|
||||
aS :Shape from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
|
||||
RefineSDShapes(myclass;
|
||||
RefineSDShapes(myclass;
|
||||
aMSD:out IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; --qft
|
||||
aTol:Real from Standard;
|
||||
aCtx:out Context from IntTools)
|
||||
aTol:Real from Standard;
|
||||
aCtx:out Context from IntTools)
|
||||
returns Integer from Standard;
|
||||
|
||||
FindSDShapes(myclass;
|
||||
aLE :ListOfShape from TopTools;
|
||||
aTol:Real from Standard;
|
||||
aMEE:out IndexedDataMapOfShapeListOfShape from TopTools;
|
||||
aCtx:out Context from IntTools)
|
||||
FindSDShapes(myclass;
|
||||
aLE :ListOfShape from TopTools;
|
||||
aTol:Real from Standard;
|
||||
aMEE:out IndexedDataMapOfShapeListOfShape from TopTools;
|
||||
aCtx:out Context from IntTools)
|
||||
returns Integer from Standard;
|
||||
|
||||
FindSDShapes(myclass;
|
||||
aE1 :Shape from TopoDS;
|
||||
aLE :ListOfShape from TopTools;
|
||||
aTol :Real from Standard;
|
||||
|
||||
FindSDShapes(myclass;
|
||||
aE1 :Shape from TopoDS;
|
||||
aLE :ListOfShape from TopTools;
|
||||
aTol :Real from Standard;
|
||||
aLESD :out ListOfShape from TopTools;
|
||||
aCtx :out Context from IntTools)
|
||||
returns Integer from Standard;
|
||||
|
||||
ProjectPointOnShape(myclass;
|
||||
aP1: Pnt from gp;
|
||||
aS :Shape from TopoDS;
|
||||
aP2:out Pnt from gp;
|
||||
aCtx :out Context from IntTools)
|
||||
returns Boolean from Standard;
|
||||
|
||||
PointOnShape(myclass;
|
||||
aS :Shape from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
PointOnEdge(myclass;
|
||||
aE :Edge from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
PointOnEdge(myclass;
|
||||
aE :Edge from TopoDS;
|
||||
aT :Real from Standard;
|
||||
aP3D:out Pnt from gp);
|
||||
aCtx :out Context from IntTools)
|
||||
returns Integer from Standard;
|
||||
|
||||
ProjectPointOnShape(myclass;
|
||||
aP1: Pnt from gp;
|
||||
aS :Shape from TopoDS;
|
||||
aP2:out Pnt from gp;
|
||||
aCtx :out Context from IntTools)
|
||||
returns Boolean from Standard;
|
||||
|
||||
PointOnFace(myclass;
|
||||
aF :Face from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
PointOnFace(myclass;
|
||||
aF :Face from TopoDS;
|
||||
aU :Real from Standard;
|
||||
aV :Real from Standard;
|
||||
aP3D:out Pnt from gp);
|
||||
PointOnShape(myclass;
|
||||
aS :Shape from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
RefinePCurveForEdgeOnFace (myclass;
|
||||
aE : Edge from TopoDS;
|
||||
aF : Face from TopoDS;
|
||||
aU1 : Real from Standard;
|
||||
aU2 : Real from Standard);
|
||||
PointOnEdge(myclass;
|
||||
aE :Edge from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
IsUPeriodic(myclass;
|
||||
aS:Surface from Geom)
|
||||
returns Boolean from Standard;
|
||||
PointOnEdge(myclass;
|
||||
aE :Edge from TopoDS;
|
||||
aT :Real from Standard;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
PointOnFace(myclass;
|
||||
aF :Face from TopoDS;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
PointOnFace(myclass;
|
||||
aF :Face from TopoDS;
|
||||
aU :Real from Standard;
|
||||
aV :Real from Standard;
|
||||
aP3D:out Pnt from gp);
|
||||
|
||||
RefinePCurveForEdgeOnFace (myclass;
|
||||
aE : Edge from TopoDS;
|
||||
aF : Face from TopoDS;
|
||||
aU1 : Real from Standard;
|
||||
aU2 : Real from Standard);
|
||||
|
||||
IsUPeriodic(myclass;
|
||||
aS:Surface from Geom)
|
||||
returns Boolean from Standard;
|
||||
|
||||
CorrectWires(myclass;
|
||||
aS :Shape from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
|
||||
--modified by NIZNHY-PKV Mon Feb 06 06:59:14 2012f
|
||||
BuildPCurveForEdgeOnFace (myclass;
|
||||
aE : Edge from TopoDS;
|
||||
aEold: Edge from TopoDS;
|
||||
aF : Face from TopoDS;
|
||||
aCtx :out Context from IntTools)
|
||||
returns Integer from Standard;
|
||||
--modified by NIZNHY-PKV Mon Feb 06 06:59:22 2012t
|
||||
|
||||
CorrectWires(myclass;
|
||||
aS :Shape from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
--fields
|
||||
|
||||
end Tools;
|
||||
|
@ -25,15 +25,22 @@
|
||||
|
||||
#include <GEOMAlgo_Tools.ixx>
|
||||
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
@ -53,16 +60,16 @@
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>//qft
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>//qft
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
|
||||
static
|
||||
static
|
||||
void GetCount(const TopoDS_Shape& aS,
|
||||
Standard_Integer& iCnt);
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCompositeShape
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS)
|
||||
{
|
||||
@ -79,7 +86,7 @@ Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS)
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCount
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GetCount(const TopoDS_Shape& aS,
|
||||
Standard_Integer& iCnt)
|
||||
@ -100,13 +107,13 @@ void GetCount(const TopoDS_Shape& aS,
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
GetCount(aSx, iCnt);
|
||||
GetCount(aSx, iCnt);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RefineSDShapes
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
|
||||
const Standard_Real aTol,
|
||||
@ -129,7 +136,7 @@ void GetCount(const TopoDS_Shape& aS,
|
||||
//
|
||||
aNbEE=aMEE.Extent();
|
||||
if (aNbEE==1) {
|
||||
continue; // nothing to do
|
||||
continue; // nothing to do
|
||||
}
|
||||
//
|
||||
for (j=1; j<=aNbEE; ++j) {
|
||||
@ -168,7 +175,7 @@ void GetCount(const TopoDS_Shape& aS,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindSDShapes
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
@ -184,11 +191,11 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
aNbE=aLE.Extent();
|
||||
if (!aNbE) {
|
||||
return 3; // Err
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f
|
||||
if (aNbE==1) {
|
||||
return 0; // Nothing to do
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t
|
||||
//
|
||||
while(1) {
|
||||
@ -240,7 +247,7 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindSDShapes
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1,
|
||||
const TopTools_ListOfShape& aLE,
|
||||
@ -265,7 +272,7 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1,
|
||||
else {
|
||||
bIsDone=GEOMAlgo_Tools::ProjectPointOnShape(aP1, aE2, aP2, aCtx);
|
||||
if (!bIsDone) {
|
||||
//return 1;
|
||||
//return 1;
|
||||
continue; // jfa BUG 20361
|
||||
}
|
||||
aD2=aP1.SquareDistance(aP2);
|
||||
@ -279,7 +286,7 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1,
|
||||
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnShape
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
const TopoDS_Shape& aS,
|
||||
@ -327,10 +334,10 @@ Standard_Boolean GEOMAlgo_Tools::ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
return bIsDone;
|
||||
}
|
||||
//
|
||||
aP2 = aProj.NearestPoint();
|
||||
aP2 = aProj.NearestPoint();
|
||||
}
|
||||
break;
|
||||
//
|
||||
//
|
||||
default:
|
||||
break; // Err
|
||||
}
|
||||
@ -338,7 +345,7 @@ Standard_Boolean GEOMAlgo_Tools::ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnShape
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnShape(const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP3D)
|
||||
@ -359,14 +366,14 @@ void GEOMAlgo_Tools::PointOnShape(const TopoDS_Shape& aS,
|
||||
GEOMAlgo_Tools::PointOnFace(aF, aP3D);
|
||||
}
|
||||
break;
|
||||
//
|
||||
//
|
||||
default:
|
||||
break; // Err
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnFace
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
gp_Pnt& aP3D)
|
||||
@ -375,14 +382,14 @@ void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
//
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
aU=BOPTools_Tools2D::IntermediatePoint(aUMin, aUMax);
|
||||
aV=BOPTools_Tools2D::IntermediatePoint(aVMin, aVMax);
|
||||
aU=BOPTools_Tools2D::IntermediatePoint(aUMin, aUMax);
|
||||
aV=BOPTools_Tools2D::IntermediatePoint(aVMin, aVMax);
|
||||
//
|
||||
GEOMAlgo_Tools::PointOnFace(aF, aU, aV, aP3D);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnFace
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
const Standard_Real aU,
|
||||
@ -396,7 +403,7 @@ void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnEdge
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
gp_Pnt& aP3D)
|
||||
@ -409,7 +416,7 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnEdge
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
const Standard_Real aT,
|
||||
@ -423,12 +430,12 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : RefinePCurveForEdgeOnFace
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aUMin,
|
||||
const Standard_Real aUMax)
|
||||
const Standard_Real aUMin,
|
||||
const Standard_Real aUMax)
|
||||
{
|
||||
Standard_Real aT1, aT2, aTx, aUx, aTol;
|
||||
gp_Pnt2d aP2D;
|
||||
@ -449,13 +456,13 @@ void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
Handle(Geom2d_Curve) aC2Dx;
|
||||
//
|
||||
aTol=BRep_Tool::Tolerance(aE);
|
||||
aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
|
||||
aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsUPeriodic
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS)
|
||||
{
|
||||
@ -471,3 +478,135 @@ Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS)
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:16:35 2012f
|
||||
//=======================================================================
|
||||
//function : BuildPCurveForEdgeOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer
|
||||
GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(const TopoDS_Edge& aEold,
|
||||
const TopoDS_Edge& aEnew,
|
||||
const TopoDS_Face& aF,
|
||||
IntTools_Context& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsClosed, bUClosed, bHasOld;
|
||||
Standard_Integer iRet, aNbPoints;
|
||||
Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol;
|
||||
Standard_Real aU, aV, aUS1, aVS1, aUS2, aVS2;
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2DS1, aP2DS2, aP2D;
|
||||
gp_Vec2d aV2DS1, aV2DS2;
|
||||
Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2;
|
||||
Handle(Geom_Surface) aS;
|
||||
TopoDS_Edge aES;
|
||||
//
|
||||
iRet=0;
|
||||
//
|
||||
bHasOld=BOPTools_Tools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol);
|
||||
if (bHasOld) {
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEnew, aF);
|
||||
aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
|
||||
if (aC2D.IsNull()){
|
||||
iRet=1;
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
bIsClosed=BRep_Tool::IsClosed(aEold, aF);
|
||||
if (!bIsClosed) {
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
aTol=1.e-7;
|
||||
//
|
||||
// 1. bUClosed - direction of closeness
|
||||
//
|
||||
aES=aEold;
|
||||
aES.Orientation(TopAbs_FORWARD);
|
||||
aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
|
||||
//
|
||||
aES.Orientation(TopAbs_REVERSED);
|
||||
aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
|
||||
//
|
||||
aTS=BOPTools_Tools2D::IntermediatePoint(aTS1, aTS2);
|
||||
//
|
||||
aC2DS1->D1(aTS, aP2DS1, aV2DS1);
|
||||
aC2DS2->D1(aTS, aP2DS2, aV2DS2);
|
||||
//
|
||||
gp_Vec2d aV2DS12(aP2DS1, aP2DS2);
|
||||
gp_Dir2d aD2DS12(aV2DS12);
|
||||
const gp_Dir2d& aD2DX=gp::DX2d();
|
||||
//
|
||||
aScPr=aD2DS12*aD2DX;
|
||||
bUClosed=Standard_True;
|
||||
if (fabs(aScPr) < aTol) {
|
||||
bUClosed=!bUClosed;
|
||||
}
|
||||
//
|
||||
// 2. aP2D - point on curve aC2D, that corresponds to aP2DS1
|
||||
aP2DS1.Coord(aUS1, aVS1);
|
||||
aP2DS2.Coord(aUS2, aVS2);
|
||||
//
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
aS->D0(aUS1, aVS1, aP);
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjPC=aCtx.ProjPC(aEnew);
|
||||
//
|
||||
aProjPC.Perform(aP);
|
||||
aNbPoints=aProjPC.NbPoints();
|
||||
if (!aNbPoints) {
|
||||
iRet=2;
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
aT=aProjPC.LowerDistanceParameter();
|
||||
|
||||
//
|
||||
// 3. Build the second 2D curve
|
||||
Standard_Boolean bRevOrder;
|
||||
gp_Vec2d aV2DT, aV2D;
|
||||
Handle(Geom2d_Curve) aC2Dnew;
|
||||
Handle(Geom2d_TrimmedCurve) aC2DTnew;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aC2D->D1(aT, aP2D, aV2D);
|
||||
aP2D.Coord(aU, aV);
|
||||
//
|
||||
aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy());
|
||||
aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2);
|
||||
//
|
||||
aV2DT=aV2DS12;
|
||||
if (!bUClosed) { // V Closed
|
||||
if (fabs(aV-aVS2)<aTol) {
|
||||
aV2DT.Reverse();
|
||||
}
|
||||
}
|
||||
else { // U Closed
|
||||
if (fabs(aU-aUS2)<aTol) {
|
||||
aV2DT.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
aC2DTnew->Translate(aV2DT);
|
||||
//
|
||||
// 4 Order the 2D curves
|
||||
bRevOrder=Standard_False;
|
||||
aScPr=aV2D*aV2DS1;
|
||||
if(aScPr<0.) {
|
||||
bRevOrder=!bRevOrder;
|
||||
}
|
||||
//
|
||||
// 5. Update the edge
|
||||
aTol=BRep_Tool::Tolerance(aEnew);
|
||||
if (!bRevOrder) {
|
||||
aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol);
|
||||
}
|
||||
else {
|
||||
aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol);
|
||||
}
|
||||
//
|
||||
return iRet;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_Tools_HeaderFile
|
||||
#define _GEOMAlgo_Tools_HeaderFile
|
||||
@ -35,6 +34,7 @@
|
||||
#ifndef _Handle_Geom_Surface_HeaderFile
|
||||
#include <Handle_Geom_Surface.hxx>
|
||||
#endif
|
||||
|
||||
class TopoDS_Shape;
|
||||
class GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape;
|
||||
class IntTools_Context;
|
||||
@ -45,7 +45,6 @@ class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class Geom_Surface;
|
||||
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
@ -70,56 +69,44 @@ public:
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
}
|
||||
// Methods PUBLIC
|
||||
//
|
||||
|
||||
// Methods PUBLIC
|
||||
//
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
|
||||
Standard_EXPORT static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,const Standard_Real aTol,IntTools_Context& aCtx) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,const Standard_Real aTol,IntTools_Context& aCtx) ;
|
||||
Standard_EXPORT static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_IndexedDataMapOfShapeListOfShape& aMEE,IntTools_Context& aCtx) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_ListOfShape& aLESD,IntTools_Context& aCtx) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_IndexedDataMapOfShapeListOfShape& aMEE,IntTools_Context& aCtx) ;
|
||||
Standard_EXPORT static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,const TopoDS_Shape& aS,gp_Pnt& aP2,IntTools_Context& aCtx) ;
|
||||
|
||||
Standard_EXPORT static void PointOnShape(const TopoDS_Shape& aS,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_ListOfShape& aLESD,IntTools_Context& aCtx) ;
|
||||
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,const Standard_Real aT,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,const TopoDS_Shape& aS,gp_Pnt& aP2,IntTools_Context& aCtx) ;
|
||||
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,const Standard_Real aU,const Standard_Real aV,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT static void PointOnShape(const TopoDS_Shape& aS,gp_Pnt& aP3D) ;
|
||||
Standard_EXPORT static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Standard_Real aU1,const Standard_Real aU2) ;
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ;
|
||||
|
||||
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,gp_Pnt& aP3D) ;
|
||||
|
||||
|
||||
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,const Standard_Real aT,gp_Pnt& aP3D) ;
|
||||
|
||||
|
||||
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,gp_Pnt& aP3D) ;
|
||||
|
||||
|
||||
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,const Standard_Real aU,const Standard_Real aV,gp_Pnt& aP3D) ;
|
||||
|
||||
|
||||
Standard_EXPORT static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Standard_Real aU1,const Standard_Real aU2) ;
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ;
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Boolean CorrectWires(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT static Standard_Boolean CorrectWires(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT static Standard_Integer BuildPCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Edge& aEold,const TopoDS_Face& aF,IntTools_Context& aCtx) ;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Methods PROTECTED
|
||||
//
|
||||
// Methods PROTECTED
|
||||
//
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
@ -143,7 +130,6 @@ private:
|
||||
|
||||
|
||||
// other Inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user