mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0032877: Modeling algorithms - Sweeping issue
Add fix at sweeping algorithm: sweeping happens in the opposite direction as expected Add test case tests/bugs/modalg_7/bug32877
This commit is contained in:
parent
6d1a049be7
commit
a29bae45f9
@ -102,41 +102,6 @@ static Standard_Real EvalAngle(const gp_Vec& V1,
|
|||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Standard_Integer NbSamples(const Handle(Geom_Curve)& aCurve)
|
|
||||||
{
|
|
||||||
Standard_Real nbs = 100.; //on default
|
|
||||||
|
|
||||||
Handle(Geom_Curve) theCurve = aCurve;
|
|
||||||
if (aCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
|
||||||
theCurve = (Handle(Geom_TrimmedCurve)::DownCast(aCurve))->BasisCurve();
|
|
||||||
|
|
||||||
if (theCurve->IsInstance(STANDARD_TYPE(Geom_Line)))
|
|
||||||
nbs = 1;
|
|
||||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom_Conic)))
|
|
||||||
nbs = 4;
|
|
||||||
else if (theCurve->IsInstance(STANDARD_TYPE(Geom_BezierCurve)))
|
|
||||||
{
|
|
||||||
Handle(Geom_BezierCurve) BC = Handle(Geom_BezierCurve)::DownCast(theCurve);
|
|
||||||
nbs = 3 + BC->NbPoles();
|
|
||||||
}
|
|
||||||
else if (theCurve->IsInstance(STANDARD_TYPE(Geom_BSplineCurve)))
|
|
||||||
{
|
|
||||||
Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(theCurve);
|
|
||||||
nbs = BC->NbKnots();
|
|
||||||
nbs *= BC->Degree();
|
|
||||||
Standard_Real ratio =
|
|
||||||
(aCurve->LastParameter() - aCurve->FirstParameter())/(BC->LastParameter() - BC->FirstParameter());
|
|
||||||
nbs *= ratio;
|
|
||||||
if(nbs < 4.0)
|
|
||||||
nbs = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbs > 300.)
|
|
||||||
nbs = 300;
|
|
||||||
|
|
||||||
return ((Standard_Integer)nbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
// Function :DistMini
|
// Function :DistMini
|
||||||
// Purpose : Examine un extrema pour updater <Dist> & <Param>
|
// Purpose : Examine un extrema pour updater <Dist> & <Param>
|
||||||
@ -497,20 +462,18 @@ void GeomFill_SectionPlacement::Perform(const Handle(Adaptor3d_Curve)& Path,
|
|||||||
}
|
}
|
||||||
if (!Intersector.IsDone() || Intersector.NbPoints() == 0)
|
if (!Intersector.IsDone() || Intersector.NbPoints() == 0)
|
||||||
{
|
{
|
||||||
Standard_Integer NbPnts = NbSamples( mySection );
|
// Comparing the distances from the path's endpoints to the best matching plane of the profile.
|
||||||
TColgp_Array1OfPnt Pnts( 1, NbPnts+1 );
|
const gp_Pnt firstPoint = Path->Value(Path->FirstParameter());
|
||||||
Standard_Real delta = (mySection->LastParameter()-mySection->FirstParameter())/NbPnts;
|
const gp_Pnt lastPoint = Path->Value(Path->LastParameter());
|
||||||
for (ii = 0; ii <= NbPnts; ii++)
|
const gp_Pln plane = plan->Pln();
|
||||||
Pnts(ii+1) = mySection->Value( mySection->FirstParameter() + ii*delta );
|
Standard_Real firstDistance = plane.SquareDistance(firstPoint);
|
||||||
|
Standard_Real lastDistance = plane.SquareDistance(lastPoint);
|
||||||
|
|
||||||
gp_Pnt BaryCenter;
|
if (((Abs(firstDistance) < Precision::SquareConfusion()) && Abs(lastDistance) < Precision::SquareConfusion()) ||
|
||||||
gp_Dir Xdir, Ydir;
|
firstDistance < lastDistance)
|
||||||
Standard_Real Xgap, Ygap, Zgap;
|
{
|
||||||
GeomLib::Inertia( Pnts, BaryCenter, Xdir, Ydir, Xgap, Ygap, Zgap );
|
|
||||||
|
|
||||||
gp_Pnt Pfirst = Path->Value( Path->FirstParameter() );
|
|
||||||
if (Pfirst.Distance(BaryCenter) < Plast.Distance(BaryCenter))
|
|
||||||
PathParam = Path->FirstParameter();
|
PathParam = Path->FirstParameter();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PathParam = Path->LastParameter();
|
PathParam = Path->LastParameter();
|
||||||
|
16
tests/bugs/modalg_7/bug32877
Normal file
16
tests/bugs/modalg_7/bug32877
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
puts "================================================="
|
||||||
|
puts "0032877: Modeling algorithms - Sweeping issue"
|
||||||
|
puts "================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
polyline f 0 0 0 10 0 0 10 5 0 0 5 0 0 0 0
|
||||||
|
mkplane f f
|
||||||
|
polyline path 9 1 0.01 5 2.5 4
|
||||||
|
pipe result path f
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
checknbshapes result -shell 1 -face 6 -wire 6 -edge 12
|
||||||
|
|
||||||
|
smallview
|
||||||
|
fit
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user