mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0029782: Shape Healing - Reading of invalid shape
This commit is contained in:
parent
47ba172e98
commit
cdcb6655e7
@ -222,9 +222,11 @@ Standard_Boolean StepToTopoDS_GeometricTool::IsLikeSeam
|
||||
// This situation occurs when an edge crosses the parametric origin.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
||||
(const Handle(Geom_Curve)& theCurve, Standard_Real& w1, Standard_Real& w2,
|
||||
const Standard_Real preci)
|
||||
Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d(
|
||||
const Handle(Geom_Curve)& theCurve,
|
||||
Standard_Real& w1,
|
||||
Standard_Real& w2,
|
||||
const Standard_Real preci)
|
||||
{
|
||||
// w1 et/ou w2 peuvent etre en dehors des bornes naturelles de la courbe.
|
||||
// On donnera alors la valeur en bout a w1 et/ou w2
|
||||
@ -232,14 +234,17 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
||||
Standard_Real cf = theCurve->FirstParameter();
|
||||
Standard_Real cl = theCurve->LastParameter();
|
||||
|
||||
if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed()) {
|
||||
if (w1 < cf) {
|
||||
if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed())
|
||||
{
|
||||
if (w1 < cf)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Update Edge First Parameter to Curve First Parameter" << endl;
|
||||
#endif
|
||||
w1 = cf;
|
||||
}
|
||||
else if (w1 > cl) {
|
||||
else if (w1 > cl)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Update Edge First Parameter to Curve Last Parameter" << endl;
|
||||
#endif
|
||||
@ -262,25 +267,46 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
||||
if (w1 < w2) return Standard_True;
|
||||
|
||||
if (theCurve->IsPeriodic())
|
||||
ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),w1,w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
|
||||
else if (theCurve->IsClosed()) {
|
||||
{
|
||||
ElCLib::AdjustPeriodic(cf, cl, Precision::PConfusion(), w1, w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
|
||||
}
|
||||
else if (theCurve->IsClosed())
|
||||
{
|
||||
// l'un des points projecte se trouve sur l'origine du parametrage
|
||||
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
||||
// DANGER precision 3d applique a une espace 1d
|
||||
|
||||
// w2 = cf au lieu de w2 = cl
|
||||
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/) w2 = cl;
|
||||
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/)
|
||||
{
|
||||
w2 = cl;
|
||||
}
|
||||
// w1 = cl au lieu de w1 = cf
|
||||
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/) w1 = cf;
|
||||
|
||||
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/)
|
||||
{
|
||||
w1 = cf;
|
||||
}
|
||||
// on se trouve dans un cas ou l origine est traversee
|
||||
// illegal sur une courbe fermee non periodique
|
||||
// on inverse quand meme les parametres !!!!!!
|
||||
else {
|
||||
else
|
||||
{
|
||||
//:S4136 abv 20 Apr 99: r0701_ug.stp #6230: add check in 3d
|
||||
if (theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci) w1 = cf;
|
||||
if (theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci) w2 = cl;
|
||||
if (w1 > w2) {
|
||||
if (theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci)
|
||||
{
|
||||
w1 = cf;
|
||||
}
|
||||
if (theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci)
|
||||
{
|
||||
w2 = cl;
|
||||
}
|
||||
if (fabs(w2 - w1) < Precision::PConfusion())
|
||||
{
|
||||
w1 = cf;
|
||||
w2 = cl;
|
||||
}
|
||||
else if (w1 > w2)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
||||
#endif
|
||||
@ -291,48 +317,60 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
||||
}
|
||||
}
|
||||
// The curve is closed within the 3D tolerance
|
||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle(Geom_BSplineCurve) aBSpline =
|
||||
Handle(Geom_BSplineCurve)::DownCast(theCurve);
|
||||
if (aBSpline->StartPoint().Distance(aBSpline->EndPoint()) <= preci ) {
|
||||
//:S4136 <= BRepAPI::Precision()) {
|
||||
// l'un des points projecte se trouve sur l'origine du parametrage
|
||||
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
||||
// DANGER precision 3d applique a une espace 1d
|
||||
if (aBSpline->StartPoint().Distance(aBSpline->EndPoint()) <= preci)
|
||||
{
|
||||
//:S4136 <= BRepAPI::Precision()) {
|
||||
// l'un des points projecte se trouve sur l'origine du parametrage
|
||||
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
||||
// DANGER precision 3d applique a une espace 1d
|
||||
|
||||
// w2 = cf au lieu de w2 = cl
|
||||
if (Abs(w2 - cf) < Precision::PConfusion()) w2 = cl ;
|
||||
// w2 = cf au lieu de w2 = cl
|
||||
if (Abs(w2 - cf) < Precision::PConfusion())
|
||||
{
|
||||
w2 = cl;
|
||||
}
|
||||
// w1 = cl au lieu de w1 = cf
|
||||
else if (Abs(w1 - cl) < Precision::PConfusion()) w1 = cf;
|
||||
|
||||
else if (Abs(w1 - cl) < Precision::PConfusion())
|
||||
{
|
||||
w1 = cf;
|
||||
}
|
||||
// on se trouve dans un cas ou l origine est traversee
|
||||
// illegal sur une courbe fermee non periodique
|
||||
// on inverse quand meme les parametres !!!!!!
|
||||
else {
|
||||
else
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
||||
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
||||
#endif
|
||||
Standard_Real tmp = w1;
|
||||
w1 = w2;
|
||||
w2 = tmp;
|
||||
Standard_Real tmp = w1;
|
||||
w1 = w2;
|
||||
w2 = tmp;
|
||||
}
|
||||
}
|
||||
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
||||
else if ( w1 > w2 ) {
|
||||
else if (w1 > w2)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
||||
#endif
|
||||
w1 = theCurve->ReversedParameter ( w1 );
|
||||
w2 = theCurve->ReversedParameter ( w2 );
|
||||
w1 = theCurve->ReversedParameter(w1);
|
||||
w2 = theCurve->ReversedParameter(w2);
|
||||
theCurve->Reverse();
|
||||
}
|
||||
//:j9 abv 11 Dec 98: PRO7747 #4875, after :j8: else
|
||||
if (w1 == w2) { //gka 10.07.1998 file PRO7656 entity 33334
|
||||
w1 = cf; w2 = cl;
|
||||
//:j9 abv 11 Dec 98: PRO7747 #4875, after :j8: else
|
||||
if (w1 == w2)
|
||||
{ //gka 10.07.1998 file PRO7656 entity 33334
|
||||
w1 = cf;
|
||||
w2 = cl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "UpdateParam3d Failed" << endl;
|
||||
cout << " - Curve Type : " << theCurve->DynamicType() << endl;
|
||||
@ -340,16 +378,18 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
||||
cout << " - Param 2 : " << w2 << endl;
|
||||
#endif
|
||||
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
||||
if ( w1 > w2 ) {
|
||||
if (w1 > w2)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
||||
#endif
|
||||
w1 = theCurve->ReversedParameter ( w1 );
|
||||
w2 = theCurve->ReversedParameter ( w2 );
|
||||
w1 = theCurve->ReversedParameter(w1);
|
||||
w2 = theCurve->ReversedParameter(w2);
|
||||
theCurve->Reverse();
|
||||
}
|
||||
//pdn 11.01.99 #144 bm1_pe_t4 protection of exceptions in draw
|
||||
if (w1 == w2) {
|
||||
if (w1 == w2)
|
||||
{
|
||||
w1 -= Precision::PConfusion();
|
||||
w2 += Precision::PConfusion();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user