1 // Created on: 1993-12-13
2 // Created by: Christophe MARION
3 // Copyright (c) 1993-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 _Extrema_ExtPElC2d_HeaderFile
18 #define _Extrema_ExtPElC2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Extrema_POnCurv2d.hxx>
28 class StdFail_NotDone;
29 class Standard_OutOfRange;
36 class Extrema_POnCurv2d;
39 //! It calculates all the distances between a point
40 //! and an elementary curve.
41 //! These distances can be minimum or maximum.
42 class Extrema_ExtPElC2d
49 Standard_EXPORT Extrema_ExtPElC2d();
51 //! Calculates the extremum distance between the
52 //! point P and the segment [Uinf,Usup] of the line L.
53 Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d& P, const gp_Lin2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
55 Standard_EXPORT void Perform (const gp_Pnt2d& P, const gp_Lin2d& L, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
57 //! Calculates the 2 extremum distances between the
58 //! point P and the segment [Uinf,Usup] of the circle C.
59 //! Tol is used to determine
60 //! if P is on the axis of the circle or
61 //! if an extremum is on an endpoint of the segment.
62 //! If P is on the axis of the circle,
63 //! there are infinite solution then IsDone(me)=False.
64 //! The conditions on the Uinf and Usup are:
65 //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
66 //! If Usup > Uinf + 2.*PI, then only the solutions in
67 //! the range [Uinf,Uinf+2.*PI[ are computed.
68 Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d& P, const gp_Circ2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
70 Standard_EXPORT void Perform (const gp_Pnt2d& P, const gp_Circ2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
72 //! Calculates the 4 extremum distances between the
73 //! point P and the segment [Uinf,Usup] of the elipse C.
74 //! Tol is used to determine
75 //! if the point is on the axis of the elipse and
76 //! if the major radius is equal to the minor radius or
77 //! if an extremum is on an endpoint of the segment.
78 //! If P is on the axis of the elipse,
79 //! there are infinite solution then IsDone(me)=False.
80 //! The conditions on the Uinf and Usup are:
81 //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
82 //! If Usup > Uinf + 2.*PI, then only the solutions in
83 //! the range [Uinf,Uinf+2.*PI[ are computed.
84 Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d& P, const gp_Elips2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
86 Standard_EXPORT void Perform (const gp_Pnt2d& P, const gp_Elips2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
88 //! Calculates the extremum distances between the
89 //! point P and the segment [Uinf,Usup] of the hyperbola
91 //! Tol is used to determine if two solutions u and v
92 //! are identical; the condition is:
93 //! dist(C(u),C(v)) < Tol.
94 Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d& P, const gp_Hypr2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
96 Standard_EXPORT void Perform (const gp_Pnt2d& P, const gp_Hypr2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
98 //! Calculates the 4 extremum distances between the
99 //! point P and the segment [Uinf,Usup] of the parabola
101 //! Tol is used to determine if two solutions u and v
102 //! are identical; the condition is:
103 //! dist(C(u),C(v)) < Tol.
104 Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d& P, const gp_Parab2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
106 Standard_EXPORT void Perform (const gp_Pnt2d& P, const gp_Parab2d& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
108 //! True if the distances are found.
109 Standard_EXPORT Standard_Boolean IsDone() const;
111 //! Returns the number of extremum distances.
112 Standard_EXPORT Standard_Integer NbExt() const;
114 //! Returns the value of the Nth extremum square distance.
115 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
117 //! Returns True if the Nth extremum distance is a
119 Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
121 //! Returns the point of the Nth extremum distance.
122 Standard_EXPORT const Extrema_POnCurv2d& Point (const Standard_Integer N) const;
137 Standard_Boolean myDone;
138 Standard_Integer myNbExt;
139 Standard_Real mySqDist[4];
140 Standard_Boolean myIsMin[4];
141 Extrema_POnCurv2d myPoint[4];
152 #endif // _Extrema_ExtPElC2d_HeaderFile