From aec37c1569d4f8155e3f000c059149c231087e74 Mon Sep 17 00:00:00 2001 From: kgv <kgv@opencascade.org> Date: Sat, 26 Jan 2013 23:39:56 +0400 Subject: [PATCH] 0023728: Unused variables "Tolu" and "Tolv" in Select3D --- src/Select3D/Select3D_SensitiveCircle.cxx | 69 +++++++-------- src/Select3D/Select3D_SensitiveCurve.cxx | 41 +++++---- src/Select3D/Select3D_SensitiveFace.cxx | 27 +++--- src/Select3D/Select3D_SensitivePoint.cxx | 19 ++--- src/Select3D/Select3D_SensitiveSegment.cxx | 61 +++++++------ src/Select3D/Select3D_SensitiveTriangle.cxx | 79 +++++++++-------- .../Select3D_SensitiveTriangulation.cxx | 85 +++++++++---------- 7 files changed, 180 insertions(+), 201 deletions(-) diff --git a/src/Select3D/Select3D_SensitiveCircle.cxx b/src/Select3D/Select3D_SensitiveCircle.cxx index 3afbfe4e13..66288e7501 100755 --- a/src/Select3D/Select3D_SensitiveCircle.cxx +++ b/src/Select3D/Select3D_SensitiveCircle.cxx @@ -66,8 +66,8 @@ static Standard_Integer S3D_GetArcNBPoints(const Handle(Geom_Circle)& C, //======================================================================= Select3D_SensitiveCircle:: -Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, - const Handle(Geom_Circle)& TheCircle, +Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, + const Handle(Geom_Circle)& TheCircle, const Standard_Boolean FilledCircle, const Standard_Integer NbPoints): Select3D_SensitivePoly(OwnerId, S3D_GetCircleNBPoints(TheCircle,NbPoints)), @@ -89,7 +89,7 @@ myend(0) for(Standard_Integer anIndex=1;anIndex<=NbPoints;anIndex++) { TheCircle->D1(curu,p1,v1); - + v1.Normalize(); mypolyg.SetPnt(rank-1, p1); rank++; @@ -121,7 +121,7 @@ myend(0) //======================================================================= Select3D_SensitiveCircle:: -Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, +Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, const Handle(Geom_Circle)& TheCircle, const Standard_Real u1, const Standard_Real u2, @@ -138,18 +138,18 @@ myend(u2) { gp_Pnt p1,p2; gp_Vec v1; - + if (u1 > u2) { mystart = u2; myend = u1; } - + Standard_Real du = (myend-mystart)/(NbPoints-1); Standard_Real R = TheCircle->Radius(); Standard_Integer rank = 1; Standard_Real curu = mystart; - + for(Standard_Integer anIndex=1;anIndex<=NbPoints-1;anIndex++) { TheCircle->D1(curu,p1,v1); @@ -165,7 +165,7 @@ myend(u2) } TheCircle->D0(myend,p1); mypolyg.SetPnt(NbPoints*2-2, p1); - // Get myCenter3D + // Get myCenter3D myCenter3D = TheCircle->Location(); } else @@ -178,7 +178,7 @@ myend(u2) //======================================================================= //function : Select3D_SensitiveCircle -//purpose : +//purpose : //======================================================================= Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, @@ -198,7 +198,7 @@ myend(0) //======================================================================= //function : Select3D_SensitiveCircle -//purpose : +//purpose : //======================================================================= Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& OwnerId, @@ -218,7 +218,7 @@ myend(0) //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveCircle:: @@ -232,7 +232,7 @@ Matches(const Standard_Real X, { Standard_Boolean Found = Standard_False; Standard_Integer anIndex = 0; - + if(!myFillStatus) { while(anIndex < aSize-2 && !Found) @@ -258,11 +258,11 @@ Matches(const Standard_Real X, // Fill anArrayOf2dPnt with points from mypolig2d Points2D(anArrayOf2dPnt); - + CSLib_Class2d anInOutTool(anArrayOf2dPnt,aTol,aTol,Xmin,Ymin,Xmax,Ymax); // Method SiDans returns the status : - // 1 - the point is inside the circle + // 1 - the point is inside the circle // 0 - the point is on the circle // -1 - the point is outside the circle Standard_Integer aStat = anInOutTool.SiDans(gp_Pnt2d(X,Y)); @@ -270,7 +270,7 @@ Matches(const Standard_Real X, { // Compute DMin (a distance between the center and the point) DMin = gp_XY(myCenter2D.x - X, myCenter2D.y - Y).Modulus(); - Select3D_SensitiveEntity::Matches(X,Y,aTol,DMin); + Select3D_SensitiveEntity::Matches(X,Y,aTol,DMin); return Standard_True; } return Standard_False; @@ -291,7 +291,7 @@ Matches(const Standard_Real X, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveCircle:: @@ -316,7 +316,7 @@ Matches(const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveCircle:: @@ -327,9 +327,6 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, myDetectedIndex = -1; Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = Precision::Confusion(); - Tolv = Precision::Confusion(); CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); for(Standard_Integer anIndex=0;anIndex<mypolyg.Size();++anIndex) @@ -343,7 +340,7 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, //======================================================================= //function : ArrayBounds -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveCircle:: @@ -356,7 +353,7 @@ ArrayBounds(Standard_Integer & Low, //======================================================================= //function : GetPoint3d -//purpose : +//purpose : //======================================================================= gp_Pnt Select3D_SensitiveCircle:: @@ -370,24 +367,24 @@ GetPoint3d(const Standard_Integer Rank) const //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveCircle::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const { Standard_Integer aSize = mypolyg.Size(); - + S<<"\tSensitiveCircle 3D :"; - + Standard_Boolean isclosed = 1== aSize; if(isclosed) S<<"(Closed Circle)"<<endl; else S<<"(Arc Of Circle)"<<endl; - + if(HasLocation()) S<<"\t\tExisting Location"<<endl; - + if(FullDump) { @@ -401,7 +398,7 @@ void Select3D_SensitiveCircle::Dump(Standard_OStream& S,const Standard_Boolean F //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitiveCircle::ComputeDepth(const gp_Lin& EyeLine) const @@ -423,12 +420,12 @@ Standard_Real Select3D_SensitiveCircle::ComputeDepth(const gp_Lin& EyeLine) cons //======================================================================= //function : GetConnected -//purpose : +//purpose : //======================================================================= -Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected(const TopLoc_Location& theLocation) +Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected(const TopLoc_Location& theLocation) { - // Create a copy of this + // Create a copy of this Handle(Select3D_SensitiveEntity) aNewEntity; // this was constructed using Handle(Geom_Circle) if(!myCircle.IsNull()) @@ -445,7 +442,7 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected(const To } } // this was constructed using TColgp_Array1OfPnt - else + else { Standard_Integer aSize = mypolyg.Size(); TColgp_Array1OfPnt aPolyg(1, aSize); @@ -457,7 +454,7 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected(const To } if(HasLocation()) - aNewEntity->SetLocation(Location()); + aNewEntity->SetLocation(Location()); aNewEntity->UpdateLocation(theLocation); @@ -466,12 +463,12 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected(const To //======================================================================= //function : Project -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveCircle::Project(const Handle_Select3D_Projector &aProjector) { - Select3D_SensitivePoly::Project(aProjector); + Select3D_SensitivePoly::Project(aProjector); gp_Pnt2d aCenter; aProjector->Project(myCenter3D, aCenter); myCenter2D = aCenter; @@ -479,7 +476,7 @@ void Select3D_SensitiveCircle::Project(const Handle_Select3D_Projector &aProject //======================================================================= //function : ComputeCenter3D -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveCircle::ComputeCenter3D() diff --git a/src/Select3D/Select3D_SensitiveCurve.cxx b/src/Select3D/Select3D_SensitiveCurve.cxx index 0e85c2e5b4..5965a338f5 100755 --- a/src/Select3D/Select3D_SensitiveCurve.cxx +++ b/src/Select3D/Select3D_SensitiveCurve.cxx @@ -39,7 +39,7 @@ Select3D_SensitiveCurve const Handle(Geom_Curve)& C, const Standard_Integer NbPoints): Select3D_SensitivePoly(OwnerId, NbPoints), -mylastseg(0), +mylastseg(0), myCurve(C) { LoadPoints(C,NbPoints); @@ -113,7 +113,7 @@ Matches (const Standard_Real XMin, { Bnd_Box2d BoundBox; BoundBox.Update(XMin-aTol,YMin-aTol,XMax+aTol,YMax+aTol); - + for(Standard_Integer anIndex=0; anIndex<mypolyg.Size(); ++anIndex) { if(BoundBox.IsOut(mypolyg.Pnt2d(anIndex))) @@ -124,7 +124,7 @@ Matches (const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveCurve:: @@ -134,9 +134,6 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, { Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); for(Standard_Integer anIndex=0;anIndex<mypolyg.Size();++anIndex) @@ -156,7 +153,7 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, void Select3D_SensitiveCurve ::LoadPoints (const Handle(Geom_Curve)& aCurve,const Standard_Integer NbP) { - /*this method is private and it used only inside of constructor. + /*this method is private and it used only inside of constructor. That's why check !NbP==mypolyg3d->Length() was removed*/ Standard_Real Step = (aCurve->LastParameter()- aCurve->FirstParameter())/(NbP-1); @@ -170,10 +167,10 @@ void Select3D_SensitiveCurve //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= -void Select3D_SensitiveCurve::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const +void Select3D_SensitiveCurve::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const { S<<"\tSensitiveCurve 3D :"<<endl; if (HasLocation()) @@ -189,7 +186,7 @@ void Select3D_SensitiveCurve::Dump(Standard_OStream& S,const Standard_Boolean Fu //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitiveCurve::ComputeDepth(const gp_Lin& EyeLine) const @@ -219,35 +216,35 @@ Standard_Real Select3D_SensitiveCurve::ComputeDepth(const gp_Lin& EyeLine) const //======================================================================= //function : GetConnected -//purpose : -//======================================================================= +//purpose : +//======================================================================= -Handle(Select3D_SensitiveEntity) Select3D_SensitiveCurve::GetConnected(const TopLoc_Location &theLocation) +Handle(Select3D_SensitiveEntity) Select3D_SensitiveCurve::GetConnected(const TopLoc_Location &theLocation) { - // Create a copy of this + // Create a copy of this Handle(Select3D_SensitiveEntity) aNewEntity; - // this was constructed using Handle(Geom_Curve) - if (!myCurve.IsNull()) + // this was constructed using Handle(Geom_Curve) + if (!myCurve.IsNull()) { aNewEntity = new Select3D_SensitiveCurve(myOwnerId, myCurve); } // this was constructed using TColgp_HArray1OfPnt - else + else { Standard_Integer aSize = mypolyg.Size(); Handle(TColgp_HArray1OfPnt) aPoints = new TColgp_HArray1OfPnt(1, aSize); // Fill the array with points from mypolyg3d - for (Standard_Integer anIndex = 1; anIndex <= aSize; ++anIndex) + for (Standard_Integer anIndex = 1; anIndex <= aSize; ++anIndex) { aPoints->SetValue(anIndex, mypolyg.Pnt(anIndex-1)); } aNewEntity = new Select3D_SensitiveCurve(myOwnerId, aPoints); } - - if (HasLocation()) - aNewEntity->SetLocation(Location()); + + if (HasLocation()) + aNewEntity->SetLocation(Location()); aNewEntity->UpdateLocation(theLocation); return aNewEntity; -} \ No newline at end of file +} diff --git a/src/Select3D/Select3D_SensitiveFace.cxx b/src/Select3D/Select3D_SensitiveFace.cxx index c4ac79db97..227a0798b5 100755 --- a/src/Select3D/Select3D_SensitiveFace.cxx +++ b/src/Select3D/Select3D_SensitiveFace.cxx @@ -122,8 +122,8 @@ Matches(const Standard_Real X, V-=mypolyg.Pnt2d(anIndex-1); Standard_Real Vector = V1^V; Standard_Real V1V1 = V1.SquareModulus(); - DMin2 = - (V1V1 <=aTol2) ? + DMin2 = + (V1V1 <=aTol2) ? Min(DMin2,V.SquareModulus()): // if the segment is too small... Min(DMin2,Vector*Vector/V1V1); //cdg ... @@ -163,7 +163,7 @@ Matches(const Standard_Real X, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveFace:: @@ -186,7 +186,7 @@ Matches (const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveFace:: @@ -196,9 +196,6 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, { Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); gp_Pnt2d aPnt2d; @@ -213,7 +210,7 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveFace::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const @@ -221,10 +218,10 @@ void Select3D_SensitiveFace::Dump(Standard_OStream& S,const Standard_Boolean Ful S<<"\tSensitiveFace 3D :"<<endl;; if(HasLocation()) S<<"\t\tExisting Location"<<endl; - - if(mytype==Select3D_TOS_BOUNDARY) + + if(mytype==Select3D_TOS_BOUNDARY) S<<"\t\tSelection Of Bounding Polyline Only"<<endl; - + if(FullDump) { S<<"\t\tNumber Of Points :"<<mypolyg.Size()<<endl; @@ -234,7 +231,7 @@ void Select3D_SensitiveFace::Dump(Standard_OStream& S,const Standard_Boolean Ful //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitiveFace::ComputeDepth(const gp_Lin& EyeLine) const @@ -258,10 +255,10 @@ Standard_Real Select3D_SensitiveFace::ComputeDepth(const gp_Lin& EyeLine) const //======================================================================= //function : GetConnected -//purpose : +//purpose : //======================================================================= -Handle(Select3D_SensitiveEntity) Select3D_SensitiveFace::GetConnected(const TopLoc_Location &theLocation) +Handle(Select3D_SensitiveEntity) Select3D_SensitiveFace::GetConnected(const TopLoc_Location &theLocation) { // Create a copy of this Standard_Integer aSize = mypolyg.Size(); @@ -280,4 +277,4 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveFace::GetConnected(const TopL aNewEntity->UpdateLocation(theLocation); return aNewEntity; -} \ No newline at end of file +} diff --git a/src/Select3D/Select3D_SensitivePoint.cxx b/src/Select3D/Select3D_SensitivePoint.cxx index d32d1e7404..e213781f1e 100755 --- a/src/Select3D/Select3D_SensitivePoint.cxx +++ b/src/Select3D/Select3D_SensitivePoint.cxx @@ -115,30 +115,27 @@ Matches (const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitivePoint:: Matches (const TColgp_Array1OfPnt2d& aPoly, const Bnd_Box2d& aBox, const Standard_Real aTol) -{ +{ Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); Standard_Integer RES = aClassifier2d.SiDans(myprojpt); if(RES==1) return Standard_True; - + return Standard_False; } //======================================================================= //function : Point -//purpose : +//purpose : //======================================================================= gp_Pnt Select3D_SensitivePoint::Point() const @@ -146,10 +143,10 @@ gp_Pnt Select3D_SensitivePoint::Point() const //======================================================================= //function : GetConnected -//purpose : +//purpose : //======================================================================= -Handle(Select3D_SensitiveEntity) Select3D_SensitivePoint::GetConnected(const TopLoc_Location& aLoc) +Handle(Select3D_SensitiveEntity) Select3D_SensitivePoint::GetConnected(const TopLoc_Location& aLoc) { Handle(Select3D_SensitivePoint) NiouEnt = new Select3D_SensitivePoint(myOwnerId,mypoint); if(HasLocation()) NiouEnt->SetLocation(Location()); @@ -159,7 +156,7 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitivePoint::GetConnected(const Top //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void Select3D_SensitivePoint::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const @@ -174,7 +171,7 @@ void Select3D_SensitivePoint::Dump(Standard_OStream& S,const Standard_Boolean Fu //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitivePoint::ComputeDepth(const gp_Lin& EyeLine) const diff --git a/src/Select3D/Select3D_SensitiveSegment.cxx b/src/Select3D/Select3D_SensitiveSegment.cxx index 0eebad52c6..9dfe33034b 100755 --- a/src/Select3D/Select3D_SensitiveSegment.cxx +++ b/src/Select3D/Select3D_SensitiveSegment.cxx @@ -43,7 +43,7 @@ //===================================================== Select3D_SensitiveSegment:: -Select3D_SensitiveSegment(const Handle(SelectBasics_EntityOwner)& OwnerId, +Select3D_SensitiveSegment(const Handle(SelectBasics_EntityOwner)& OwnerId, const gp_Pnt& FirstP, const gp_Pnt& LastP, const Standard_Integer MaxRect): @@ -65,15 +65,15 @@ void Select3D_SensitiveSegment Select3D_SensitiveEntity::Project(aProj); // to set the field last proj... gp_Pnt2d aPoint2dStart; gp_Pnt2d aPoint2dEnd; - - if(HasLocation()) + + if(HasLocation()) { gp_Pnt aStart(mystart.x, mystart.y, mystart.z); gp_Pnt aEnd(myend.x, myend.y, myend.z); aProj->Project(aStart.Transformed(Location().Transformation()),aPoint2dStart); aProj->Project(aEnd.Transformed(Location().Transformation()),aPoint2dEnd); } - else + else { aProj->Project(mystart,aPoint2dStart); aProj->Project(myend,aPoint2dEnd); @@ -83,7 +83,7 @@ void Select3D_SensitiveSegment } //===================================================== -// Function : Areas +// Function : Areas // Purpose : //===================================================== @@ -92,30 +92,30 @@ void Select3D_SensitiveSegment { // gp_Dir2d dy (0.,1.); gp_Pnt2d aPStart(myprojstart.x,myprojstart.y); - if(aPStart.Distance(myprojend)<=Precision::Confusion()) + if(aPStart.Distance(myprojend)<=Precision::Confusion()) { Bnd_Box2d curbox; curbox.Set(myprojstart); theareas.Append(curbox); } - else + else { gp_Vec2d MyVec(myprojstart,myprojend);//,VAxx(gp_Dir2d(0.,1.)); Standard_Real theangle = Abs(gp_Dir2d(0.,1.).Angle(gp_Vec2d(myprojstart,myprojend))); if(theangle>=M_PI/2.) theangle-=M_PI/2; if(theangle>=M_PI/12. && theangle <=5*M_PI/12.) - { - TColgp_Array1OfPnt2d BoxPoint (1,mymaxrect+1); + { + TColgp_Array1OfPnt2d BoxPoint (1,mymaxrect+1); BoxPoint (1) = myprojstart; - BoxPoint(mymaxrect+1)=myprojend; + BoxPoint(mymaxrect+1)=myprojend; gp_Vec2d Vtr = MyVec/mymaxrect; - Standard_Integer i; - for ( i=2;i<=mymaxrect;i++) - { - BoxPoint (i) = BoxPoint (i-1).Translated(Vtr); - } - for (i=2;i<=mymaxrect+1;i++) - { + Standard_Integer i; + for ( i=2;i<=mymaxrect;i++) + { + BoxPoint (i) = BoxPoint (i-1).Translated(Vtr); + } + for (i=2;i<=mymaxrect+1;i++) + { Bnd_Box2d curbox; curbox.Set(BoxPoint(i-1)); curbox.Add(BoxPoint(i)); @@ -123,10 +123,10 @@ void Select3D_SensitiveSegment } } else - { - Bnd_Box2d curbox; - curbox.Set(myprojstart); - curbox.Add(myprojend); + { + Bnd_Box2d curbox; + curbox.Set(myprojstart); + curbox.Add(myprojend); theareas.Append(curbox); } } @@ -171,19 +171,16 @@ Matches (const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveSegment:: Matches (const TColgp_Array1OfPnt2d& aPoly, const Bnd_Box2d& aBox, const Standard_Real aTol) -{ +{ Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); Standard_Integer RES = aClassifier2d.SiDans(myprojstart); @@ -198,13 +195,13 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, //======================================================================= //function : GetConnected -//purpose : +//purpose : //======================================================================= Handle(Select3D_SensitiveEntity) Select3D_SensitiveSegment:: -GetConnected(const TopLoc_Location& aLoc) +GetConnected(const TopLoc_Location& aLoc) { - Handle(Select3D_SensitiveSegment) NiouEnt = + Handle(Select3D_SensitiveSegment) NiouEnt = new Select3D_SensitiveSegment(myOwnerId,mystart,myend,mymaxrect); if(HasLocation()) NiouEnt->SetLocation(Location()); @@ -214,7 +211,7 @@ GetConnected(const TopLoc_Location& aLoc) //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void Select3D_SensitiveSegment::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const @@ -225,11 +222,11 @@ void Select3D_SensitiveSegment::Dump(Standard_OStream& S,const Standard_Boolean S<<"\t\t P1 [ "<<mystart.x<<" , "<<mystart.y <<" , "<<mystart.z <<" ]"<<endl; S<<"\t\t P2 [ "<<myend.x<<" , "<<myend.y <<" , "<<myend.z <<" ]"<<endl; S<<"\t\t maxrect ="<<mymaxrect<<endl; - + } //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitiveSegment::ComputeDepth(const gp_Lin& EyeLine) const diff --git a/src/Select3D/Select3D_SensitiveTriangle.cxx b/src/Select3D/Select3D_SensitiveTriangle.cxx index 0be130f440..b073b5c506 100755 --- a/src/Select3D/Select3D_SensitiveTriangle.cxx +++ b/src/Select3D/Select3D_SensitiveTriangle.cxx @@ -42,7 +42,7 @@ static Standard_Boolean S3D_Str_NearSegment (const gp_XY& p0, const gp_XY& p1, c gp_XY Vec(TheP); Vec -= p0; - + Standard_Real u = Vec*V01.Normalized(); if(u<-aTol) return Standard_False; Standard_Real u1 = u-aTol; @@ -80,9 +80,9 @@ mytype (aType) //================================================== Standard_Boolean Select3D_SensitiveTriangle:: -Matches(const Standard_Real X, - const Standard_Real Y, - const Standard_Real aTol, +Matches(const Standard_Real X, + const Standard_Real Y, + const Standard_Real aTol, Standard_Real& DMin) { Select3D_SensitiveEntity::Matches(X,Y,aTol,DMin); @@ -131,7 +131,7 @@ Matches (const Standard_Real XMin, //======================================================================= //function : Matches -//purpose : +//purpose : //======================================================================= Standard_Boolean Select3D_SensitiveTriangle:: @@ -141,9 +141,6 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, { Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); for(Standard_Integer anIndex=0;anIndex<=2;++anIndex) @@ -211,7 +208,7 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const Standard_Real X, //======================================================================= //function : Status -//purpose : +//purpose : //======================================================================= Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, @@ -225,7 +222,7 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, B.Update(p0.X(),p0.Y());B.Update(p1.X(),p1.Y());B.Update(p2.X(),p2.Y()); B.Enlarge(aTol); if(B.IsOut(TheP)) return 2; - + // the point is classified corresponding to demi-spaces limited // by each side of the triangle (with tolerance) gp_XY V01(p1);V01-=p0; @@ -235,9 +232,9 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, // check these particular cases... // if one of vectors is almost null (2 points are mixed), // leave at once (it is already in the bounding box, which is good...) - + DMin = aTol; - + if ( V01.SquareModulus() <= gp::Resolution() ) { Standard_Real LV = V02.SquareModulus(); @@ -246,7 +243,7 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, if ( S3D_Str_NearSegment (p0, p2, TheP, aTol, DMin) ) return 0; - return 2; + return 2; } if ( V02.SquareModulus() <= gp::Resolution() ) { @@ -268,16 +265,16 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, } // oriented normal to p0p1... - gp_Dir2d N (-V01.Y(), V01.X()); + gp_Dir2d N (-V01.Y(), V01.X()); Standard_Boolean Neg = (N * V02 < 0.); - if ( Neg ) + if ( Neg ) N.Reverse(); gp_XY Vec(TheP); Vec -= p0; - + Standard_Real aD1 = Vec * N.XY(); - if ( aD1 < -aTol ) + if ( aD1 < -aTol ) return 2; // oriented normal to p1p2... @@ -285,10 +282,10 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, N.SetCoord(p2.Y()-p1.Y(),p1.X()-p2.X()); else N.SetCoord(p1.Y()-p2.Y(),p2.X()-p1.X()); - + Vec.SetCoord(TheP.X()-p1.X(),TheP.Y()-p1.Y()); Standard_Real aD2 = Vec * N.XY(); - if ( aD2 < -aTol ) + if ( aD2 < -aTol ) return 2; // outside // oriented normal to p2p0... @@ -298,10 +295,10 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, N.SetCoord(p0.Y()-p2.Y(),p2.X()-p0.X()); else N.SetCoord(p2.Y()-p0.Y(),p0.X()-p2.X()); - + Vec.SetCoord(TheP.X()-p2.X(),TheP.Y()-p2.Y()); Standard_Real aD3 = Vec * N.XY(); - if ( aD3 < -aTol ) + if ( aD3 < -aTol ) return 2; // outside // compute 2d distance to triangle @@ -312,10 +309,10 @@ Standard_Integer Select3D_SensitiveTriangle::Status(const gp_XY& p0, //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= -void Select3D_SensitiveTriangle::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const +void Select3D_SensitiveTriangle::Dump(Standard_OStream& S,const Standard_Boolean FullDump) const { // general information.... @@ -331,7 +328,7 @@ void Select3D_SensitiveTriangle::Dump(Standard_OStream& S,const Standard_Boolean S<<"\t\t P1 [ "<<aPnt2.X()<<" , "<<aPnt2.Y()<<" , "<<aPnt2.Z()<<" ]"<<endl; S<<"\t\t P2 [ "<<aPnt3.X()<<" , "<<aPnt3.Y()<<" , "<<aPnt3.Z()<<" ]"<<endl; - if(FullDump) + if(FullDump) { S<<"\t\tProjected Points"<<endl; @@ -348,7 +345,7 @@ void Select3D_SensitiveTriangle::Dump(Standard_OStream& S,const Standard_Boolean //======================================================================= //function : ComputeDepth -//purpose : +//purpose : //======================================================================= Standard_Real Select3D_SensitiveTriangle::ComputeDepth(const gp_Lin& EyeLine) const @@ -361,34 +358,34 @@ Standard_Real Select3D_SensitiveTriangle::ComputeDepth(const gp_Lin& EyeLine) co P3 = mypolyg.Pnt(2); gp_Trsf TheTrsf ; - if(HasLocation()) + if(HasLocation()) TheTrsf = Location().Transformation(); - - if(TheTrsf.Form()!=gp_Identity) + + if(TheTrsf.Form()!=gp_Identity) { P1.Transform(TheTrsf); P2.Transform(TheTrsf); P3.Transform(TheTrsf); } - + // formula calculation of the point parameters on intersection // t = (P1P2 ^P1P3)* OP1 / ((P1P2^P1P3)*Dir) - + gp_Pnt Oye = EyeLine.Location(); // origin of the target line eye/point... gp_Dir Dir = EyeLine.Direction(); - + gp_Vec P1P2 (P1,P2), P1P3(P1,P3); P1P2.Normalize(); P1P3.Normalize(); - + gp_Vec oP1(Oye,P1); Standard_Real val1 = oP1.DotCross(P1P2,P1P3); Standard_Real val2 = Dir.DotCross(P1P2,P1P3); - + if(Abs(val2)>Precision::Confusion()) prof =val1/val2; - - if (prof==Precision::Infinite()) + + if (prof==Precision::Infinite()) { prof= ElCLib::Parameter(EyeLine,P1); prof = Min (prof, ElCLib::Parameter(EyeLine,P2)); @@ -403,16 +400,16 @@ Standard_Real Select3D_SensitiveTriangle::ComputeDepth(const gp_Lin& EyeLine) co //================================================== Handle(Select3D_SensitiveEntity) Select3D_SensitiveTriangle:: -GetConnected(const TopLoc_Location &theLocation) +GetConnected(const TopLoc_Location &theLocation) { - // Create a copy of this - Handle(Select3D_SensitiveEntity) aNewEntity = + // Create a copy of this + Handle(Select3D_SensitiveEntity) aNewEntity = new Select3D_SensitiveTriangle(myOwnerId, mypolyg.Pnt(0), mypolyg.Pnt(1), mypolyg.Pnt(2), mytype); - if (HasLocation()) - aNewEntity->SetLocation(Location()); + if (HasLocation()) + aNewEntity->SetLocation(Location()); aNewEntity->UpdateLocation(theLocation); return aNewEntity; -} \ No newline at end of file +} diff --git a/src/Select3D/Select3D_SensitiveTriangulation.cxx b/src/Select3D/Select3D_SensitiveTriangulation.cxx index 066d8e0d2b..84871f2eb2 100755 --- a/src/Select3D/Select3D_SensitiveTriangulation.cxx +++ b/src/Select3D/Select3D_SensitiveTriangulation.cxx @@ -113,10 +113,10 @@ static Standard_Boolean S3D_IsEdgeIn(const Standard_Integer e1, //======================================================================= Select3D_SensitiveTriangulation:: -Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId, - const Handle(Poly_Triangulation)& Trg, - const TopLoc_Location& Loc, - const Standard_Boolean InteriorFlag): +Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId, + const Handle(Poly_Triangulation)& Trg, + const TopLoc_Location& Loc, + const Standard_Boolean InteriorFlag): Select3D_SensitiveEntity(OwnerId), myTriangul(Trg), myiniloc(Loc), @@ -133,24 +133,24 @@ myDetectedTr(-1) Standard_Integer nbTriangles (myTriangul->NbTriangles()); gp_XYZ cdg(0,0,0); Standard_Integer n[3]; - + // to find connections in case when the border is not concerned... - if(!myIntFlag) + if(!myIntFlag) { myFreeEdges = new TColStd_HArray1OfInteger(1,2*S3D_NumberOfFreeEdges(Trg)); TColStd_Array1OfInteger& FreeE = myFreeEdges->ChangeArray1(); Poly_Connect pc(myTriangul); Standard_Integer t[3]; Standard_Integer i,j; - for ( i = 1; i <= nbTriangles; i++) + for ( i = 1; i <= nbTriangles; i++) { pc.Triangles(i,t[0],t[1],t[2]); triangles(i).Get(n[0],n[1],n[2]); cdg += (Nodes(n[0]).XYZ() + Nodes(n[1]).XYZ()+ Nodes(n[2]).XYZ())/3.; - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - Standard_Integer k = (j+1) % 3; - if (t[j] == 0) + Standard_Integer k = (j+1) % 3; + if (t[j] == 0) { FreeE(fr) = n[j]; FreeE(fr+1)= n[k]; @@ -160,7 +160,7 @@ myDetectedTr(-1) } } else{ - for (Standard_Integer i = 1; i <= nbTriangles; i++) + for (Standard_Integer i = 1; i <= nbTriangles; i++) { triangles(i).Get(n[0],n[1],n[2]); cdg += (Nodes(n[0]).XYZ() + Nodes(n[1]).XYZ()+ Nodes(n[2]).XYZ())/3.; @@ -183,11 +183,11 @@ myDetectedTr(-1) //======================================================================= Select3D_SensitiveTriangulation:: -Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId, - const Handle(Poly_Triangulation)& Trg, - const TopLoc_Location& Loc, - const Handle(TColStd_HArray1OfInteger)& FreeEdges, - const gp_Pnt& TheCDG, +Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId, + const Handle(Poly_Triangulation)& Trg, + const TopLoc_Location& Loc, + const Handle(TColStd_HArray1OfInteger)& FreeEdges, + const gp_Pnt& TheCDG, const Standard_Boolean InteriorFlag): Select3D_SensitiveEntity(OwnerId), myTriangul(Trg), @@ -242,7 +242,7 @@ void Select3D_SensitiveTriangulation::Areas(SelectBasics_ListOfBox2d& boxes) //purpose : //======================================================================= Standard_Boolean Select3D_SensitiveTriangulation:: -Matches(const Standard_Real X, +Matches(const Standard_Real X, const Standard_Real Y, const Standard_Real aTol, Standard_Real& DMin) @@ -295,9 +295,9 @@ Matches(const Standard_Real X, } } } - + // Case only Test on Border of the triangulation... - // + // else { //Standard_Integer ifirst; @@ -373,9 +373,6 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, { Standard_Real Umin,Vmin,Umax,Vmax; aBox.Get(Umin,Vmin,Umax,Vmax); - Standard_Real Tolu,Tolv; - Tolu = 1e-7; - Tolv = 1e-7; CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); for(Standard_Integer j=1;j<=myNodes2d.Length();j++) @@ -392,7 +389,7 @@ Matches (const TColgp_Array1OfPnt2d& aPoly, //======================================================================= Standard_Integer Select3D_SensitiveTriangulation:: -Status (const gp_XY& TheP, +Status (const gp_XY& TheP, const gp_XY& Proj0, const gp_XY& Proj1, const gp_XY& Proj2, @@ -420,17 +417,17 @@ Standard_Boolean Select3D_SensitiveTriangulation::IsFree(const Standard_Integer { if(FreeE(I) == n[0]) { - if(FreeE(I+1)== n[1] || FreeE(I+1)== n[2]) + if(FreeE(I+1)== n[1] || FreeE(I+1)== n[2]) FoundIndex=I; } else if(FreeE(I) == n[1]) { - if(FreeE(I+1)== n[0] || FreeE(I+1)== n[2]) + if(FreeE(I+1)== n[0] || FreeE(I+1)== n[2]) FoundIndex=I; } else if(FreeE(I) == n[2]) { - if(FreeE(I+1)== n[0] || FreeE(I+1)== n[1]) + if(FreeE(I+1)== n[0] || FreeE(I+1)== n[1]) FoundIndex=I; } } @@ -450,7 +447,7 @@ GetConnected(const TopLoc_Location& aLoc) Handle(Select3D_SensitiveTriangulation) NiouEnt = new Select3D_SensitiveTriangulation(myOwnerId,myTriangul,myiniloc,myFreeEdges,myCDG3D,myIntFlag); - if(HasLocation()) + if(HasLocation()) NiouEnt->SetLocation(Location()); // TopLoc_Location TheLocToApply = HasLocation() ? Location()*aLoc : aLoc; // if(!TheLocToApply.IsIdentity()) @@ -500,7 +497,7 @@ void Select3D_SensitiveTriangulation::Dump(Standard_OStream& S,const Standard_Bo S<<"\t\tNb Nodes : "<<myTriangul->NbNodes()<<endl; S<<"\t\tNb Free Edges: "<<myFreeEdges->Length()/2<<endl; - if(FullDump) + if(FullDump) { // S<<"\t\t\tOwner:"<<myOwnerId<<endl; Select3D_SensitiveEntity::DumpBox(S,mybox2d); @@ -529,7 +526,7 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin P[i].Transform(myTrsf); } } - + // formula calculate the parameter of the point on the intersection // t = (P1P2 ^P1P3)* OP1 / ((P1P2^P1P3)*Dir) Standard_Real prof(Precision::Infinite()); @@ -540,7 +537,7 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin for(Standard_Integer i=0;i<=2;i++) Vtr[i] = gp_Vec(P[i%3],P[(i+1)%3]); Vtr[2] = -Vtr[2]; - + // remove singular cases immediately... Standard_Integer SingularCase(-1); if(Vtr[0].SquareMagnitude()<= Precision::Confusion()) @@ -551,9 +548,9 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin if(Vtr[2].SquareMagnitude()<= Precision::Confusion()) if( SingularCase < 0 ) SingularCase = 1; #endif - + // 3 pts mixed... - if(SingularCase ==2) + if(SingularCase ==2) { prof= ElCLib::Parameter(EyeLine,P[0]); return prof; @@ -566,8 +563,8 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin Vtr[2].Normalize(); gp_Vec OPo(Oye,P[0]); // 2 points mixed... the intersection between the segment and the target line eye/point. - // - if(SingularCase!=-1) + // + if(SingularCase!=-1) { gp_Vec V = SingularCase==0 ? Vtr[2] : Vtr[0]; gp_Vec Det = Dir^V; @@ -579,7 +576,7 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin else if(Det.Z()> Precision::Confusion()) prof = VSM.Z()/Det.Z(); } - else + else { Standard_Real val1 = OPo.DotCross(Vtr[0],Vtr[2]); Standard_Real val2 = Dir.DotCross(Vtr[0],Vtr[2]); @@ -587,7 +584,7 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin if(Abs(val2)>Precision::Confusion()) prof =val1/val2; } - if (prof==Precision::Infinite()) + if (prof==Precision::Infinite()) { prof= ElCLib::Parameter(EyeLine,P[0]); prof = Min (prof, ElCLib::Parameter(EyeLine,P[1])); @@ -603,8 +600,8 @@ Standard_Real Select3D_SensitiveTriangulation::ComputeDepth(const gp_Lin& EyeLin //======================================================================= Standard_Boolean Select3D_SensitiveTriangulation:: -DetectedTriangle(gp_Pnt& P1, - gp_Pnt& P2, +DetectedTriangle(gp_Pnt& P1, + gp_Pnt& P2, gp_Pnt& P3) const { if(myDetectedTr==-1) return Standard_False; // currently not implemented... @@ -616,7 +613,7 @@ DetectedTriangle(gp_Pnt& P1, P1 = Nodes(n1); P2 = Nodes(n2); P3 = Nodes(n3); - if(myTrsf.Form()!=gp_Identity) + if(myTrsf.Form()!=gp_Identity) { P1.Transform(myTrsf); P2.Transform(myTrsf); @@ -632,11 +629,11 @@ DetectedTriangle(gp_Pnt& P1, //============================================================================= Standard_Boolean Select3D_SensitiveTriangulation:: -DetectedTriangle2d(gp_Pnt2d& P1, - gp_Pnt2d& P2, +DetectedTriangle2d(gp_Pnt2d& P1, + gp_Pnt2d& P2, gp_Pnt2d& P3) const { - if(myDetectedTr==-1) + if(myDetectedTr==-1) return Standard_False; // currently not implemented... const Poly_Array1OfTriangle& triangles = myTriangul->Triangles(); Standard_Integer n1,n2,n3; @@ -670,14 +667,14 @@ void Select3D_SensitiveTriangulation::ComputeTotalTrsf() { if(myiniloc.IsIdentity()) myTrsf = Location().Transformation(); - else if(HasLocation()) + else if(HasLocation()) { myTrsf = (Location()*myiniloc).Transformation(); } else myTrsf = myiniloc.Transformation(); } - else + else { gp_Trsf TheId; myTrsf = TheId;