1 // Copyright (C) 2014-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "GeomAPI_Face.h"
22 #include "GeomAPI_Dir.h"
23 #include "GeomAPI_Pln.h"
24 #include "GeomAPI_Pnt.h"
25 #include "GeomAPI_Sphere.h"
26 #include "GeomAPI_Curve.h"
27 #include "GeomAPI_Cylinder.h"
28 #include "GeomAPI_Cone.h"
29 #include "GeomAPI_Torus.h"
31 #include <Basics_OCCTVersion.hxx>
33 #include <Bnd_Box2d.hxx>
34 #include <BndLib_Add2dCurve.hxx>
35 #include <BOPTools_AlgoTools.hxx>
36 #include <BRep_Tool.hxx>
37 #include <BRepAdaptor_Surface.hxx>
38 #include <BRepGProp_Face.hxx>
39 #include <BRepTools.hxx>
40 #include <BRepTopAdaptor_TopolTool.hxx>
41 #include <Geom_Surface.hxx>
42 #include <Geom_SphericalSurface.hxx>
43 #include <Geom_ConicalSurface.hxx>
44 #include <Geom_CylindricalSurface.hxx>
45 #include <Geom_OffsetSurface.hxx>
46 #include <Geom_Plane.hxx>
47 #include <Geom_RectangularTrimmedSurface.hxx>
48 #include <Geom_SurfaceOfLinearExtrusion.hxx>
49 #include <Geom_SurfaceOfRevolution.hxx>
50 #include <Geom_SweptSurface.hxx>
51 #include <Geom_ToroidalSurface.hxx>
52 #include <GeomAPI_ExtremaCurveCurve.hxx>
53 #include <GeomLib_IsPlanarSurface.hxx>
54 #include <IntPatch_ImpImpIntersection.hxx>
55 #include <IntTools_Context.hxx>
56 #include <Standard_Type.hxx>
58 #include <TopoDS_Face.hxx>
60 #if OCC_VERSION_LARGE < 0x07070000
61 #include <GeomAdaptor_HSurface.hxx>
63 #include <GeomAdaptor_Surface.hxx>
66 #include <gp_Sphere.hxx>
67 #include <gp_Cylinder.hxx>
68 #include <gp_Cone.hxx>
69 #include <gp_Torus.hxx>
71 static void optimalBounds(const TopoDS_Face& theFace, double& theUMin, double& theUMax,
72 double& theVMin, double& theVMax);
75 GeomAPI_Face::GeomAPI_Face()
80 GeomAPI_Face::GeomAPI_Face(const std::shared_ptr<GeomAPI_Shape>& theShape)
82 if (!theShape->isNull() && theShape->isFace()) {
83 setImpl(new TopoDS_Shape(theShape->impl<TopoDS_Shape>()));
87 bool GeomAPI_Face::isEqual(std::shared_ptr<GeomAPI_Shape> theFace) const
92 if (!theFace->isFace())
95 const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
96 const TopoDS_Shape& aInShape = theFace->impl<TopoDS_Shape>();
98 TopoDS_Face aMyFace = TopoDS::Face(aMyShape);
99 TopoDS_Face aInFace = TopoDS::Face(aInShape);
101 Handle(Geom_Surface) aMySurf = BRep_Tool::Surface(aMyFace);
102 Handle(Geom_Surface) aInSurf = BRep_Tool::Surface(aInFace);
104 // Check that surfaces a the same type
105 if (aMySurf->DynamicType() != aInSurf->DynamicType())
108 // Get parameters of surfaces
109 double aMyUMin, aMyUMax, aMyVMin, aMyVMax;
110 aMySurf->Bounds(aMyUMin, aMyUMax, aMyVMin, aMyVMax);
111 double aInUMin, aInUMax, aInVMin, aInVMax;
112 aInSurf->Bounds(aInUMin, aInUMax, aInVMin, aInVMax);
114 // Check that parameters are the same
115 if (fabs(aMyUMin - aInUMin) > Precision::PConfusion() ||
116 fabs(aMyUMax - aInUMax) > Precision::PConfusion() ||
117 fabs(aMyVMin - aInVMin) > Precision::PConfusion() ||
118 fabs(aMyVMax - aInVMax) > Precision::PConfusion())
121 Handle(IntTools_Context) aContext = new IntTools_Context();
122 // Double check needed because BOPTools_AlgoTools::AreFacesSameDomain not very smart.
123 Standard_Boolean aRes = BOPTools_AlgoTools::AreFacesSameDomain(aMyFace, aInFace, aContext)
124 && BOPTools_AlgoTools::AreFacesSameDomain(aInFace, aMyFace, aContext);
126 return aRes == Standard_True;
129 static Handle(Geom_Surface) baseSurface(const TopoDS_Face& theFace)
131 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
132 while (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
133 Handle(Geom_RectangularTrimmedSurface) rts =
134 Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
135 aSurf = rts->BasisSurface();
140 bool GeomAPI_Face::isSameGeometry(const std::shared_ptr<GeomAPI_Shape> theShape) const
142 if (!theShape->isFace())
144 if (isSame(theShape))
147 GeomFacePtr anOther = theShape->face();
148 if (isPlanar() && anOther->isPlanar()) {
149 GeomPlanePtr anOwnPlane = getPlane();
150 GeomPlanePtr anOtherPlane = anOther->getPlane();
151 return anOwnPlane->isCoincident(anOtherPlane);
154 TopoDS_Face anOwnFace = TopoDS::Face(impl<TopoDS_Shape>());
155 TopoDS_Face anOtherFace = TopoDS::Face(theShape->impl<TopoDS_Shape>());
157 Handle(Geom_Surface) anOwnSurf = baseSurface(anOwnFace);
158 Handle(Geom_Surface) anOtherSurf = baseSurface(anOtherFace);
159 if (anOwnSurf == anOtherSurf)
162 // case of two elementary surfaces
163 if (anOwnSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
164 anOtherSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
166 #if OCC_VERSION_LARGE < 0x07070000
167 Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(anOwnSurf);
168 Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(anOtherSurf);
170 Handle(GeomAdaptor_Surface) aGA1 = new GeomAdaptor_Surface(anOwnSurf);
171 Handle(GeomAdaptor_Surface) aGA2 = new GeomAdaptor_Surface(anOtherSurf);
174 Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
175 Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
178 IntPatch_ImpImpIntersection anIIInt(aGA1, aTT1, aGA2, aTT2,
179 Precision::Confusion(),
180 Precision::Confusion());
181 if (!anIIInt.IsDone() || anIIInt.IsEmpty())
184 return anIIInt.TangentFaces();
186 catch (Standard_Failure const&) {
191 // case of two cylindrical surfaces, at least one of which is a swept surface
192 // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
193 if ((anOwnSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
194 anOwnSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
195 (anOtherSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
196 anOtherSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
198 GeomCylinderPtr anOwnCyl = getCylinder();
199 GeomCylinderPtr anOtherCyl = anOther->getCylinder();
200 if (anOwnCyl && anOtherCyl)
201 return anOwnCyl->isCoincident(anOtherCyl);
203 // compare two swept surfaces of the same type
204 if ((anOwnSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) &&
205 anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) ||
206 (anOwnSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)) &&
207 anOtherSurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)))) {
208 Handle(Geom_SweptSurface) anOwnSwept = Handle(Geom_SweptSurface)::DownCast(anOwnSurf);
209 Handle(Geom_SweptSurface) anOtherSwept = Handle(Geom_SweptSurface)::DownCast(anOtherSurf);
211 const gp_Dir& anOwnDir = anOwnSwept->Direction();
212 const gp_Dir& anOtherDir = anOtherSwept->Direction();
214 if (anOwnDir.IsParallel(anOtherDir, Precision::Angular())) {
215 Handle(Geom_Curve) anOwnCurve = anOwnSwept->BasisCurve();
216 Handle(Geom_Curve) anOtherCurve = anOtherSwept->BasisCurve();
217 GeomAPI_ExtremaCurveCurve anExtrema(anOwnCurve, anOtherCurve);
218 return anExtrema.Extrema().IsParallel() &&
219 anExtrema.TotalLowerDistance() < Precision::Confusion();
227 bool GeomAPI_Face::isCylindrical() const
229 const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
230 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
231 Handle(Geom_RectangularTrimmedSurface) aTrimmed =
232 Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
233 if (!aTrimmed.IsNull())
234 aSurf = aTrimmed->BasisSurface();
235 return aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) == Standard_True;
238 std::shared_ptr<GeomAPI_Pln> GeomAPI_Face::getPlane() const
240 std::shared_ptr<GeomAPI_Pln> aResult;
241 TopoDS_Shape aShape = this->impl<TopoDS_Shape>();
243 return aResult; // null shape
244 if (aShape.ShapeType() != TopAbs_FACE)
245 return aResult; // not face
246 TopoDS_Face aFace = TopoDS::Face(aShape);
248 return aResult; // not face
249 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
251 return aResult; // no surface
252 GeomLib_IsPlanarSurface isPlanarSurf(aSurf);
254 bool isPlanar = false;
255 if (isPlanarSurf.IsPlanar()) {
256 aPln = isPlanarSurf.Plan();
259 else if (aSurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
260 Handle(Geom_OffsetSurface) anOffsetSurf = Handle(Geom_OffsetSurface)::DownCast(aSurf);
261 Handle(Geom_Surface) aBasisSurf = anOffsetSurf->BasisSurface();
262 if (aBasisSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
263 aPln = Handle(Geom_Plane)::DownCast(aBasisSurf)->Pln();
264 gp_Vec aTranslation(aPln.Axis().Direction().XYZ() * anOffsetSurf->Offset());
265 aPln.Translate(aTranslation);
271 double aA, aB, aC, aD;
272 aPln.Coefficients(aA, aB, aC, aD);
273 if (aFace.Orientation() == TopAbs_REVERSED) {
279 aResult = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
284 std::shared_ptr<GeomAPI_Sphere> GeomAPI_Face::getSphere() const
286 GeomSpherePtr aSphere;
288 const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
289 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
290 if (aSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
291 gp_Sphere aSph = Handle(Geom_SphericalSurface)::DownCast(aSurf)->Sphere();
292 const gp_Pnt& aCenter = aSph.Location();
293 double aRadius = aSph.Radius();
295 GeomPointPtr aCenterPnt(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z()));
296 aSphere = GeomSpherePtr(new GeomAPI_Sphere(aCenterPnt, aRadius));
301 std::shared_ptr<GeomAPI_Cylinder> GeomAPI_Face::getCylinder() const
303 GeomCylinderPtr aCylinder;
305 const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
306 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
307 if (aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
308 gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(aSurf)->Cylinder();
309 gp_Pnt aLoc = aCyl.Location();
310 const gp_Dir& aDir = aCyl.Position().Direction();
311 double aRadius = aCyl.Radius();
313 double aUMin, aUMax, aVMin, aVMax;
314 BRepTools::UVBounds(aFace, aUMin, aUMax, aVMin, aVMax);
315 double aHeight = aVMax - aVMin;
317 aLoc.ChangeCoord() += aDir.XYZ() * aVMin;
318 GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
319 GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
320 aCylinder = GeomCylinderPtr(new GeomAPI_Cylinder(aLocation, aDirection, aRadius, aHeight));
325 std::shared_ptr<GeomAPI_Cone> GeomAPI_Face::getCone() const
329 const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
330 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
331 if (aSurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
332 gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(aSurf)->Cone();
333 gp_Pnt aLoc = aCon.Location();
334 gp_Dir aDir = aCon.Position().Direction();
336 double aUMin, aUMax, aVMin, aVMax;
337 BRepTools::UVBounds(aFace, aUMin, aUMax, aVMin, aVMax);
339 double aSemiAngle = Abs(aCon.SemiAngle());
340 double aRadius1 = Abs(aCon.RefRadius() + aVMin * Sin(aCon.SemiAngle()));
341 double aRadius2 = Abs(aCon.RefRadius() + aVMax * Sin(aCon.SemiAngle()));
343 aLoc.ChangeCoord() += aDir.XYZ() * aVMin * Cos(aCon.SemiAngle());
345 GeomPointPtr aLocation(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
346 GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
347 aCone = GeomConePtr(new GeomAPI_Cone(aLocation, aDirection, aSemiAngle, aRadius1, aRadius2));
352 std::shared_ptr<GeomAPI_Torus> GeomAPI_Face::getTorus() const
356 const TopoDS_Face& aFace = TopoDS::Face(impl<TopoDS_Shape>());
357 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
358 if (aSurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
359 gp_Torus aTor = Handle(Geom_ToroidalSurface)::DownCast(aSurf)->Torus();
360 const gp_Pnt& aLoc = aTor.Location();
361 const gp_Dir& aDir = aTor.Position().Direction();
362 double aMajorRadius = aTor.MajorRadius();
363 double aMinorRadius = aTor.MinorRadius();
365 GeomPointPtr aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
366 GeomDirPtr aDirection(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
367 aTorus = GeomTorusPtr(new GeomAPI_Torus(aCenter, aDirection, aMajorRadius, aMinorRadius));
372 GeomPointPtr GeomAPI_Face::middlePoint() const
374 GeomPointPtr anInnerPoint;
376 const TopoDS_Face& aFace = impl<TopoDS_Face>();
380 double aUMin, aUMax, aVMin, aVMax;
381 optimalBounds(aFace, aUMin, aUMax, aVMin, aVMax);
383 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
387 gp_Pnt aPnt = aSurf->Value((aUMin + aUMax) * 0.5, (aVMin + aVMax) * 0.5);
388 anInnerPoint = GeomPointPtr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));
393 // ================== Auxiliary functions ========================
395 void optimalBounds(const TopoDS_Face& theFace, const TopoDS_Edge& theEdge, Bnd_Box2d& theBndBox)
397 Standard_Real aFirst, aLast;
398 const Handle(Geom2d_Curve) aC2D = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
402 Standard_Real aXmin = 0.0, aYmin = 0.0, aXmax = 0.0, aYmax = 0.0;
403 Standard_Real aUmin, aUmax, aVmin, aVmax;
404 Bnd_Box2d aBoxC, aBoxS;
405 BndLib_Add2dCurve::AddOptimal(aC2D, aFirst, aLast, 0., aBoxC);
409 aBoxC.Get(aXmin, aYmin, aXmax, aYmax);
411 TopLoc_Location aLoc;
412 Handle(Geom_Surface) aS = BRep_Tool::Surface(theFace, aLoc);
413 aS->Bounds(aUmin, aUmax, aVmin, aVmax);
415 if (aS->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface))
417 const Handle(Geom_RectangularTrimmedSurface) aSt =
418 Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
419 aS = aSt->BasisSurface();
423 if (!aS->IsUPeriodic())
425 Standard_Boolean isUPeriodic = Standard_False;
427 // Additional verification for U-periodicity for B-spline surfaces.
428 // 1. Verify that the surface is U-closed (if such flag is false). Verification uses 2 points.
429 // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 or 6 points.
430 if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) &&
431 (aXmin < aUmin || aXmax > aUmax))
433 Standard_Real aTol2 = 100 * Precision::SquareConfusion();
434 isUPeriodic = Standard_True;
436 // 1. Verify that the surface is U-closed
437 if (!aS->IsUClosed())
439 Standard_Real aVStep = aVmax - aVmin;
440 for (Standard_Real aV = aVmin; aV <= aVmax; aV += aVStep)
442 P1 = aS->Value(aUmin, aV);
443 P2 = aS->Value(aUmax, aV);
444 if (P1.SquareDistance(P2) > aTol2)
446 isUPeriodic = Standard_False;
451 // 2. Verify periodicity of surface inside UV-bounds of the edge
452 if (isUPeriodic) // the flag still not changed
454 Standard_Real aV = (aVmin + aVmax) * 0.5;
455 Standard_Real aU[6]; // values of U lying out of surface boundaries
456 Standard_Real aUpp[6]; // corresponding U-values plus/minus period
457 Standard_Integer aNbPnt = 0;
461 aU[1] = (aXmin + aUmin) * 0.5;
463 aUpp[0] = aU[0] + aUmax - aUmin;
464 aUpp[1] = aU[1] + aUmax - aUmin;
465 aUpp[2] = aU[2] + aUmax - aUmin;
471 aU[aNbPnt + 1] = (aXmax + aUmax) * 0.5;
472 aU[aNbPnt + 2] = aXmax;
473 aUpp[aNbPnt] = aU[aNbPnt] - aUmax + aUmin;
474 aUpp[aNbPnt + 1] = aU[aNbPnt + 1] - aUmax + aUmin;
475 aUpp[aNbPnt + 2] = aU[aNbPnt + 2] - aUmax + aUmin;
478 for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++)
480 P1 = aS->Value(aU[anInd], aV);
481 P2 = aS->Value(aUpp[anInd], aV);
482 if (P1.SquareDistance(P2) > aTol2)
484 isUPeriodic = Standard_False;
493 if ((aXmin < aUmin) && (aUmin < aXmax))
497 if ((aXmin < aUmax) && (aUmax < aXmax))
504 if (!aS->IsVPeriodic())
506 Standard_Boolean isVPeriodic = Standard_False;
508 // Additional verification for V-periodicity for B-spline surfaces.
509 // 1. Verify that the surface is V-closed (if such flag is false). Verification uses 2 points.
510 // 2. Verify periodicity of surface inside UV-bounds of the edge. It uses 3 or 6 points.
511 if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) &&
512 (aYmin < aVmin || aYmax > aVmax))
514 Standard_Real aTol2 = 100 * Precision::SquareConfusion();
515 isVPeriodic = Standard_True;
517 // 1. Verify that the surface is V-closed
518 if (!aS->IsVClosed())
520 Standard_Real aUStep = aUmax - aUmin;
521 for (Standard_Real aU = aUmin; aU <= aUmax; aU += aUStep)
523 P1 = aS->Value(aU, aVmin);
524 P2 = aS->Value(aU, aVmax);
525 if (P1.SquareDistance(P2) > aTol2)
527 isVPeriodic = Standard_False;
532 // 2. Verify periodicity of surface inside UV-bounds of the edge
533 if (isVPeriodic) // the flag still not changed
535 Standard_Real aU = (aUmin + aUmax) * 0.5;
536 Standard_Real aV[6]; // values of V lying out of surface boundaries
537 Standard_Real aVpp[6]; // corresponding V-values plus/minus period
538 Standard_Integer aNbPnt = 0;
542 aV[1] = (aYmin + aVmin) * 0.5;
544 aVpp[0] = aV[0] + aVmax - aVmin;
545 aVpp[1] = aV[1] + aVmax - aVmin;
546 aVpp[2] = aV[2] + aVmax - aVmin;
552 aV[aNbPnt + 1] = (aYmax + aVmax) * 0.5;
553 aV[aNbPnt + 2] = aYmax;
554 aVpp[aNbPnt] = aV[aNbPnt] - aVmax + aVmin;
555 aVpp[aNbPnt + 1] = aV[aNbPnt + 1] - aVmax + aVmin;
556 aVpp[aNbPnt + 2] = aV[aNbPnt + 2] - aVmax + aVmin;
559 for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++)
561 P1 = aS->Value(aU, aV[anInd]);
562 P2 = aS->Value(aU, aVpp[anInd]);
563 if (P1.SquareDistance(P2) > aTol2)
565 isVPeriodic = Standard_False;
574 if ((aYmin < aVmin) && (aVmin < aYmax))
578 if ((aYmin < aVmax) && (aVmax < aYmax))
585 aBoxS.Update(aXmin, aYmin, aXmax, aYmax);
587 theBndBox.Add(aBoxS);
590 void optimalBounds(const TopoDS_Face& theFace, double& theUMin, double& theUMax,
591 double& theVMin, double& theVMax)
595 for (TopExp_Explorer anExp(theFace, TopAbs_EDGE); anExp.More(); anExp.Next())
596 optimalBounds(theFace, TopoDS::Edge(anExp.Current()), aBB);
598 aBB.Get(theUMin, theVMin, theUMax, theVMax);