mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0025427: Algorithm of building plane from wire hangs
Test-case for issue #25427
This commit is contained in:
parent
3908084224
commit
43dbdb15db
@ -287,7 +287,11 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
|||||||
// Put all poles for bezier
|
// Put all poles for bezier
|
||||||
Handle(Geom_BezierCurve) GC = c.Bezier();
|
Handle(Geom_BezierCurve) GC = c.Bezier();
|
||||||
Standard_Integer iNbPol = GC->NbPoles();
|
Standard_Integer iNbPol = GC->NbPoles();
|
||||||
if ( iNbPol < 2)
|
Standard_Real tf = GC->FirstParameter();
|
||||||
|
Standard_Real tl = GC->LastParameter();
|
||||||
|
Standard_Real r = (dfUl - dfUf) / (tl - tf);
|
||||||
|
r *= iNbPol;
|
||||||
|
if ( iNbPol < 2 || r < 1.)
|
||||||
// Degenerate
|
// Degenerate
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
@ -318,20 +322,36 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
|||||||
// Put all poles for bspline
|
// Put all poles for bspline
|
||||||
Handle(Geom_BSplineCurve) GC = c.BSpline();
|
Handle(Geom_BSplineCurve) GC = c.BSpline();
|
||||||
Standard_Integer iNbPol = GC->NbPoles();
|
Standard_Integer iNbPol = GC->NbPoles();
|
||||||
if ( iNbPol < 2)
|
Standard_Real tf = GC->FirstParameter();
|
||||||
|
Standard_Real tl = GC->LastParameter();
|
||||||
|
Standard_Real r = (dfUl - dfUf) / (tl - tf);
|
||||||
|
r *= iNbPol;
|
||||||
|
if ( iNbPol < 2 || r < 1.)
|
||||||
// Degenerate
|
// Degenerate
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const Standard_Integer aNbPolMax = 200;
|
||||||
|
Standard_Integer incr = 1;
|
||||||
|
if(iNbPol > aNbPolMax)
|
||||||
|
{
|
||||||
|
Standard_Integer nb = iNbPol;
|
||||||
|
while(nb > aNbPolMax)
|
||||||
|
{
|
||||||
|
incr++;
|
||||||
|
nb = (iNbPol-1) / incr;
|
||||||
|
}
|
||||||
|
}
|
||||||
Handle(TColgp_HArray1OfPnt) aPoles = new (TColgp_HArray1OfPnt) (1, iNbPol);
|
Handle(TColgp_HArray1OfPnt) aPoles = new (TColgp_HArray1OfPnt) (1, iNbPol);
|
||||||
GC->Poles(aPoles->ChangeArray1());
|
GC->Poles(aPoles->ChangeArray1());
|
||||||
gp_Pnt aPolePrev = aPoles->Value(1), aPoleNext;
|
gp_Pnt aPolePrev = aPoles->Value(1), aPoleNext;
|
||||||
Standard_Real dfDistPrev = 0., dfDistNext;
|
Standard_Real dfDistPrev = 0., dfDistNext;
|
||||||
for (Standard_Integer iPol=1; iPol<=iNbPol; iPol++)
|
Standard_Integer iPol;
|
||||||
|
for (iPol = 1; iPol <= iNbPol; iPol += incr)
|
||||||
{
|
{
|
||||||
if (iPol<iNbPol)
|
if (iPol <= iNbPol - incr)
|
||||||
{
|
{
|
||||||
aPoleNext = aPoles->Value(iPol+1);
|
aPoleNext = aPoles->Value(iPol+incr);
|
||||||
dfDistNext = aPolePrev.Distance(aPoleNext);
|
dfDistNext = aPolePrev.Distance(aPoleNext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -450,7 +470,8 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
|||||||
if (!isSolved || myTolerance < dfDist) {
|
if (!isSolved || myTolerance < dfDist) {
|
||||||
gp_Pnt aFirstPnt=aPoints(1);
|
gp_Pnt aFirstPnt=aPoints(1);
|
||||||
for (iPoint=2; iPoint<=aPoints.Length(); iPoint++) {
|
for (iPoint=2; iPoint<=aPoints.Length(); iPoint++) {
|
||||||
gp_Vec aDir(aFirstPnt,aPoints(iPoint));
|
const gp_Pnt& aNextPnt = aPoints(iPoint);
|
||||||
|
gp_Vec aDir(aFirstPnt, aNextPnt);
|
||||||
Standard_Real dfSide=aDir.Magnitude();
|
Standard_Real dfSide=aDir.Magnitude();
|
||||||
if (dfSide<myTolerance) {
|
if (dfSide<myTolerance) {
|
||||||
continue; // degeneration
|
continue; // degeneration
|
||||||
|
17
tests/bugs/modalg_5/bug25427
Normal file
17
tests/bugs/modalg_5/bug25427
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25427"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###############################################
|
||||||
|
# Algorithm of building plane from wire hangs
|
||||||
|
###############################################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
|
||||||
|
restore [locate_data_file bug25427_w.brep] w
|
||||||
|
|
||||||
|
mkplane p w 1
|
||||||
|
|
||||||
|
fit
|
||||||
|
|
||||||
|
set only_screen_axo 1
|
Loading…
x
Reference in New Issue
Block a user