Back to home page

EIC code displayed by LXR

 
 

    


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

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 _BRepOffsetAPI_MakeFilling_HeaderFile
0018 #define _BRepOffsetAPI_MakeFilling_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepFill_Filling.hxx>
0025 #include <BRepBuilderAPI_MakeShape.hxx>
0026 #include <Standard_Boolean.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <GeomAbs_Shape.hxx>
0029 #include <TopTools_ListOfShape.hxx>
0030 class TopoDS_Face;
0031 class TopoDS_Edge;
0032 class gp_Pnt;
0033 class TopoDS_Shape;
0034 
0035 
0036 //! N-Side Filling
0037 //! This algorithm avoids to build a face from:
0038 //! * a set of edges defining the bounds of the face and some
0039 //! constraints the surface of the face has to satisfy
0040 //! * a set of edges and points defining some constraints
0041 //! the support surface has to satisfy
0042 //! * an initial surface to deform for satisfying the constraints
0043 //! * a set of parameters to control the constraints.
0044 //!
0045 //! The support surface of the face is computed by deformation
0046 //! of the initial surface in order to satisfy the given constraints.
0047 //! The set of bounding edges defines the wire of the face.
0048 //!
0049 //! If no initial surface is given, the algorithm computes it
0050 //! automatically.
0051 //! If the set of edges is not connected (Free constraint)
0052 //! missing edges are automatically computed.
0053 //!
0054 //! Limitations:
0055 //! * If some constraints are not compatible
0056 //! The algorithm does not take them into account.
0057 //! So the constraints will not be satisfyed in an area containing
0058 //! the incompatibilitries.
0059 //! * The constraints defining the bound of the face have to be
0060 //! entered in order to have a continuous wire.
0061 //!
0062 //! Other Applications:
0063 //! * Deformation of a face to satisfy internal constraints
0064 //! * Deformation of a face to improve Gi continuity with
0065 //! connected faces
0066 class BRepOffsetAPI_MakeFilling  : public BRepBuilderAPI_MakeShape
0067 {
0068 public:
0069 
0070   DEFINE_STANDARD_ALLOC
0071 
0072   
0073   //! Constructs a wire filling object defined by
0074   //! - the energy minimizing criterion Degree
0075   //! - the number of points on the curve NbPntsOnCur
0076   //! - the number of iterations NbIter
0077   //! - the Boolean Anisotropie
0078   //! - the 2D tolerance Tol2d
0079   //! - the 3D tolerance Tol3d
0080   //! - the angular tolerance TolAng
0081   //! - the tolerance for curvature TolCur
0082   //! - the highest polynomial degree MaxDeg
0083   //! - the greatest number of segments MaxSeg.
0084   //! If the Boolean Anistropie is true, the algorithm's
0085   //! performance is better in cases where the ratio of the
0086   //! length U and the length V indicate a great difference
0087   //! between the two. In other words, when the surface is, for
0088   //! example, extremely long.
0089   Standard_EXPORT BRepOffsetAPI_MakeFilling(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);
0090   
0091   //! Sets the values of Tolerances used to control the constraint.
0092   //! Tol2d:
0093   //! Tol3d:   it is the maximum distance allowed between the support surface
0094   //! and the constraints
0095   //! TolAng:  it is the maximum angle allowed between the normal of the surface
0096   //! and the constraints
0097   //! TolCurv: it is the maximum difference of curvature allowed between
0098   //! the surface and the constraint
0099   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);
0100   
0101   //! Sets the parameters used for resolution.
0102   //! The default values of these parameters have been chosen for a good
0103   //! ratio quality/performance.
0104   //! Degree:      it is the order of energy criterion to minimize for computing
0105   //! the deformation of the surface.
0106   //! The default value is 3
0107   //! The recommended value is i+2 where i is the maximum order of the
0108   //! constraints.
0109   //! NbPtsOnCur:  it is the average number of points for discretisation
0110   //! of the edges.
0111   //! NbIter:      it is the maximum number of iterations of the process.
0112   //! For each iteration the number of discretisation points is
0113   //! increased.
0114   //! Anisotropie:
0115   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);
0116   
0117   //! Sets the parameters used to approximate the filling
0118   //! surface. These include:
0119   //! - MaxDeg - the highest degree which the polynomial
0120   //! defining the filling surface can have
0121   //! - MaxSegments - the greatest number of segments
0122   //! which the filling surface can have.
0123   Standard_EXPORT void SetApproxParam (const Standard_Integer MaxDeg = 8, const Standard_Integer MaxSegments = 9);
0124   
0125   //! Loads the initial surface Surf to
0126   //! begin the construction of the surface.
0127   //! This optional function is useful if the surface resulting from
0128   //! construction for the algorithm is likely to be complex.
0129   //! The support surface of the face under construction is computed by a
0130   //! deformation of Surf which satisfies the given constraints.
0131   //! The set of bounding edges defines the wire of the face.
0132   //! If no initial surface is given, the algorithm computes it
0133   //! automatically. If the set of edges is not connected (Free constraint),
0134   //! missing edges are automatically computed.
0135   //! Important: the initial surface must have orthogonal local coordinates,
0136   //! i.e. partial derivatives dS/du and dS/dv must be orthogonal
0137   //! at each point of surface.
0138   //! If this condition breaks, distortions of resulting surface
0139   //! are possible.
0140   Standard_EXPORT void LoadInitSurface (const TopoDS_Face& Surf);
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 first
0149   //! face of the edge
0150   //! GeomAbs_G2 : the surface has to pass by 3D representation
0151   //! of the edge and to respect tangency and curvature
0152   //! with the first face of the edge.
0153   //! Raises ConstructionError if the edge has no representation on a face and Order is
0154   //! GeomAbs_G1 or GeomAbs_G2.
0155   Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& Constr, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
0156   
0157   //! Adds a new constraint which also defines an edge of the wire
0158   //! of the face
0159   //! Order: Order of the constraint:
0160   //! GeomAbs_C0 : the surface has to pass by 3D representation
0161   //! of the edge
0162   //! GeomAbs_G1 : the surface has to pass by 3D representation
0163   //! of the edge and to respect tangency with the
0164   //! given face
0165   //! GeomAbs_G2 : the surface has to pass by 3D representation
0166   //! of the edge and to respect tangency and curvature
0167   //! with the given face.
0168   //! Raises ConstructionError if the edge has no 2d representation on the given face
0169   Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& Constr, const TopoDS_Face& Support, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
0170   
0171   //! Adds a free constraint on a face. The corresponding edge has to
0172   //! be automatically recomputed. It is always a bound.
0173   Standard_EXPORT Standard_Integer Add (const TopoDS_Face& Support, const GeomAbs_Shape Order);
0174   
0175   //! Adds a punctual constraint.
0176   Standard_EXPORT Standard_Integer Add (const gp_Pnt& Point);
0177   
0178   //! Adds a punctual constraint.
0179   Standard_EXPORT Standard_Integer Add (const Standard_Real U, const Standard_Real V, const TopoDS_Face& Support, const GeomAbs_Shape Order);
0180   
0181   //! Builds the resulting faces
0182   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0183   
0184   //! Tests whether computation of the filling plate has been completed.
0185   Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
0186   
0187   //! Returns the list of shapes generated from the
0188   //! shape <S>.
0189   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0190   
0191   //! Returns the maximum distance between the result and
0192   //! the constraints. This is set at construction time.
0193   Standard_EXPORT Standard_Real G0Error() const;
0194   
0195   //! Returns the maximum angle between the result and the
0196   //! constraints. This is set at construction time.
0197   Standard_EXPORT Standard_Real G1Error() const;
0198   
0199   //! Returns the maximum angle between the result and the
0200   //! constraints. This is set at construction time.
0201   Standard_EXPORT Standard_Real G2Error() const;
0202   
0203   //! Returns the maximum distance attained between the
0204   //! result and the constraint Index. This is set at construction time.
0205   Standard_EXPORT Standard_Real G0Error (const Standard_Integer Index);
0206   
0207   //! Returns the maximum angle between the result and the
0208   //! constraints. This is set at construction time.
0209   Standard_EXPORT Standard_Real G1Error (const Standard_Integer Index);
0210   
0211   //! Returns the greatest difference in curvature found
0212   //! between the result and the constraint Index.
0213   Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
0214 
0215 
0216 
0217 
0218 protected:
0219 
0220 
0221 
0222 
0223 
0224 private:
0225 
0226 
0227 
0228   BRepFill_Filling myFilling;
0229 
0230 
0231 };
0232 
0233 
0234 
0235 
0236 
0237 
0238 
0239 #endif // _BRepOffsetAPI_MakeFilling_HeaderFile