1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0024915: Wrong intersection curves between two cylinders

Existing method of Cylinder-Cylinder intersection computing is based on finding the analytic line (as a function of one argument) and converting one into the walking-line with set of equidistant (along the line parameter) points.

The main advantage of applied method is using adaptively computed step. Necessary step is computed into every point of the obtained walking-line. At that we receive final walking-line directly (without preliminary analytic line) and we determine moments more precisely, when it should be split (see IntPatch_ImpImpIntersection_4.gxx).

The main disadvantages is bad working this method for non-trimmed cylinders (with infinite bounds), because step value is depend on the boundaries values.

More over, new method always returns walking-line, while intersection result can be an analytic curve (lines, circle, ellipse). That is NO good. Therefore, analytic curve is computed by existing method.

In conclusion, in spite of covering almost all more often meeting cases, new method has limited application. Then we should use the existing old method.

Additionally, method MinMax() is added (see Standard_Real.hxx file). It uses into new algorithm.

Some test cases is changed according to their new behavior.

Test case for issue CR24915 is added.

Into GeometryTest_APICommands.cxx only tabulations were chaged.

"Extending" of isolines (see Geom2dHatch_Hatcher.cxx).

Small correction of test case for issue CR24915.
This commit is contained in:
nbv
2014-08-15 14:35:04 +04:00
committed by bugmaster
parent d15f387afa
commit ecc4f1489d
22 changed files with 2800 additions and 827 deletions

View File

@@ -46,32 +46,32 @@ static Standard_Real HatcherConfusion3d = 1.e-8 ;
//=======================================================================
DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
const Standard_Real Infinite,
const Standard_Integer NbIsos) :
Geom2dHatch_Hatcher (Geom2dHatch_Intersector (IntersectorConfusion,
IntersectorTangency),
HatcherConfusion2d,
HatcherConfusion3d,
Standard_True,
Standard_False) ,
myInfinite (Infinite) ,
myUMin (0.0) ,
myUMax (0.0) ,
myVMin (0.0) ,
myVMax (0.0) ,
myUPrm (1, NbIsos) ,
myUInd (1, NbIsos) ,
myVPrm (1, NbIsos) ,
myVInd (1, NbIsos) ,
myNbDom (0)
const Standard_Real Infinite,
const Standard_Integer NbIsos) :
Geom2dHatch_Hatcher (Geom2dHatch_Intersector (IntersectorConfusion,
IntersectorTangency),
HatcherConfusion2d,
HatcherConfusion3d,
Standard_True,
Standard_False) ,
myInfinite (Infinite) ,
myUMin (0.0) ,
myUMax (0.0) ,
myVMin (0.0) ,
myVMax (0.0) ,
myUPrm (1, NbIsos) ,
myUInd (1, NbIsos) ,
myVPrm (1, NbIsos) ,
myVInd (1, NbIsos) ,
myNbDom (0)
{
myUInd.Init(0);
myVInd.Init(0);
//-----------------------------------------------------------------------
// If the Min Max bounds are infinite, there are bounded to Infinite
// value.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// If the Min Max bounds are infinite, there are bounded to Infinite
// value.
//-----------------------------------------------------------------------
BRepTools::UVBounds (TopologicalFace, myUMin, myUMax, myVMin, myVMax) ;
Standard_Boolean InfiniteUMin = Precision::IsNegativeInfinite (myUMin) ;
@@ -95,9 +95,9 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
myVMax = myVMin + Infinite ;
}
//-----------------------------------------------------------------------
// Retreiving the edges and loading them into the hatcher.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// Retreiving the edges and loading them into the hatcher.
//-----------------------------------------------------------------------
TopExp_Explorer ExpEdges;
for (ExpEdges.Init (TopologicalFace, TopAbs_EDGE); ExpEdges.More(); ExpEdges.Next())
@@ -108,22 +108,22 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
if (PCurve.IsNull())
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder : PCurve is null\n";
#endif
#endif
return;
}
else if (U1 == U2)
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder PCurve : U1==U2\n";
#endif
#endif
return;
}
//-- Test if a TrimmedCurve is necessary
if (Abs(PCurve->FirstParameter()-U1)<= Precision::PConfusion()
&& Abs(PCurve->LastParameter()-U2)<= Precision::PConfusion())
&& Abs(PCurve->LastParameter()-U2)<= Precision::PConfusion())
{
AddElement (PCurve, TopologicalEdge.Orientation());
}
@@ -135,16 +135,16 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
if (!TrimPCurve.IsNull())
{
if (TrimPCurve->BasisCurve()->FirstParameter() - U1 > Precision::PConfusion() ||
TrimPCurve->BasisCurve()->FirstParameter() - U2 > Precision::PConfusion() ||
U1 - TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion() ||
U2 - TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion())
TrimPCurve->BasisCurve()->FirstParameter() - U2 > Precision::PConfusion() ||
U1 - TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion() ||
U2 - TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion())
{
AddElement (PCurve, TopologicalEdge.Orientation());
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder TrimPCurve : parameters out of range\n";
cout << " U1(" << U1 << "), Umin(" << PCurve->FirstParameter()
<< "), U2(" << U2 << "), Umax(" << PCurve->LastParameter() << ")\n";
#endif
<< "), U2(" << U2 << "), Umax(" << PCurve->LastParameter() << ")\n";
#endif
return;
}
}
@@ -152,34 +152,34 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
{
if (PCurve->FirstParameter() - U1 > Precision::PConfusion())
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder PCurve : parameters out of range\n";
cout << " U1(" << U1 << "), Umin(" << PCurve->FirstParameter() << ")\n";
#endif
#endif
U1 = PCurve->FirstParameter();
}
if (PCurve->FirstParameter() - U2 > Precision::PConfusion())
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder PCurve : parameters out of range\n";
cout << " U2(" << U2 << "), Umin(" << PCurve->FirstParameter() << ")\n";
#endif
#endif
U2 = PCurve->FirstParameter();
}
if (U1 - PCurve->LastParameter() > Precision::PConfusion())
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder PCurve : parameters out of range\n";
cout << " U1(" << U1 << "), Umax(" << PCurve->LastParameter() << ")\n";
#endif
#endif
U1 = PCurve->LastParameter();
}
if (U2 - PCurve->LastParameter() > Precision::PConfusion())
{
#ifdef DEB
#ifdef DEB
cout << "DBRep_IsoBuilder PCurve : parameters out of range\n";
cout << " U2(" << U2 << "), Umax(" << PCurve->LastParameter() << ")\n";
#endif
#endif
U2 = PCurve->LastParameter();
}
}
@@ -192,9 +192,9 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
}
}
//-----------------------------------------------------------------------
// Loading and trimming the hatchings.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// Loading and trimming the hatchings.
//-----------------------------------------------------------------------
Standard_Integer IIso ;
Standard_Real DeltaU = Abs (myUMax - myUMin) ;
@@ -228,29 +228,36 @@ DBRep_IsoBuilder::DBRep_IsoBuilder (const TopoDS_Face& TopologicalFace,
}
}
//-----------------------------------------------------------------------
// Computation.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// Computation.
//-----------------------------------------------------------------------
Trim() ;
myNbDom = 0 ;
for (IIso = 1 ; IIso <= NbIsos ; IIso++) {
for (IIso = 1 ; IIso <= NbIsos ; IIso++)
{
Standard_Integer Index ;
Index = myUInd(IIso) ;
if (Index != 0) {
if (TrimDone (Index) && !TrimFailed (Index)) {
ComputeDomains (Index);
if (IsDone (Index)) myNbDom = myNbDom + Geom2dHatch_Hatcher::NbDomains (Index) ;
if (Index != 0)
{
if (TrimDone (Index) && !TrimFailed (Index))
{
ComputeDomains (Index);
if (IsDone (Index))
myNbDom = myNbDom + Geom2dHatch_Hatcher::NbDomains (Index) ;
}
}
Index = myVInd(IIso) ;
if (Index != 0) {
if (TrimDone (Index) && !TrimFailed (Index)) {
ComputeDomains (Index);
if (IsDone (Index)) myNbDom = myNbDom + Geom2dHatch_Hatcher::NbDomains (Index) ;
if (Index != 0)
{
if (TrimDone (Index) && !TrimFailed (Index))
{
ComputeDomains (Index);
if (IsDone (Index))
myNbDom = myNbDom + Geom2dHatch_Hatcher::NbDomains (Index) ;
}
}
}