1 // Created on: 1994-10-07
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-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 _ProjLib_ComputeApproxOnPolarSurface_HeaderFile
18 #define _ProjLib_ComputeApproxOnPolarSurface_HeaderFile
20 #include <Adaptor2d_Curve2d.hxx>
21 #include <Adaptor3d_Curve.hxx>
22 #include <Adaptor3d_Surface.hxx>
23 #include <AppParCurves_Constraint.hxx>
25 class Geom2d_BSplineCurve;
28 //! Approximate the projection of a 3d curve on an
29 //! polar surface and stores the result in Approx.
30 //! The result is a 2d curve. The evaluation of the
31 //! current point of the 2d curve is done with the
32 //! evaluation of the extrema P3d - Surface.
33 //! For approximation some parameters are used, including
34 //! required tolerance of approximation.
35 //! Tolerance is maximal possible value of 3d deviation of 3d projection of projected curve from
36 //! "exact" 3d projection. Since algorithm searches 2d curve on surface, required 2d tolerance is computed
37 //! from 3d tolerance with help of U,V resolutions of surface.
38 //! 3d and 2d tolerances have sence only for curves on surface, it defines precision of projecting and approximation
39 //! and have nothing to do with distance between the projected curve and the surface.
40 class ProjLib_ComputeApproxOnPolarSurface
46 //! Empty constructor, it only sets some initial values for class fields.
47 Standard_EXPORT ProjLib_ComputeApproxOnPolarSurface();
49 //! Constructor, which performs projecting.
50 Standard_EXPORT ProjLib_ComputeApproxOnPolarSurface(const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol = 1.0e-4);
53 //! Constructor, which performs projecting, using initial curve 2d InitCurve2d, which is any rough approximation of result curve.
54 //! Parameter Tol is 3d tolerance of approximation.
55 Standard_EXPORT ProjLib_ComputeApproxOnPolarSurface(const Handle(Adaptor2d_Curve2d)& InitCurve2d, const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol);
57 //! Constructor, which performs projecting, using two initial curves 2d: InitCurve2d and InitCurve2dBis that are any rough approximations of result curves.
58 //! This constructor is used to get two pcurves for seem edge.
59 //! Parameter Tol is 3d tolerance of approximation.
60 Standard_EXPORT ProjLib_ComputeApproxOnPolarSurface(const Handle(Adaptor2d_Curve2d)& InitCurve2d, const Handle(Adaptor2d_Curve2d)& InitCurve2dBis, const Handle(Adaptor3d_Curve)& C,
61 const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol);
64 //! Set min and max possible degree of result BSpline curve2d, which is got by approximation.
65 //! If theDegMin/Max < 0, algorithm uses values min = 2, max = 8.
66 Standard_EXPORT void SetDegree(const Standard_Integer theDegMin, const Standard_Integer theDegMax);
68 //! Set the parameter, which defines maximal value of parametric intervals the projected
69 //! curve can be cut for approximation. If theMaxSegments < 0, algorithm uses default
71 Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
73 //! Set the parameter, which defines type of boundary condition between segments during approximation.
74 //! It can be AppParCurves_PassPoint or AppParCurves_TangencyPoint.
75 //! Default value is AppParCurves_TangencyPoint.
76 Standard_EXPORT void SetBndPnt(const AppParCurves_Constraint theBndPnt);
78 //! Set the parameter, which defines maximal possible distance between projected curve and surface.
79 //! It is used only for projecting on not analytical surfaces.
80 //! If theMaxDist < 0, algoritm uses default value 100.*Tolerance.
81 //! If real distance between curve and surface more then theMaxDist, algorithm stops working.
82 Standard_EXPORT void SetMaxDist(const Standard_Real theMaxDist);
84 //! Set the tolerance used to project
85 //! the curve on the surface.
86 //! Default value is Precision::Approximation().
87 Standard_EXPORT void SetTolerance (const Standard_Real theTolerance);
89 //! Method, which performs projecting, using default values of parameters or
90 //! they must be set by corresponding methods before using.
91 Standard_EXPORT void Perform (const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S);
93 //! Method, which performs projecting, using default values of parameters or
94 //! they must be set by corresponding methods before using.
95 //! Parameter InitCurve2d is any rough estimation of 2d result curve.
96 Standard_EXPORT Handle(Geom2d_BSplineCurve) Perform (const Handle(Adaptor2d_Curve2d)& InitCurve2d, const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S);
98 //! Builds initial 2d curve as BSpline with degree = 1 using Extrema algoritm.
99 //! Method is used in method Perform(...).
100 Standard_EXPORT Handle(Adaptor2d_Curve2d) BuildInitialCurve2d (const Handle(Adaptor3d_Curve)& Curve, const Handle(Adaptor3d_Surface)& S);
103 //! Method, which performs projecting.
104 //! Method is used in method Perform(...).
105 Standard_EXPORT Handle(Geom2d_BSplineCurve) ProjectUsingInitialCurve2d (const Handle(Adaptor3d_Curve)& Curve, const Handle(Adaptor3d_Surface)& S, const Handle(Adaptor2d_Curve2d)& InitCurve2d);
107 //! Returns result curve 2d.
108 Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const;
109 //! Returns second 2d curve.
110 Standard_EXPORT Handle(Geom2d_Curve) Curve2d() const;
112 Standard_EXPORT Standard_Boolean IsDone() const;
114 //! returns the reached Tolerance.
115 Standard_EXPORT Standard_Real Tolerance() const;
129 Standard_Boolean myProjIsDone;
130 Standard_Real myTolerance;
131 Handle(Geom2d_BSplineCurve) myBSpline;
132 Handle(Geom2d_Curve) my2ndCurve;
133 Standard_Real myTolReached;
134 Standard_Integer myDegMin;
135 Standard_Integer myDegMax;
136 Standard_Integer myMaxSegments;
137 Standard_Real myMaxDist;
138 AppParCurves_Constraint myBndPnt;
139 Standard_Real myDist;
149 #endif // _ProjLib_ComputeApproxOnPolarSurface_HeaderFile