mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-07 01:20:48 +05:00
PAL8395: Improve CheckCompoundOfBlocks and RemoveExtraEdges. Improvement done by SKL.
This commit is contained in:
parent
5767b14e0b
commit
aa5ce1d37f
@ -38,6 +38,7 @@ fields
|
|||||||
myNbSolids : Integer;
|
myNbSolids : Integer;
|
||||||
myNbBlocks : Integer;
|
myNbBlocks : Integer;
|
||||||
myPossibleBlocks : SequenceOfShape from TopTools;
|
myPossibleBlocks : SequenceOfShape from TopTools;
|
||||||
|
myNbDegen : Integer;
|
||||||
myNbUF : Integer;
|
myNbUF : Integer;
|
||||||
myNbUE : Integer;
|
myNbUE : Integer;
|
||||||
myNbUFUE : Integer;
|
myNbUFUE : Integer;
|
||||||
|
@ -54,6 +54,7 @@ void BlockFix_CheckTool::Perform()
|
|||||||
{
|
{
|
||||||
myNbSolids=0;
|
myNbSolids=0;
|
||||||
myNbBlocks=0;
|
myNbBlocks=0;
|
||||||
|
myNbDegen=0;
|
||||||
myNbUF=0;
|
myNbUF=0;
|
||||||
myNbUE=0;
|
myNbUE=0;
|
||||||
myNbUFUE=0;
|
myNbUFUE=0;
|
||||||
@ -108,13 +109,29 @@ void BlockFix_CheckTool::Perform()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer ne=0;
|
Standard_Integer nbe=0;
|
||||||
|
TopTools_MapOfShape DegenEdges;
|
||||||
TopExp_Explorer expe;
|
TopExp_Explorer expe;
|
||||||
for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) ne++;
|
for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) {
|
||||||
ne = ne/2;
|
TopoDS_Edge E = TopoDS::Edge(expe.Current());
|
||||||
if(ne<12)
|
if(BRep_Tool::Degenerated(E)) {
|
||||||
|
if(!DegenEdges.Contains(E)) {
|
||||||
|
DegenEdges.Add(E);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nbe++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( nbe==24 && DegenEdges.Extent()>0 ) {
|
||||||
IsBlock=Standard_False;
|
IsBlock=Standard_False;
|
||||||
if(ne>12) {
|
myNbDegen++;
|
||||||
|
myPossibleBlocks.Append(aSolid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(nbe<24)
|
||||||
|
IsBlock=Standard_False;
|
||||||
|
if(nbe>24) {
|
||||||
IsBlock=Standard_False;
|
IsBlock=Standard_False;
|
||||||
// check edges unification
|
// check edges unification
|
||||||
// creating map of edge faces
|
// creating map of edge faces
|
||||||
@ -214,11 +231,11 @@ void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
|
|||||||
S<<" total number of solids = "<<myNbSolids<<endl;
|
S<<" total number of solids = "<<myNbSolids<<endl;
|
||||||
S<<" including: number of good blocks = "<<myNbBlocks<<endl;
|
S<<" including: number of good blocks = "<<myNbBlocks<<endl;
|
||||||
S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
|
S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
|
||||||
Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
|
S<<" including: need remove degenerative = "<<myNbDegen<<endl;
|
||||||
S<<" number of impossible blocks = "<<nbtmp<<endl;
|
S<<" need unionfaces = "<<myNbUF<<endl;
|
||||||
S<<" including: need unionfaces = "<<myNbUF<<endl;
|
|
||||||
S<<" need unionedges = "<<myNbUE<<endl;
|
S<<" need unionedges = "<<myNbUE<<endl;
|
||||||
S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
|
S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
|
||||||
|
Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
|
||||||
|
S<<" number of impossible blocks = "<<nbtmp<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ Standard_Boolean myHasCheck;
|
|||||||
Standard_Integer myNbSolids;
|
Standard_Integer myNbSolids;
|
||||||
Standard_Integer myNbBlocks;
|
Standard_Integer myNbBlocks;
|
||||||
TopTools_SequenceOfShape myPossibleBlocks;
|
TopTools_SequenceOfShape myPossibleBlocks;
|
||||||
|
Standard_Integer myNbDegen;
|
||||||
Standard_Integer myNbUF;
|
Standard_Integer myNbUF;
|
||||||
Standard_Integer myNbUE;
|
Standard_Integer myNbUE;
|
||||||
Standard_Integer myNbUFUE;
|
Standard_Integer myNbUFUE;
|
||||||
|
@ -65,16 +65,35 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
|
|||||||
ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
|
ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
|
||||||
Standard_Real PI2 = PI/2.;
|
Standard_Real PI2 = PI/2.;
|
||||||
if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
|
if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
|
||||||
if(Abs(Vmax-Vmin) < PI2) {
|
|
||||||
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
|
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
|
||||||
gp_Sphere sp = aSphere->Sphere();
|
gp_Sphere sp = aSphere->Sphere();
|
||||||
gp_Ax3 ax3 = sp.Position();
|
gp_Ax3 ax3 = sp.Position();
|
||||||
|
if(Abs(Vmax-Vmin) < PI2) {
|
||||||
gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
|
gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
|
||||||
sp.SetPosition(axnew3);
|
sp.SetPosition(axnew3);
|
||||||
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
|
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
|
||||||
aNewSurface = aNewSphere;
|
aNewSurface = aNewSphere;
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
gp_Pnt PC = ax3.Location();
|
||||||
|
Standard_Real Vpar;
|
||||||
|
if(fabs(PI2-Vmax)>fabs(-PI2-Vmin))
|
||||||
|
Vpar = (PI2+Vmax)/2.;
|
||||||
|
else
|
||||||
|
Vpar = (-PI2+Vmin)/2.;
|
||||||
|
Standard_Real Upar = (Umin+Umax)/2.;;
|
||||||
|
gp_Pnt PN,PX;
|
||||||
|
S->D0(Upar,Vpar,PN);
|
||||||
|
S->D0(Upar+PI2,0.,PX);
|
||||||
|
gp_Dir newNorm(gp_Vec(PC,PN));
|
||||||
|
gp_Dir newDirX(gp_Vec(PC,PX));
|
||||||
|
gp_Ax3 axnew3(ax3.Axis().Location(), newNorm, newDirX);
|
||||||
|
sp.SetPosition(axnew3);
|
||||||
|
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
|
||||||
|
aNewSurface = aNewSphere;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@ -221,4 +240,3 @@ GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,cons
|
|||||||
{
|
{
|
||||||
return BRep_Tool::Continuity(E,F1,F2);
|
return BRep_Tool::Continuity(E,F1,F2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user