1 // Created on: 1997-10-13
2 // Created by: Roman BORISOV
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepAlgo_NormalProjection_HeaderFile
18 #define _BRepAlgo_NormalProjection_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <GeomAbs_Shape.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TopTools_DataMapOfShapeShape.hxx>
27 #include <TopTools_DataMapOfShapeListOfShape.hxx>
28 #include <TopTools_ListOfShape.hxx>
30 class Adaptor3d_Curve;
33 //! This class makes the projection of a wire on a
35 class BRepAlgo_NormalProjection
42 Standard_EXPORT BRepAlgo_NormalProjection();
44 Standard_EXPORT BRepAlgo_NormalProjection(const TopoDS_Shape& S);
46 Standard_EXPORT void Init (const TopoDS_Shape& S);
48 //! Add an edge or a wire to the list of shape to project
49 Standard_EXPORT void Add (const TopoDS_Shape& ToProj);
51 //! Set the parameters used for computation
52 //! Tol3d is the required tolerance between the 3d projected
53 //! curve and its 2d representation
54 //! InternalContinuity is the order of constraints
55 //! used for approximation.
56 //! MaxDeg and MaxSeg are the maximum degree and the maximum
57 //! number of segment for BSpline resulting of an approximation.
58 Standard_EXPORT void SetParams (const Standard_Real Tol3D, const Standard_Real Tol2D, const GeomAbs_Shape InternalContinuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSeg);
60 //! Set the parameters used for computation
61 //! in their default values
62 Standard_EXPORT void SetDefaultParams();
64 //! Sets the maximum distance between target shape and
65 //! shape to project. If this condition is not satisfied then
66 //! corresponding part of solution is discarded.
67 //! if MaxDist < 0 then this method does not affect the algorithm
68 Standard_EXPORT void SetMaxDistance (const Standard_Real MaxDist);
70 //! if With3d = Standard_False the 3dcurve is not computed
71 //! the initial 3dcurve is kept to build the resulting edges.
72 Standard_EXPORT void Compute3d (const Standard_Boolean With3d = Standard_True);
74 //! Manage limitation of projected edges.
75 Standard_EXPORT void SetLimit (const Standard_Boolean FaceBoundaries = Standard_True);
77 //! Builds the result as a compound.
78 Standard_EXPORT void Build();
80 Standard_EXPORT Standard_Boolean IsDone() const;
82 //! returns the result
83 Standard_EXPORT const TopoDS_Shape& Projection() const;
85 //! For a resulting edge, returns the corresponding initial edge.
86 Standard_EXPORT const TopoDS_Shape& Ancestor (const TopoDS_Edge& E) const;
88 //! For a projected edge, returns the corresponding initial face.
89 Standard_EXPORT const TopoDS_Shape& Couple (const TopoDS_Edge& E) const;
91 //! Returns the list of shapes generated from the
93 Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& S);
95 Standard_EXPORT Standard_Boolean IsElementary (const Adaptor3d_Curve& C) const;
97 //! build the result as a list of wire if possible in --
98 //! a first returns a wire only if there is only a wire.
99 Standard_EXPORT Standard_Boolean BuildWire (TopTools_ListOfShape& Liste) const;
114 TopoDS_Shape myShape;
115 Standard_Boolean myIsDone;
116 Standard_Real myTol3d;
117 Standard_Real myTol2d;
118 Standard_Real myMaxDist;
119 Standard_Boolean myWith3d;
120 GeomAbs_Shape myContinuity;
121 Standard_Integer myMaxDegree;
122 Standard_Integer myMaxSeg;
123 Standard_Boolean myFaceBounds;
124 TopoDS_Shape myToProj;
125 TopTools_DataMapOfShapeShape myAncestorMap;
126 TopTools_DataMapOfShapeShape myCorresp;
127 TopTools_DataMapOfShapeListOfShape myDescendants;
139 #endif // _BRepAlgo_NormalProjection_HeaderFile