Back to home page

EIC code displayed by LXR

 
 

    


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

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