|
|
|||
File indexing completed on 2026-09-26 09:02:37
0001 // Created on: 1998-08-26 0002 // Created by: Julia GERASIMOVA 0003 // Copyright (c) 1998-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 _BRepFill_Filling_HeaderFile 0018 #define _BRepFill_Filling_HeaderFile 0019 0020 #include <BRepFill_EdgeFaceAndOrder.hxx> 0021 #include <NCollection_Sequence.hxx> 0022 #include <BRepFill_FaceAndOrder.hxx> 0023 #include <GeomAbs_Shape.hxx> 0024 #include <GeomPlate_BuildPlateSurface.hxx> 0025 #include <GeomPlate_PointConstraint.hxx> 0026 #include <TopoDS_Face.hxx> 0027 #include <TopoDS_Shape.hxx> 0028 #include <TopTools_ShapeMapHasher.hxx> 0029 #include <NCollection_DataMap.hxx> 0030 #include <NCollection_List.hxx> 0031 0032 #include <memory> 0033 0034 class TopoDS_Edge; 0035 class gp_Pnt; 0036 0037 //! N-Side Filling 0038 //! This algorithm avoids to build a face from: 0039 //! * a set of edges defining the bounds of the face and some 0040 //! constraints the surface support has to satisfy 0041 //! * a set of edges and points defining some constraints 0042 //! the support surface has to satisfy 0043 //! * an initial surface to deform for satisfying the constraints 0044 //! * a set of parameters to control the constraints. 0045 //! 0046 //! The support surface of the face is computed by deformation 0047 //! of the initial surface in order to satisfy the given constraints. 0048 //! The set of bounding edges defines the wire of the face. 0049 //! 0050 //! If no initial surface is given, the algorithm computes it 0051 //! automatically. 0052 //! If the set of edges is not connected (Free constraint) 0053 //! missing edges are automatically computed. 0054 //! 0055 //! Limitations: 0056 //! * If some constraints are not compatible 0057 //! The algorithm does not take them into account. 0058 //! So the constraints will not be satisfied in an area containing 0059 //! the incompatibilities. 0060 //! * The constraints defining the bound of the face have to be 0061 //! entered in order to have a continuous wire. 0062 //! 0063 //! Other Applications: 0064 //! * Deformation of a face to satisfy internal constraints 0065 //! * Deformation of a face to improve Gi continuity with 0066 //! connected faces 0067 class BRepFill_Filling 0068 { 0069 public: 0070 DEFINE_STANDARD_ALLOC 0071 0072 //! Constructor 0073 Standard_EXPORT BRepFill_Filling(const int Degree = 3, 0074 const int NbPtsOnCur = 15, 0075 const int NbIter = 2, 0076 const bool Anisotropie = false, 0077 const double Tol2d = 0.00001, 0078 const double Tol3d = 0.0001, 0079 const double TolAng = 0.01, 0080 const double TolCurv = 0.1, 0081 const int MaxDeg = 8, 0082 const int MaxSegments = 9); 0083 0084 //! Sets the values of Tolerances used to control the constraint. 0085 //! Tol2d: 0086 //! Tol3d: it is the maximum distance allowed between the support surface 0087 //! and the constraints 0088 //! TolAng: it is the maximum angle allowed between the normal of the surface 0089 //! and the constraints 0090 //! TolCurv: it is the maximum difference of curvature allowed between 0091 //! the surface and the constraint 0092 Standard_EXPORT void SetConstrParam(const double Tol2d = 0.00001, 0093 const double Tol3d = 0.0001, 0094 const double TolAng = 0.01, 0095 const double TolCurv = 0.1); 0096 0097 //! Sets the parameters used for resolution. 0098 //! The default values of these parameters have been chosen for a good 0099 //! ratio quality/performance. 0100 //! Degree: it is the order of energy criterion to minimize for computing 0101 //! the deformation of the surface. 0102 //! The default value is 3 0103 //! The recommended value is i+2 where i is the maximum order of the 0104 //! constraints. 0105 //! NbPtsOnCur: it is the average number of points for discretisation 0106 //! of the edges. 0107 //! NbIter: it is the maximum number of iterations of the process. 0108 //! For each iteration the number of discretisation points is 0109 //! increased. 0110 //! Anisotropie: 0111 Standard_EXPORT void SetResolParam(const int Degree = 3, 0112 const int NbPtsOnCur = 15, 0113 const int NbIter = 2, 0114 const bool Anisotropie = false); 0115 0116 //! Sets the parameters used for approximation of the surface 0117 Standard_EXPORT void SetApproxParam(const int MaxDeg = 8, const int MaxSegments = 9); 0118 0119 //! Loads the initial Surface 0120 //! The initial surface must have orthogonal local coordinates, 0121 //! i.e. partial derivatives dS/du and dS/dv must be orthogonal 0122 //! at each point of surface. 0123 //! If this condition breaks, distortions of resulting surface 0124 //! are possible. 0125 Standard_EXPORT void LoadInitSurface(const TopoDS_Face& aFace); 0126 0127 //! Adds a new constraint which also defines an edge of the wire 0128 //! of the face 0129 //! Order: Order of the constraint: 0130 //! GeomAbs_C0 : the surface has to pass by 3D representation 0131 //! of the edge 0132 //! GeomAbs_G1 : the surface has to pass by 3D representation 0133 //! of the edge and to respect tangency with the first 0134 //! face of the edge 0135 //! GeomAbs_G2 : the surface has to pass by 3D representation 0136 //! of the edge and to respect tangency and curvature 0137 //! with the first face of the edge. 0138 Standard_EXPORT int Add(const TopoDS_Edge& anEdge, 0139 const GeomAbs_Shape Order, 0140 const bool IsBound = true); 0141 0142 //! Adds a new constraint which also defines an edge of the wire 0143 //! of the face 0144 //! Order: Order of the constraint: 0145 //! GeomAbs_C0 : the surface has to pass by 3D representation 0146 //! of the edge 0147 //! GeomAbs_G1 : the surface has to pass by 3D representation 0148 //! of the edge and to respect tangency with the 0149 //! given face 0150 //! GeomAbs_G2 : the surface has to pass by 3D representation 0151 //! of the edge and to respect tangency and curvature 0152 //! with the given face. 0153 Standard_EXPORT int Add(const TopoDS_Edge& anEdge, 0154 const TopoDS_Face& Support, 0155 const GeomAbs_Shape Order, 0156 const bool IsBound = true); 0157 0158 //! Adds a free constraint on a face. The corresponding edge has to 0159 //! be automatically recomputed. 0160 //! It is always a bound. 0161 Standard_EXPORT int Add(const TopoDS_Face& Support, const GeomAbs_Shape Order); 0162 0163 //! Adds a punctual constraint 0164 Standard_EXPORT int Add(const gp_Pnt& Point); 0165 0166 //! Adds a punctual constraint. 0167 Standard_EXPORT int Add(const double U, 0168 const double V, 0169 const TopoDS_Face& Support, 0170 const GeomAbs_Shape Order); 0171 0172 //! Builds the resulting faces 0173 Standard_EXPORT void Build(); 0174 0175 Standard_EXPORT bool IsDone() const; 0176 0177 Standard_EXPORT TopoDS_Face Face() const; 0178 0179 //! Returns the list of shapes generated from the 0180 //! shape <S>. 0181 Standard_EXPORT const NCollection_List<TopoDS_Shape>& Generated(const TopoDS_Shape& S); 0182 0183 Standard_EXPORT double G0Error() const; 0184 0185 Standard_EXPORT double G1Error() const; 0186 0187 Standard_EXPORT double G2Error() const; 0188 0189 Standard_EXPORT double G0Error(const int Index); 0190 0191 Standard_EXPORT double G1Error(const int Index); 0192 0193 Standard_EXPORT double G2Error(const int Index); 0194 0195 private: 0196 //! Adds constraints to builder 0197 Standard_EXPORT void AddConstraints( 0198 const NCollection_Sequence<BRepFill_EdgeFaceAndOrder>& SeqOfConstraints); 0199 0200 //! Builds wires of maximum length 0201 Standard_EXPORT void BuildWires(NCollection_List<TopoDS_Shape>& EdgeList, 0202 NCollection_List<TopoDS_Shape>& WireList); 0203 0204 //! Finds extremities of future edges to fix the holes between wires. 0205 //! Can properly operate only with convex contour 0206 Standard_EXPORT void FindExtremitiesOfHoles(const NCollection_List<TopoDS_Shape>& WireList, 0207 NCollection_Sequence<TopoDS_Shape>& VerSeq) const; 0208 0209 private: 0210 std::shared_ptr<GeomPlate_BuildPlateSurface> myBuilder; 0211 NCollection_Sequence<BRepFill_EdgeFaceAndOrder> myBoundary; 0212 NCollection_Sequence<BRepFill_EdgeFaceAndOrder> myConstraints; 0213 NCollection_Sequence<BRepFill_FaceAndOrder> myFreeConstraints; 0214 NCollection_Sequence<occ::handle<GeomPlate_PointConstraint>> myPoints; 0215 NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myOldNewMap; 0216 NCollection_List<TopoDS_Shape> myGenerated; 0217 TopoDS_Face myFace; 0218 TopoDS_Face myInitFace; 0219 double myTol2d; 0220 double myTol3d; 0221 double myTolAng; 0222 double myTolCurv; 0223 int myMaxDeg; 0224 int myMaxSegments; 0225 int myDegree; 0226 int myNbPtsOnCur; 0227 int myNbIter; 0228 bool myAnisotropie; 0229 bool myIsInitFaceGiven; 0230 bool myIsDone; 0231 }; 0232 0233 #endif // _BRepFill_Filling_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|