1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00

0023511: The function BRepTools::UVBounds provides icorrect result for a face

Range of changing of some analytic curves is computed by other methods. It allows computing face's boundaries with more precise.
Tolerance was increased to provide successful work of some algorithms.
Functions BRepOffsetAPI_MiddlePath::Build() and ApproxWithPCurves(...) (file IntTools_FaceFace.cxx) were changed according to new result of algorithm's work.
It is possibly for "outboundaried faces" (see bug#23675) to compute incorrect UV-Bounds, when first parameter is more than last. To avoid it, extended control of computed bounds was added.
Function for fail sameparameter fixing was added to HLRAppli_ReflectLines to avoid creation bad shapes after algorithm's work.

In file ShapeFix_ComposeShell.cxx only text formatting was changed.

Some test cases are changed according to their new behavior.
Added test case bugs/moddata_3/bug23511
This commit is contained in:
nbv 2014-05-19 11:57:24 +04:00 committed by apn
parent 0734c53d68
commit 59495dbe8a
34 changed files with 3055 additions and 2215 deletions

View File

@ -1843,11 +1843,16 @@ Standard_Boolean FindPointInFace(const TopoDS_Edge& aE,
GeomAPI_ProjectPointOnSurf& aProjPL)
{
Standard_Integer aNbItMax;
Standard_Real aDt, aDtMin, aTolE, aTolF, aDist;
Standard_Real aDt, aDtMin, aTolE, aTolF, aDist, aDTol, aPM;
Standard_Boolean bRet;
gp_Pnt aP1;
BRepAdaptor_Surface aBAS;
//
aDTol = Precision::Angular();
aPM = aP.XYZ().Modulus();
if (aPM > 1000.) {
aDTol = 5.e-16 * aPM;
}
bRet = Standard_False;
aTolE = BRep_Tool::Tolerance(aE);
aTolF = BRep_Tool::Tolerance(aF);
@ -1910,9 +1915,9 @@ Standard_Boolean FindPointInFace(const TopoDS_Edge& aE,
//
gp_Vec aV(aP, aPOut);
aDB.SetXYZ(aV.XYZ());
} while (aDist>Precision::Angular() && --aNbItMax);
} while (aDist > aDTol && --aNbItMax);
//
bRet = aDist < Precision::Angular();
bRet = aDist < aDTol;
return bRet;
}
//=======================================================================

View File

@ -533,6 +533,32 @@ void BRepOffsetAPI_MiddlePath::Build()
if (myPaths((j<=NbPaths)? j : 1)(i).ShapeType() == TopAbs_EDGE)
E2 = TopoDS::Edge(myPaths((j<=NbPaths)? j : 1)(i));
TopoDS_Edge E12 = TopoDS::Edge(SectionsEdges(i)(j-1));
//Find the face on which (E1 or E2) and E12 lie
TopoDS_Shape E1orE2 = (E1.IsNull())? E2 : E1;
if (E1orE2.IsNull()) //both E1 and E2 are vertices =>
{
EdgeSeq(j-1) = E12; // => proper edge is the edge of previous section between them
continue;
}
const TopTools_ListOfShape& LF = EFmap.FindFromKey(E1orE2);
TopoDS_Face theFace;
for (itl.Initialize(LF); itl.More(); itl.Next())
{
const TopoDS_Shape& aFace = itl.Value();
const TopTools_ListOfShape& LF2 = EFmap.FindFromKey(E12);
TopTools_ListIteratorOfListOfShape itl2(LF2);
for (; itl2.More(); itl2.Next())
{
const TopoDS_Shape& aFace2 = itl2.Value();
if (aFace.IsSame(aFace2))
{
theFace = TopoDS::Face(aFace);
break;
}
}
if (!theFace.IsNull())
break;
}
TopoDS_Vertex PrevVertex = (E1.IsNull())? TopoDS::Vertex(myPaths(j-1)(i))
: TopExp::LastVertex(E1, Standard_True);
@ -541,14 +567,19 @@ void BRepOffsetAPI_MiddlePath::Build()
TopoDS_Edge ProperEdge;
const TopTools_ListOfShape& LE = VEmap.FindFromKey(PrevVertex);
//Temporary
//Standard_Integer LenList = LE.Extent();
///////////
TopTools_IndexedMapOfShape EdgesOfTheFace;
TopExp::MapShapes(theFace, TopAbs_EDGE, EdgesOfTheFace);
for (itl.Initialize(LE); itl.More(); itl.Next())
{
anEdge = TopoDS::Edge(itl.Value());
TopExp::Vertices(anEdge, V1, V2);
if (((V1.IsSame(PrevVertex) && V2.IsSame(CurVertex)) ||
(V1.IsSame(CurVertex) && V2.IsSame(PrevVertex))) &&
!anEdge.IsSame(E1))
EdgesOfTheFace.Contains(anEdge) && //this condition is for a section of two edges
!anEdge.IsSame(E1)) //the last condition is for torus-like shape
{
ProperEdge = anEdge;
break;
@ -570,35 +601,6 @@ void BRepOffsetAPI_MiddlePath::Build()
{
//Find the face on which E1, E2 and E12 lie
//ToInsertVertex = Standard_False;
const TopoDS_Shape& EE1 = (E1.IsNull())?
myPaths(j-1)(i-1) : E1;
const TopoDS_Shape& EE2 = (E2.IsNull())?
myPaths((j<=NbPaths)? j : 1)(i-1) : E2;
const TopTools_ListOfShape& LF = EFmap.FindFromKey(EE1);
TopoDS_Face theFace;
for (itl.Initialize(LF); itl.More(); itl.Next())
{
const TopoDS_Shape& aFace = itl.Value();
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
if (EE2.IsSame(Explo.Current()))
{
const TopTools_ListOfShape& LFsec = EFmap.FindFromKey(E12);
TopTools_ListIteratorOfListOfShape itlsec(LFsec);
for (; itlsec.More(); itlsec.Next())
if (aFace.IsSame(itlsec.Value()))
{
theFace = TopoDS::Face(aFace);
break;
}
if (!theFace.IsNull())
break;
}
}
if (!theFace.IsNull())
break;
}
TopTools_ListOfShape ListOneFace;
ListOneFace.Append(theFace);

View File

@ -49,6 +49,7 @@
#include <gp_Vec2d.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <errno.h>
@ -132,7 +133,6 @@ void BRepTools::AddUVBounds(const TopoDS_Face& FF, Bnd_Box2d& B)
//function : AddUVBounds
//purpose :
//=======================================================================
void BRepTools::AddUVBounds(const TopoDS_Face& F,
const TopoDS_Wire& W,
Bnd_Box2d& B)
@ -148,117 +148,62 @@ void BRepTools::AddUVBounds(const TopoDS_Face& F,
//function : AddUVBounds
//purpose :
//=======================================================================
void BRepTools::AddUVBounds(const TopoDS_Face& F,
const TopoDS_Edge& E,
Bnd_Box2d& B)
void BRepTools::AddUVBounds(const TopoDS_Face& aF,
const TopoDS_Edge& aE,
Bnd_Box2d& aB)
{
Standard_Real pf,pl;
Bnd_Box2d Baux;
const Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(E,F,pf,pl);
if (C.IsNull()) return;
if (pl < pf) { // Petit Blindage
Standard_Real aux;
aux = pf; pf = pl; pl = aux;
Standard_Real aT1, aT2, aXmin, aYmin, aXmax, aYmax;
Standard_Real aUmin, aUmax, aVmin, aVmax;
Bnd_Box2d aBoxC, aBoxS;
TopLoc_Location aLoc;
//
const Handle(Geom2d_Curve) aC2D = BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
if (aC2D.IsNull()) {
return;
}
Geom2dAdaptor_Curve PC(C,pf,pl);
if (Precision::IsNegativeInfinite(pf) ||
Precision::IsPositiveInfinite(pf)) {
Geom2dAdaptor_Curve GC(PC);
BndLib_Add2dCurve::Add(GC,0.,B);
}
else {
//
BndLib_Add2dCurve::Add(aC2D, aT1, aT2, 0., aBoxC);
aBoxC.Get(aXmin, aYmin, aXmax, aYmax);
//
Handle(Geom_Surface) aS = BRep_Tool::Surface(aF, aLoc);
aS->Bounds(aUmin, aUmax, aVmin, aVmax);
// just compute points to get a close box.
TopLoc_Location L;
Standard_Real Umin,Umax,Vmin,Vmax;
const Handle(Geom_Surface)& Surf=BRep_Tool::Surface(F,L);
Surf->Bounds(Umin,Umax,Vmin,Vmax);
gp_Pnt2d Pa,Pb,Pc;
Standard_Integer i, j, k, nbp = 20;
if (PC.GetType() == GeomAbs_Line) nbp = 2;
Standard_Integer NbIntC1 = PC.NbIntervals(GeomAbs_C1);
if (NbIntC1 > 1)
nbp = 10;
TColStd_Array1OfReal SharpPoints(1, NbIntC1+1);
PC.Intervals(SharpPoints, GeomAbs_C1);
TColStd_Array1OfReal Parameters(1, nbp*NbIntC1+1);
k = 1;
for (i = 1; i <= NbIntC1; i++)
if(aS->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface))
{
Standard_Real delta = (SharpPoints(i+1) - SharpPoints(i))/nbp;
for (j = 0; j < nbp; j++)
Parameters(k++) = SharpPoints(i) + j*delta;
const Handle(Geom_RectangularTrimmedSurface) aSt =
Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
aS = aSt->BasisSurface();
}
Parameters(nbp*NbIntC1+1) = SharpPoints(NbIntC1+1);
gp_Pnt2d P;
PC.D0(pf,P);
Baux.Add(P);
Standard_Real du=0.0;
Standard_Real dv=0.0;
Pc=P;
for (i = 2; i < Parameters.Upper(); i++) {
pf = Parameters(i);
PC.D0(pf,P);
Baux.Add(P);
if(i==2) { Pb=Pc; Pc=P; }
else {
//-- Calcul de la fleche
Pa=Pb; Pb=Pc; Pc=P;
gp_Vec2d PaPc(Pa,Pc);
// gp_Lin2d L2d(Pa,PaPc);
// Standard_Real up = ElCLib::Parameter(L2d,Pb);
// gp_Pnt2d PProj = ElCLib::Value(up,L2d);
gp_Pnt2d PProj(Pa.Coord()+(PaPc.XY()/2.));
Standard_Real ddu=Abs(Pb.X()-PProj.X());
Standard_Real ddv=Abs(Pb.Y()-PProj.Y());
if(ddv>dv) dv=ddv;
if(ddu>du) du=ddu;
//
if(!aS->IsUPeriodic())
{
if((aXmin<aUmin) && (aUmin < aXmax))
{
aXmin=aUmin;
}
if((aXmin < aUmax) && (aUmax < aXmax))
{
aXmax=aUmax;
}
}
PC.D0(pl,P);
Baux.Add(P);
//-- cout<<" du="<<du<<" dv="<<dv<<endl;
Standard_Real u0,u1,v0,v1;
Baux.Get(u0,v0,u1,v1);
du*=1.5;
dv*=1.5;
u0-=du; v0-=dv; u1+=du; v1+=dv;
if(Surf->IsUPeriodic()) { }
else {
if(u0<=Umin) { u0=Umin; }
if(u1>=Umax) { u1=Umax; }
if(!aS->IsVPeriodic())
{
if((aYmin<aVmin) && (aVmin < aYmax))
{
aYmin=aVmin;
}
if(Surf->IsVPeriodic()) { }
else {
if(v0<=Vmin) { v0=Vmin; }
if(v1>=Vmax) { v1=Vmax; }
}
P.SetCoord(u0,v0) ; Baux.Add(P);
P.SetCoord(u1,v1) ; Baux.Add(P);
Bnd_Box2d FinalBox;
Standard_Real aXmin, aYmin, aXmax, aYmax;
Baux.Get(aXmin, aYmin, aXmax, aYmax);
Standard_Real Tol2d = Precision::PConfusion();
if (Abs(aXmin - Umin) <= Tol2d)
aXmin = Umin;
if (Abs(aYmin - Vmin) <= Tol2d)
aYmin = Vmin;
if (Abs(aXmax - Umax) <= Tol2d)
aXmax = Umax;
if (Abs(aYmax - Vmax) <= Tol2d)
aYmax = Vmax;
FinalBox.Update(aXmin, aYmin, aXmax, aYmax);
B.Add(FinalBox);
if((aYmin < aVmax) && (aVmax < aYmax))
{
aYmax=aVmax;
}
}
aBoxS.Update(aXmin, aYmin, aXmax, aYmax);
aB.Add(aBoxS);
}
//=======================================================================

View File

@ -20,7 +20,8 @@ class Add2dCurve from BndLib
-- The 2D curve is defined from a Geom2d curve.
uses Box2d from Bnd,
Curve2d from Adaptor2d
Curve2d from Adaptor2d,
Curve from Geom2d
is
@ -89,5 +90,33 @@ is
-- and P1 and P2 are either two negative infinite real
-- numbers, or two positive infinite real numbers.
Add(myclass;
C : Curve from Geom2d;
Tol: Real from Standard;
Box: out Box2d from Bnd);
---Purpose: Adds to the bounding box B the curve C
-- B is then enlarged by the tolerance value Tol.
-- Note: depending on the type of curve, one of the following
-- representations of the curve C is used to include it in the bounding box B:
-- - an exact representation if C is built from a line, a circle or a conic curve,
-- - the poles of the curve if C is built from a Bezier curve or a BSpline curve,
-- - if not, the points of an approximation of the curve C.
Add(myclass;
C : Curve from Geom2d;
U1 : Real from Standard;
U2 : Real from Standard;
Tol: Real from Standard;
B: out Box2d from Bnd);
---Purpose: Adds to the bounding box B the part of curve C
-- B is then enlarged by the tolerance value Tol.
-- U1, U2 - the parametric range to comute the bounding box;
-- Note: depending on the type of curve, one of the following
-- representations of the curve C is used to include it in the bounding box B:
-- - an exact representation if C is built from a line, a circle or a conic curve,
-- - the poles of the curve if C is built from a Bezier curve or a BSpline curve,
-- - if not, the points of an approximation of the curve C.
end Add2dCurve;

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@
#include <HLRBRep_HLRToShape.hxx>
#include <BRep_Builder.hxx>
#include <gp_Ax3.hxx>
#include <BRepLib.hxx>
//=======================================================================
//function : HLRAppli_ReflectLines
@ -76,6 +78,8 @@ void HLRAppli_ReflectLines::Perform()
HLRBRep_HLRToShape aHLRToShape( aHLRAlgo );
myCompound = aHLRToShape.OutLineVCompound3d();
BRepLib::SameParameter(myCompound,Precision::PConfusion(),Standard_False);
}
//=======================================================================

View File

@ -516,7 +516,7 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
//function : Perform
//purpose : intersect surfaces of the faces
//=======================================================================
void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
const TopoDS_Face& aF2)
{
Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False;
@ -1144,7 +1144,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
//
if (aC3D.IsNull()) {
continue;
}
}
const Handle(Geom_BSplineCurve)& aBC=
Handle(Geom_BSplineCurve)::DownCast(aC3D);
if (aBC.IsNull()) {
@ -1195,7 +1195,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
//
bPCurvesOk = Standard_True;
reapprox:;
reapprox:;
Tolpc = myTolApprox;
bAvoidLineConstructor = Standard_False;
@ -1525,7 +1525,7 @@ reapprox:;
// on regarde si on garde
//
if (aNbParts==1) {
// if (Abs(fprm) < RealEpsilon() && Abs(lprm-2.*M_PI) < RealEpsilon()) {
// if (Abs(fprm) < RealEpsilon() && Abs(lprm-2.*M_PI) < RealEpsilon()) {
if (Abs(fprm) <= aRealEpsilon && Abs(lprm-2.*M_PI) <= aRealEpsilon) {
IntTools_Curve aCurve;
Handle(Geom_TrimmedCurve) aTC3D=new Geom_TrimmedCurve(newc,fprm,lprm);
@ -1811,7 +1811,7 @@ reapprox:;
}// case IntPatch_Analytic:
break;
case IntPatch_Walking: {
case IntPatch_Walking:{
Handle(IntPatch_WLine) WL =
Handle(IntPatch_WLine)::DownCast(L);
//
@ -2339,20 +2339,23 @@ reapprox:;
Standard_Real umin,umax,vmin,vmax;
//
if (C2d.IsNull()) {
if (C2d.IsNull())
{
// in class ProjLib_Function the range of parameters is shrank by 1.e-09
if((l - f) > 2.e-09) {
if((l - f) > 2.e-09)
{
C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
//
if (C2d.IsNull()) {
// proj. a circle that goes through the pole on a sphere to the sphere
Tol=Tol+1.e-7;
Tol += Precision::Confusion();
C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
}
}
else {
if((l - f) > Epsilon(Abs(f))) {
else
{
if((l - f) > Epsilon(Abs(f)))
{
GeomAPI_ProjectPointOnSurf aProjector1, aProjector2;
gp_Pnt P1 = C->Value(f);
gp_Pnt P2 = C->Value(l);
@ -2398,7 +2401,8 @@ reapprox:;
//
S->Bounds(umin, umax, vmin, vmax);
if (S->IsUPeriodic() && !C2d.IsNull()) {
if (S->IsUPeriodic() && !C2d.IsNull())
{
// Recadre dans le domaine UV de la face
Standard_Real period, U0, du, aEps;
@ -2411,7 +2415,7 @@ reapprox:;
gp_Pnt2d Pl = C2d->Value(l);
U0 = Min(Pl.X(), U0);
// while(U0-umin<aEps) {
// while(U0-umin<aEps) {
while(U0-umin<-aEps) {
U0+=period;
du+=period;
@ -2621,7 +2625,7 @@ Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine
//function : CorrectSurfaceBoundaries
//purpose :
//=======================================================================
void CorrectSurfaceBoundaries(const TopoDS_Face& theFace,
void CorrectSurfaceBoundaries(const TopoDS_Face& theFace,
const Standard_Real theTolerance,
Standard_Real& theumin,
Standard_Real& theumax,
@ -4445,9 +4449,38 @@ Standard_Boolean ApproxWithPCurves(const gp_Cylinder& theCyl,
{
Standard_Boolean bRes = Standard_True;
Standard_Real R1 = theCyl.Radius(), R2 = theSph.Radius();
//
{
Standard_Real aD2, aRc2, aEps;
gp_Pnt aApexSph;
//
aEps=1.E-7;
aRc2=R1*R1;
//
const gp_Ax3& aAx3Sph=theSph.Position();
const gp_Pnt& aLocSph=aAx3Sph.Location();
const gp_Dir& aDirSph=aAx3Sph.Direction();
//
const gp_Ax1& aAx1Cyl=theCyl.Axis();
gp_Lin aLinCyl(aAx1Cyl);
//
aApexSph.SetXYZ(aLocSph.XYZ()+R2*aDirSph.XYZ());
aD2=aLinCyl.SquareDistance(aApexSph);
if (fabs(aD2-aRc2)<aEps) {
return !bRes;
}
//
aApexSph.SetXYZ(aLocSph.XYZ()-R2*aDirSph.XYZ());
aD2=aLinCyl.SquareDistance(aApexSph);
if (fabs(aD2-aRc2)<aEps) {
return !bRes;
}
}
//
if(R1 < 2.*R2) return bRes;
if(R1 < 2.*R2) {
return bRes;
}
gp_Lin anCylAx(theCyl.Axis());
Standard_Real aDist = anCylAx.Distance(theSph.Location());
@ -5037,7 +5070,7 @@ Standard_Real MaxSquareDistance (const Standard_Real aT,
//function : CheckPCurve
//purpose : Checks if points of the pcurve are out of the face bounds.
//=======================================================================
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
const TopoDS_Face& aFace)
{
const Standard_Integer NPoints = 23;
@ -5102,7 +5135,7 @@ Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
vmin-v > tolV || v-vmax > tolV) {
return bRet;
}
}
}
}
return !bRet;
}

View File

@ -138,7 +138,7 @@ void ProjLib_Sphere::Project(const gp_Circ& C)
Zs = mySphere.Position().Direction();
Standard_Boolean isIsoU, isIsoV;
Standard_Real Tol = 1.e-8;
Standard_Real Tol = Precision::Confusion();
isIsoU = Zc.IsNormal(Zs,Tol) && O.IsEqual(C.Location(),Tol);
isIsoV = Xc.IsNormal(Zs,Tol) && Yc.IsNormal(Zs,Tol);

View File

@ -460,67 +460,74 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con
seqw.Clear();
// Init seqw by initial set of wires (with corresponding orientation)
for ( TopoDS_Iterator iw(myFace,Standard_False); iw.More(); iw.Next() ) {
//smh#8
for ( TopoDS_Iterator iw(myFace,Standard_False); iw.More(); iw.Next() )
{
TopoDS_Shape tmpW = Context()->Apply ( iw.Value() ) ;
if(tmpW.ShapeType() != TopAbs_WIRE) {
if(tmpW.ShapeType() == TopAbs_VERTEX) {
if(tmpW.ShapeType() != TopAbs_WIRE)
{
if(tmpW.ShapeType() == TopAbs_VERTEX)
{
ShapeFix_WireSegment seg; //(( isOuter ? TopAbs_REVERSED : TopAbs_FORWARD ) );
seg.SetVertex(TopoDS::Vertex(tmpW));
seg.Orientation(tmpW.Orientation());
seqw.Append ( seg );
}
continue;
}
TopoDS_Wire wire = TopoDS::Wire ( tmpW );
Standard_Boolean isNonManifold = ( wire.Orientation() != TopAbs_REVERSED &&
wire.Orientation() != TopAbs_FORWARD );
// protect against INTERNAL/EXTERNAL wires
// if ( wire.Orientation() != TopAbs_REVERSED &&
// wire.Orientation() != TopAbs_FORWARD ) continue;
// if ( wire.Orientation() != TopAbs_REVERSED &&
// wire.Orientation() != TopAbs_FORWARD ) continue;
// determine orientation of the wire
// TopoDS_Face face = TopoDS::Face ( myFace.EmptyCopied() );
// B.Add ( face, wire );
// Standard_Boolean isOuter = ShapeAnalysis::IsOuterBound ( face );
if(isNonManifold) {
// TopoDS_Face face = TopoDS::Face ( myFace.EmptyCopied() );
// B.Add ( face, wire );
// Standard_Boolean isOuter = ShapeAnalysis::IsOuterBound ( face );
if(isNonManifold)
{
Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData ( wire ,Standard_True,Standard_False);
//pdn protection againts of wires w/o edges
Standard_Integer nbEdges = sbwd->NbEdges();
if(nbEdges) {
if(nbEdges)
{
//wire segments for non-manifold topology should have INTERNAL orientation
ShapeFix_WireSegment seg ( sbwd, TopAbs_INTERNAL);
seqw.Append ( seg );
}
}
else {
else
{
//splitting wires containing manifold and non-manifold parts on a separate
//wire segment
Handle(ShapeExtend_WireData) sbwdM = new ShapeExtend_WireData();
Handle(ShapeExtend_WireData) sbwdNM = new ShapeExtend_WireData();
sbwdNM->ManifoldMode() = Standard_False;
TopoDS_Iterator aIt(wire);
for( ; aIt.More(); aIt.Next()) {
for( ; aIt.More(); aIt.Next())
{
TopoDS_Edge E = TopoDS::Edge ( aIt.Value() );
if(E.Orientation() == TopAbs_FORWARD || E.Orientation() == TopAbs_REVERSED)
sbwdM->Add(E);
else
sbwdNM->Add(E);
}
Standard_Integer nbMEdges = sbwdM->NbEdges();
Standard_Integer nbNMEdges = sbwdNM->NbEdges();
if(nbNMEdges) {
if(nbNMEdges)
{
ShapeFix_WireSegment seg ( sbwdNM, TopAbs_INTERNAL); //(( isOuter ? TopAbs_REVERSED : TopAbs_FORWARD ) );
seqw.Append ( seg );
}
if(nbMEdges) {
// Orientation is set so as to allow the segment to be traversed in only one direction
// skl 01.04.2002
@ -528,7 +535,8 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con
sfw->Load ( sbwdM );
Standard_Integer stat=0;
Handle(Geom_Surface) gs = BRep_Tool::Surface(myFace);
if( gs->IsUPeriodic() && gs->IsVPeriodic() ) {
if( gs->IsUPeriodic() && gs->IsVPeriodic() )
{
// For torus-like shapes, first reorder in 2d since reorder is indifferent in 3d
ShapeAnalysis_WireOrder sawo(Standard_False, 0);
ShapeAnalysis_Edge sae;
@ -541,6 +549,7 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con
continue;
sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
}
sawo.Perform();
stat = (sawo.Status() < 0 ? -1 : 1);
sfw->FixReorder(sawo);
@ -550,7 +559,8 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con
if (sfw->StatusReorder(ShapeExtend_DONE3))
stat=-1;
if( stat < 0 ) {
if(stat < 0)
{
BRep_Builder B;
TopoDS_Shape dummy = myFace.EmptyCopied();
TopoDS_Face face = TopoDS::Face ( dummy );
@ -569,7 +579,6 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con
seqw.Append ( seg );
}
}
}
}

View File

@ -1417,6 +1417,8 @@ static Standard_Boolean CheckWire (const TopoDS_Wire &wire,
vec.SetX(0);
vec.SetY(0);
ShapeAnalysis_Edge sae;
isuopen = isvopen = 0;
isDeg = Standard_True;
for ( TopoDS_Iterator ed(wire); ed.More(); ed.Next() ) {
TopoDS_Edge edge = TopoDS::Edge ( ed.Value() );
@ -1427,17 +1429,48 @@ static Standard_Boolean CheckWire (const TopoDS_Wire &wire,
return Standard_False;
vec += c2d->Value(l).XY() - c2d->Value(f).XY();
}
isuopen = ( Abs ( Abs ( vec.X() ) - dU ) < 0.1 * dU ? ( vec.X() >0 ? 1 : -1 ) : 0 );
isvopen = ( Abs ( Abs ( vec.Y() ) - dV ) < 0.1 * dV ? ( vec.Y() >0 ? 1 : -1 ) : 0 );
Standard_Real aDelta = Abs(vec.X())-dU;
if(Abs(aDelta) < 0.1*dU)
{
if(vec.X() > 0.0)
{
isuopen = 1;
}
else
{
isuopen = -1;
}
}
else
{
isuopen = 0;
}
aDelta = Abs(vec.Y())-dV;
if(Abs(aDelta) < 0.1*dV)
{
if(vec.Y() > 0.0)
{
isvopen = 1;
}
else
{
isvopen = -1;
}
}
else
{
isvopen = 0;
}
return isuopen || isvopen;
}
//=======================================================================
//function : FixMissingSeam
//purpose :
//=======================================================================
Standard_Boolean ShapeFix_Face::FixMissingSeam()
{
Standard_Boolean uclosed = mySurf->IsUClosed();
@ -1480,8 +1513,8 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
}
}
URange = Abs ( SUL - SUF );
VRange = Abs ( SVL - SVF );
URange = Min(Abs (SUL - SUF), Precision::Infinite());
VRange = Min(Abs(SVL - SVF), Precision::Infinite());
// Standard_Real UTol = 0.2 * URange, VTol = 0.2 * VRange;
Standard_Integer ismodeu = 0, ismodev = 0; //szv#4:S4163:12Mar99 was Boolean
Standard_Integer isdeg1=0, isdeg2=0;

View File

@ -1,5 +1,4 @@
## cts20461
puts "TODO #22911 ALL: Error : The area of the resulting shape is"
restore [locate_data_file cts20461.rle] a
nexplode a f
@ -43,4 +42,4 @@ bcut r4 r3 p4
bcut r5 r4 p5
bcut result r5 p6
set square 0
set square 55910.6

View File

@ -5,4 +5,4 @@ restore [locate_data_file Plan.rle] b
bsection result a b
set length 1686.09
set length 1908.63

View File

@ -66,5 +66,5 @@ if { $MaxFaceTolerance > 1 || $MaxEdgeTolerance > 1 || $MaxVertexTolerance > 1 }
} else {
puts "Tolerance of shape is less then 1.0"
}
set square 2.22138e+07
set square 2.34799e+007
set 2dviewer 0

View File

@ -40,7 +40,7 @@ set CPU_user_time [expr ${CPU_user_time} / ${NbTests}]
puts "CPU_user_time=${CPU_user_time}"
#CR24317 set square 782201
set square 766474
set square 784833
# Analysis of "nbshapes res"
set nb_v_good 53

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {} $calcul $type }
set square 236.013
set square 253.552
set nb_v_good 2
set nb_e_good 3

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {s_3} $calcul $type }
set square 484.846
set square 502.411
set nb_v_good 3
set nb_e_good 5

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {s_2} $calcul $type }
set square 484.846
set square 502.411
set nb_v_good 3
set nb_e_good 5

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {s_3 s_2} $calcul $type }
set square 472.222
set square 489.812
set nb_v_good 3
set nb_e_good 5

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {} $calcul $type }
set square 754.039
set square 767.63
set nb_v_good 2
set nb_e_good 3

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {s_2} $calcul $type }
set square 1511.4
set square 1530.96
set nb_v_good 4
set nb_e_good 6

View File

@ -30,7 +30,7 @@ set distance -0.1
catch { OFFSETSHAPE $distance {s_3 s_2} $calcul $type }
set square 1451.05
set square 1471.48
set nb_v_good 4
set nb_e_good 6

View File

@ -15,6 +15,6 @@ fit
reflectlines result a 0 1 0
set length 3877.8
set length 3730.32
set only_screen_axo 1

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 77849.3
set square 80532.3
# Analysis of "nbshapes result"
set nb_v_good 54

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 82726.4
set square 81730.6
# Analysis of "nbshapes result"
set nb_v_good 121

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 117639
set square 126161
# Analysis of "nbshapes result"
set nb_v_good 16

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 77849.3
set square 80532.3
# Analysis of "nbshapes result"
set nb_v_good 54

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 82726.4
set square 81730.6
# Analysis of "nbshapes result"
set nb_v_good 121

View File

@ -21,7 +21,7 @@ for {set i 0} {$i < $nbObjs} {incr i} {
bfillds
bbuild result
set square 117639
set square 126161
# Analysis of "nbshapes result"
set nb_v_good 16

View File

@ -1,11 +1,11 @@
puts "TODO OCC12345 ALL: Error : Volume of OCC76-1.brep is calculated wrongly becuase 3020.94 value must be but 3050.41 is"
puts "TODO OCC12345 ALL: Error : Volume of OCC76-2.brep is calculated wrongly because 9871.39 value must be but 10153.6 is"
puts "================"
puts "OCC76"
puts "================"
puts ""
set vol1_exp 3050.42
set vol2_exp 10195.3
restore [locate_data_file shading_177.brep] sh1
checkshape sh1
regexp {Mass +: +([-0-9.+eE]+)} [vprops sh1] full l1
@ -14,14 +14,14 @@ restore [locate_data_file OCC76-2.brep] sh2
checkshape sh2
regexp {Mass +: +([-0-9.+eE]+)} [vprops sh2] full l2
if { [expr abs([expr $l1 - 3020.94])] > 0.00999} {
puts "Error : Volume of OCC76-1.brep is calculated wrongly becuase 3020.94 value must be but $l1 is"
if { [expr abs([expr $l1 - $vol1_exp])] > 0.00999} {
puts "Error : Volume of OCC76-1.brep is calculated wrongly becuase $vol1_exp value must be but $l1 is"
} else {
puts " Volume of OCC76-1.brep is right calculated"
}
if { [expr abs([expr $l2 - 9871.39 ])] > 0.00999} {
puts "Error : Volume of OCC76-2.brep is calculated wrongly because 9871.39 value must be but $l2 is"
if { [expr abs([expr $l2 - $vol2_exp])] > 0.00999} {
puts "Error : Volume of OCC76-2.brep is calculated wrongly because $vol2_exp value must be but $l2 is"
} else {
puts " Volume of OCC76-2.brep is right calculated"
}

View File

@ -11,10 +11,10 @@ puts ""
## strings of code. BRepTools.cxx line 213 (in dev version)
############################################################
set good_u1 -0.157166
set good_u2 4.88216
set good_v1 -1.65583
set good_v2 7.93778
set good_u1 -0.14353846357954067
set good_u2 4.8658600889104724
set good_v1 -1.386764846506505
set good_v2 7.6699722758333735
set percent_max 0.1

View File

@ -0,0 +1,21 @@
puts "================"
puts "OCC23511"
puts "================"
puts ""
#########################################################################
# The function BRepTools::UVBounds provides incorrect result for a face
#########################################################################
restore [locate_data_file bug23511_f1] result
set info [xbounds result]
set 2PI [expr 2 * 3.142]
foreach bound ${info} {
puts "bound = ${bound}"
if { ${bound} < 0 || ${bound} > ${2PI} } {
puts "Error : bad bound ${bound}"
}
}
set 2dviewer 1

View File

@ -8,8 +8,8 @@ set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 1 ) Summary = 0 ( 1 )
TPSTAT : Faulties = 0 ( 28 ) Warnings = 115 ( 7 ) Summary = 115 ( 35 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 1 ) Solids = 0 ( 1 )
NBSHAPES : Solid = 0 ( 18 ) Shell = 0 ( 18 ) Face = 1190 ( 1190 ) Summary = 15073 ( 7693 )
STATSHAPE : Solid = 0 ( 18 ) Shell = 0 ( 18 ) Face = 1190 ( 1190 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 6283 ( 3134 )
NBSHAPES : Solid = 0 ( 18 ) Shell = 0 ( 18 ) Face = 1190 ( 1190 ) Summary = 15075 ( 7693 )
STATSHAPE : Solid = 0 ( 18 ) Shell = 0 ( 18 ) Face = 1190 ( 1190 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 6284 ( 3134 )
TOLERANCE : MaxTol = 0.2496383637 ( 0.2496258832 ) AvgTol = 0.002193043247 ( 0.004111699336 )
LABELS : N0Labels = 27 ( 27 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 27 ( 27 ) NameLabels = 27 ( 27 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )

View File

@ -10,4 +10,4 @@ bfuse f pt pr
nexplode f f
depouille result f 0 0 1 f_4 5 0 0 40 0 0 1
set square 11348.9
set square 10850.6

View File

@ -2,6 +2,7 @@
# Date : 02 Dec 98
puts "TODO OCC22803 All:Error: The tolerance of the resulting shape is too big"
puts "TODO OCC23511 Debian60-64: The area of the resulting shape is 186543"
restore [locate_data_file CFE903_pro12ggx.rle] base
@ -11,4 +12,4 @@ depouille result base 0 -1 0 base_13 3 110 0 96.5000000000001 0 -1 0 base_24 3
fsameparameter result
set square 186544
set square 200050