Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:20:01

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