|
|
|||
File indexing completed on 2026-09-24 09:15:21
0001 // Copyright (c) 2013 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _BRepMesh_CircleTool_HeaderFile 0015 #define _BRepMesh_CircleTool_HeaderFile 0016 0017 #include <Standard.hxx> 0018 #include <Standard_DefineAlloc.hxx> 0019 #include <Standard_Macro.hxx> 0020 0021 #include <Standard_Real.hxx> 0022 #include <BRepMesh_CircleInspector.hxx> 0023 #include <gp_XY.hxx> 0024 #include <Standard_Integer.hxx> 0025 #include <Standard_Boolean.hxx> 0026 #include <IMeshData_Types.hxx> 0027 #include <NCollection_Array1.hxx> 0028 0029 class gp_Circ2d; 0030 0031 //! Create sort and destroy the circles used in triangulation. 0032 class BRepMesh_CircleTool 0033 { 0034 public: 0035 DEFINE_STANDARD_ALLOC 0036 0037 //! Constructor. 0038 //! @param theAllocator memory allocator to be used by internal structures. 0039 Standard_EXPORT BRepMesh_CircleTool(const occ::handle<NCollection_IncAllocator>& theAllocator); 0040 0041 //! Constructor. 0042 //! @param theReservedSize size to be reserved for vector of circles. 0043 //! @param theAllocator memory allocator to be used by internal structures. 0044 Standard_EXPORT BRepMesh_CircleTool(const int theReservedSize, 0045 const occ::handle<NCollection_IncAllocator>& theAllocator); 0046 0047 //! Initializes the tool. 0048 //! @param theReservedSize size to be reserved for vector of circles. 0049 void Init(const int /*theReservedSize*/) { myTolerance = Precision::PConfusion(); } 0050 0051 //! Sets new size for cell filter. 0052 //! @param theSize cell size to be set for X and Y dimensions. 0053 void SetCellSize(const double theSize) { myCellFilter.Reset(theSize, myAllocator); } 0054 0055 //! Sets new size for cell filter. 0056 //! @param theSizeX cell size to be set for X dimension. 0057 //! @param theSizeY cell size to be set for Y dimension. 0058 void SetCellSize(const double theSizeX, const double theSizeY) 0059 { 0060 double aCellSizeC[2] = {theSizeX, theSizeY}; 0061 NCollection_Array1<double> aCellSize(aCellSizeC[0], 1, 2); 0062 myCellFilter.Reset(aCellSize, myAllocator); 0063 } 0064 0065 //! Sets limits of inspection area. 0066 //! @param theMin bottom left corner of inspection area. 0067 //! @param theMax top right corner of inspection area. 0068 void SetMinMaxSize(const gp_XY& theMin, const gp_XY& theMax) 0069 { 0070 myFaceMin = theMin; 0071 myFaceMax = theMax; 0072 } 0073 0074 //! Returns true if cell filter contains no circle. 0075 bool IsEmpty() const { return mySelector.Circles().IsEmpty(); } 0076 0077 //! Binds the circle to the tool. 0078 //! @param theIndex index a circle should be bound with. 0079 //! @param theCircle circle to be bound. 0080 Standard_EXPORT void Bind(const int theIndex, const gp_Circ2d& theCircle); 0081 0082 //! Computes circle on three points. 0083 //! @param thePoint1 first point. 0084 //! @param thePoint2 second point. 0085 //! @param thePoint3 third point. 0086 //! @param[out] theLocation center of computed circle. 0087 //! @param[out] theRadius radius of computed circle. 0088 //! @return FALSE in case of impossibility to build a circle 0089 //! on the given points, TRUE elsewhere. 0090 Standard_EXPORT static bool MakeCircle(const gp_XY& thePoint1, 0091 const gp_XY& thePoint2, 0092 const gp_XY& thePoint3, 0093 gp_XY& theLocation, 0094 double& theRadius); 0095 0096 //! Computes circle on three points and bind it to the tool. 0097 //! @param theIndex index a circle should be bound with. 0098 //! @param thePoint1 first point. 0099 //! @param thePoint2 second point. 0100 //! @param thePoint3 third point. 0101 //! @return FALSE in case of impossibility to build a circle 0102 //! on the given points, TRUE elsewhere. 0103 Standard_EXPORT bool Bind(const int theIndex, 0104 const gp_XY& thePoint1, 0105 const gp_XY& thePoint2, 0106 const gp_XY& thePoint3); 0107 0108 //! Binds implicit zero circle. 0109 //! @param theIndex index a zero circle should be bound with. 0110 Standard_EXPORT void MocBind(const int theIndex); 0111 0112 //! Deletes a circle from the tool. 0113 //! @param theIndex index of a circle to be removed. 0114 Standard_EXPORT void Delete(const int theIndex); 0115 0116 //! Select the circles shot by the given point. 0117 //! @param thePoint bullet point. 0118 Standard_EXPORT IMeshData::ListOfInteger& Select(const gp_XY& thePoint); 0119 0120 private: 0121 //! Creates circle with the given parameters and binds it to the tool. 0122 //! @param theIndex index a circle should be bound with. 0123 //! @param theLocation location of a circle. 0124 //! @param theRadius radius of a circle. 0125 void bind(const int theIndex, const gp_XY& theLocation, const double theRadius); 0126 0127 private: 0128 double myTolerance; 0129 occ::handle<NCollection_IncAllocator> myAllocator; 0130 IMeshData::CircleCellFilter myCellFilter; 0131 BRepMesh_CircleInspector mySelector; 0132 gp_XY myFaceMax; 0133 gp_XY myFaceMin; 0134 }; 0135 0136 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|