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

Compare commits

..

1 Commits

Author SHA1 Message Date
oan
a552a72514 0033866: Foundation Classes - BVH::SurfaceCalculator::Area() fails to calculate area of transformed box
Use absolute values of intermediate calculations to compute surface area of a box, so they do not diminish each other.
2025-01-30 15:35:15 +00:00
8 changed files with 25 additions and 39 deletions

View File

@@ -38,17 +38,17 @@ If HTML documentation is not available in your package, you can:
- **Generate together with sources:** You need to have CMake and 1.8.4 (or above) installed on your system. Enable `BUILD_DOC_Overview` CMake parameter and set the path to Doxygen `3RDPARTY_DOXYGEN_EXECUTABLE`. Then build ALL or only `Overview`.
- **Read documentation in source plain text (Markdown) format** found in the subfolder `dox` or [GitHub Wiki](https://github.com/Open-Cascade-SAS/OCCT/wiki).
See [dox/build/build_documentation/building_documentation.md](dox/build/build_documentation/building_documentation.md) or [Building Documentation](https://dev.opencascade.org/doc/occt-7.8.0/overview/html/build_upgrade__building_documentation.html) for details.
See `dox/dev_guides/documentation/documentation.md` or [Building Documentation](https://dev.opencascade.org/doc/occt-7.8.0/overview/html/build_upgrade__building_documentation.html) for details.
## Building
In most cases, you need to rebuild OCCT on your platform (OS, compiler) before using it in your project to ensure binary compatibility.
Consult the file [dox/build/build_occt/building_occt.md](dox/build/build_occt/building_occt.md) or [Building OCCT](https://dev.opencascade.org/doc/overview/html/build_upgrade__building_occt.html) or [Building OCCT Wiki](https://github.com/Open-Cascade-SAS/OCCT/wiki/build_upgrade) for instructions on building OCCT from sources on supported platforms.
Consult the file `dox/dev_guides/building/building.md` or [Building OCCT](https://dev.opencascade.org/doc/overview/html/build_upgrade__building_occt.html) or [Building OCCT Wiki](https://github.com/Open-Cascade-SAS/OCCT/wiki/build_upgrade) for instructions on building OCCT from sources on supported platforms.
## Version
The current version of OCCT can be found in the file [`src/Standard/Standard_Version.hxx`](src/Standard/Standard_Version.hxx).
The current version of OCCT can be found in the file `src/Standard/Standard_Version.hxx`.
## Development

View File

@@ -119,12 +119,6 @@ static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges)
break;
}
}
if (!itl.More())
{
Message::SendWarning() << "Warning: WireFromList: can't find the next edge. The wire is not "
"complete, some edges are lost.";
break;
}
BB.Add(aWire, anEdge);
Edges.Remove(itl);
}
@@ -563,13 +557,6 @@ void BRepFill_Filling::Build()
myTolAng,
myTolCurv,
myAnisotropie));
if (myBoundary.IsEmpty())
{
myIsDone = Standard_False;
return;
}
TopoDS_Edge CurEdge;
TopoDS_Face CurFace;
Standard_Integer i, j;

View File

@@ -773,7 +773,6 @@ void BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& CC,
}
B.Range(E, p1, p2);
B.Degenerated(E, degenerated);
E.Closed(closed);
myError = BRepLib_EdgeDone;
Done();

View File

@@ -1899,9 +1899,9 @@ Standard_Boolean BRepOffset_Tool::TryProject(const TopoDS_Face& F1,
{
BRepLib::BuildCurve3d(CurE, BRep_Tool::Tolerance(CurE));
C = BRep_Tool::Curve(CurE, L, f, l);
if (C.IsNull()) // not 3d curve, can be degenerated, need to skip
if (C.IsNull())
{
continue;
return Standard_False;
}
}
C = new Geom_TrimmedCurve(C, f, l);

View File

@@ -515,16 +515,15 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewPolygon(const TopoDS_Edg
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
Handle(Geom_Curve) aNewCurve = newCurve(myMap, theEdge, aFirst, aLast);
if (aCurve.IsNull() || aNewCurve.IsNull()) // skip processing degenerated edges
if (!aCurve.IsNull() && !aNewCurve.IsNull()) // skip processing degenerated edges
{
return Standard_False;
}
TColStd_Array1OfReal& aParams = thePoly->ChangeParameters();
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
{
Standard_Real& aParam = aParams(anInd);
gp_Pnt aPoint = aCurve->Value(aParam);
newParameter(aPoint, aNewCurve, aFirst, aLast, aTol, aParam);
TColStd_Array1OfReal& aParams = thePoly->ChangeParameters();
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
{
Standard_Real& aParam = aParams(anInd);
gp_Pnt aPoint = aCurve->Value(aParam);
newParameter(aPoint, aNewCurve, aFirst, aLast, aTol, aParam);
}
}
}
return Standard_True;

View File

@@ -427,11 +427,11 @@ struct SurfaceCalculator<T, 2>
{
static T Area(const typename BVH_Box<T, 2>::BVH_VecNt& theSize)
{
const T anArea = theSize.x() * theSize.y();
const T anArea = std::abs (theSize.x() * theSize.y());
if (anArea < std::numeric_limits<T>::epsilon())
{
return theSize.x() + theSize.y();
return std::abs (theSize.x()) + std::abs (theSize.y());
}
return anArea;
@@ -444,12 +444,14 @@ struct SurfaceCalculator<T, 3>
static T Area(const typename BVH_Box<T, 3>::BVH_VecNt& theSize)
{
const T anArea =
(theSize.x() * theSize.y() + theSize.x() * theSize.z() + theSize.z() * theSize.y())
(std::abs (theSize.x() * theSize.y()) +
std::abs (theSize.x() * theSize.z()) +
std::abs (theSize.z() * theSize.y()))
* static_cast<T>(2.0);
if (anArea < std::numeric_limits<T>::epsilon())
{
return theSize.x() + theSize.y() + theSize.z();
return std::abs (theSize.x()) + std::abs (theSize.y()) + std::abs (theSize.z());
}
return anArea;
@@ -462,12 +464,14 @@ struct SurfaceCalculator<T, 4>
static T Area(const typename BVH_Box<T, 4>::BVH_VecNt& theSize)
{
const T anArea =
(theSize.x() * theSize.y() + theSize.x() * theSize.z() + theSize.z() * theSize.y())
(std::abs (theSize.x() * theSize.y()) +
std::abs (theSize.x() * theSize.z()) +
std::abs (theSize.z() * theSize.y()))
* static_cast<T>(2.0);
if (anArea < std::numeric_limits<T>::epsilon())
{
return theSize.x() + theSize.y() + theSize.z();
return std::abs (theSize.x()) + std::abs (theSize.y()) + std::abs (theSize.z());
}
return anArea;

View File

@@ -439,7 +439,7 @@ void GeomPlate_BuildAveragePlane::BasePlan(const gp_Vec& OZ)
|| ((Abs(n1) <= myTol) && (Abs(n3) <= myTol)))
{
myOX.SetCoord(V3(1), V3(2), V3(3));
myOY = OZ ^ myOX;
myOY.SetCoord(0, 0, 0);
}
else
{

View File

@@ -195,11 +195,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_Surface)& S1,
aProjectedCurve.FirstParameter(),
aProjectedCurve.LastParameter());
Geom2dInt_GInter Intersector(AC, Precision::Confusion(), Precision::Confusion());
if (Intersector.IsDone()
&& (Intersector.IsEmpty() || (AC.IsClosed() && Intersector.NbPoints() == 1)))
{
if (Intersector.IsDone() && Intersector.IsEmpty())
break;
}
}
Standard_FALLTHROUGH
default: {