Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:35:55

0001 // Created on: 1993-12-13
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1993-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 _Extrema_ExtPElC2d_HeaderFile
0018 #define _Extrema_ExtPElC2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <Extrema_POnCurv2d.hxx>
0025 class gp_Pnt2d;
0026 class gp_Lin2d;
0027 class gp_Circ2d;
0028 class gp_Elips2d;
0029 class gp_Hypr2d;
0030 class gp_Parab2d;
0031 
0032 //! It calculates all the distances between a point
0033 //! and an elementary curve.
0034 //! These distances can be minimum or maximum.
0035 class Extrema_ExtPElC2d
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   Standard_EXPORT Extrema_ExtPElC2d();
0041 
0042   //! Calculates the extremum distance between the
0043   //! point P and the segment [Uinf,Usup] of the line L.
0044   Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d&     P,
0045                                     const gp_Lin2d&     C,
0046                                     const Standard_Real Tol,
0047                                     const Standard_Real Uinf,
0048                                     const Standard_Real Usup);
0049 
0050   Standard_EXPORT void Perform(const gp_Pnt2d&     P,
0051                                const gp_Lin2d&     L,
0052                                const Standard_Real Tol,
0053                                const Standard_Real Uinf,
0054                                const Standard_Real Usup);
0055 
0056   //! Calculates the 2 extremum distances between the
0057   //! point P and the segment [Uinf,Usup] of the circle C.
0058   //! Tol is used to determine
0059   //! if P is on the axis of the circle or
0060   //! if an extremum is on an endpoint of the segment.
0061   //! If P is on the axis of the circle,
0062   //! there are infinite solution then IsDone(me)=False.
0063   //! The conditions on the Uinf and Usup are:
0064   //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
0065   //! If Usup > Uinf + 2.*PI, then only the solutions in
0066   //! the range [Uinf,Uinf+2.*PI[ are computed.
0067   Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d&     P,
0068                                     const gp_Circ2d&    C,
0069                                     const Standard_Real Tol,
0070                                     const Standard_Real Uinf,
0071                                     const Standard_Real Usup);
0072 
0073   Standard_EXPORT void Perform(const gp_Pnt2d&     P,
0074                                const gp_Circ2d&    C,
0075                                const Standard_Real Tol,
0076                                const Standard_Real Uinf,
0077                                const Standard_Real Usup);
0078 
0079   //! Calculates the 4 extremum distances between the
0080   //! point P and the segment [Uinf,Usup] of the ellipse C.
0081   //! Tol is used to determine
0082   //! if the point is on the axis of the ellipse and
0083   //! if the major radius is equal to the minor radius or
0084   //! if an extremum is on an endpoint of the segment.
0085   //! If P is on the axis of the ellipse,
0086   //! there are infinite solution then IsDone(me)=False.
0087   //! The conditions on the Uinf and Usup are:
0088   //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
0089   //! If Usup > Uinf + 2.*PI, then only the solutions in
0090   //! the range [Uinf,Uinf+2.*PI[ are computed.
0091   Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d&     P,
0092                                     const gp_Elips2d&   C,
0093                                     const Standard_Real Tol,
0094                                     const Standard_Real Uinf,
0095                                     const Standard_Real Usup);
0096 
0097   Standard_EXPORT void Perform(const gp_Pnt2d&     P,
0098                                const gp_Elips2d&   C,
0099                                const Standard_Real Tol,
0100                                const Standard_Real Uinf,
0101                                const Standard_Real Usup);
0102 
0103   //! Calculates the extremum distances between the
0104   //! point P and the segment [Uinf,Usup] of the hyperbola
0105   //! C.
0106   //! Tol is used to determine if two solutions u and v
0107   //! are identical; the condition is:
0108   //! dist(C(u),C(v)) < Tol.
0109   Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d&     P,
0110                                     const gp_Hypr2d&    C,
0111                                     const Standard_Real Tol,
0112                                     const Standard_Real Uinf,
0113                                     const Standard_Real Usup);
0114 
0115   Standard_EXPORT void Perform(const gp_Pnt2d&     P,
0116                                const gp_Hypr2d&    C,
0117                                const Standard_Real Tol,
0118                                const Standard_Real Uinf,
0119                                const Standard_Real Usup);
0120 
0121   //! Calculates the 4 extremum distances between the
0122   //! point P and the segment [Uinf,Usup] of the parabola
0123   //! C.
0124   //! Tol is used to determine if two solutions u and v
0125   //! are identical; the condition is:
0126   //! dist(C(u),C(v)) < Tol.
0127   Standard_EXPORT Extrema_ExtPElC2d(const gp_Pnt2d&     P,
0128                                     const gp_Parab2d&   C,
0129                                     const Standard_Real Tol,
0130                                     const Standard_Real Uinf,
0131                                     const Standard_Real Usup);
0132 
0133   Standard_EXPORT void Perform(const gp_Pnt2d&     P,
0134                                const gp_Parab2d&   C,
0135                                const Standard_Real Tol,
0136                                const Standard_Real Uinf,
0137                                const Standard_Real Usup);
0138 
0139   //! True if the distances are found.
0140   Standard_EXPORT Standard_Boolean IsDone() const;
0141 
0142   //! Returns the number of extremum distances.
0143   Standard_EXPORT Standard_Integer NbExt() const;
0144 
0145   //! Returns the value of the Nth extremum square distance.
0146   Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N) const;
0147 
0148   //! Returns True if the Nth extremum distance is a
0149   //! minimum.
0150   Standard_EXPORT Standard_Boolean IsMin(const Standard_Integer N) const;
0151 
0152   //! Returns the point of the Nth extremum distance.
0153   Standard_EXPORT const Extrema_POnCurv2d& Point(const Standard_Integer N) const;
0154 
0155 protected:
0156 private:
0157   Standard_Boolean  myDone;
0158   Standard_Integer  myNbExt;
0159   Standard_Real     mySqDist[4];
0160   Standard_Boolean  myIsMin[4];
0161   Extrema_POnCurv2d myPoint[4];
0162 };
0163 
0164 #endif // _Extrema_ExtPElC2d_HeaderFile