Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:09

0001 // Created on: 1993-07-22
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepBndLib_HeaderFile
0018 #define _BRepBndLib_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 class TopoDS_Shape;
0024 class Bnd_Box;
0025 class Bnd_OBB;
0026 
0027 
0028 //! This package provides the bounding boxes for curves
0029 //! and surfaces from BRepAdaptor.
0030 //! Functions to add a topological shape to a bounding box
0031 class BRepBndLib 
0032 {
0033 public:
0034 
0035   DEFINE_STANDARD_ALLOC
0036 
0037   
0038   //! Adds the shape S to the bounding box B.
0039   //! More precisely are successively added to B:
0040   //! -   each face of S; the triangulation of the face is used if it exists,
0041   //! -   then each edge of S which does not belong to a face,
0042   //! the polygon of the edge is used if it exists
0043   //! -   and last each vertex of S which does not belong to an edge.
0044   //! After each elementary operation, the bounding box B is
0045   //! enlarged by the tolerance value of the relative sub-shape.
0046   //! When working with the triangulation of a face this value of
0047   //! enlargement is the sum of the triangulation deflection and
0048   //! the face tolerance. When working with the
0049   //! polygon of an edge this value of enlargement is
0050   //! the sum of the polygon deflection and the edge tolerance.
0051   //! Warning
0052   //! -   This algorithm is time consuming if triangulation has not
0053   //! been inserted inside the data structure of the shape S.
0054   //! -   The resulting bounding box may be somewhat larger than the object.
0055   Standard_EXPORT static void Add (const TopoDS_Shape& S, Bnd_Box& B, const Standard_Boolean useTriangulation = Standard_True);
0056   
0057   //! Adds the shape S to the bounding box B.
0058   //! This is a quick algorithm but only works if the shape S is
0059   //! composed of polygonal planar faces, as is the case if S is
0060   //! an approached polyhedral representation of an exact
0061   //! shape. Pay particular attention to this because this
0062   //! condition is not checked and, if it not respected, an error
0063   //! may occur in the algorithm for which the bounding box is built.
0064   //! Note that the resulting bounding box is not enlarged by the
0065   //! tolerance value of the sub-shapes as is the case with the
0066   //! Add function. So the added part of the resulting bounding
0067   //! box is closer to the shape S.
0068   Standard_EXPORT static void AddClose (const TopoDS_Shape& S, Bnd_Box& B);
0069 
0070   //! Adds the shape S to the bounding box B.
0071   //! This algorithm builds precise bounding box,
0072   //! which differs from exact geometry boundaries of shape only on shape entities tolerances
0073   //! Algorithm is the same as for method Add(..), but uses more precise methods for building boxes 
0074   //! for geometry objects.
0075   //! If useShapeTolerance = True, bounding box is enlardged by shape tolerances and 
0076   //! these tolerances are used for numerical methods of bounding box size calculations, 
0077   //! otherwise bounding box is built according to sizes of uderlined geometrical entities,
0078   //! numerical calculation use tolerance Precision::Confusion().
0079   Standard_EXPORT static void AddOptimal (const TopoDS_Shape& S, Bnd_Box& B, 
0080                                           const Standard_Boolean useTriangulation = Standard_True,
0081                                           const Standard_Boolean useShapeTolerance = Standard_False);
0082 
0083 
0084   //! Computes the Oriented Bounding box for the shape <theS>.
0085   //! Two independent methods of computation are implemented:
0086   //! first method based on set of points (so, it demands the
0087   //! triangulated shape or shape with planar faces and linear edges).
0088   //! The second method is based on use of inertia axes and is called
0089   //! if use of the first method is impossible.
0090   //! If theIsTriangulationUsed == FALSE then the triangulation will
0091   //! be ignored at all. 
0092   //! If theIsShapeToleranceUsed == TRUE then resulting box will be
0093   //! extended on the tolerance of the shape.
0094   //! theIsOptimal flag defines whether to look for the more tight
0095   //! OBB for the cost of performance or not.
0096   Standard_EXPORT static 
0097     void AddOBB(const TopoDS_Shape& theS,
0098                 Bnd_OBB& theOBB,
0099                 const Standard_Boolean theIsTriangulationUsed = Standard_True,
0100                 const Standard_Boolean theIsOptimal = Standard_False,
0101                 const Standard_Boolean theIsShapeToleranceUsed = Standard_True);
0102 
0103 protected:
0104 
0105 
0106 
0107 
0108 
0109 private:
0110 
0111 
0112 
0113 
0114 
0115 };
0116 
0117 
0118 
0119 
0120 
0121 
0122 
0123 #endif // _BRepBndLib_HeaderFile