Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1992-11-24
0002 // Created by: Didier PIFFAULT
0003 // Copyright (c) 1992-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 _Bnd_BoundSortBox_HeaderFile
0018 #define _Bnd_BoundSortBox_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Bnd_Box.hxx>
0025 #include <Bnd_HArray1OfBox.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TColStd_DataMapOfIntegerInteger.hxx>
0028 #include <TColStd_ListOfInteger.hxx>
0029 class gp_Pln;
0030 
0031 
0032 //! A tool to compare a bounding box or a plane with a set of
0033 //! bounding boxes. It sorts the set of bounding boxes to give
0034 //! the list of boxes which intersect the element being compared.
0035 //! The boxes being sorted generally bound a set of shapes,
0036 //! while the box being compared bounds a shape to be
0037 //! compared. The resulting list of intersecting boxes therefore
0038 //! gives the list of items which potentially intersect the shape to be compared.
0039 class Bnd_BoundSortBox 
0040 {
0041 public:
0042 
0043   DEFINE_STANDARD_ALLOC
0044 
0045   
0046   //! Constructs an empty comparison algorithm for bounding boxes.
0047   //! The bounding boxes are then defined using the Initialize function.
0048   Standard_EXPORT Bnd_BoundSortBox();
0049   
0050   //! Initializes this comparison algorithm with
0051   //! -   the set of bounding boxes SetOfBox.
0052   Standard_EXPORT void Initialize (const Bnd_Box& CompleteBox, const Handle(Bnd_HArray1OfBox)& SetOfBox);
0053   
0054   //! Initializes this comparison algorithm with
0055   //! -   the set of bounding boxes SetOfBox, where
0056   //! CompleteBox is given as the global bounding box of SetOfBox.
0057   Standard_EXPORT void Initialize (const Handle(Bnd_HArray1OfBox)& SetOfBox);
0058   
0059   //! Initializes this comparison algorithm, giving it only
0060   //! -   the maximum number nbComponents
0061   //! of the bounding boxes to be managed. Use the Add
0062   //! function to define the array of bounding boxes to be sorted by this algorithm.
0063   Standard_EXPORT void Initialize (const Bnd_Box& CompleteBox, const Standard_Integer nbComponents);
0064   
0065   //! Adds the bounding box theBox at position boxIndex in
0066   //! the array of boxes to be sorted by this comparison algorithm.
0067   //! This function is used only in conjunction with the third
0068   //! syntax described in the synopsis of Initialize.
0069   //!
0070   //! Exceptions:
0071   //!
0072   //! - Standard_OutOfRange if boxIndex is not in the
0073   //! range [ 1,nbComponents ] where
0074   //! nbComponents is the maximum number of bounding
0075   //! boxes declared for this comparison algorithm at
0076   //! initialization.
0077   //!
0078   //! - Standard_MultiplyDefined if a box already exists at
0079   //! position boxIndex in the array of boxes to be sorted by
0080   //! this comparison algorithm.
0081   Standard_EXPORT void Add (const Bnd_Box& theBox, const Standard_Integer boxIndex);
0082   
0083   //! Compares the bounding box theBox,
0084   //! with the set of bounding boxes to be sorted by this
0085   //! comparison algorithm, and returns the list of intersecting
0086   //! bounding boxes as a list of indexes on the array of
0087   //! bounding boxes used by this algorithm.
0088   Standard_EXPORT const TColStd_ListOfInteger& Compare (const Bnd_Box& theBox);
0089   
0090   //! Compares the plane P
0091   //! with the set of bounding boxes to be sorted by this
0092   //! comparison algorithm, and returns the list of intersecting
0093   //! bounding boxes as a list of indexes on the array of
0094   //! bounding boxes used by this algorithm.
0095   Standard_EXPORT const TColStd_ListOfInteger& Compare (const gp_Pln& P);
0096   
0097   Standard_EXPORT void Dump() const;
0098   
0099   Standard_EXPORT void Destroy();
0100 ~Bnd_BoundSortBox()
0101 {
0102   Destroy();
0103 }
0104 
0105 
0106 
0107 
0108 protected:
0109 
0110 
0111 
0112 
0113 
0114 private:
0115 
0116   
0117   //! Prepares  BoundSortBox and  sorts   the  boxes of
0118   //! <SetOfBox> .
0119   Standard_EXPORT void SortBoxes();
0120 
0121 
0122   Bnd_Box myBox;
0123   Handle(Bnd_HArray1OfBox) myBndComponents;
0124   Standard_Real Xmin;
0125   Standard_Real Ymin;
0126   Standard_Real Zmin;
0127   Standard_Real deltaX;
0128   Standard_Real deltaY;
0129   Standard_Real deltaZ;
0130   Standard_Integer discrX;
0131   Standard_Integer discrY;
0132   Standard_Integer discrZ;
0133   Standard_Integer theFound;
0134   TColStd_DataMapOfIntegerInteger Crible;
0135   TColStd_ListOfInteger lastResult;
0136   Standard_Address TabBits;
0137 
0138 
0139 };
0140 
0141 
0142 
0143 
0144 
0145 
0146 
0147 #endif // _Bnd_BoundSortBox_HeaderFile