GeomAbs_SurfaceType Adaptor3d_SurfaceOfRevolution::GetType() const
{
-
- Standard_Real TolConf = Precision::Confusion();
- Standard_Real TolAng = Precision::Angular();
+ Standard_Real TolConf, TolAng;
+ GeomAbs_SurfaceType bRet;
+ //
+ bRet=GeomAbs_SurfaceOfRevolution;
+ TolConf = Precision::Confusion();
+ TolAng = Precision::Angular();
+ //
switch ( myBasisCurve->GetType()) {
+ case GeomAbs_Line: {
+ const gp_Ax1& Axe = (myBasisCurve->Line()).Position();
- case GeomAbs_Line:
- {
- const gp_Ax1& Axe = (myBasisCurve->Line()).Position();
-
- if (myAxis.IsParallel(Axe, TolAng)) {
- return GeomAbs_Cylinder;
- }
- else if (myAxis.IsNormal( Axe, TolAng)) {
- return GeomAbs_Plane;
- }
- else {
- Standard_Real uf = myBasisCurve->FirstParameter();
- Standard_Real ul = myBasisCurve->LastParameter();
- Standard_Boolean istrim = (!Precision::IsInfinite(uf) &&
- !Precision::IsInfinite(ul));
- if(istrim){
- gp_Pnt pf = myBasisCurve->Value(uf);
- gp_Pnt pl = myBasisCurve->Value(ul);
- Standard_Real len = pf.Distance(pl);
- //on calcule la distance projetee sur l axe.
- gp_Vec vlin(pf,pl);
- gp_Vec vaxe(myAxis.Direction());
- Standard_Real projlen = Abs(vaxe.Dot(vlin));
- Standard_Real aTolConf = len*TolAng;
- if ((len - projlen) <= aTolConf) {
- return GeomAbs_Cylinder;
- }
- else if (projlen <= aTolConf) {
- return GeomAbs_Plane;
- }
- }
- gp_Vec V(myAxis.Location(),
- myBasisCurve->Line().Location());
- gp_Vec W(Axe.Direction());
- if (Abs(V.DotCross(myAxis.Direction(),W)) <= TolConf){
- return GeomAbs_Cone;
+ if (myAxis.IsParallel(Axe, TolAng)) {
+ bRet=GeomAbs_Cylinder;
+ return bRet;
+ }
+ else if (myAxis.IsNormal( Axe, TolAng)) {
+ bRet=GeomAbs_Plane;
+ return bRet;
+ }
+ else {
+ Standard_Real uf = myBasisCurve->FirstParameter();
+ Standard_Real ul = myBasisCurve->LastParameter();
+ Standard_Boolean istrim = (!Precision::IsInfinite(uf) &&
+ !Precision::IsInfinite(ul));
+ if(istrim){
+ gp_Pnt pf = myBasisCurve->Value(uf);
+ gp_Pnt pl = myBasisCurve->Value(ul);
+ Standard_Real len = pf.Distance(pl);
+ //on calcule la distance projetee sur l axe.
+ gp_Vec vlin(pf,pl);
+ gp_Vec vaxe(myAxis.Direction());
+ Standard_Real projlen = Abs(vaxe.Dot(vlin));
+ Standard_Real aTolConf = len*TolAng;
+ if ((len - projlen) <= aTolConf) {
+ bRet=GeomAbs_Cylinder;
+ return bRet;
}
- else {
- return GeomAbs_SurfaceOfRevolution;
+ else if (projlen <= aTolConf) {
+ bRet=GeomAbs_Plane;
+ return bRet;
}
}
- break;
- }
-
- case GeomAbs_Circle:
- {
- const gp_Circ& C = myBasisCurve->Circle();
- if (!C.Position().IsCoplanar(myAxis,TolConf,TolAng)) {
- return GeomAbs_SurfaceOfRevolution;
- }
- else if( gp_Lin(myAxis).Distance(C.Location()) <= TolConf) {
- return GeomAbs_Sphere;
+ gp_Vec V(myAxis.Location(),
+ myBasisCurve->Line().Location());
+ gp_Vec W(Axe.Direction());
+ if (Abs(V.DotCross(myAxis.Direction(),W)) <= TolConf){
+ bRet=GeomAbs_Cone;
+ return bRet;
}
else {
- Standard_Real MajorRadius = gp_Lin(myAxis).Distance(C.Location());
- if(MajorRadius > C.Radius()) return GeomAbs_Torus;
- return GeomAbs_SurfaceOfRevolution;
+ return bRet;
}
- break;
}
+ break;
+ }//case GeomAbs_Line:
+ //
+ case GeomAbs_Circle: {
+ Standard_Real MajorRadius, aR;
+ gp_Lin aLin(myAxis);
+ //
+ const gp_Circ& C=myBasisCurve->Circle();
+ const gp_Pnt& aLC=C.Location();
+ aR=C.Radius();
+ //
+
+ if (!C.Position().IsCoplanar(myAxis, TolConf, TolAng)) {
+ return bRet;
+ }
+ else if(aLin.Distance(aLC) <= TolConf) {
+ bRet=GeomAbs_Sphere;
+ return bRet;
+ }
+ else {
+ MajorRadius = aLin.Distance(aLC);
+ if(MajorRadius>aR) {
+ //modified by NIZNHY-PKV Thu Feb 24 09:46:29 2011f
+ Standard_Real aT, aDx, dX;
+ gp_Pnt aPx;
+ //
+ aT=0.;
+ aPx=ElCLib::Value(aT, C);
+ aDx=aLin.Distance(aPx);
+ dX=aDx-MajorRadius-aR;
+ if (dX<0.) {
+ dX=-dX;
+ }
+ if (dX<TolConf) {
+ bRet=GeomAbs_Torus;
+ }
+ //bRet=GeomAbs_Torus;
+ //return bRet;
+ //modified by NIZNHY-PKV Thu Feb 24 09:52:29 2011t
+ }
+ return bRet;
+ }
+ break;
+ }
+ //
default:
- return GeomAbs_SurfaceOfRevolution;
+ break;
}
- // portage WNT
- return GeomAbs_SurfaceOfRevolution;
+ return bRet;
}
//=======================================================================
const TopTools_ListOfShape& theL,
Standard_Real& theTF);
+//modified by NIZNHY-PKV Sat Mar 05 12:23:05 2011f
+void CorrectTolR3D(BOPTools_PaveFiller& aPF,
+ const BOPTools_SSInterference& aFF,
+ const TColStd_MapOfInteger& aMVStick,
+ Standard_Real& aTolR3D);
+//modified by NIZNHY-PKV Sat Mar 05 12:23:07 2011t
+
//=======================================================================
// function: PerformFF
// purpose:
for (i=1; i<=aNbFFs; i++) {
BOPTools_SSInterference& aFFi=aFFs(i);
- //
+ //
+ nF1=aFFi.Index1();
+ nF2=aFFi.Index2();
+ //
// Curves' tolerance
aTolR3D=aFFi.TolR3D();
//
// Faces
- nF1=aFFi.Index1();
- nF2=aFFi.Index2();
const TopoDS_Face& aF1=TopoDS::Face(myDS->GetShape(nF1));
const TopoDS_Face& aF2=TopoDS::Face(myDS->GetShape(nF2));
continue;
}
}
- // -&&
//
aBC.AppendNewBlock(aPBNew);
}
{
Standard_Integer nV;
Standard_Boolean bIsVertexOnLine;
- Standard_Real aT, aTolVExt;
-
-
+ Standard_Real aT, aTolVExt, aTolTresh;
+ BRep_Builder aBB;
+ //
+ aTolTresh=0.01;
nV=aPave.Index();
const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV));
const IntTools_Curve& aC=aBC.Curve();
aPaveSet.Append(aPaveNew);
//<-B
BOPTools_Tools::UpdateVertex (aC, aT, aV);
+ //modified by NIZNHY-PKV Sat Mar 05 13:43:27 2011f
+ if(aTolR3D<aTolTresh) {
+ aBB.UpdateVertex(aV, aTolR3D);
+ }
+ //modified by NIZNHY-PKV Sat Mar 05 13:43:29 2011t
}
}
//
// Put existing paves on curves
BOPTools_PaveSet aPSF;
PrepareSetForFace (nF1, nF2, aPSF);
-
+ //
+ //modified by NIZNHY-PKV Sat Mar 05 12:12:05 2011f
+ {
+ Standard_Integer nVX;
+ BOPTools_ListIteratorOfListOfPave aItLP;
+ TColStd_MapOfInteger aMVStick;
+ //
+ const BOPTools_ListOfPave& aLPX=aPSF.Set();
+ aItLP.Initialize(aLPX);
+ for (; aItLP.More(); aItLP.Next()) {
+ const BOPTools_Pave& aPX=aItLP.Value();
+ nVX=aPX.Index();
+ aMVStick.Add(nVX);
+ }
+ //
+ CorrectTolR3D(*this, aFFi, aMVStick, aTolR3D);
+ }
+ //modified by NIZNHY-PKV Sat Mar 05 12:12:07 2011t
+ //
BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
aNbCurves=aSCvs.Length();
for (j=1; j<=aNbCurves; j++) {
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <BOPTools_Tools3D.hxx>
//=======================================================================
// function: ProcessAloneStickVertices
theTF = maxD;
return eIndex;
}
+//modified by NIZNHY-PKV Sat Mar 05 12:18:43 2011f
+//=======================================================================
+//function : CorrectTolR3D
+//purpose :
+//=======================================================================
+void CorrectTolR3D(BOPTools_PaveFiller& aPF,
+ const BOPTools_SSInterference& aFF,
+ const TColStd_MapOfInteger& aMVStick,
+ Standard_Real& aTolR3D)
+{
+ Standard_Boolean bHasBounds;
+ Standard_Integer i, nF[2], nV, aNbCurves;
+ Standard_Real aT1, aT2, aU, aV, aT, aA, aTolV, aTolVmax;
+ Standard_Real aTolR, aTolTresh, aAmin, aAmax;
+ TColStd_MapIteratorOfMapOfInteger aIt;
+ gp_Pnt aP, aP1, aP2;
+ gp_Dir aDN[2];
+ gp_Vec aVT;
+ Handle(Geom_Surface) aS[2];
+ Handle(Geom_Curve) aC3D;
+ GeomAdaptor_Surface aGAS;
+ GeomAbs_SurfaceType aType;
+ TopoDS_Face aF[2];
+ //
+ BooleanOperations_PShapesDataStructure myDS=aPF.DS();
+ IntTools_Context& myContext=aPF.ChangeContext();
+ //
+ aTolTresh=0.0005;
+ aAmin=0.012;// 0.7-7 deg
+ aAmax=0.12;
+ //
+ if (!aMVStick.Extent()) {
+ return;
+ }
+ //
+ BOPTools_SSInterference& aFFi=*((BOPTools_SSInterference*)&aFF);
+ BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
+ aNbCurves=aSCvs.Length();
+ if (aNbCurves!=1){
+ return;
+ }
+ //
+ aFFi.Indices(nF[0], nF[1]);
+ for (i=0; i<2; ++i) {
+ aF[i]=*((TopoDS_Face*)(&myDS->Shape(nF[i])));
+ aS[i]=BRep_Tool::Surface(aF[i]);
+ aGAS.Load(aS[i]);
+ aType=aGAS.GetType();
+ if (aType!=GeomAbs_BSplineSurface) {
+ return;
+ }
+ }
+ //
+ BOPTools_Curve& aBC=aSCvs(1);
+ const IntTools_Curve& aIC=aBC.Curve();
+ bHasBounds=aIC.HasBounds();
+ if (!bHasBounds){
+ return;
+ }
+ //
+ aIC.Bounds (aT1, aT2, aP1, aP2);
+ aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
+ aC3D=aIC.Curve();
+ aC3D->D0(aT, aP);
+ //
+ for (i=0; i<2; ++i) {
+ GeomAPI_ProjectPointOnSurf& aPPS=myContext.ProjPS(aF[i]);
+ aPPS.Perform(aP);
+ aPPS.LowerDistanceParameters(aU, aV);
+ BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]);
+ }
+ //
+ aA=aDN[0].Angle(aDN[1]);
+ aA=fabs(aA);
+ if (aA>0.5*PI) {
+ aA=PI-aA;
+ }
+ //
+ if (aA<aAmin || aA>aAmax) {
+ return;
+ }
+ //
+ aTolVmax=-1.;
+ aIt.Initialize(aMVStick);
+ for (; aIt.More(); aIt.Next()) {
+ nV=aIt.Key();
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)(&myDS->Shape(nV)));
+ aTolV=BRep_Tool::Tolerance(aV);
+ if (aTolV>aTolVmax) {
+ aTolVmax=aTolV;
+ }
+ }
+ //
+ aTolR=aTolVmax/aA;
+ if (aTolR<aTolTresh) {
+ aTolR3D=aTolR;
+ }
+}
+//modified by NIZNHY-PKV Sat Mar 05 12:18:46 2011t
// modified by NIZHNY-MKK Mon Jun 21 15:13:40 2004
#include <Precision.hxx>
#include <ElCLib.hxx>
+#include <Geom_Surface.hxx>
+#include <BRep_Tool.hxx>
-static Standard_Real GetAddToParam(const gp_Lin& L,const Standard_Real P,const Bnd_Box& B);
+static
+ void FaceNormal (const TopoDS_Face& aF,
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Dir& aDN);
-//extern void DrawSegment(const gp_Pnt& P1,const gp_Lin& L,const Standard_Real par);
-//extern Standard_Boolean DebugDrawSegment;
+static
+ Standard_Real GetAddToParam(const gp_Lin& L,const Standard_Real P,const Bnd_Box& B);
+
+//=======================================================================
+//function : BRepClass3d_SClassifier
+//purpose :
+//=======================================================================
BRepClass3d_SClassifier::BRepClass3d_SClassifier()
{
}
+//=======================================================================
+//function : BRepClass3d_SClassifier
+//purpose :
+//=======================================================================
BRepClass3d_SClassifier::BRepClass3d_SClassifier(BRepClass3d_SolidExplorer& S,
const gp_Pnt& P,
const Standard_Real Tol) {
}
-void BRepClass3d_SClassifier::PerformInfinitePoint(BRepClass3d_SolidExplorer& SolidExplorer,
+//=======================================================================
+//function : PerformInfinitePoint
+//purpose :
+//=======================================================================
+void BRepClass3d_SClassifier::PerformInfinitePoint(BRepClass3d_SolidExplorer& aSE,
const Standard_Real /*Tol*/) {
//-- Idee : On prend un point A dans la face1 et un point B dans la face B
//-- ( si on a une seule face , on prend 2 points dans la meme face.)
//-- premier point. Si le solide a une seule face et que la droite AB ne le coupe pas
//-- on ne peut pas decider.
- if(SolidExplorer.Reject(gp_Pnt(0,0,0))) {
+ if(aSE.Reject(gp_Pnt(0,0,0))) {
myState=3; //-- in ds le cas solide sans face
return;
}
-
-
- Standard_Integer nump = 0;
+ //
+ //------------------------------------------------------------
+ // 1
+ Standard_Boolean bFound, bFlag;
+ Standard_Integer nump;
+ Standard_Real aParam, aU1, aV1, aU2, aV2;
gp_Pnt A,B;
-
- Standard_Real aParam = 0.5;
+ gp_Dir aDN1, aDN2;
+ TopoDS_Face aF, aF1, aF2;
+ //
+ nump = 0;
+ aParam = 0.5;
myFace.Nullify();
myState=2;
- for(SolidExplorer.InitShell();
- SolidExplorer.MoreShell() && nump<2;
- SolidExplorer.NextShell()) {
-
- for(SolidExplorer.InitFace();
- SolidExplorer.MoreFace() && nump<2;
- ) {
-
- TopoDS_Shape aLocalShape = SolidExplorer.CurrentFace();
- TopoDS_Face f = TopoDS::Face(aLocalShape);
-// TopoDS_Face f = TopoDS::Face(SolidExplorer.CurrentFace());
- SolidExplorer.NextFace();
- if(nump==0) {
+ for(aSE.InitShell(); aSE.MoreShell() && nump<2; aSE.NextShell()) {
+ for(aSE.InitFace(); aSE.MoreFace() && nump<2; ) {
+ aF =*((TopoDS_Face*)&aSE.CurrentFace());
+ aSE.NextFace();
+ if(!nump) {
nump++;
- if(SolidExplorer.FindAPointInTheFace(f,A,aParam)) {
- if(SolidExplorer.MoreFace() == Standard_False) {
- nump++;
- SolidExplorer.FindAPointInTheFace(f,B,aParam);
- }
- }
- else {
+ bFound=aSE.FindAPointInTheFace(aF, A, aU1, aV1, aParam);
+ if (!bFound) {
return;
}
- }
- else if(nump==1) {
- if(SolidExplorer.FindAPointInTheFace(f,B,aParam)) {
+ aF1=aF;
+ if(!aSE.MoreFace()) {
nump++;
+ bFound=aSE.FindAPointInTheFace(aF, B, aU2, aV2, aParam);
+ if (!bFound) {
+ return;
+ }
+ aF2=aF;
}
- else {
+ }// if(nump==0) {
+ else if(nump==1) {
+ bFound=aSE.FindAPointInTheFace(aF, B, aU2, aV2, aParam);
+ if(!bFound) {
return;
- }
+ }
+ aF2=aF;
+ nump++;
}
+ }// for(aSE.InitFace(); aSE.MoreFace() && nump<2; ) {
+ }// for(aSE.InitShell(); aSE.MoreShell() && nump<2; aSE.NextShell()) {
+ //
+ //------------------------------------------------------------
+ // 2
+ Standard_Integer cpasbon;
+ Standard_Real parmin, aD2, aSP;
+ IntCurveSurface_TransitionOnCurve aTC;
+ TopAbs_State aState;
+ //
+ parmin = RealLast();
+ //
+ bFlag=Standard_False;
+ if (aF1!=aF2) {
+ FaceNormal(aF1, aU1, aV1, aDN1);
+ FaceNormal(aF2, aU2, aV2, aDN2);
+ aSP=1.-aDN1*aDN2;
+ if (aSP < 1.e-5) {
+ bFlag=!bFlag;
}
}
- //------------------------------------------------------------
-
- Standard_Real parmin = RealLast();
-
- if(A.SquareDistance(B)<0.000001) {
+ //
+ aD2=A.SquareDistance(B);
+ if(aD2<0.000001 || bFlag) {
B.SetCoord(A.X()+1,A.Y()+1,A.Z()+1);
}
- Standard_Integer cpasbon = 0;
+ //
+ cpasbon = 0;
gp_Vec AB(A,B);
-
+ //
do {
switch (cpasbon)
{
gp_Lin L(A,gp_Dir(AB));
//-- cout<<"\npoint A "<<A.X()<<" "<<A.Y()<<" "<<A.Z()<<endl;
//-- cout<<"\npoint B "<<B.X()<<" "<<B.Y()<<" "<<B.Z()<<endl;
-
-
- for(SolidExplorer.InitShell();
- SolidExplorer.MoreShell();
- SolidExplorer.NextShell()) {
-
- if(SolidExplorer.RejectShell(L) == Standard_False) {
-
- for(SolidExplorer.InitFace();
- SolidExplorer.MoreFace();
- SolidExplorer.NextFace()) {
-
- if(SolidExplorer.RejectFace(L) == Standard_False) {
-
- TopoDS_Shape aLocalShape = SolidExplorer.CurrentFace();
+ for(aSE.InitShell();aSE.MoreShell();aSE.NextShell()) {
+ if(aSE.RejectShell(L) == Standard_False) {
+ for(aSE.InitFace();aSE.MoreFace(); aSE.NextFace()) {
+ if(aSE.RejectFace(L) == Standard_False) {
+ TopoDS_Shape aLocalShape = aSE.CurrentFace();
TopoDS_Face f = TopoDS::Face(aLocalShape);
-// TopoDS_Face f = TopoDS::Face(SolidExplorer.CurrentFace());
- IntCurvesFace_Intersector& Intersector3d = SolidExplorer.Intersector(f);
- Intersector3d.Perform(L,-RealLast(),parmin); //-- Avant (14 oct 98 il y avait -RealLast RealLast)
+ IntCurvesFace_Intersector& Intersector3d = aSE.Intersector(f);
+ Intersector3d.Perform(L,-RealLast(),parmin);
if(Intersector3d.IsDone()) {
if(Intersector3d.NbPnt()) {
if(Intersector3d.WParameter(1) < parmin) {
+ aState=Intersector3d.State(1);
parmin = Intersector3d.WParameter(1);
- if(Intersector3d.State(1)==TopAbs_IN) {
-
+ if(aState==TopAbs_IN || aState==TopAbs_ON) {
+ aTC=Intersector3d.Transition(1);
//-- The intersection point between the line and a face F
// -- of the solid is in the face F
-
- if(Intersector3d.Transition(1) == IntCurveSurface_Out) {
+ if(aTC == IntCurveSurface_Out) {
//-- The line is going from inside the solid to outside
//-- the solid.
myState = 3; //-- IN --
}
- else if(Intersector3d.Transition(1) == IntCurveSurface_In) {
+ else if(aTC == IntCurveSurface_In) {
myState = 4; //-- OUT --
}
myFace = f;
}
+ /*
else if(Intersector3d.State(1)==TopAbs_ON) {
//-- The intersection point between the line and a face F
//-- of the solid is in the face F
//-- myState = 2;
myFace = f;
}
+ */
}
+
else {
//-- No point has been found by the Intersector3d.
//-- Or a Point has been found with a greater parameter.
//function : Perform
//purpose :
//=======================================================================
- void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
- const gp_Pnt& P,
- const Standard_Real Tol)
+void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
+ const gp_Pnt& P,
+ const Standard_Real Tol)
{
//-- englobantes en priorite de facon a avoir un parmin le plus faible possible.
//-- optimisation pour assurer le plus de rejections possibles avec les autres
//-- faces.
- //modified by NIZNHY-PKV Thu Nov 14 12:33:53 2002 f
Standard_Integer iFlag;
//
return;
}
//SolidExplorer.Segment(P,L,Par);
- //modified by NIZNHY-PKV Thu Nov 14 12:33:58 2002 t
//
//process results from uncorrected shells
//
- //modified by NIZNHY-PKV Thu Nov 14 15:05:43 2002 f
//if(Par > 1.e+100 && L.Direction().IsParallel(gp_Dir(0.,0.,1.),1.e-8)) {
if (iFlag==2) {
- //modified by NIZNHY-PKV Thu Nov 14 15:06:16 2002 t
myState = 4;
return;
}
}
return Par - P;
}
-
+//=======================================================================
+//function : FaceNormal
+//purpose :
+//=======================================================================
+void FaceNormal (const TopoDS_Face& aF,
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Dir& aDN)
+{
+ gp_Pnt aPnt ;
+ gp_Vec aD1U, aD1V, aN;
+ Handle(Geom_Surface) aS;
+
+ aS=BRep_Tool::Surface(aF);
+ aS->D1 (U, V, aPnt, aD1U, aD1V);
+ aN=aD1U.Crossed(aD1V);
+ aN.Normalize();
+ aDN.SetXYZ(aN.XYZ());
+ if (aF.Orientation() == TopAbs_REVERSED){
+ aDN.Reverse();
+ }
+ return;
+}
return 0;
}
+//=======================================================================
+//function : xbounds
+//purpose :
+//=======================================================================
+Standard_Integer xbounds(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n<2) {
+ di << "Usage : " << a[0] << " face" << "\n";
+ return 0;
+ }
+ //
+
+ Standard_Real aUMin, aUMax, aVMin, aVMax;
+ TopoDS_Shape aS;
+ TopoDS_Face aF;
+ //
+ aS=DBRep::Get(a[1]);
+ if (aS.IsNull()) {
+ di << " null shapes is not allowed here\n";
+ return 0;
+ }
+ if (aS.ShapeType()!=TopAbs_FACE) {
+ di << " shape" << a[1] <<" must be a face\n";
+ return 0;
+ }
+ //
+ aF=*((TopoDS_Face*)&aS);
+ //
+ BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
+ //
+ TCollection_AsciiString aStr;
+ TCollection_AsciiString sUMin(aUMin);
+ TCollection_AsciiString sUMax(aUMax);
+ TCollection_AsciiString sVMin(aVMin);
+ TCollection_AsciiString sVMax(aVMax);
+ //
+ aStr=aStr+sUMin + "\n";
+ aStr=aStr+sUMax + "\n";
+ aStr=aStr+sVMin + "\n";
+ aStr=aStr+sVMax + "\n";
+ di <<aStr.ToCString();
+ //
+ return 0;
+}
//=======================================================================
//function : OtherCommands
theCommands.Add("mksh",
"create a shell on Shape", __FILE__, MakeShell, g);
+
+ theCommands.Add("xbounds",
+ "xbounds face", __FILE__, xbounds, g);
+
}
NbSolTotal++;
}
}
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+//=======================================================================
+//function : LineCircleGeometricIntersection
+//purpose :
//~~ On cherche des segments d intersection dans le `tuyau`
//~~ R+Tol R-Tol ( Tol est TolConf : Tolerance de confusion d arc)
//~~ On Cherche un point d intersection a une distance TolTang du cercle.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-void LineCircleGeometricIntersection(const gp_Lin2d& Line
- ,const gp_Circ2d& Circle
- ,const Standard_Real Tol
- ,const Standard_Real TolTang
- ,PeriodicInterval& CInt1
- ,PeriodicInterval& CInt2
- ,Standard_Integer& nbsol) {
+//=======================================================================
+void LineCircleGeometricIntersection(const gp_Lin2d& Line,
+ const gp_Circ2d& Circle,
+ const Standard_Real Tol,
+ const Standard_Real TolTang,
+ PeriodicInterval& CInt1,
+ PeriodicInterval& CInt2,
+ Standard_Integer& nbsol)
+{
Standard_Real dO1O2=Line.Distance(Circle.Location());
Standard_Real R=Circle.Radius();
- // Standard_Real RpTol=R+Tol;
Standard_Real RmTol=R-Tol;
Standard_Real binf1,binf2=0,bsup1,bsup2=0;
}
else {
//----------------------------------------------------------------
-// Standard_Real dO1O2dO1O2=dO1O2*dO1O2;
+ Standard_Boolean b2Sol;
Standard_Real dAlpha1;
//---------------------------------------------------------------
//-- Line coupe le cercle Circle+ (=C(x1,y1,R1+Tol))
-
- if(dO1O2 > RmTol) {
+ //modified by NIZNHY-PKV Thu May 12 12:25:17 2011f
+ b2Sol=Standard_False;
+ if (R>dO1O2+TolTang) {
+ Standard_Real aX2, aTol2;
+ //
+ aTol2=Tol*Tol;
+ aX2=4.*(R*R-dO1O2*dO1O2);
+ if (aX2>aTol2) {
+ b2Sol=!b2Sol;
+ }
+ }
+ if(dO1O2 > RmTol && !b2Sol) {
+ //if(dO1O2 > RmTol) {
+ //modified by NIZNHY-PKV Thu May 12 12:25:20 2011t
Standard_Real dx=dO1O2;
Standard_Real dy=0.0; //(RpTol*RpTol-dx*dx); //Patch !!!
dy=(dy>=0.0)? Sqrt(dy) : 0.0;
#include <gp_Circ.hxx>
#include <Extrema_ExtElC.hxx>
#include <Extrema_POnCurv.hxx>
+#include <TopoDS_Iterator.hxx>
//=======================================================================
//function : IntTools_EdgeEdge::IntTools_EdgeEdge
aCurveFrom->D0(t, aPFrom);
Handle(Geom_Curve)aCurveTo=BRep_Tool::Curve (myCTo.Edge(), f, l);
- //modified by NIZNHY-PKV Mon Jun 8 09:52:09 2009f
- //aProjector.Init(aPFrom, aCurveTo, myTminTo, myTmaxTo);
aProjector.Init(aCurveTo, myTminTo, myTmaxTo);
aProjector.Perform(aPFrom);
- //modified by NIZNHY-PKV Mon Jun 8 09:53:00 2009t
aNbProj=aProjector.NbPoints();
//
if (myCTo.GetType()==GeomAbs_Circle) {
}
}
- //modified by NIZNHY-PKV Mon Jun 8 09:54:19 2009f
- //aProjector.Init(aPFrom, aCurveTo, myTminTo, myTmaxTo);
aProjector.Init(aCurveTo, myTminTo, myTmaxTo);
aProjector.Perform(aPFrom);
- //modified by NIZNHY-PKV Mon Jun 8 09:55:11 2009t
//
Standard_Integer j, aNbPoints;
//
}
aCurveFrom->D0 (tt, aPFrom);
- //modified by NIZNHY-PKV Mon Jun 8 09:54:52 2009f
- //aProjector.Init(aPFrom, aCurveTo, myTminTo, myTmaxTo);
aProjector.Init(aCurveTo, myTminTo, myTmaxTo);
aProjector.Perform(aPFrom);
- //modified by NIZNHY-PKV Mon Jun 8 09:55:07 2009t
aNbPoints=aProjector.NbPoints();
if (aNbPoints) {
break;
}
}
//
- //modified by NIZNHY-PKV Mon Jun 8 09:55:42 2009f
- //aProjector.Init(aPm2, aCurveFrom, myTminFrom, myTmaxFrom);
aProjector.Init(aCurveFrom, myTminFrom, myTmaxFrom);
aProjector.Perform(aPm2);
- //modified by NIZNHY-PKV Mon Jun 8 09:56:12 2009t
Standard_Integer aNbPoints=aProjector.NbPoints();
if (aNbPoints) {
Standard_Real aDD=aProjector.LowerDistance();
}
}
//
- //modified by NIZNHY-PKV Wed May 13 11:08:46 2009f
if (aCT1==GeomAbs_Circle && aCT2==GeomAbs_Circle) {
Standard_Boolean bIsDone, bIsParallel;
Standard_Integer aNbExt;
}
}
}
- //modified by NIZNHY-PKV Wed May 13 11:08:51 2009t
//
// Prepare values of arguments for the interval [ta, tb]
pri=IntTools::PrepareArgs (myCFrom, tb, ta, myDiscret, myDeflection, anArgs);
gp_Pnt aP1;
aCurveFrom->D0 (aT1, aP1);
GeomAPI_ProjectPointOnCurve aProjector;
- //modified by NIZNHY-PKV Mon Jun 8 09:56:53 2009f
- //aProjector.Init(aP1, aCurveTo, myTminTo, myTmaxTo);
aProjector.Init(aCurveTo, myTminTo, myTmaxTo);
aProjector.Perform(aP1);
- //modified by NIZNHY-PKV Mon Jun 8 09:57:12 2009t
aNbPoints=aProjector.NbPoints();
found=1;
if (!aNbPoints) {
tt=aT1-myEpsT;
}
aCurveFrom->D0 (tt, aP1);
- //modified by NIZNHY-PKV Mon Jun 8 09:57:34 2009f
- //aProjector.Init(aP1, aCurveTo, myTminTo, myTmaxTo);
aProjector.Init(aCurveTo, myTminTo, myTmaxTo);
aProjector.Perform(aP1);
- //modified by NIZNHY-PKV Mon Jun 8 09:57:51 2009t
aNbPoints=aProjector.NbPoints();
if (aNbPoints) {
found=1;
if(!isfirst || !islast) {
if(isfirst) {
aTx1 = aTF1;
- //modified by NIZNHY-PKV Mon Jun 8 09:59:27 2009f
- //GeomAPI_ProjectPointOnCurve aProjector(Curve1->Value(aTx1), Curve2, aTF2, aTL2);
GeomAPI_ProjectPointOnCurve aProjector;
aProjector.Init(Curve2, aTF2, aTL2);
aProjector.Perform(Curve1->Value(aTx1));
- //modified by NIZNHY-PKV Mon Jun 8 10:00:12 2009t
//
if(aProjector.NbPoints() > 0)
aTx2 = aProjector.LowerDistanceParameter();
if(islast) {
aTx1 = aTL1;
- //modified by NIZNHY-PKV Mon Jun 8 10:00:24 2009f
- //GeomAPI_ProjectPointOnCurve aProjector(Curve1->Value(aTx1), Curve2, aTF2, aTL2);
GeomAPI_ProjectPointOnCurve aProjector;
aProjector.Init(Curve2, aTF2, aTL2);
aProjector.Perform(Curve1->Value(aTx1));
- //modified by NIZNHY-PKV Mon Jun 8 10:00:26 2009t
if(aProjector.NbPoints() > 0)
aTx2 = aProjector.LowerDistanceParameter();
else {
GeomAPI_ProjectPointOnCurve aProjector;
Standard_Real aMidPar, aMidDist;
aMidPar = (aTF1 + aTL1) * 0.5;
- //modified by NIZNHY-PKV Mon Jun 8 10:01:32 2009f
- //aProjector.Init(Curve1->Value(aMidPar), Curve2, aTF2, aTL2);
aProjector.Init(Curve2, aTF2, aTL2);
aProjector.Perform(Curve1->Value(aMidPar));
- //modified by NIZNHY-PKV Mon Jun 8 10:02:09 2009t
if(aProjector.NbPoints() > 0) {
aMidDist=aProjector.LowerDistance();
if(aMidDist * aMidDist < aDist2 || !istouch) {
//=======================================================================
void IntTools_EdgeEdge::ComputeLineLine()
{
- Standard_Real Tolang2 = 1.e-16;
- Standard_Real Tol2 = myCriteria*myCriteria;
- Standard_Boolean IsParallel = Standard_False, IsCoincide = Standard_False;
- myIsDone = Standard_True;
-
+ Standard_Boolean IsParallel, IsCoincide;
+ Standard_Real Tolang2, Tol2;
gp_Pnt P11, P12, P21, P22;
-
+ //
+ myIsDone = Standard_True;
+ //
+ IsParallel = Standard_False;
+ IsCoincide = Standard_False;
+ Tolang2 = 1.e-16;
+ Tol2 = myCriteria*myCriteria;
+ //
gp_Lin C1 = myCFrom.Line();
gp_Lin C2 = myCTo.Line();
const gp_Dir& D1 = C1.Position().Direction();
if(IsParallel) {
return;
}
-
+ //
+ //modified by NIZNHY-PKV Tue Mar 29 08:29:14 2011f
+ {
+ TopoDS_Iterator aIt1, aIt2;
+ //
+ aIt1.Initialize(myEdge1);
+ for (; aIt1.More(); aIt1.Next()) {
+ const TopoDS_Shape& aV1=aIt1.Value();
+ aIt2.Initialize(myEdge2);
+ for (; aIt2.More(); aIt2.Next()) {
+ const TopoDS_Shape& aV2=aIt2.Value();
+ if (aV2.IsSame(aV1)) {
+ // the two straight lines have commpn vertex
+ return;
+ }
+ }
+ }
+ }
+ //modified by NIZNHY-PKV Tue Mar 29 08:29:16 2011t
+ //
Standard_Real aSin2 = 1. - aCos*aCos;
gp_Pnt O1 = C1.Location();
gp_Pnt O2 = C2.Location();
if(d2 > Tol2) {
return;
}
-
+ //
IntTools_CommonPrt aCommonPrt;
aCommonPrt.SetEdge1(myCFrom.Edge());
aCommonPrt.SetEdge2(myCTo.Edge());
nbFaces = 0,
nbWires = 0,
nbEdges = 0,
- nbVertexes = 0;
+ nbVertexes = 0,
+ nbCompounds = 0;
+
+ if (S.ShapeType() == TopAbs_COMPOUND)
+ nbCompounds++;
for( ; itL.More(); itL.Next() ) {
TopoDS_Iterator it( itL.Value() );
if ( !aMapOfShape.Add(aSubShape) )
continue;
aListOfShape.Append(aSubShape);
+ if (aSubShape.ShapeType() == TopAbs_COMPOUND)
+ nbCompounds++;
if (aSubShape.ShapeType() == TopAbs_SOLID)
nbSolids++;
if (aSubShape.ShapeType() == TopAbs_SHELL) {
}
}
#ifdef DEB
+ cout << "//What is?// NB COMPOUNDS: " << nbCompounds << endl;
cout << "//What is?// NB SOLIDS: " << nbSolids << endl;
cout << "//What is?// NB SHELLS: " << nbShells << endl;
cout << "//What is?// OPEN SHELLS: " << nbOpenShells << endl;
#endif
}
+namespace {
+ // Set global var to inform outer methods that current representation item is non-manifold.
+ // The better way is to pass this information via binder or via TopoDS_Shape itself, however,
+ // this is very specific info to do so...
+ Standard_Boolean NM_DETECTED = Standard_False;
+};
+
// ============================================================================
// Method : STEPControl_ActorRead::STEPControl_ActorRead ()
// Purpose : Empty constructor
TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
if (!theResult.IsNull()) {
Result1 = theResult;
- B.Add(Cund, theResult);
+ // [BEGIN] ssv: OCCT#22436: extra compound in NMSSR case
+ if (NM_DETECTED && Result1.ShapeType() == TopAbs_COMPOUND)
+ {
+ TopoDS_Iterator it(Result1);
+ for ( ; it.More(); it.Next() )
+ {
+ TopoDS_Shape aSubShape = it.Value();
+ B.Add(Cund, aSubShape);
+ }
+ }
+ else
+ B.Add(Cund, theResult);
+ // [END] ssv: OCCT#22436: extra compound in NMSSR case
nbComponents++;
}
}
theResult = TransferBRep::ShapeResult (binder);
if (!theResult.IsNull()) {
Result1 = theResult;
- B.Add(Cund, theResult);
+ // [BEGIN] ssv: OCCT#22436: extra compound in NMSSR case
+ if (NM_DETECTED && Result1.ShapeType() == TopAbs_COMPOUND)
+ {
+ TopoDS_Iterator it(Result1);
+ for ( ; it.More(); it.Next() )
+ {
+ TopoDS_Shape aSubShape = it.Value();
+ B.Add(Cund, aSubShape);
+ }
+ }
+ else
+ B.Add(Cund, theResult);
+ // [END] ssv: OCCT#22436: extra compound in NMSSR case
nbShapes++;
}
}
const Handle(Transfer_TransientProcess)& TP,
Standard_Boolean& isBound)
{
+ NM_DETECTED = Standard_False;
Handle(TransferBRep_ShapeBinder) shbinder;
if(!Recognize(sr))
return shbinder;
Standard_Boolean isManifold = Standard_True;
if ( isNMMode && sr->IsKind(STANDARD_TYPE(StepShape_NonManifoldSurfaceShapeRepresentation)) ) {
isManifold = Standard_False;
+ NM_DETECTED = Standard_True;
#ifdef DEB
Standard_Integer NMSSRItemsLen = sr->Items()->Length();
cout << "NMSSR with " << NMSSRItemsLen << " items detected" << endl;
Standard_Integer isIDeasMode = Interface_Static::IVal("read.step.ideas");
if (isNMMode && myNMTool.IsIDEASCase() && isIDeasMode) {
isManifold = Standard_False;
+ NM_DETECTED = Standard_True;
#ifdef DEB
cout << "I-DEAS post processing for non-manifold topology ENABLED" << endl;
#endif
Handle(Geom_Axis2Placement) theTarg;
StepToGeom_MakeAxis2Placement::Convert(trg,theTarg);
if ( oldSRContext != TargContext ) PrepareUnits(oldSRContext,TP);
-
+
gp_Ax3 ax3Orig(theOrig->Ax2());
gp_Ax3 ax3Targ(theTarg->Ax2());
- //ax3Orig - defines CS for component(always is equal to (0 0 0 ))(related product from NAUO)
- //ax3Targ - defines place of component in assemby CS (relating product
- // ne pas se tromper de sens !
-
- gp_Trsf aTrsf2;
- gp_Ax3 anAxis(gp_Pnt(0.,0.,0.), gp::DZ(), gp::DX());;
- aTrsf2.SetTransformation(anAxis,ax3Orig);
- gp_Trsf aTrsf3;
- aTrsf3.SetTransformation(ax3Targ,anAxis);
-
- Trsf = aTrsf3 * aTrsf2;
-
+ // ne pas se tromper de sens !
+ Trsf.SetTransformation(ax3Targ, ax3Orig);
return Trsf.Form() != gp_Identity;
}