Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1997-10-13
0002 // Created by: Roman BORISOV
0003 // Copyright (c) 1997-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_NormalProjection_HeaderFile
0018 #define _BRepOffsetAPI_NormalProjection_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepAlgo_NormalProjection.hxx>
0025 #include <BRepBuilderAPI_MakeShape.hxx>
0026 #include <GeomAbs_Shape.hxx>
0027 #include <TopTools_ListOfShape.hxx>
0028 class TopoDS_Shape;
0029 class TopoDS_Edge;
0030 
0031 
0032 //! A framework to define projection onto a shape
0033 //! according to the normal from each point to be projected.
0034 //! The target shape is a face, and the source shape is an edge or a wire.
0035 class BRepOffsetAPI_NormalProjection  : public BRepBuilderAPI_MakeShape
0036 {
0037 public:
0038 
0039   DEFINE_STANDARD_ALLOC
0040 
0041   
0042   //! Constructs an empty framework to define projection on
0043   //! a shape according to the normal from each point to be
0044   //! projected to the shape.
0045   Standard_EXPORT BRepOffsetAPI_NormalProjection();
0046   
0047   //! Constructs a framework to define projection onto the
0048   //! basis shape S according to the normal from each point
0049   //! to be projected from the shape added to this framework by Add.
0050   //! Default parameters of the algorithm: Tol3D = 1.e-04, Tol2D =sqr(tol3d)
0051   //! , InternalContinuity = GeomAbs_C2, MaxDegree = 14, MaxSeg = 16.
0052   Standard_EXPORT BRepOffsetAPI_NormalProjection(const TopoDS_Shape& S);
0053   
0054   //! Initializes the empty constructor framework with the shape S.
0055   Standard_EXPORT void Init (const TopoDS_Shape& S);
0056   
0057   //! Adds the shape ToProj to the framework for calculation
0058   //! of the projection by Compute3d.
0059   //! ToProj is an edge or a wire and will be projected onto the basis shape.
0060   //! Exceptions
0061   //! Standard_ConstructionError if ToProj is not added.
0062   Standard_EXPORT void Add (const TopoDS_Shape& ToProj);
0063   
0064   //! Sets the parameters  used  for computation
0065   //! Tol3 is the required  tolerance between the  3d projected
0066   //! curve  and     its    2d    representation
0067   //! InternalContinuity  is the order of constraints
0068   //! used for  approximation
0069   //! MaxDeg and MaxSeg are the maximum degree and the maximum
0070   //! number of segment for BSpline resulting of an approximation.
0071   Standard_EXPORT void SetParams (const Standard_Real Tol3D, const Standard_Real Tol2D, const GeomAbs_Shape InternalContinuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSeg);
0072   
0073   //! Sets the maximum distance between target shape and
0074   //! shape to project. If this condition is not satisfied then corresponding
0075   //! part of solution is discarded.
0076   //! if MaxDist < 0 then this method does not affect the algorithm
0077   Standard_EXPORT void SetMaxDistance (const Standard_Real MaxDist);
0078   
0079   //! Manage  limitation  of  projected  edges.
0080   Standard_EXPORT void SetLimit (const Standard_Boolean FaceBoundaries = Standard_True);
0081   
0082   //! Returns true if a 3D curve is computed. If not, false is
0083   //! returned and an initial 3D curve is kept to build the resulting edges.
0084   Standard_EXPORT void Compute3d (const Standard_Boolean With3d = Standard_True);
0085   
0086   //! Builds the result of the projection as a compound of
0087   //! wires. Tries to build oriented wires.
0088   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0089   
0090   //! Returns true if the object was correctly built by the shape
0091   //! construction algorithm.
0092   //! If at the construction time of the shape, the algorithm
0093   //! cannot be completed, or the original data is corrupted,
0094   //! IsDone returns false and therefore protects the use of
0095   //! functions to access the result of the construction
0096   //! (typically the Shape function).
0097   Standard_EXPORT Standard_Boolean IsDone() const Standard_OVERRIDE;
0098   
0099   //! Performs the projection.
0100   //! The construction of the result is performed by Build.
0101   //! Exceptions
0102   //! StdFail_NotDone if the projection was not performed.
0103   Standard_EXPORT const TopoDS_Shape& Projection() const;
0104   
0105   //! Returns the initial face corresponding to the projected edge E.
0106   //! Exceptions
0107   //! StdFail_NotDone if no face was found.
0108   //! Standard_NoSuchObject if a face corresponding to
0109   //! E has already been found.
0110   Standard_EXPORT const TopoDS_Shape& Couple (const TopoDS_Edge& E) const;
0111   
0112   //! Returns the  list   of shapes generated   from the
0113   //! shape <S>.
0114   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0115   
0116   //! Returns the initial edge corresponding to the edge E
0117   //! resulting from the computation of the projection.
0118   //! Exceptions
0119   //! StdFail_NotDone if no edge was found.
0120   //! Standard_NoSuchObject if an edge corresponding to
0121   //! E has already been found.
0122   Standard_EXPORT const TopoDS_Shape& Ancestor (const TopoDS_Edge& E) const;
0123   
0124   //! build the result as a list of wire if possible in --
0125   //! a first returns a wire only if there is only a wire.
0126   Standard_EXPORT Standard_Boolean BuildWire (TopTools_ListOfShape& Liste) const;
0127 
0128 
0129 
0130 
0131 protected:
0132 
0133 
0134 
0135 
0136 
0137 private:
0138 
0139 
0140 
0141   BRepAlgo_NormalProjection myNormalProjector;
0142 
0143 
0144 };
0145 
0146 
0147 
0148 
0149 
0150 
0151 
0152 #endif // _BRepOffsetAPI_NormalProjection_HeaderFile