mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0021762: Integration of new Boolean Operation algorithm to OCCT.
Modifications: - BRepOffset/BRepOffset_Tool.cxx, Features and Fillets algorithms have been ported on new BO algorithm. - Old BO algorithm, that was implemented in BOP, BooleanOperations and BOPTools packages, has - been deleted. - Porting SALOME algorithms to new BOP algorithm. - Fixing regressions. Rebased on current master. - Corrections in post treatment of section edges; - Corrections in the accordance with the bug 0023293; - Small corrections in the bopcheck and bopargcheck commands. - NCollection maps have been replaced by NCollection indexed maps to guarantee the constant order of sub-shapes in the result of boolean operation. - Test case feat featprism M9 has been fixed. - Test cases chl 902 E3 H3 have been fixed (corrections in the treatment of section edges). - Test cases caf driver B6 B7, caf named_shape F6 F7 have been modified according to the new order of sub-shapes in the result of boolean operation. - Test cases blend buildevol G1, blend simple K4, bcommon_complex C7, feat featprism L6 have been modified as they are improvements. - Test case boolean bsection A3 has been modified according to the new syntax of the bsection command. - Test cases boolean bfuse_complex J1 P9 have been fixed (the function IsInternalFace has been modified to use the function GetFaceOff); - Test case chl 902 H3 has been fixed (changes in the treatment of section edges); - Test case boolean bsection D8 has been modified (removed TODO statement); - Test case boolean bsection A3 has been modified (as the shapes have been changed). - Added correction of the tolerance values of the shapes according to the bug 0023610. - test cases: boolean bcommon_complex C3, boolean bcut_complex F2 O7, boolean bfuse_complex C4 C5 E4, boolean bsection B6 M8 M9 N4 N5 N7, boolean bfuse_simple ZP6, draft angle G8, feat featprism S2 have been marked as invalid according to the bug 0022033; - New value of result has been set in the test cases : boolean bopsection D4 boolean bsection R8 as it is correct. - test case bugs modalg bug23472 has been rewritten according to the new format of bsection command. - The classes IntTools_Context and IntTools_ShrunkRange have been replaced by BOPInt_Context and BOPInt_ShrunkRange accordingly. - The new class BRepAlgoAPI_Check has been added according to the bug 0023648. - Some regressions have been fixed. - The following test cases have been marked as invalid or rewritten bugs modalg buc60462_2, 60531_2, 60776_1, bug472_1, bug472_2, bug472_3, bug497_3, bug62 bugs moddata bug26_1, bug26_2, - The test case bugs modalg buc60533 has been rewritten to use the general fuse algorithm for building the result. - The new value of the result has been set in the test case bugs modalg 60776_2. - The following test cases have been rewritten according to the new format of the bsection command bugs modlag fra62369, pro18892 bugs moddata bug75_1, bug75_2 - Corrected BRepAlgoAPI_Check. - Removed package BOPTColStd. - Rewritten test cases caf named_shape F8 F9. - Removed unnecessary comments. - Corrected the following test scripts : boolean bcut_complex(012) O3 O4 O5 O6 O8 boolean bfuse_complex(013) O5 O6 P8 boolean bopcommon_complex(021) D8 D9 boolean bopfuse_complex(022) H1 J6 boolean boptuc_complex(024) D5 bugs modalg(006) bug399 bug497_1 feat featprism(003) C4 - Corrections in the treatment of section edges (putting paves on the curves); - Corrections in BRepOffset_Tool; - The following test cases have been rewritten according to the new format of the bsection command bugs modalg bug6502, bug6554, bug6766_1, bug6766_3 - The new value of the result has been set in the following test cases bugs modalg bug1255, bug1255_1 - The following test cases have been marked as invalid or rewritten bugs modalg bug472_2, bug472_3, bug825_2 bugs moddata bug10603, bug152_1, bug152_2, bug3721_1, bug3721_2, bug3721_3 - The following test cases have been rewritten as improvements bugs modalg bug693, bug693_1, bug817_1 bugs moddata bug3721_5, bug3721_6, bug6862_3, bug6862_4, bug6862_6 - Test cases bugs modlag buc60787_1, buc60787_2, buc60788_2, buc60788_3 have been corrected. - Fixed some SALOME regressions (modifications in the treatment of the section edges); - Fixed test case bugs modalg bug23100; - Test cases bugs modalg bug21754, bug22990 have been corrected according to the new format of the bsection command. - Test cases bugs modalg bug13116_*, bug23711 have been fixed; - Test cases bugs modalg bug697_2, bug697_4, bug697_7, bug697_8 have been marked as invalid according to the issue 0022033; - Test cases bugs modalg bug22109_2, bug22109_3 have been corrected; - Test case bugs modalg bug18186 has been corrected as it is improvement; - Test case bugs modalg bug22802 has been deleted as there is no package BOPTColStd.
This commit is contained in:
@@ -48,7 +48,7 @@ uses
|
||||
BRepClass3d,
|
||||
TColgp,
|
||||
MMgt,
|
||||
Geom2dHatch
|
||||
BOPInt
|
||||
|
||||
is
|
||||
|
||||
@@ -113,24 +113,12 @@ is
|
||||
---Purpose: class provides the Face/Face algorithm
|
||||
---
|
||||
|
||||
class ShrunkRange;
|
||||
---Purpose: class provides computing and storage of shrunk range
|
||||
--- for an edge bounded by two vertices
|
||||
|
||||
class Context;
|
||||
---Purpose: class is a container of a large number of reusable
|
||||
--- projection and classification algorithms
|
||||
|
||||
class Tools;
|
||||
---Purpose: class is a container of usefull geometrical and
|
||||
--- topological algorithms
|
||||
|
||||
generic class CArray1;
|
||||
---
|
||||
--- P o i n t e r s
|
||||
---
|
||||
--pointer PContext to Context from IntTools;
|
||||
---
|
||||
--- I n s t a n t i a t i o n s
|
||||
---
|
||||
class SequenceOfPntOn2Faces instantiates
|
||||
|
@@ -33,7 +33,7 @@ uses
|
||||
SequenceOfRoots from IntTools,
|
||||
MarkedRangeSet from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
Context from IntTools,
|
||||
Context from BOPInt,
|
||||
ExtCS from Extrema,
|
||||
ProjectPointOnSurf from GeomAPI,
|
||||
Edge from TopoDS,
|
||||
@@ -128,12 +128,12 @@ is
|
||||
---
|
||||
|
||||
SetContext(me: in out;
|
||||
theContext: Context from IntTools);
|
||||
theContext: Context from BOPInt);
|
||||
---Purpose:
|
||||
--- Sets the intersecton context
|
||||
---
|
||||
Context(me)
|
||||
returns Context from IntTools;
|
||||
returns Context from BOPInt;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Gets the intersecton context
|
||||
@@ -173,9 +173,9 @@ is
|
||||
|
||||
ComputeLinePlane(me: in out)
|
||||
is private;
|
||||
|
||||
|
||||
FastComputeExactIntersection(me: in out)
|
||||
returns Boolean from Standard is private;
|
||||
returns Integer from Standard is private;
|
||||
|
||||
ComputeUsingExtremum(me: in out)
|
||||
is private;
|
||||
@@ -247,7 +247,7 @@ fields
|
||||
myProjector : ProjectPointOnSurf from GeomAPI;
|
||||
myRangeManager : MarkedRangeSet from IntTools;
|
||||
myDeflection : Real from Standard;
|
||||
myContext : Context from IntTools;
|
||||
myContext : Context from BOPInt;
|
||||
|
||||
-- results
|
||||
myResults : SequenceOfRanges from IntTools;
|
||||
|
@@ -46,7 +46,8 @@
|
||||
#include <Extrema_ExtCS.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <IntCurveSurface_HInter.hxx>
|
||||
#include <IntCurveSurface_IntersectionPoint.hxx>
|
||||
@@ -280,7 +281,7 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
|
||||
// function: SetContext
|
||||
// purpose:
|
||||
// ==================================================================================
|
||||
void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& theContext)
|
||||
void IntTools_BeanFaceIntersector::SetContext(const Handle(BOPInt_Context)& theContext)
|
||||
{
|
||||
myContext = theContext;
|
||||
}
|
||||
@@ -288,7 +289,7 @@ void IntTools_BeanFaceIntersector::SetContext(const Handle(IntTools_Context)& th
|
||||
// function: Context
|
||||
// purpose:
|
||||
// ==================================================================================
|
||||
const Handle(IntTools_Context)& IntTools_BeanFaceIntersector::Context()const
|
||||
const Handle(BOPInt_Context)& IntTools_BeanFaceIntersector::Context()const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
@@ -327,13 +328,13 @@ void IntTools_BeanFaceIntersector::Perform()
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
myResults.Clear();
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer bRet;
|
||||
Standard_Integer aDiscretization = 30;
|
||||
Standard_Real aRelativeDeflection = 0.01;
|
||||
myDeflection = aRelativeDeflection;
|
||||
//
|
||||
if (myContext.IsNull()) {
|
||||
myContext=new IntTools_Context;
|
||||
myContext=new BOPInt_Context;
|
||||
}
|
||||
//
|
||||
if(myCurve.GetType()==GeomAbs_Line && mySurface.GetType()==GeomAbs_Plane) {
|
||||
@@ -409,12 +410,18 @@ void IntTools_BeanFaceIntersector::Perform()
|
||||
}
|
||||
//
|
||||
bRet=FastComputeExactIntersection();
|
||||
if(bRet) {
|
||||
if(bRet == 1) {
|
||||
IntTools_Range aRange(myFirstParameter, myLastParameter);
|
||||
myResults.Append(aRange);
|
||||
myIsDone = Standard_True;
|
||||
return;
|
||||
}
|
||||
//modified by NIZHNY-EMV Fri Apr 20 09:38:08 2012
|
||||
else if (bRet == 2) {
|
||||
myIsDone = Standard_True;
|
||||
return;
|
||||
}
|
||||
//modified by NIZHNY-EMV Fri Apr 20 09:38:10 2012
|
||||
|
||||
|
||||
// Standard_Boolean coinside = TestCoinside(myCurve,mySurface);
|
||||
@@ -714,13 +721,13 @@ void IntTools_BeanFaceIntersector::ComputeAroundExactIntersection()
|
||||
// function: FastComputeExactIntersection
|
||||
// purpose:
|
||||
// ==================================================================================
|
||||
Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
Standard_Integer IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
{
|
||||
Standard_Boolean aresult;
|
||||
Standard_Integer aresult;
|
||||
GeomAbs_CurveType aCT;
|
||||
GeomAbs_SurfaceType aST;
|
||||
//
|
||||
aresult = Standard_False;
|
||||
aresult = 0;
|
||||
aCT=myCurve.GetType();
|
||||
aST=mySurface.GetType();
|
||||
//
|
||||
@@ -737,7 +744,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
if((surfPlane.Distance(myCurve.Value(myFirstParameter)) < myCriteria) &&
|
||||
(surfPlane.Distance(myCurve.Value(myLastParameter)) < myCriteria)) {
|
||||
myRangeManager.InsertRange(myFirstParameter, myLastParameter, 2);
|
||||
aresult = Standard_True;
|
||||
aresult = 1;
|
||||
}
|
||||
}
|
||||
else { // else 1
|
||||
@@ -815,7 +822,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
//
|
||||
if(insertRange) {
|
||||
myRangeManager.InsertRange(myFirstParameter, myLastParameter, 2);
|
||||
aresult = Standard_True;
|
||||
aresult = 1;
|
||||
}
|
||||
}//if(anAngle < Precision::Angular()) {
|
||||
}//else { // else 1
|
||||
@@ -850,7 +857,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
|
||||
if(adist < myCriteria) { // Abs is important function here
|
||||
myRangeManager.InsertRange(myFirstParameter, myLastParameter, 2);
|
||||
aresult = Standard_True;
|
||||
aresult = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -870,7 +877,7 @@ Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
|
||||
if(adist < myCriteria) {
|
||||
myRangeManager.InsertRange(myFirstParameter, myLastParameter, 2);
|
||||
aresult = Standard_True;
|
||||
aresult = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -922,12 +929,31 @@ Standard_Boolean IntTools_BeanFaceIntersector::FastComputeExactIntersection()
|
||||
break;
|
||||
}
|
||||
}
|
||||
//modified by NIZHNY-EMV Fri Apr 20 08:45:29 2012
|
||||
//
|
||||
if (!bFlag) {
|
||||
Standard_Real U, V, aTm;
|
||||
gp_Pnt aPm;
|
||||
gp_Pnt2d aP2d;
|
||||
//
|
||||
aTm = IntTools_Tools::IntermediatePoint(myFirstParameter, myLastParameter);
|
||||
aPm = myCurve.Value(aTm);
|
||||
ElSLib::Parameters(aCyl, aPm, U, V);
|
||||
aP2d.SetCoord(U,V);
|
||||
//
|
||||
bFlag = !(myContext->IsPointInOnFace(mySurface.Face(), aP2d));
|
||||
}
|
||||
//
|
||||
if (!bFlag){
|
||||
myRangeManager.InsertRange(myFirstParameter, myLastParameter, 2);
|
||||
aresult = Standard_True;
|
||||
aresult = 1;
|
||||
return aresult;
|
||||
}
|
||||
else {
|
||||
aresult = 2;
|
||||
return aresult;
|
||||
}
|
||||
//modified by NIZHNY-EMV Fri Apr 20 08:45:32 2012
|
||||
}
|
||||
|
||||
}//if(aCT==GeomAbs_Line) {
|
||||
|
@@ -1,319 +0,0 @@
|
||||
-- Created on: 2002-04-03
|
||||
-- Created by: Peter KURNEV
|
||||
-- Copyright (c) 2002-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class Context from IntTools
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose:
|
||||
--- The class is to provide direct access
|
||||
--- to the frequently using objects like
|
||||
--- IntTools_FClass2d,
|
||||
--- GeomAPI_ProjectPointOnSurf, etc.
|
||||
--- The instance of the class allows to avoid repeated
|
||||
--- computations by mapping internal objects in the
|
||||
-- instance.
|
||||
|
||||
uses
|
||||
State from TopAbs,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp,
|
||||
Curve from Geom,
|
||||
ProjectPointOnCurve from GeomAPI,
|
||||
ProjectPointOnSurf from GeomAPI,
|
||||
Vertex from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Solid from TopoDS,
|
||||
SolidClassifier from BRepClass3d,
|
||||
IndexedDataMapOfShapeAddress from TopTools,
|
||||
IndexedDataMapOfTransientAddress from IntTools,
|
||||
FClass2d from IntTools,
|
||||
SurfaceRangeLocalizeData from IntTools,
|
||||
Curve from IntTools,
|
||||
Hatcher from Geom2dHatch
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns mutable Context from IntTools;
|
||||
---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
|
||||
FClass2d(me: mutable;
|
||||
aF: Face from TopoDS)
|
||||
returns FClass2d from IntTools;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point classifier
|
||||
--- for given face
|
||||
---
|
||||
|
||||
ProjPS (me: mutable;
|
||||
aF: Face from TopoDS)
|
||||
returns ProjectPointOnSurf from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given face
|
||||
---
|
||||
|
||||
ProjPC (me: mutable;
|
||||
aE: Edge from TopoDS)
|
||||
returns ProjectPointOnCurve from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given edge
|
||||
---
|
||||
|
||||
ProjPT (me: mutable;
|
||||
aC: Curve from Geom)
|
||||
returns ProjectPointOnCurve from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given curve
|
||||
---
|
||||
|
||||
SurfaceData(me: mutable;
|
||||
aF: Face from TopoDS)
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to surface localization data
|
||||
--- for given face
|
||||
|
||||
|
||||
SolidClassifier(me: mutable;
|
||||
aSolid: Solid from TopoDS)
|
||||
returns SolidClassifier from BRepClass3d;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to solid classifier
|
||||
--- for given solid
|
||||
---
|
||||
--modified by NIZNHY-PKV Mon Sep 24 07:52:54 2012f
|
||||
Hatcher(me: mutable;
|
||||
aF: Face from TopoDS)
|
||||
returns Hatcher from Geom2dHatch;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to 2D hatcher
|
||||
--- for given face
|
||||
---
|
||||
--modified by NIZNHY-PKV Mon Sep 24 07:52:54 2012t
|
||||
|
||||
|
||||
|
||||
--- API Block
|
||||
---
|
||||
ComputeVE (me:mutable;
|
||||
aV : Vertex from TopoDS;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the edge aE.
|
||||
--- Returns zero if the distance between vertex
|
||||
--- and edge is less than sum of tolerances,
|
||||
--- otherwise and for following conditions returns
|
||||
--- negative value
|
||||
--- 1. the edge is degenerated (-1)
|
||||
--- 2. the edge does not contain 3d curve and pcurves (-2)
|
||||
--- 3. projection algorithm failed (-3)
|
||||
---
|
||||
|
||||
ComputeVE (me:mutable;
|
||||
aV : Vertex from TopoDS;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard;
|
||||
bToUpdateVertex:out Boolean from Standard;
|
||||
aDist :out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter aT of the vertex aV on
|
||||
--- the edge aE.
|
||||
--- Returns zero if the distance between vertex
|
||||
--- and edge is less than sum of tolerances,
|
||||
--- otherwise and for following conditions returns
|
||||
--- negative value
|
||||
--- 1. the edge is degenerated (-1)
|
||||
--- 2. the edge does not contain 3d curve and pcurves (-2)
|
||||
--- 3. projection algorithm failed (-3)
|
||||
---
|
||||
--- Output parameters
|
||||
---
|
||||
--- bToUpdateVertex - the flag that indicates whether the
|
||||
--- vertex tolerance should be modified or not
|
||||
--- aDist - the value of the distance between the vertex
|
||||
--- and the edge
|
||||
|
||||
ComputeVS (me:mutable;
|
||||
aV : Vertex from TopoDS;
|
||||
aF : Face from TopoDS;
|
||||
U : out Real from Standard;
|
||||
V : out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes UV parameters of the vertex aV on face aF
|
||||
--- Returns zero if the distance between vertex and face is
|
||||
--- less than or equal the sum of tolerances and the projection
|
||||
--- point lays inside boundaries of the face.
|
||||
--- For following conditions returns negative value
|
||||
--- 1. projection algorithm failed (-1)
|
||||
--- 2. distance is more than sum of tolerances (-2)
|
||||
--- 3. projection point out or on the boundaries of face (-3)
|
||||
---
|
||||
|
||||
StatePointFace(me:mutable;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns the state of the point aP2D
|
||||
--- relative to face aF
|
||||
---
|
||||
|
||||
IsPointInFace(me:mutable;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the point aP2D is
|
||||
--- inside the boundaries of the face aF,
|
||||
--- otherwise returns false
|
||||
---
|
||||
|
||||
IsPointInOnFace(me:mutable;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the point aP2D is
|
||||
--- inside or on the boundaries of aF
|
||||
---
|
||||
|
||||
IsValidPointForFace(me:mutable ;
|
||||
aP3D : Pnt from gp;
|
||||
aF : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the distance between point aP3D
|
||||
--- and face aF is less or equal to tolerance aTol
|
||||
--- and projection point is inside or on the boundaries
|
||||
--- of the face aF
|
||||
---
|
||||
|
||||
IsValidPointForFaces(me:mutable;
|
||||
aP3D : Pnt from gp;
|
||||
aF1 : Face from TopoDS;
|
||||
aF2 : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidPointForFace returns true
|
||||
--- for both face aF1 and aF2
|
||||
---
|
||||
|
||||
IsValidBlockForFace (me:mutable;
|
||||
aT1 : Real from Standard;
|
||||
aT2 : Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aF : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidPointForFace returns true
|
||||
--- for some 3d point that lay on the curve aIC bounded by
|
||||
--- parameters aT1 and aT2
|
||||
---
|
||||
|
||||
IsValidBlockForFaces (me:mutable;
|
||||
aT1 : Real from Standard;
|
||||
aT2 : Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aF1 : Face from TopoDS;
|
||||
aF2 : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidBlockForFace returns true
|
||||
--- for both faces aF1 and aF2
|
||||
---
|
||||
|
||||
IsVertexOnLine(me:mutable;
|
||||
aV : Vertex from TopoDS;
|
||||
aIC : Curve from IntTools;
|
||||
aTolC: Real from Standard;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the curve aIC.
|
||||
--- Returns true if the distance between vertex and
|
||||
--- curve is less than sum of tolerance of aV and aTolC,
|
||||
--- otherwise or if projection algorithm failed
|
||||
--- returns false (in this case aT isn't significant)
|
||||
---
|
||||
|
||||
IsVertexOnLine(me:mutable;
|
||||
aV : Vertex from TopoDS;
|
||||
aTolV: Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aTolC: Real from Standard;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the curve aIC.
|
||||
--- Returns true if the distance between vertex and
|
||||
--- curve is less than sum of tolerance of aV and aTolC,
|
||||
--- otherwise or if projection algorithm failed
|
||||
--- returns false (in this case aT isn't significant)
|
||||
---
|
||||
|
||||
ProjectPointOnEdge (me:mutable;
|
||||
aP : Pnt from gp;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the point aP on
|
||||
--- the edge aE.
|
||||
--- Returns false if projection algorithm failed
|
||||
--- other wiese returns true.
|
||||
---
|
||||
|
||||
fields
|
||||
myFClass2dMap : IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
myProjPSMap : IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
myProjPCMap : IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
myProjPTMap : IndexedDataMapOfTransientAddress from IntTools is protected;
|
||||
mySClassMap : IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
myProjSDataMap: IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
myHatcherMap : IndexedDataMapOfShapeAddress from TopTools is protected;
|
||||
|
||||
end Context;
|
||||
|
@@ -1,795 +0,0 @@
|
||||
// Created on: 2002-04-03
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2002-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
#include <IntTools_Context.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
//
|
||||
#include <Geom2dHatch_Intersector.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Context::IntTools_Context()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Context::~IntTools_Context()
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
Standard_Integer i, aNb;
|
||||
//
|
||||
//modified by NIZNHY-PKV Mon Sep 24 08:01:03 2012f
|
||||
Geom2dHatch_Hatcher* pHatcher;
|
||||
aNb=myHatcherMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myHatcherMap(i);
|
||||
pHatcher=(Geom2dHatch_Hatcher*)anAdr;
|
||||
delete pHatcher;
|
||||
}
|
||||
myHatcherMap.Clear();
|
||||
//
|
||||
//modified by NIZNHY-PKV Mon Sep 24 08:01:07 2012t
|
||||
//
|
||||
IntTools_FClass2d* pFClass2d;
|
||||
aNb=myFClass2dMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myFClass2dMap(i);
|
||||
pFClass2d=(IntTools_FClass2d*)anAdr;
|
||||
delete pFClass2d;
|
||||
}
|
||||
myFClass2dMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnSurf* pProjPS;
|
||||
aNb=myProjPSMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPSMap(i);
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
|
||||
delete pProjPS;
|
||||
}
|
||||
myProjPSMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve* pProjPC;
|
||||
aNb=myProjPCMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPCMap(i);
|
||||
pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
delete pProjPC;
|
||||
}
|
||||
myProjPCMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve* pProjPT;
|
||||
aNb=myProjPTMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPTMap(i);
|
||||
pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
delete pProjPT;
|
||||
}
|
||||
myProjPTMap.Clear();
|
||||
//
|
||||
BRepClass3d_SolidClassifier* pSC;
|
||||
aNb=mySClassMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=mySClassMap(i);
|
||||
pSC=(BRepClass3d_SolidClassifier*)anAdr;
|
||||
delete pSC;
|
||||
}
|
||||
mySClassMap.Clear();
|
||||
//
|
||||
IntTools_SurfaceRangeLocalizeData* pSData = NULL;
|
||||
aNb = myProjSDataMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjSDataMap(i);
|
||||
pSData = (IntTools_SurfaceRangeLocalizeData*)anAdr;
|
||||
if(pSData)
|
||||
delete pSData;
|
||||
pSData = NULL;
|
||||
}
|
||||
myProjSDataMap.Clear();
|
||||
}
|
||||
//modified by NIZNHY-PKV Mon Sep 24 07:56:45 2012f
|
||||
//=======================================================================
|
||||
//function : Hatcher
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
Geom2dHatch_Hatcher* pHatcher;
|
||||
//
|
||||
anAdr=myHatcherMap.FindFromKey1(aF);
|
||||
if (!anAdr) {
|
||||
Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
|
||||
Standard_Real aU1, aU2, aEpsT;
|
||||
TopAbs_Orientation aOrE;
|
||||
Handle(Geom_Surface) aS;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
Handle(Geom2d_TrimmedCurve) aCT2D;
|
||||
TopoDS_Face aFF;
|
||||
TopExp_Explorer aExp;
|
||||
//
|
||||
aTolHatch2D=1.e-8;
|
||||
aTolHatch3D=1.e-8;
|
||||
aTolArcIntr=1.e-10;
|
||||
aTolTangfIntr=1.e-10;
|
||||
aEpsT=Precision::PConfusion();
|
||||
//
|
||||
Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
|
||||
pHatcher=new Geom2dHatch_Hatcher(aIntr,
|
||||
aTolHatch2D, aTolHatch3D,
|
||||
Standard_True, Standard_False);
|
||||
|
||||
//
|
||||
aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
aS=BRep_Tool::Surface(aFF);
|
||||
|
||||
aExp.Init (aFF, TopAbs_EDGE);
|
||||
for (; aExp.More() ; aExp.Next()) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
|
||||
aOrE=aE.Orientation();
|
||||
//
|
||||
aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
|
||||
if (aC2D.IsNull() ) {
|
||||
continue;
|
||||
}
|
||||
if (fabs(aU1-aU2) < aEpsT) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
|
||||
pHatcher->AddElement(aCT2D, aOrE);
|
||||
}// for (; aExp.More() ; aExp.Next()) {
|
||||
//
|
||||
anAdr=(Standard_Address)pHatcher;
|
||||
myHatcherMap.Add(aFF, anAdr);
|
||||
}// if (!anAdr) {
|
||||
//
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pHatcher=(Geom2dHatch_Hatcher*)*pAdr;
|
||||
}
|
||||
|
||||
return *pHatcher;
|
||||
}
|
||||
//modified by NIZNHY-PKV Mon Sep 24 07:56:45 2012t
|
||||
//=======================================================================
|
||||
//function : FClass2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
IntTools_FClass2d* pFClass2d;
|
||||
//
|
||||
anAdr=myFClass2dMap.FindFromKey1(aF);
|
||||
if (!anAdr) {
|
||||
Standard_Real aTolF;
|
||||
TopoDS_Face aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
aTolF=BRep_Tool::Tolerance(aFF);
|
||||
//
|
||||
pFClass2d=new IntTools_FClass2d(aFF, aTolF);
|
||||
//
|
||||
anAdr=(Standard_Address)pFClass2d;
|
||||
myFClass2dMap.Add(aFF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pFClass2d=(IntTools_FClass2d*)*pAdr;
|
||||
}
|
||||
|
||||
return *pFClass2d;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnSurf* pProjPS;
|
||||
//
|
||||
anAdr=myProjPSMap.FindFromKey1(aF);
|
||||
if (!anAdr) {
|
||||
Standard_Real Umin, Usup, Vmin, Vsup;
|
||||
Standard_Real anEpsT = Precision::PConfusion(); //1.e-12;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
//
|
||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
|
||||
aBAS.Initialize (aF, Standard_True);
|
||||
//
|
||||
Umin=aBAS.FirstUParameter();
|
||||
Usup=aBAS.LastUParameter ();
|
||||
Vmin=aBAS.FirstVParameter();
|
||||
Vsup=aBAS.LastVParameter ();
|
||||
//
|
||||
pProjPS=new GeomAPI_ProjectPointOnSurf;
|
||||
pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, anEpsT);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPS;
|
||||
myProjPSMap.Add(aF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)*pAdr;
|
||||
}
|
||||
return *pProjPS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPC
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnCurve* pProjPC;
|
||||
//
|
||||
anAdr=myProjPCMap.FindFromKey1(aE);
|
||||
if (!anAdr) {
|
||||
Standard_Real f, l;
|
||||
//
|
||||
Handle(Geom_Curve)aC3D=BRep_Tool::Curve (aE, f, l);
|
||||
//
|
||||
pProjPC=new GeomAPI_ProjectPointOnCurve;
|
||||
pProjPC->Init(aC3D, f, l);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPC;
|
||||
myProjPCMap.Add(aE, anAdr);
|
||||
}
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pProjPC=(GeomAPI_ProjectPointOnCurve*)*pAdr;
|
||||
}
|
||||
return *pProjPC;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPT
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT(const Handle(Geom_Curve)& aC3D)
|
||||
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnCurve* pProjPT;
|
||||
//
|
||||
anAdr=myProjPTMap.FindFromKey1(aC3D);
|
||||
if (!anAdr) {
|
||||
Standard_Real f, l;
|
||||
f=aC3D->FirstParameter();
|
||||
l=aC3D->LastParameter();
|
||||
//
|
||||
pProjPT=new GeomAPI_ProjectPointOnCurve;
|
||||
pProjPT->Init(aC3D, f, l);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPT;
|
||||
myProjPTMap.Add(aC3D, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pProjPT=(GeomAPI_ProjectPointOnCurve*)*pAdr;
|
||||
}
|
||||
return *pProjPT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SurfaceData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
IntTools_SurfaceRangeLocalizeData* pSData;
|
||||
//
|
||||
anAdr=myProjSDataMap.FindFromKey1(aF);
|
||||
if (!anAdr) {
|
||||
//
|
||||
pSData=new IntTools_SurfaceRangeLocalizeData(3,
|
||||
3,
|
||||
10. * Precision::PConfusion(),
|
||||
10. * Precision::PConfusion());
|
||||
//
|
||||
anAdr=(Standard_Address)pSData;
|
||||
myProjSDataMap.Add(aF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pSData=(IntTools_SurfaceRangeLocalizeData*)*pAdr;
|
||||
}
|
||||
return *pSData;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SolidClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier(const TopoDS_Solid& aSolid)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
BRepClass3d_SolidClassifier* pSC;
|
||||
//
|
||||
anAdr=mySClassMap.FindFromKey1(aSolid);
|
||||
if (!anAdr) {
|
||||
//
|
||||
pSC=new BRepClass3d_SolidClassifier(aSolid);
|
||||
//
|
||||
anAdr=(Standard_Address)pSC;
|
||||
mySClassMap.Add(aSolid, anAdr);
|
||||
}
|
||||
else {
|
||||
Standard_Address *pAdr=(Standard_Address *)anAdr;
|
||||
pSC =(BRepClass3d_SolidClassifier*)*pAdr;
|
||||
}
|
||||
return *pSC;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeVE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVE(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Edge& aE2,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Boolean bToUpdate;
|
||||
Standard_Integer iFlag;
|
||||
Standard_Real aDist;
|
||||
//
|
||||
iFlag= IntTools_Context::ComputeVE(aV1, aE2, aT, bToUpdate, aDist);
|
||||
//
|
||||
return iFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeVE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVE(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Edge& aE2,
|
||||
Standard_Real& aT,
|
||||
Standard_Boolean& bToUpdateVertex,
|
||||
Standard_Real& aDist)
|
||||
{
|
||||
bToUpdateVertex=Standard_False;
|
||||
aDist=0.;
|
||||
//
|
||||
if (BRep_Tool::Degenerated(aE2)) {
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
Standard_Real aTolV1, aTolE2, aTolSum, aTolVx;
|
||||
Standard_Integer aNbProj;
|
||||
gp_Pnt aP;
|
||||
//
|
||||
aP=BRep_Tool::Pnt(aV1);
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
|
||||
aProjector.Perform(aP);
|
||||
aNbProj=aProjector.NbPoints();
|
||||
if (!aNbProj) {
|
||||
return -3;
|
||||
}
|
||||
//
|
||||
aDist=aProjector.LowerDistance();
|
||||
aTolV1=BRep_Tool::Tolerance(aV1);
|
||||
aTolE2=BRep_Tool::Tolerance(aE2);
|
||||
aTolSum=aTolV1+aTolE2;
|
||||
//
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
if (aDist > aTolSum) {
|
||||
return -4;
|
||||
}
|
||||
//
|
||||
aTolVx=aDist+aTolE2;
|
||||
if (aTolVx>aTolV1) {
|
||||
bToUpdateVertex=!bToUpdateVertex;
|
||||
aDist=aTolVx;
|
||||
}
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeVS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVS(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Face& aF2,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
{
|
||||
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
|
||||
gp_Pnt aP;
|
||||
|
||||
aP=BRep_Tool::Pnt(aV1);
|
||||
//
|
||||
// 1. Check if the point is projectable on the surface
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF2);
|
||||
aProjector.Perform(aP);
|
||||
//
|
||||
if (!aProjector.IsDone()) {
|
||||
// the point is not projectable on the surface
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
// 2. Check the distance between the projection point and
|
||||
// the original point
|
||||
aDist=aProjector.LowerDistance();
|
||||
|
||||
aTolV1=BRep_Tool::Tolerance(aV1);
|
||||
aTolF2=BRep_Tool::Tolerance(aF2);
|
||||
aTolSum=aTolV1+aTolF2;
|
||||
if (aDist > aTolSum) {
|
||||
// the distance is too large
|
||||
return -2;
|
||||
}
|
||||
aProjector.LowerDistanceParameters(U, V);
|
||||
//
|
||||
gp_Pnt2d aP2d(U, V);
|
||||
Standard_Boolean pri=IsPointInFace (aF2, aP2d);
|
||||
if (!pri) {
|
||||
// the point lays on the surface but out of the face
|
||||
return -3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : StatePointFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_Context::StatePointFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState;
|
||||
IntTools_FClass2d& aClass2d=FClass2d(aF);
|
||||
aState=aClass2d.Perform(aP2d);
|
||||
return aState;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsPointInFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState=StatePointFace(aF, aP2d);
|
||||
if (aState==TopAbs_OUT || aState==TopAbs_ON) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsPointInOnFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState=StatePointFace(aF, aP2d);
|
||||
if (aState==TopAbs_OUT) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidPointForFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidPointForFace(const gp_Pnt& aP,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Real Umin, myEpsT, U, V;
|
||||
myEpsT=1.e-12;
|
||||
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
|
||||
aProjector.Perform(aP);
|
||||
|
||||
bFlag=aProjector.IsDone();
|
||||
if (bFlag) {
|
||||
|
||||
Umin=aProjector.LowerDistance();
|
||||
//if (Umin > 1.e-3) { // it was
|
||||
if (Umin > aTol) {
|
||||
return !bFlag;
|
||||
}
|
||||
//
|
||||
aProjector.LowerDistanceParameters(U, V);
|
||||
gp_Pnt2d aP2D(U, V);
|
||||
bFlag=IsPointInOnFace (aF, aP2D);
|
||||
}
|
||||
return bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidPointForFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidPointForFaces (const gp_Pnt& aP,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag1, bFlag2;
|
||||
|
||||
bFlag1=IsValidPointForFace(aP, aF1, aTol);
|
||||
if (!bFlag1) {
|
||||
return bFlag1;
|
||||
}
|
||||
bFlag2=IsValidPointForFace(aP, aF2, aTol);
|
||||
return bFlag2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidBlockForFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidBlockForFace (const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const IntTools_Curve& aC,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Real aTInterm, aFirst, aLast;
|
||||
gp_Pnt aPInterm;
|
||||
|
||||
aTInterm=IntTools_Tools::IntermediatePoint(aT1, aT2);
|
||||
|
||||
Handle(Geom_Curve) aC3D=aC.Curve();
|
||||
aFirst=aC3D->FirstParameter();
|
||||
aLast =aC3D->LastParameter();
|
||||
// point 3D
|
||||
aC3D->D0(aTInterm, aPInterm);
|
||||
//
|
||||
bFlag=IsValidPointForFace (aPInterm, aF, aTol);
|
||||
return bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidBlockForFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidBlockForFaces (const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const IntTools_Curve& aC,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag1, bFlag2;
|
||||
//
|
||||
Handle(Geom2d_Curve) aPC1 = aC.FirstCurve2d();
|
||||
Handle(Geom2d_Curve) aPC2 = aC.SecondCurve2d();
|
||||
if( !aPC1.IsNull() && !aPC2.IsNull() ) {
|
||||
Standard_Real aMidPar = IntTools_Tools::IntermediatePoint(aT1, aT2);
|
||||
gp_Pnt2d aPnt2D;
|
||||
|
||||
|
||||
aPC1->D0(aMidPar, aPnt2D);
|
||||
bFlag1 = IsPointInOnFace(aF1, aPnt2D);
|
||||
|
||||
if( !bFlag1 )
|
||||
return bFlag1;
|
||||
|
||||
aPC2->D0(aMidPar, aPnt2D);
|
||||
bFlag2 = IsPointInOnFace(aF2, aPnt2D);
|
||||
return bFlag2;
|
||||
}
|
||||
//
|
||||
|
||||
bFlag1=IsValidBlockForFace (aT1, aT2, aC, aF1, aTol);
|
||||
if (!bFlag1) {
|
||||
return bFlag1;
|
||||
}
|
||||
bFlag2=IsValidBlockForFace (aT1, aT2, aC, aF2, aTol);
|
||||
return bFlag2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsVertexOnLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
|
||||
const IntTools_Curve& aC,
|
||||
const Standard_Real aTolC,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aTolV;
|
||||
//
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
bRet=IntTools_Context::IsVertexOnLine(aV, aTolV, aC, aTolC , aT);
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsVertexOnLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
|
||||
const Standard_Real aTolV,
|
||||
const IntTools_Curve& aC,
|
||||
const Standard_Real aTolC,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Real aFirst, aLast, aDist, aTolSum;
|
||||
Standard_Integer aNbProj;
|
||||
gp_Pnt aPv;
|
||||
|
||||
aPv=BRep_Tool::Pnt(aV);
|
||||
|
||||
Handle(Geom_Curve) aC3D=aC.Curve();
|
||||
|
||||
|
||||
aTolSum=aTolV+aTolC;
|
||||
//
|
||||
GeomAdaptor_Curve aGAC(aC3D);
|
||||
GeomAbs_CurveType aType=aGAC.GetType();
|
||||
if (aType==GeomAbs_BSplineCurve ||
|
||||
aType==GeomAbs_BezierCurve) {
|
||||
aTolSum=2.*aTolSum;
|
||||
if (aTolSum<1.e-5) {
|
||||
aTolSum=1.e-5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
aTolSum=2.*aTolSum;//xft
|
||||
if(aTolSum < 1.e-6)
|
||||
aTolSum = 1.e-6;
|
||||
}
|
||||
//
|
||||
aFirst=aC3D->FirstParameter();
|
||||
aLast =aC3D->LastParameter();
|
||||
//
|
||||
//Checking extermities first
|
||||
if (!Precision::IsInfinite(aFirst)) {
|
||||
gp_Pnt aPCFirst=aC3D->Value(aFirst);
|
||||
aDist=aPv.Distance(aPCFirst);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aFirst;
|
||||
//
|
||||
if(aDist > aTolV) {
|
||||
Extrema_LocateExtPC anExt(aPv, aGAC, aFirst, 1.e-10);
|
||||
|
||||
if(anExt.IsDone()) {
|
||||
Extrema_POnCurv aPOncurve = anExt.Point();
|
||||
aT = aPOncurve.Parameter();
|
||||
|
||||
if((aT > (aLast + aFirst) * 0.5) ||
|
||||
(aPv.Distance(aPOncurve.Value()) > aTolSum) ||
|
||||
(aPCFirst.Distance(aPOncurve.Value()) < Precision::Confusion()))
|
||||
aT = aFirst;
|
||||
}
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!Precision::IsInfinite(aLast)) {
|
||||
gp_Pnt aPCLast=aC3D->Value(aLast);
|
||||
aDist=aPv.Distance(aPCLast);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aLast;
|
||||
//
|
||||
if(aDist > aTolV) {
|
||||
Extrema_LocateExtPC anExt(aPv, aGAC, aLast, 1.e-10);
|
||||
|
||||
if(anExt.IsDone()) {
|
||||
Extrema_POnCurv aPOncurve = anExt.Point();
|
||||
aT = aPOncurve.Parameter();
|
||||
|
||||
if((aT < (aLast + aFirst) * 0.5) ||
|
||||
(aPv.Distance(aPOncurve.Value()) > aTolSum) ||
|
||||
(aPCLast.Distance(aPOncurve.Value()) < Precision::Confusion()))
|
||||
aT = aLast;
|
||||
}
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPT(aC3D);
|
||||
aProjector.Perform(aPv);
|
||||
|
||||
aNbProj=aProjector.NbPoints();
|
||||
if (!aNbProj) {
|
||||
Handle(Geom_BoundedCurve) aBC=
|
||||
Handle(Geom_BoundedCurve)::DownCast(aC3D);
|
||||
if (!aBC.IsNull()) {
|
||||
gp_Pnt aPStart=aBC->StartPoint();
|
||||
gp_Pnt aPEnd =aBC->EndPoint();
|
||||
|
||||
aDist=aPv.Distance(aPStart);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aFirst;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
aDist=aPv.Distance(aPEnd);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aLast;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aDist=aProjector.LowerDistance();
|
||||
|
||||
if (aDist > aTolSum) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::ProjectPointOnEdge(const gp_Pnt& aP,
|
||||
const TopoDS_Edge& anEdge,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Integer aNbPoints;
|
||||
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(anEdge);
|
||||
aProjector.Perform(aP);
|
||||
|
||||
aNbPoints=aProjector.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -1512,7 +1512,7 @@ Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt& aComm
|
||||
//
|
||||
IsParallel = Standard_False;
|
||||
IsCoincide = Standard_False;
|
||||
Tolang2 = 1.e-16;
|
||||
Tolang2 = Precision::Angular();
|
||||
Tol2 = myCriteria*myCriteria;
|
||||
//
|
||||
gp_Lin C1 = myCFrom.Line();
|
||||
@@ -1521,6 +1521,7 @@ Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt& aComm
|
||||
const gp_Dir& D2 = C2.Position().Direction();
|
||||
Standard_Real aCos = D1.Dot(D2);
|
||||
Standard_Real Ang2;
|
||||
|
||||
if(aCos >= 0. ) {
|
||||
Ang2 = 2.*(1. - aCos);
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ uses
|
||||
FClass2d from IntTools,
|
||||
SequenceOfRoots from IntTools,
|
||||
SequenceOfCommonPrts from IntTools,
|
||||
Context from IntTools,
|
||||
Context from BOPInt,
|
||||
Range from IntTools
|
||||
|
||||
--raises
|
||||
@@ -103,13 +103,13 @@ is
|
||||
---
|
||||
|
||||
SetContext (me: in out;
|
||||
theContext: Context from IntTools);
|
||||
theContext: Context from BOPInt);
|
||||
---Purpose:
|
||||
--- Sets the intersecton context
|
||||
---
|
||||
|
||||
Context (me)
|
||||
returns Context from IntTools;
|
||||
returns Context from BOPInt;
|
||||
---C++:return const &
|
||||
---Purpose:
|
||||
--- Gets the intersecton context
|
||||
@@ -264,7 +264,7 @@ fields
|
||||
myErrorStatus : Integer from Standard;
|
||||
|
||||
--- internal members
|
||||
myContext : Context from IntTools;
|
||||
myContext : Context from BOPInt;
|
||||
myProjectableRanges: SequenceOfRanges from IntTools;
|
||||
myFClass2d : FClass2d from IntTools;
|
||||
myFuncArray : CArray1OfReal from IntTools;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <IntTools_BeanFaceIntersector.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
@@ -105,7 +105,7 @@ static
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext)
|
||||
void IntTools_EdgeFace::SetContext(const Handle(BOPInt_Context)& theContext)
|
||||
{
|
||||
myContext = theContext;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void IntTools_EdgeFace::SetContext(const Handle(IntTools_Context)& theContext)
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(IntTools_Context)& IntTools_EdgeFace::Context()const
|
||||
const Handle(BOPInt_Context)& IntTools_EdgeFace::Context()const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ void IntTools_EdgeFace::CheckData()
|
||||
}
|
||||
//
|
||||
if (myContext.IsNull()) {
|
||||
myContext=new IntTools_Context;
|
||||
myContext=new BOPInt_Context;
|
||||
}
|
||||
//
|
||||
myIsDone = Standard_False;
|
||||
|
@@ -33,7 +33,7 @@ uses
|
||||
SequenceOfCurves from IntTools,
|
||||
LineConstructor from IntTools,
|
||||
SequenceOfPntOn2Faces from IntTools,
|
||||
Context from IntTools
|
||||
Context from BOPInt
|
||||
|
||||
|
||||
|
||||
@@ -142,12 +142,12 @@ is
|
||||
is protected;
|
||||
|
||||
SetContext(me:out;
|
||||
aContext : Context from IntTools);
|
||||
aContext : Context from BOPInt);
|
||||
---Purpose:
|
||||
--- Sets the intersecton context
|
||||
|
||||
Context(me)
|
||||
returns Context from IntTools;
|
||||
returns Context from BOPInt;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Gets the intersecton context
|
||||
@@ -178,9 +178,7 @@ fields
|
||||
|
||||
myListOfPnts : ListOfPntOn2S from IntSurf;
|
||||
|
||||
--modified by NIZNHY-PKV Tue Jan 31 08:27:18 2012f
|
||||
myContext : Context from IntTools;
|
||||
--modified by NIZNHY-PKV Tue Jan 31 08:27:21 2012t
|
||||
myContext : Context from BOPInt;
|
||||
|
||||
end FaceFace from IntTools;
|
||||
|
||||
|
@@ -111,15 +111,13 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
|
||||
#include <BOPTColStd_Dump.hxx>
|
||||
|
||||
#include <IntTools_Curve.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_TopolTool.hxx>
|
||||
#include <IntTools_PntOnFace.hxx>
|
||||
#include <IntTools_PntOn2Faces.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
|
||||
|
||||
static
|
||||
@@ -193,7 +191,7 @@ static
|
||||
const Standard_Boolean theAvoidLConstructor,
|
||||
IntPatch_SequenceOfLine& theNewLines,
|
||||
Standard_Real& theReachedTol3d,
|
||||
const Handle(IntTools_Context)& );
|
||||
const Handle(BOPInt_Context)& );
|
||||
|
||||
static
|
||||
Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
|
||||
@@ -203,7 +201,7 @@ static
|
||||
const Standard_Real theOtherParameter,
|
||||
const Standard_Boolean bIncreasePar,
|
||||
Standard_Real& theNewParameter,
|
||||
const Handle(IntTools_Context)& );
|
||||
const Handle(BOPInt_Context)& );
|
||||
|
||||
static
|
||||
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
|
||||
@@ -232,7 +230,7 @@ static
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
|
||||
Handle(TColStd_HArray1OfReal)& theResultRadius,
|
||||
const Handle(IntTools_Context)& );
|
||||
const Handle(BOPInt_Context)& );
|
||||
|
||||
static
|
||||
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
|
||||
@@ -306,7 +304,7 @@ static
|
||||
const Handle(GeomAdaptor_HSurface) myHS2,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Handle(IntTools_Context)& aCtx);
|
||||
const Handle(BOPInt_Context)& aCtx);
|
||||
|
||||
static
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
@@ -324,7 +322,7 @@ static
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Handle(IntTools_Context)& aCtx);
|
||||
const Handle(BOPInt_Context)& aCtx);
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -345,7 +343,7 @@ IntTools_FaceFace::IntTools_FaceFace()
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext)
|
||||
void IntTools_FaceFace::SetContext(const Handle(BOPInt_Context)& aContext)
|
||||
{
|
||||
myContext=aContext;
|
||||
}
|
||||
@@ -353,7 +351,7 @@ void IntTools_FaceFace::SetContext(const Handle(IntTools_Context)& aContext)
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(IntTools_Context)& IntTools_FaceFace::Context()const
|
||||
const Handle(BOPInt_Context)& IntTools_FaceFace::Context()const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
@@ -464,7 +462,7 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
BRepAdaptor_Surface aBAS1, aBAS2;
|
||||
//
|
||||
if (myContext.IsNull()) {
|
||||
myContext=new IntTools_Context;
|
||||
myContext=new BOPInt_Context;
|
||||
}
|
||||
//
|
||||
mySeqOfCurve.Clear();
|
||||
@@ -1040,6 +1038,47 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
myTolReached3d=sqrt(aD2max);
|
||||
}
|
||||
}//else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ...
|
||||
else if (!myApprox) {
|
||||
Standard_Integer i, aNbP, j ;
|
||||
Standard_Real aT1, aT2, dT, aD2, aD2Max, aEps, aT11, aT12;
|
||||
//
|
||||
aD2Max=0.;
|
||||
aNbLin=mySeqOfCurve.Length();
|
||||
//
|
||||
for (i=1; i<=aNbLin; ++i) {
|
||||
const IntTools_Curve& aIC=mySeqOfCurve(i);
|
||||
const Handle(Geom_Curve)& aC3D=aIC.Curve();
|
||||
const Handle(Geom2d_Curve)& aC2D1=aIC.FirstCurve2d();
|
||||
const Handle(Geom2d_Curve)& aC2D2=aIC.SecondCurve2d();
|
||||
//
|
||||
if (aC3D.IsNull()) {
|
||||
continue;
|
||||
}
|
||||
const Handle(Geom_BSplineCurve)& aBC=
|
||||
Handle(Geom_BSplineCurve)::DownCast(aC3D);
|
||||
if (aBC.IsNull()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aT1=aBC->FirstParameter();
|
||||
aT2=aBC->LastParameter();
|
||||
//
|
||||
aEps=0.0001*(aT2-aT1);
|
||||
aNbP=11;
|
||||
dT=(aT2-aT1)/aNbP;
|
||||
for (j=1; j<aNbP-1; ++j) {
|
||||
aT11=aT1+j*dT;
|
||||
aT12=aT11+dT;
|
||||
aD2=FindMaxSquareDistance(aT11, aT12, aEps, aC3D, aC2D1, aC2D2,
|
||||
myHS1, myHS2, myFace1, myFace2, myContext);
|
||||
if (aD2>aD2Max) {
|
||||
aD2Max=aD2;
|
||||
}
|
||||
}
|
||||
}//for (i=1; i<=aNbLin; ++i) {
|
||||
myTolReached3d=sqrt(aD2Max);
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Aug 30 13:31:12 2012t
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeCurve
|
||||
@@ -2274,9 +2313,6 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (C2d.IsNull()) {
|
||||
BOPTColStd_Dump::PrintMessage("BuildPCurves()=> Echec ProjLib\n");
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2686,9 +2722,9 @@ Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine
|
||||
// because inside degenerated zone of the surface the approx. algo.
|
||||
// uses wrong values of normal, etc., and resulting curve will have
|
||||
// oscillations that we would not like to have.
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
Standard_Boolean IsDegeneratedZone(const gp_Pnt2d& aP2d,
|
||||
const Handle(Geom_Surface)& aS,
|
||||
@@ -3244,7 +3280,7 @@ Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_HSurface)& theSur
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
|
||||
Handle(TColStd_HArray1OfReal)& theResultRadius,
|
||||
const Handle(IntTools_Context)& aContext)
|
||||
const Handle(BOPInt_Context)& aContext)
|
||||
{
|
||||
Standard_Integer aResult = 0;
|
||||
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
|
||||
@@ -3456,7 +3492,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
|
||||
const Standard_Boolean theAvoidLConstructor,
|
||||
IntPatch_SequenceOfLine& theNewLines,
|
||||
Standard_Real& theReachedTol3d,
|
||||
const Handle(IntTools_Context)& aContext)
|
||||
const Handle(BOPInt_Context)& aContext)
|
||||
{
|
||||
|
||||
Standard_Boolean bRet, bAvoidLineConstructor;
|
||||
@@ -4181,7 +4217,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
|
||||
const Standard_Real theOtherParameter,
|
||||
const Standard_Boolean bIncreasePar,
|
||||
Standard_Real& theNewParameter,
|
||||
const Handle(IntTools_Context)& aContext)
|
||||
const Handle(BOPInt_Context)& aContext)
|
||||
{
|
||||
Standard_Boolean bIsComputed = Standard_False;
|
||||
theNewParameter = theParameter;
|
||||
@@ -4785,7 +4821,7 @@ Standard_Real FindMaxSquareDistance (const Standard_Real aT1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const TopoDS_Face& myFace1,
|
||||
const TopoDS_Face& myFace2,
|
||||
const Handle(IntTools_Context)& myContext)
|
||||
const Handle(BOPInt_Context)& myContext)
|
||||
{
|
||||
Standard_Real aA, aB, aCf, aX1, aX2, aF1, aF2, aX, aF;
|
||||
//
|
||||
@@ -4839,7 +4875,7 @@ Standard_Real MaxSquareDistance (const Standard_Real aT,
|
||||
const Handle(GeomAdaptor_HSurface) myHS2,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
const Handle(BOPInt_Context)& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsDone;
|
||||
Standard_Integer i;
|
||||
|
@@ -1,136 +0,0 @@
|
||||
-- Created on: 2001-03-11
|
||||
-- Created by: Peter KURNEV
|
||||
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class ShrunkRange from IntTools
|
||||
|
||||
---Purpose:
|
||||
--- The class provides the computation of
|
||||
--- a working (shrunk) range [t1, t2] for
|
||||
--- the 3D-curve of the edge.
|
||||
|
||||
uses
|
||||
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
Range from IntTools,
|
||||
Box from Bnd,
|
||||
Context from IntTools
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns ShrunkRange from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aE : Edge from TopoDS;
|
||||
aV1 : Vertex from TopoDS;
|
||||
aV2 : Vertex from TopoDS;
|
||||
aR : Range from IntTools;
|
||||
ICtx: Context from IntTools)
|
||||
returns ShrunkRange from IntTools;
|
||||
---Purpose:
|
||||
---
|
||||
SetContext(me:out;
|
||||
aContext : Context from IntTools);
|
||||
---Purpose:
|
||||
--- Sets the intersecton context
|
||||
---
|
||||
Context(me)
|
||||
returns Context from IntTools;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Gets the intersecton context
|
||||
---
|
||||
|
||||
|
||||
SetShrunkRange(me:out; aR:Range from IntTools);
|
||||
---Purpose:
|
||||
--- Sets an shrunk range
|
||||
---
|
||||
|
||||
ShrunkRange(me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns shrunk range
|
||||
---
|
||||
|
||||
BndBox (me)
|
||||
returns Box from Bnd;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns bounding box for edge restricted
|
||||
--- by shrunk range
|
||||
---
|
||||
|
||||
Edge (me)
|
||||
returns Edge from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns edge for which
|
||||
--- the shrunk range is computed
|
||||
---
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose:
|
||||
--- Computes shrunk range for
|
||||
--- an edge given in constructor
|
||||
---
|
||||
|
||||
|
||||
IsDone (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if no error occured
|
||||
--- during shrunk range computation
|
||||
---
|
||||
|
||||
ErrorStatus(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns code of computing shrunk range
|
||||
--- completion
|
||||
--- 0 - means successful completion
|
||||
--- 1 - nothing has been done
|
||||
--- 2 - initial range is out of edge's range
|
||||
--- 3 - first boundary of initial range is more than
|
||||
--- last boundary
|
||||
--- 4 - projection of first vertex failed
|
||||
--- 5 - projection of second vertex failed
|
||||
--- 6 - shrunk range can not be computed
|
||||
--- shrunk range is setted to initial range
|
||||
---
|
||||
|
||||
fields
|
||||
myEdge : Edge from TopoDS;
|
||||
myV1 : Vertex from TopoDS;
|
||||
myV2 : Vertex from TopoDS;
|
||||
myRange : Range from IntTools;
|
||||
myShrunkRange : Range from IntTools;
|
||||
myBndBox : Box from Bnd;
|
||||
myContext : Context from IntTools;
|
||||
myIsDone : Boolean from Standard;
|
||||
myErrorStatus : Integer from Standard;
|
||||
|
||||
end ShrunkRange;
|
@@ -1,454 +0,0 @@
|
||||
// Created on: 2001-03-11
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2001-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <IntTools_ShrunkRange.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BndLib_Add3dCurve.hxx>
|
||||
|
||||
#include <IntTools_Tools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_ShrunkRange::IntTools_ShrunkRange ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
|
||||
const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Vertex& aV2,
|
||||
const IntTools_Range& aR,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
myEdge=aE;
|
||||
myV1=aV1;
|
||||
myV2=aV2;
|
||||
myRange=aR;
|
||||
myContext=aCtx;
|
||||
myIsDone=Standard_False;
|
||||
myErrorStatus=1;
|
||||
Perform();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_ShrunkRange::SetContext(const Handle(IntTools_Context)& aContext)
|
||||
{
|
||||
myContext=aContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(IntTools_Context)& IntTools_ShrunkRange::Context()const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
|
||||
{
|
||||
return myShrunkRange;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BndBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Bnd_Box& IntTools_ShrunkRange::BndBox() const
|
||||
{
|
||||
return myBndBox;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_ShrunkRange::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ErrorStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
|
||||
{
|
||||
return myErrorStatus;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_ShrunkRange::Perform()
|
||||
{
|
||||
Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C;
|
||||
Standard_Real aCoeff, dt1, dt2, aR;
|
||||
Standard_Integer pri;
|
||||
Standard_Boolean bInf1, bInf2;
|
||||
GeomAbs_CurveType aCurveType;
|
||||
Handle(Geom_Curve) aC;
|
||||
//
|
||||
if (myContext.IsNull()) {
|
||||
myContext=new IntTools_Context;
|
||||
}
|
||||
//
|
||||
aTolE =BRep_Tool::Tolerance(myEdge);
|
||||
aTolV1=BRep_Tool::Tolerance(myV1);
|
||||
aTolV2=BRep_Tool::Tolerance(myV2);
|
||||
//
|
||||
myRange.Range (t1, t2);
|
||||
//
|
||||
BRepAdaptor_Curve aBAC(myEdge);
|
||||
aCurveType=aBAC.GetType();
|
||||
//
|
||||
aC=BRep_Tool::Curve(myEdge, aCF, aCL);
|
||||
BRep_Tool::Range(myEdge, aCF, aCL);
|
||||
//
|
||||
if (t1 < aCF || t2 > aCL) {
|
||||
myErrorStatus=2;
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (t1 > t2 ) {
|
||||
myErrorStatus=3;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aCoeff=2.;
|
||||
// xf
|
||||
if (aCurveType==GeomAbs_Line) {
|
||||
Standard_Real aTV1, aTV2, aEps;
|
||||
gp_Pnt aPV1, aPV2, aPC1, aPC2;
|
||||
gp_Lin aL;
|
||||
//
|
||||
aEps=Precision::Confusion();
|
||||
aEps=aEps*aEps;//1.e-14;
|
||||
aL=aBAC.Line();
|
||||
//
|
||||
aPV1=BRep_Tool::Pnt(myV1);
|
||||
aTV1=ElCLib::Parameter(aL, aPV1);
|
||||
//
|
||||
aPV2=BRep_Tool::Pnt(myV2);
|
||||
aTV2=ElCLib::Parameter(aL, aPV2);
|
||||
//
|
||||
if (fabs(aTV1-aCF)<aEps && fabs(aTV2-aCL)<aEps) {
|
||||
aCoeff=1.;
|
||||
}
|
||||
}
|
||||
//
|
||||
dt1=aCoeff*(aTolV1+aTolE);
|
||||
dt2=aCoeff*(aTolV2+aTolE);
|
||||
// xt
|
||||
//
|
||||
if (aCurveType==GeomAbs_Line) {
|
||||
Standard_Real dt1x, dt2x;
|
||||
|
||||
dt1x = aBAC.Resolution(dt1);
|
||||
t11=t1+dt1x;
|
||||
|
||||
dt2x = aBAC.Resolution(dt2);
|
||||
t12=t2-dt2x;
|
||||
|
||||
if (t11>t2 || t12<t1) {
|
||||
t1C=t1;
|
||||
t2C=t2;
|
||||
myShrunkRange.SetFirst(t1C);
|
||||
myShrunkRange.SetLast (t2C);
|
||||
//
|
||||
// BndBox
|
||||
Standard_Real ddx=aTolE;//1.e-12;
|
||||
BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
|
||||
|
||||
myErrorStatus=6;
|
||||
myIsDone=Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aCurveType==GeomAbs_Circle) {
|
||||
gp_Circ aCrc=aBAC.Circle();
|
||||
aR=aCrc.Radius();
|
||||
t1C=t1+dt1/aR;
|
||||
t2C=t2-dt2/aR;
|
||||
}
|
||||
|
||||
else {
|
||||
//
|
||||
// Vertex1 => t1C
|
||||
gp_Pnt aP1,aP11;
|
||||
aC->D0 (t1, aP1);
|
||||
//
|
||||
bInf1=Precision::IsNegativeInfinite(t1);
|
||||
if (bInf1) {
|
||||
t1C=t1;
|
||||
}
|
||||
//
|
||||
else {
|
||||
Standard_Real d1 = aCoeff*(aTolV1+aTolE);
|
||||
// dt1 = aBAC.Resolution(d1);
|
||||
//
|
||||
gp_Vec aD1vec1;
|
||||
gp_Pnt aPoint;
|
||||
aBAC.D1(t1, aPoint, aD1vec1);
|
||||
Standard_Real ad1length1 = aD1vec1.Magnitude();
|
||||
Standard_Boolean bTryOtherPoints = Standard_False;
|
||||
dt1 = (t2 - t1) * 0.5;
|
||||
|
||||
if(ad1length1 > 1.e-12) {
|
||||
dt1 = d1 / ad1length1;
|
||||
|
||||
if(dt1 > (t2 - t1)) {
|
||||
// bad parametrization, big tolerance or too small range
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
|
||||
if(bTryOtherPoints) {
|
||||
Standard_Integer nbsamples = 5;
|
||||
Standard_Integer ii = 0;
|
||||
Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
|
||||
Standard_Boolean bFound = Standard_False;
|
||||
|
||||
for(ii = 1; ii <= nbsamples; ii++) {
|
||||
Standard_Real aparameter = t1 + (adelta * ii);
|
||||
gp_Pnt aPoint2;
|
||||
aBAC.D1(aparameter, aPoint2, aD1vec1);
|
||||
|
||||
if(aPoint.Distance(aPoint2) < d1)
|
||||
dt1 = adelta * ii;
|
||||
ad1length1 = aD1vec1.Magnitude();
|
||||
|
||||
if(ad1length1 > 1.e-12) {
|
||||
dt1 = d1 / ad1length1;
|
||||
|
||||
if(dt1 < (t2 - t1)) {
|
||||
bFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound) {
|
||||
if(dt1 > (t2 - t1)) {
|
||||
dt1 = aBAC.Resolution(d1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
t11=t1+dt1;
|
||||
aC->D0 (t11, aP11);
|
||||
|
||||
gp_Vec aV11(aP1, aP11);
|
||||
// avoid exception if aP1 == aP11
|
||||
if (aV11.SquareMagnitude() < gp::Resolution())
|
||||
t1C = t1;
|
||||
else {
|
||||
gp_Dir aD11(aV11);
|
||||
|
||||
gp_Pnt aP1L;
|
||||
//
|
||||
aP1L.SetCoord (aP1.X()+d1*aD11.X(),
|
||||
aP1.Y()+d1*aD11.Y(),
|
||||
aP1.Z()+d1*aD11.Z());
|
||||
|
||||
BRepBuilderAPI_MakeVertex aMV1(aP1L);
|
||||
const TopoDS_Vertex& aV1L=aMV1.Vertex();
|
||||
//
|
||||
pri=myContext->ComputeVE (aV1L, myEdge, t1C);
|
||||
//
|
||||
if (pri==-3) {
|
||||
t1C = t1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Vertex2 => t2C
|
||||
gp_Pnt aP2, aP12;
|
||||
aC->D0 (t2, aP2);
|
||||
//
|
||||
bInf2=Precision::IsPositiveInfinite(t2);
|
||||
if (bInf2) {
|
||||
t2C=t2;
|
||||
}
|
||||
//
|
||||
else {
|
||||
Standard_Real d2 = aCoeff*(aTolV2+aTolE);
|
||||
// dt2 = aBAC.Resolution(d2);
|
||||
|
||||
//
|
||||
gp_Vec aD1vec2;
|
||||
gp_Pnt aPoint;
|
||||
aBAC.D1(t2, aPoint, aD1vec2);
|
||||
Standard_Real ad1length2 = aD1vec2.Magnitude();
|
||||
Standard_Boolean bTryOtherPoints = Standard_False;
|
||||
dt2 = (t2 - t1) * 0.5;
|
||||
|
||||
if(ad1length2 > 1.e-12) {
|
||||
dt2 = d2 / ad1length2;
|
||||
|
||||
if(dt2 > (t2 - t1)) {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
|
||||
if(bTryOtherPoints) {
|
||||
Standard_Integer nbsamples = 5;
|
||||
Standard_Integer ii = 0;
|
||||
Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
|
||||
Standard_Boolean bFound = Standard_False;
|
||||
|
||||
for(ii = 1; ii <= nbsamples; ii++) {
|
||||
Standard_Real aparameter = t2 - (adelta * ii);
|
||||
gp_Pnt aPoint2;
|
||||
aBAC.D1(aparameter, aPoint2, aD1vec2);
|
||||
|
||||
if(aPoint.Distance(aPoint2) < d2)
|
||||
dt2 = adelta * ii;
|
||||
ad1length2 = aD1vec2.Magnitude();
|
||||
|
||||
if(ad1length2 > 1.e-12) {
|
||||
dt2 = d2 / ad1length2;
|
||||
|
||||
if(dt2 < (t2 - t1)) {
|
||||
bFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound) {
|
||||
if(dt2 > (t2 - t1)) {
|
||||
dt2 = aBAC.Resolution(d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
t12=t2-dt2;
|
||||
aC->D0 (t12, aP12);
|
||||
|
||||
gp_Vec aV12(aP2, aP12);
|
||||
// avoid exception if aP1 == aP11
|
||||
if (aV12.SquareMagnitude() < gp::Resolution())
|
||||
t2C = t2;
|
||||
else {
|
||||
gp_Dir aD12(aV12);
|
||||
|
||||
gp_Pnt aP2L;
|
||||
//
|
||||
aP2L.SetCoord (aP2.X()+d2*aD12.X(),
|
||||
aP2.Y()+d2*aD12.Y(),
|
||||
aP2.Z()+d2*aD12.Z());
|
||||
|
||||
BRepBuilderAPI_MakeVertex aMV2(aP2L);
|
||||
const TopoDS_Vertex& aV2L=aMV2.Vertex();
|
||||
//
|
||||
pri=myContext->ComputeVE (aV2L, myEdge, t2C);
|
||||
//
|
||||
if (pri==-3) {
|
||||
t2C = t2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // else {
|
||||
|
||||
|
||||
if (t1C>t2){
|
||||
t1C=0.5*(t2+t1);
|
||||
t2C=t1C+0.1*(t2-t1C);
|
||||
}
|
||||
|
||||
if (t1C>t2C) {
|
||||
t2C=t1C+0.1*(t2-t1C);
|
||||
}
|
||||
|
||||
myShrunkRange.SetFirst(t1C);
|
||||
myShrunkRange.SetLast (t2C);
|
||||
//
|
||||
// BndBox
|
||||
Standard_Real ddx=aTolE;//1.e-12;
|
||||
BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
|
||||
//
|
||||
// Ok
|
||||
myErrorStatus=0;
|
||||
myIsDone=Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_ShrunkRange::SetShrunkRange(const IntTools_Range& aR)
|
||||
{
|
||||
Standard_Real f, l;
|
||||
aR.Range(f, l);
|
||||
|
||||
myShrunkRange.SetFirst(f);
|
||||
myShrunkRange.SetLast (l);
|
||||
|
||||
BRepAdaptor_Curve aBAC(myEdge);
|
||||
BndLib_Add3dCurve::Add (aBAC, f, l, 0., myBndBox);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// myErrorStatus :
|
||||
//
|
||||
// 1- Nothing has been done
|
||||
// 2- The source range is out of the edge's range
|
||||
// 3- t1 < t2 for source range
|
||||
// 4- Can not project V1L to the Edge;
|
||||
// 5- Can not project V2L to the Edge;
|
||||
// 6- for obtained shrunk range [t11, t12] -> t11>t2 || t12<t1;
|
Reference in New Issue
Block a user