1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024886: BRepOffsetAPI_NormalProjection failure

Test case for issue CR24886
This commit is contained in:
ifv 2014-09-11 12:33:38 +04:00 committed by bugmaster
parent 1e2fb24474
commit 6e0fd076ae
3 changed files with 617 additions and 593 deletions

View File

@ -93,7 +93,7 @@ static void d1(const Standard_Real t,
//purpose : computes second derivative of the projected curve
//=======================================================================
static void d2(const Standard_Real t,
static void d2(const Standard_Real t,
const Standard_Real u,
const Standard_Real v,
gp_Vec2d& V1, gp_Vec2d& V2,
@ -206,7 +206,7 @@ static void d1CurvOnSurf(const Standard_Real t,
//purpose : computes second derivative of the 3D projected curve
//=======================================================================
static void d2CurvOnSurf(const Standard_Real t,
static void d2CurvOnSurf(const Standard_Real t,
const Standard_Real u,
const Standard_Real v,
gp_Vec& V1 , gp_Vec& V2 ,
@ -495,7 +495,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
//purpose :
//=======================================================================
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve()
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve()
{
}
@ -504,7 +504,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
//purpose :
//=======================================================================
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve(
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve(
const Handle(Adaptor3d_HSurface)& S,
const Handle(Adaptor3d_HCurve)& C,
const Standard_Real TolU,
@ -521,7 +521,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
//purpose :
//=======================================================================
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve(
ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve(
const Handle(Adaptor3d_HSurface)& S,
const Handle(Adaptor3d_HCurve)& C,
const Standard_Real TolU,
@ -539,7 +539,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::Init()
void ProjLib_CompProjectedCurve::Init()
{
myTabInt.Nullify();
@ -847,11 +847,11 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
// Sequence postproceeding
Standard_Integer j;
// 1. Removing poor parts
// 1. Removing poor parts
Standard_Integer NbPart=myNbCurves;
Standard_Integer ipart=1;
for(i = 1; i <= NbPart; i++) {
// Standard_Integer NbPoints = mySequence->Value(i)->Length();
// Standard_Integer NbPoints = mySequence->Value(i)->Length();
if(mySequence->Value(ipart)->Length() < 2) {
mySequence->Remove(ipart);
myNbCurves--;
@ -861,7 +861,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
if(myNbCurves == 0) return;
// 2. Removing common parts of bounds
// 2. Removing common parts of bounds
for(i = 1; i < myNbCurves; i++)
{
if(mySequence->Value(i)->Value(mySequence->Value(i)->Length()).X() >=
@ -869,7 +869,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
mySequence->ChangeValue(i+1)->ChangeValue(1).SetX(mySequence->Value(i)->Value(mySequence->Value(i)->Length()).X() + 1.e-12);
}
// 3. Computation of the maximum distance from each part of curve to surface
// 3. Computation of the maximum distance from each part of curve to surface
myMaxDistance = new TColStd_HArray1OfReal(1, myNbCurves);
myMaxDistance->Init(0);
@ -887,7 +887,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
}
// 4. Check the projection to be a single point
// 4. Check the projection to be a single point
gp_Pnt2d Pmoy, Pcurr, P;
Standard_Real AveU, AveV;
@ -919,7 +919,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
}
}
// 5. Check the projection to be an isoparametric curve of the surface
// 5. Check the projection to be an isoparametric curve of the surface
myUIso = new TColStd_HArray1OfBoolean(1, myNbCurves);
for(i = 1; i <= myNbCurves; i++) myUIso->SetValue(i, Standard_True);
@ -934,7 +934,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
continue;
}
// new test for isoparametrics
// new test for isoparametrics
if ( mySequence->Value(i)->Length() > 2) {
//compute an average U and V
@ -965,7 +965,7 @@ static Standard_Boolean InitialPoint(const gp_Pnt& Point,
break;
}
}
//
//
}
}
}
@ -994,7 +994,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
const Handle(Adaptor3d_HSurface)& ProjLib_CompProjectedCurve::GetSurface() const
const Handle(Adaptor3d_HSurface)& ProjLib_CompProjectedCurve::GetSurface() const
{
return mySurface;
}
@ -1005,7 +1005,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
const Handle(Adaptor3d_HCurve)& ProjLib_CompProjectedCurve::GetCurve() const
const Handle(Adaptor3d_HCurve)& ProjLib_CompProjectedCurve::GetCurve() const
{
return myCurve;
}
@ -1015,7 +1015,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::GetTolerance(Standard_Real& TolU,
void ProjLib_CompProjectedCurve::GetTolerance(Standard_Real& TolU,
Standard_Real& TolV) const
{
TolU = myTolU;
@ -1027,7 +1027,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
Standard_Integer ProjLib_CompProjectedCurve::NbCurves() const
Standard_Integer ProjLib_CompProjectedCurve::NbCurves() const
{
return myNbCurves;
}
@ -1036,7 +1036,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::Bounds(const Standard_Integer Index,
void ProjLib_CompProjectedCurve::Bounds(const Standard_Integer Index,
Standard_Real& Udeb,
Standard_Real& Ufin) const
{
@ -1049,7 +1049,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
Standard_Boolean ProjLib_CompProjectedCurve::IsSinglePnt(const Standard_Integer Index, gp_Pnt2d& P) const
Standard_Boolean ProjLib_CompProjectedCurve::IsSinglePnt(const Standard_Integer Index, gp_Pnt2d& P) const
{
if(Index < 1 || Index > myNbCurves) Standard_NoSuchObject::Raise();
P = gp_Pnt2d(mySequence->Value(Index)->Value(1).Y(), mySequence->Value(Index)->Value(1).Z());
@ -1061,7 +1061,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
Standard_Boolean ProjLib_CompProjectedCurve::IsUIso(const Standard_Integer Index, Standard_Real& U) const
Standard_Boolean ProjLib_CompProjectedCurve::IsUIso(const Standard_Integer Index, Standard_Real& U) const
{
if(Index < 1 || Index > myNbCurves) Standard_NoSuchObject::Raise();
U = mySequence->Value(Index)->Value(1).Y();
@ -1072,7 +1072,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
Standard_Boolean ProjLib_CompProjectedCurve::IsVIso(const Standard_Integer Index, Standard_Real& V) const
Standard_Boolean ProjLib_CompProjectedCurve::IsVIso(const Standard_Integer Index, Standard_Real& V) const
{
if(Index < 1 || Index > myNbCurves) Standard_NoSuchObject::Raise();
V = mySequence->Value(Index)->Value(1).Z();
@ -1083,7 +1083,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
gp_Pnt2d ProjLib_CompProjectedCurve::Value(const Standard_Real t) const
gp_Pnt2d ProjLib_CompProjectedCurve::Value(const Standard_Real t) const
{
gp_Pnt2d P;
D0(t, P);
@ -1094,7 +1094,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::D0(const Standard_Real U,gp_Pnt2d& P) const
void ProjLib_CompProjectedCurve::D0(const Standard_Real U,gp_Pnt2d& P) const
{
Standard_Integer i, j;
Standard_Real Udeb, Ufin;
@ -1117,10 +1117,10 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
for(j = 1; j < End; j++)
if ((U >= mySequence->Value(i)->Value(j).X()) && (U <= mySequence->Value(i)->Value(j + 1).X())) break;
// U0 = mySequence->Value(i)->Value(j).Y();
// V0 = mySequence->Value(i)->Value(j).Z();
// U0 = mySequence->Value(i)->Value(j).Y();
// V0 = mySequence->Value(i)->Value(j).Z();
// Cubic Interpolation
// Cubic Interpolation
if(mySequence->Value(i)->Length() < 4 ||
(Abs(U-mySequence->Value(i)->Value(j).X()) <= Precision::PConfusion()) )
{
@ -1190,7 +1190,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::D1(const Standard_Real t,
void ProjLib_CompProjectedCurve::D1(const Standard_Real t,
gp_Pnt2d& P,
gp_Vec2d& V) const
{
@ -1205,7 +1205,7 @@ void ProjLib_CompProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::D2(const Standard_Real t,
void ProjLib_CompProjectedCurve::D2(const Standard_Real t,
gp_Pnt2d& P,
gp_Vec2d& V1,
gp_Vec2d& V2) const
@ -1249,7 +1249,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
const Handle(ProjLib_HSequenceOfHSequenceOfPnt)& ProjLib_CompProjectedCurve::GetSequence() const
const Handle(ProjLib_HSequenceOfHSequenceOfPnt)& ProjLib_CompProjectedCurve::GetSequence() const
{
return mySequence;
}
@ -1258,7 +1258,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
Standard_Real ProjLib_CompProjectedCurve::FirstParameter() const
Standard_Real ProjLib_CompProjectedCurve::FirstParameter() const
{
return myCurve->FirstParameter();
}
@ -1268,7 +1268,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
Standard_Real ProjLib_CompProjectedCurve::LastParameter() const
Standard_Real ProjLib_CompProjectedCurve::LastParameter() const
{
return myCurve->LastParameter();
}
@ -1278,7 +1278,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
Standard_Real ProjLib_CompProjectedCurve::MaxDistance(const Standard_Integer Index) const
Standard_Real ProjLib_CompProjectedCurve::MaxDistance(const Standard_Integer Index) const
{
if(Index < 1 || Index > myNbCurves) Standard_NoSuchObject::Raise();
return myMaxDistance->Value(Index);
@ -1289,7 +1289,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
Standard_Integer ProjLib_CompProjectedCurve::NbIntervals(const GeomAbs_Shape S) const
Standard_Integer ProjLib_CompProjectedCurve::NbIntervals(const GeomAbs_Shape S) const
{
const_cast<ProjLib_CompProjectedCurve*>(this)->myTabInt.Nullify();
BuildIntervals(S);
@ -1301,7 +1301,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const
void ProjLib_CompProjectedCurve::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const
{
if (myTabInt.IsNull()) BuildIntervals (S);
T = myTabInt->Array1();
@ -1312,7 +1312,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//purpose :
//=======================================================================
void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const
void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const
{
GeomAbs_Shape SforS = GeomAbs_CN;
switch(S) {
@ -1370,7 +1370,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
TColStd_SequenceOfReal TUdisc;
for(k = 2; k <= NbIntSurU; k++) {
// cout<<"CutPntsU("<<k<<") = "<<CutPntsU(k)<<endl;
// cout<<"CutPntsU("<<k<<") = "<<CutPntsU(k)<<endl;
for(i = 1; i <= myNbCurves; i++)
for(j = 1; j < mySequence->Value(i)->Length(); j++) {
Ul = mySequence->Value(i)->Value(j).Y();
@ -1404,10 +1404,14 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
gp_Pnt2d(Tol, myTolV),
gp_Pnt2d(Tl, mySurface->FirstVParameter()),
gp_Pnt2d(Tr, mySurface->LastVParameter()));
//
if(Solver.IsDone())
{
TUdisc.Append(Solver.Solution().X());
}
}
}
}
for(i = 2; i <= TUdisc.Length(); i++)
if(TUdisc(i) - TUdisc(i-1) < Precision::PConfusion())
TUdisc.Remove(i--);
@ -1424,7 +1428,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
for(k = 2; k <= NbIntSurV; k++)
for(i = 1; i <= myNbCurves; i++)
{
// cout<<"CutPntsV("<<k<<") = "<<CutPntsV(k)<<endl;
// cout<<"CutPntsV("<<k<<") = "<<CutPntsV(k)<<endl;
for(j = 1; j < mySequence->Value(i)->Length(); j++) {
Vl = mySequence->Value(i)->Value(j).Z();
@ -1458,10 +1462,14 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
gp_Pnt2d(Tol, myTolV),
gp_Pnt2d(Tl, mySurface->FirstUParameter()),
gp_Pnt2d(Tr, mySurface->LastUParameter()));
//
if(Solver.IsDone())
{
TVdisc.Append(Solver.Solution().X());
}
}
}
}
for(i = 2; i <= TVdisc.Length(); i++)
if(TVdisc(i) - TVdisc(i-1) < Precision::PConfusion())
TVdisc.Remove(i--);
@ -1519,7 +1527,7 @@ gp_Vec2d ProjLib_CompProjectedCurve::DN(const Standard_Real t,
//=======================================================================
Handle(Adaptor2d_HCurve2d) ProjLib_CompProjectedCurve::Trim
(const Standard_Real First,
(const Standard_Real First,
const Standard_Real Last,
const Standard_Real Tol) const
{

View File

@ -107,16 +107,12 @@ void TopOpeBRepDS_EdgeInterferenceTool::Add
}
// V est un sommet de E ?
#ifdef DEB
Standard_Boolean VofE = Standard_False;
#endif
TopoDS_Iterator it(E,Standard_False);
for ( ; it.More(); it.Next() ) {
const TopoDS_Shape& S = it.Value();
if ( S.IsSame(V) ) {
#ifdef DEB
VofE = Standard_True;
#endif
break;
}
}
@ -126,7 +122,10 @@ void TopOpeBRepDS_EdgeInterferenceTool::Add
cout<<"===================== VofE = False"<<endl;
}
#endif
if(!VofE)
{
return;
}
// V est un sommet de E
const TopoDS_Vertex& VV = TopoDS::Vertex(V);
const TopoDS_Edge& EE = TopoDS::Edge(E);

17
tests/bugs/moddata_3/bug24886 Executable file
View File

@ -0,0 +1,17 @@
puts "============"
puts "CR24886"
puts "============"
puts ""
###################################################################################
# BRepOffsetAPI_NormalProjection failure
###################################################################################
restore [locate_data_file bug24886_comp.brep] c
explode c
if [catch { nproject r c_1 c_2 } ] {
puts "Error : BRepOffsetAPI_NormalProjection failure"
} else {
puts "OK : BRepOffsetAPI_NormalProjection work good"
}