Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:13:43

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 _BRepAlgo_NormalProjection_HeaderFile
0018 #define _BRepAlgo_NormalProjection_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <GeomAbs_Shape.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <TopTools_ShapeMapHasher.hxx>
0027 #include <NCollection_DataMap.hxx>
0028 #include <NCollection_List.hxx>
0029 class TopoDS_Edge;
0030 class Adaptor3d_Curve;
0031 
0032 //! This class makes the projection of a wire on a
0033 //! shape.
0034 class BRepAlgo_NormalProjection
0035 {
0036 public:
0037   DEFINE_STANDARD_ALLOC
0038 
0039   Standard_EXPORT BRepAlgo_NormalProjection();
0040 
0041   Standard_EXPORT BRepAlgo_NormalProjection(const TopoDS_Shape& S);
0042 
0043   Standard_EXPORT void Init(const TopoDS_Shape& S);
0044 
0045   //! Add an edge or a wire to the list of shape to project
0046   Standard_EXPORT void Add(const TopoDS_Shape& ToProj);
0047 
0048   //! Set the parameters used for computation
0049   //! Tol3d is the required tolerance between the 3d projected
0050   //! curve and its 2d representation
0051   //! InternalContinuity is the order of constraints
0052   //! used for approximation.
0053   //! MaxDeg and MaxSeg are the maximum degree and the maximum
0054   //! number of segment for BSpline resulting of an approximation.
0055   Standard_EXPORT void SetParams(const double        Tol3D,
0056                                  const double        Tol2D,
0057                                  const GeomAbs_Shape InternalContinuity,
0058                                  const int           MaxDegree,
0059                                  const int           MaxSeg);
0060 
0061   //! Set the parameters used for computation
0062   //! in their default values
0063   Standard_EXPORT void SetDefaultParams();
0064 
0065   //! Sets the maximum distance between target shape and
0066   //! shape to project. If this condition is not satisfied then
0067   //! corresponding part of solution is discarded.
0068   //! if MaxDist < 0 then this method does not affect the algorithm
0069   Standard_EXPORT void SetMaxDistance(const double MaxDist);
0070 
0071   //! if With3d = false the 3dcurve is not computed
0072   //! the initial 3dcurve is kept to build the resulting edges.
0073   Standard_EXPORT void Compute3d(const bool With3d = true);
0074 
0075   //! Manage limitation of projected edges.
0076   Standard_EXPORT void SetLimit(const bool FaceBoundaries = true);
0077 
0078   //! Builds the result as a compound.
0079   Standard_EXPORT void Build();
0080 
0081   Standard_EXPORT bool IsDone() const;
0082 
0083   //! returns the result
0084   Standard_EXPORT const TopoDS_Shape& Projection() const;
0085 
0086   //! For a resulting edge, returns the corresponding initial edge.
0087   Standard_EXPORT const TopoDS_Shape& Ancestor(const TopoDS_Edge& E) const;
0088 
0089   //! For a projected edge, returns the corresponding initial face.
0090   Standard_EXPORT const TopoDS_Shape& Couple(const TopoDS_Edge& E) const;
0091 
0092   //! Returns the list of shapes generated from the
0093   //! shape <S>.
0094   Standard_EXPORT const NCollection_List<TopoDS_Shape>& Generated(const TopoDS_Shape& S);
0095 
0096   Standard_EXPORT bool IsElementary(const Adaptor3d_Curve& C) const;
0097 
0098   //! build the result as a list of wire if possible in --
0099   //! a first returns a wire only if there is only a wire.
0100   Standard_EXPORT bool BuildWire(NCollection_List<TopoDS_Shape>& Liste) const;
0101 
0102 private:
0103   TopoDS_Shape                                                             myShape;
0104   bool                                                                     myIsDone;
0105   double                                                                   myTol3d;
0106   double                                                                   myTol2d;
0107   double                                                                   myMaxDist;
0108   bool                                                                     myWith3d;
0109   GeomAbs_Shape                                                            myContinuity;
0110   int                                                                      myMaxDegree;
0111   int                                                                      myMaxSeg;
0112   bool                                                                     myFaceBounds;
0113   TopoDS_Shape                                                             myToProj;
0114   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myAncestorMap;
0115   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myCorresp;
0116   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0117                myDescendants;
0118   TopoDS_Shape myRes;
0119 };
0120 
0121 #endif // _BRepAlgo_NormalProjection_HeaderFile