1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/IntTools/IntTools_Curve.cxx
emv 5652dc6272 0028591: BOP Cut creates wrong result
The Face/Face intersection procedure has been changed in Boolean Operations algorithm.
Previously, the intersection tolerance for all section curves between pair of faces has been calculated
as the maximal tolerance among all curves. Now, each curve has its own valid tolerance calculated
as the maximal deviation of the 3D curve from its 2D curves on faces or surfaces in case there are no 2D curves.

Thus, such methods of IntTools_FaceFace algorithm as TolReached3d(), TolReal() and TolReached2d() have been removed.
Now the tolerances of the curve can be obtained from the curve itself (IntTools_Curve - result of intersection):
- IntTools_Curve::Tolerance() - returns the valid tolerance for the curve;
- IntTools_Curve::TangentialTolerance() - returns the tangential tolerance, which depends on the size of the common
  between faces. Currently, this tolerance is computed for Plane/Plane cases only. For other case, the value
  of the tangential tolerance is the maximal tolerance of faces.

2D intersection tolerance (IntTools_FaceFace::TolReached2d()) has been completely removed from the algorithm as unused.
2017-04-12 17:53:03 +03:00

103 lines
3.7 KiB
C++

// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <IntTools_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BoundedCurve.hxx>
#include <Geom_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <gp_Pnt.hxx>
//=======================================================================
//function : IntTools_Curve::IntTools_Curve
//purpose :
//=======================================================================
IntTools_Curve::IntTools_Curve()
:
myTolerance(0.0),
myTangentialTolerance(0.0)
{
}
//=======================================================================
//function : IntTools_Curve::IntTools_Curve
//purpose :
//=======================================================================
IntTools_Curve::IntTools_Curve(const Handle(Geom_Curve)& the3dCurve,
const Handle(Geom2d_Curve)& the2dCurve1,
const Handle(Geom2d_Curve)& the2dCurve2,
const Standard_Real theTolerance,
const Standard_Real theTangentialTolerance)
:
myTolerance(theTolerance),
myTangentialTolerance(theTangentialTolerance)
{
SetCurves(the3dCurve, the2dCurve1, the2dCurve2);
}
//=======================================================================
//function : HasBounds
//purpose :
//=======================================================================
Standard_Boolean IntTools_Curve::HasBounds() const
{
Handle(Geom_BoundedCurve) aC3DBounded =
Handle(Geom_BoundedCurve)::DownCast(my3dCurve);
Standard_Boolean bIsBounded = !aC3DBounded.IsNull();
return bIsBounded;
}
//=======================================================================
//function : Bounds
//purpose :
//=======================================================================
Standard_Boolean IntTools_Curve::Bounds(Standard_Real& theFirst,
Standard_Real& theLast,
gp_Pnt& theFirstPnt,
gp_Pnt& theLastPnt) const
{
Standard_Boolean bIsBounded = HasBounds();
if (bIsBounded) {
theFirst = my3dCurve->FirstParameter();
theLast = my3dCurve->LastParameter();
my3dCurve->D0(theFirst, theFirstPnt);
my3dCurve->D0(theLast, theLastPnt);
}
return bIsBounded;
}
//=======================================================================
//function : D0
//purpose :
//=======================================================================
Standard_Boolean IntTools_Curve::D0(const Standard_Real& thePar,
gp_Pnt& thePnt) const
{
Standard_Boolean bInside = !(thePar < my3dCurve->FirstParameter() &&
thePar > my3dCurve->LastParameter());
if (bInside) {
my3dCurve->D0(thePar, thePnt);
}
return bInside;
}
//=======================================================================
//function : Type
//purpose :
//=======================================================================
GeomAbs_CurveType IntTools_Curve::Type() const
{
GeomAdaptor_Curve aGAC(my3dCurve);
GeomAbs_CurveType aType = aGAC.GetType();
return aType;
}