// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BOPTools_AlgoTools3D.ixx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Vertex.hxx>
-
-#include <BOPCol_IndexedMapOfShape.hxx>
+#include <Bnd_Box.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
-
+#include <BOPCol_IndexedMapOfShape.hxx>
+#include <BOPTools_AlgoTools2D.hxx>
+#include <BOPTools_AlgoTools3D.hxx>
#include <BRep_Builder.hxx>
+#include <BRep_CurveRepresentation.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
+#include <BRep_PointRepresentation.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_TFace.hxx>
#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
+#include <BRep_TVertex.hxx>
#include <BRepAdaptor_Surface.hxx>
-
-#include <gp_Vec2d.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Lin2d.hxx>
-#include <gp_Dir2d.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pln.hxx>
-
+#include <BRepBndLib.hxx>
+#include <BRepGProp.hxx>
+#include <BRepTools.hxx>
#include <Geom2d_Curve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
-
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <Geom_BSplineSurface.hxx>
#include <Geom_Curve.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
-#include <Geom_BSplineSurface.hxx>
-#include <Geom_BezierSurface.hxx>
-
#include <GeomAdaptor_Surface.hxx>
-
-#include <IntTools_Tools.hxx>
-
-#include <BOPTools_AlgoTools2D.hxx>
-
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-#include <BRepBndLib.hxx>
-#include <Bnd_Box.hxx>
#include <gp_Cylinder.hxx>
-#include <BRep_TVertex.hxx>
-#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
-#include <BRep_PointRepresentation.hxx>
-#include <BRep_TEdge.hxx>
-#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
-#include <BRep_CurveRepresentation.hxx>
-#include <BRep_TFace.hxx>
-#include <Poly_Triangulation.hxx>
-#include <BRep_Builder.hxx>
-#include <BOPInt_Context.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
-#include <Geom2dHatch_Hatcher.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Dir2d.hxx>
+#include <gp_Lin2d.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <GProp_GProps.hxx>
#include <HatchGen_Domain.hxx>
+#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
+#include <Poly_Triangulation.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
static void Add(const TopoDS_Shape& aS,
BOPCol_IndexedMapOfShape& myShapes,
Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft;
Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1;
Standard_Real aScPr, anV, dV, anV1;
+ Standard_Real aUmin, aUmax, aVmin, aVmax;
gp_Pnt2d aP2D;
gp_Vec2d aVec2D;
Handle(Geom2d_Curve) aTmpC1, aTmpC2;
aTol=BRep_Tool::Tolerance(aSp);
//
aS=BRep_Tool::Surface(aF);
+ //
+ aS->Bounds(aUmin, aUmax, aVmin, aVmax);
+ //
bIsUPeriodic=aS->IsUPeriodic();
bIsVPeriodic=aS->IsVPeriodic();
//
//
if (!bIsUPeriodic && !bIsVPeriodic) {
Standard_Boolean bIsUClosed, bIsVClosed;
- Standard_Real aUmin = 0., aUmax = 0., aVmin = 0., aVmax = 0.;
Handle(Geom_BSplineSurface) aBS;
Handle(Geom_BezierSurface) aBZ;
+ Handle(Geom_RectangularTrimmedSurface) aRTS;
//
bIsUClosed=Standard_False;
bIsVClosed=Standard_False;
aBS=Handle(Geom_BSplineSurface)::DownCast(aS);
aBZ=Handle(Geom_BezierSurface) ::DownCast(aS);
+ aRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
//
if (!aBS.IsNull()) {
bIsUClosed=aBS->IsUClosed();
bIsVClosed=aBS->IsVClosed();
- aBS->Bounds(aUmin, aUmax, aVmin, aVmax);
}
else if (!aBZ.IsNull()) {
bIsUClosed=aBZ->IsUClosed();
bIsVClosed=aBZ->IsVClosed();
- aBZ->Bounds(aUmin, aUmax, aVmin, aVmax);
}
- if (!bIsUClosed && !bIsVClosed) {
- return;
+ else if (!aRTS.IsNull()) {
+ Handle(Geom_Surface) aSB;
+ //
+ aSB=aRTS->BasisSurface();
+ bIsUPeriodic=aSB->IsUPeriodic();
+ bIsVPeriodic=aSB->IsVPeriodic();
+ //
+ if (!(bIsUPeriodic || bIsVPeriodic)) {
+ return;
+ }
+ anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.;
+ anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.;
}
//
- if (bIsUClosed) {
- anUPeriod=aUmax-aUmin;
- }
- if (bIsVClosed) {
- anVPeriod=aVmax-aVmin;
+ if (aRTS.IsNull()) {
+ if (!bIsUClosed && !bIsVClosed) {
+ return;
+ }
+ //
+ if (bIsUClosed) {
+ anUPeriod=aUmax-aUmin;
+ }
+ if (bIsVClosed) {
+ anVPeriod=aVmax-aVmin;
+ }
}
}
//
+ //---------------------------------------------------
C2D1=BRep_Tool::CurveOnSurface(aSp, aF, a, b);
//
aT=BOPTools_AlgoTools2D::IntermediatePoint(a, b);
dV = aGAS.VResolution(aTol);
//
if (anUPeriod > 0.){
- if (fabs (anU) < dU) {
+ if (fabs (anU-aUmin) < dU) {
bIsLeft=Standard_True;
anU1=anU+anUPeriod;
}
- else if (fabs (anU-anUPeriod) < dU) {
+ else if (fabs (anU-aUmax) < dU) {
bIsLeft=Standard_False;
anU1=anU-anUPeriod;
}
}
//
if (anVPeriod > 0.) {
- if (fabs (anV) < dV) {
+ if (fabs (anV-aVmin) < dV) {
bIsLeft=Standard_True;
anV1=anV+anVPeriod;
}
- else if (fabs (anV-anVPeriod) < dV) {
+ else if (fabs (anV-aVmax) < dV) {
bIsLeft=Standard_False;
anV1=anV-anVPeriod;
}
const Standard_Real aT,
gp_Pnt& aPNear,
gp_Dir& aDNF,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
Handle(Geom2d_Curve) aC2D=
}
}
if( aETol > 1.e-5 || aFTol > 1.e-5 ) {
- //if( aETol > 1.e-5 && aFTol > 1.e-5 ) {
- //pkv/103/D7
+ //
if(aTS!=GeomAbs_Sphere) {
gp_Vec2d transVec( aDP );
transVal = aDt2D + aETol + aFTol;
const Standard_Real aT,
gp_Pnt2d& aPx2DNear,
gp_Pnt& aPxNear,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aTolE, aTolF, dTx, dT2D;
Handle(Geom_Surface) aS;
const TopoDS_Face& aF,
gp_Pnt2d& aPInFace2D,
gp_Pnt& aPInFace,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Real aT, aT1, aT2;
//
(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D,
- Handle(BOPInt_Context)& theContext)
+ Handle(IntTools_Context)& theContext)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
- Standard_Integer iErr, aIx, aNbDomains;
+ Standard_Integer iErr, aIx = 0, aNbDomains = 0;
Standard_Real aUMin, aUMax, aVMin, aVMax;
Standard_Real aVx = 0., aUx, aV1, aV2;
gp_Dir2d aD2D (0., 1.);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
- aP2D.SetCoord(aUx, 0.);
- aL2D=new Geom2d_Line (aP2D, aD2D);
- Geom2dAdaptor_Curve aHCur(aL2D);
- //
- aIx=aHatcher.AddHatching(aHCur) ;
- //
- aHatcher.Trim();
- bIsDone=aHatcher.TrimDone(aIx);
- if (!bIsDone) {
- iErr=1;
- return iErr;
+ Standard_Integer i;
+ for(i = 1; i <= 2; ++i)
+ {
+ aP2D.SetCoord(aUx, 0.);
+ aL2D=new Geom2d_Line (aP2D, aD2D);
+ Geom2dAdaptor_Curve aHCur(aL2D);
+ //
+ aIx=aHatcher.AddHatching(aHCur) ;
+ //
+ aHatcher.Trim(aIx);
+ bIsDone=aHatcher.TrimDone(aIx);
+ if (!bIsDone) {
+ iErr=1;
+ return iErr;
+ }
+ //
+ if(aHatcher.NbPoints(aIx) > 1)
+ {
+ aHatcher.ComputeDomains(aIx);
+ bIsDone=aHatcher.IsDone(aIx);
+ if (!bIsDone) {
+ iErr=2;
+ return iErr;
+ }
+ break;
+ }
+ else
+ {
+ aUx = aUMax - (aUx - aUMin);
+ }
}
//
- aHatcher.ComputeDomains(aIx);
- bIsDone=aHatcher.IsDone(aIx);
- if (!bIsDone) {
+ if(!aHatcher.IsDone(aIx))
+ {
iErr=2;
return iErr;
}
- //
+
aNbDomains=aHatcher.NbDomains(aIx);
if (aNbDomains > 0) {
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, 1);