1 // Created on: 1997-09-22
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 _ProjLib_CompProjectedCurve_HeaderFile
18 #define _ProjLib_CompProjectedCurve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <ProjLib_HSequenceOfHSequenceOfPnt.hxx>
26 #include <Standard_Real.hxx>
27 #include <TColStd_HArray1OfBoolean.hxx>
28 #include <TColStd_HArray1OfReal.hxx>
29 #include <Adaptor2d_Curve2d.hxx>
30 #include <Standard_Boolean.hxx>
31 #include <GeomAbs_Shape.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33 #include <GeomAbs_CurveType.hxx>
34 class Adaptor3d_HSurface;
35 class Adaptor3d_HCurve;
36 class Standard_OutOfRange;
37 class Standard_NoSuchObject;
38 class Standard_DomainError;
39 class Standard_NotImplemented;
42 class Adaptor2d_HCurve2d;
46 class ProjLib_CompProjectedCurve : public Adaptor2d_Curve2d
53 Standard_EXPORT ProjLib_CompProjectedCurve();
55 //! try to find all solutions
56 Standard_EXPORT ProjLib_CompProjectedCurve(const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HCurve)& C, const Standard_Real TolU, const Standard_Real TolV);
58 //! this constructor tries to optimize the search using the
59 //! assamption that maximum distance between surface and curve less or
60 //! equal then MaxDist.
61 //! if MaxDist < 0 then algorithm works as above.
62 Standard_EXPORT ProjLib_CompProjectedCurve(const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HCurve)& C, const Standard_Real TolU, const Standard_Real TolV, const Standard_Real MaxDist);
64 //! computes a set of projected point and determine the
65 //! continuous parts of the projected curves. The points
66 //! corresponding to a projection on the bounds of the surface are
67 //! included in this set of points.
68 Standard_EXPORT void Init();
70 //! Changes the surface.
71 Standard_EXPORT void Load (const Handle(Adaptor3d_HSurface)& S);
73 //! Changes the curve.
74 Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
76 Standard_EXPORT const Handle(Adaptor3d_HSurface)& GetSurface() const;
78 Standard_EXPORT const Handle(Adaptor3d_HCurve)& GetCurve() const;
80 Standard_EXPORT void GetTolerance (Standard_Real& TolU, Standard_Real& TolV) const;
82 //! returns the number of continuous part of the projected curve
83 Standard_EXPORT Standard_Integer NbCurves() const;
85 //! returns the bounds of the continuous part corresponding to Index
86 Standard_EXPORT void Bounds (const Standard_Integer Index, Standard_Real& Udeb, Standard_Real& Ufin) const;
88 //! returns True if part of projection with number Index is a single point and writes its coordinats in P
89 Standard_EXPORT Standard_Boolean IsSinglePnt (const Standard_Integer Index, gp_Pnt2d& P) const;
91 //! returns True if part of projection with number Index is an u-isoparametric curve of input surface
92 Standard_EXPORT Standard_Boolean IsUIso (const Standard_Integer Index, Standard_Real& U) const;
94 //! returns True if part of projection with number Index is an v-isoparametric curve of input surface
95 Standard_EXPORT Standard_Boolean IsVIso (const Standard_Integer Index, Standard_Real& V) const;
97 //! Computes the point of parameter U on the curve.
98 Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const Standard_OVERRIDE;
100 //! Computes the point of parameter U on the curve.
101 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
103 //! Computes the point of parameter U on the curve with its
104 //! first derivative.
105 //! Raised if the continuity of the current interval
107 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE;
110 //! Returns the point P of parameter U, the first and second
111 //! derivatives V1 and V2.
112 //! Raised if the continuity of the current interval
114 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
117 //! The returned vector gives the value of the derivative for the
118 //! order of derivation N.
121 Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
123 //! Returns the first parameter of the curve C
124 //! which has a projection on S.
125 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
127 //! Returns the last parameter of the curve C
128 //! which has a projection on S.
129 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
131 //! Returns the number of intervals which define
132 //! an S continuous part of the projected curve
133 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
135 //! Returns a curve equivalent of <me> between
136 //! parameters <First> and <Last>. <Tol> is used to
137 //! test for 2d points confusion.
138 //! If <First> >= <Last>
139 Standard_EXPORT Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real FirstParam, const Standard_Real LastParam, const Standard_Real Tol) const Standard_OVERRIDE;
141 //! Returns the parameters corresponding to
142 //! S discontinuities.
144 //! The array must provide enough room to accomodate
145 //! for the parameters. i.e. T.Length() > NbIntervals()
146 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
148 //! returns the maximum distance between
149 //! curve to project and surface
150 Standard_EXPORT Standard_Real MaxDistance (const Standard_Integer Index) const;
152 Standard_EXPORT const Handle(ProjLib_HSequenceOfHSequenceOfPnt)& GetSequence() const;
154 //! Returns the type of the curve in the current
155 //! interval : Line, Circle, Ellipse, Hyperbola,
156 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
157 Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
171 Standard_EXPORT void BuildIntervals (const GeomAbs_Shape S) const;
174 Handle(Adaptor3d_HSurface) mySurface;
175 Handle(Adaptor3d_HCurve) myCurve;
176 Standard_Integer myNbCurves;
177 Handle(ProjLib_HSequenceOfHSequenceOfPnt) mySequence;
178 Standard_Real myTolU;
179 Standard_Real myTolV;
180 Standard_Real myMaxDist;
181 Handle(TColStd_HArray1OfBoolean) myUIso;
182 Handle(TColStd_HArray1OfBoolean) myVIso;
183 Handle(TColStd_HArray1OfBoolean) mySnglPnts;
184 Handle(TColStd_HArray1OfReal) myMaxDistance;
185 Handle(TColStd_HArray1OfReal) myTabInt;
196 #endif // _ProjLib_CompProjectedCurve_HeaderFile