Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:28

0001 // Created on: 1991-02-26
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1991-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_ExtPC2d_HeaderFile
0018 #define _Extrema_ExtPC2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <gp_Pnt2d.hxx>
0024 #include <Extrema_ExtPElC2d.hxx>
0025 #include <Extrema_EPCOfExtPC2d.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <GeomAbs_CurveType.hxx>
0028 #include <TColStd_SequenceOfBoolean.hxx>
0029 #include <TColStd_SequenceOfReal.hxx>
0030 class StdFail_NotDone;
0031 class Standard_OutOfRange;
0032 class Standard_TypeMismatch;
0033 class Adaptor2d_Curve2d;
0034 class Extrema_Curve2dTool;
0035 class Extrema_ExtPElC2d;
0036 class gp_Pnt2d;
0037 class gp_Vec2d;
0038 class Extrema_POnCurv2d;
0039 class Extrema_EPCOfExtPC2d;
0040 class Extrema_PCFOfEPCOfExtPC2d;
0041 
0042 
0043 
0044 class Extrema_ExtPC2d 
0045 {
0046 public:
0047 
0048   DEFINE_STANDARD_ALLOC
0049 
0050   
0051   Standard_EXPORT Extrema_ExtPC2d();
0052   
0053   //! It calculates all the distances.
0054   //! The function F(u)=distance(P,C(u)) has an extremum
0055   //! when g(u)=dF/du=0. The algorithm searches all the
0056   //! zeros inside the definition range of the curve.
0057   //! Zeros are searched between uinf and usup.
0058   //! Tol  is used to decide to stop the
0059   //! iterations according to the following condition:
0060   //! if n is the number of iterations,
0061   //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
0062   Standard_EXPORT Extrema_ExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
0063   
0064   //! It calculates all the distances.
0065   //! The function F(u)=distance(P,C(u)) has an extremum
0066   //! when g(u)=dF/du=0. The algorithm searches all the
0067   //! zeros inside the definition range of the curve.
0068   //! Tol is used to decide to stop the
0069   //! iterations according to the following condition:
0070   //! if n is the number of iterations,
0071   //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
0072   Standard_EXPORT Extrema_ExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Real TolF = 1.0e-10);
0073   
0074   //! initializes the fields of the algorithm.
0075   Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
0076   
0077   //! An exception is raised if the fields have not been
0078   //! initialized.
0079   Standard_EXPORT void Perform (const gp_Pnt2d& P);
0080   
0081   //! True if the distances are found.
0082   Standard_EXPORT Standard_Boolean IsDone() const;
0083   
0084   //! Returns the value of the <N>th extremum square distance.
0085   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
0086   
0087   //! Returns the number of extremum distances.
0088   Standard_EXPORT Standard_Integer NbExt() const;
0089   
0090   //! Returns True if the <N>th extremum distance is a
0091   //! minimum.
0092   Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
0093   
0094   //! Returns the point of the <N>th extremum distance.
0095   Standard_EXPORT const Extrema_POnCurv2d& Point (const Standard_Integer N) const;
0096   
0097   //! if the curve is a trimmed curve,
0098   //! dist1 is a square distance between <P> and the point
0099   //! of parameter FirstParameter <P1> and
0100   //! dist2 is a square distance between <P> and the point
0101   //! of parameter LastParameter <P2>.
0102   Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dist1, Standard_Real& dist2, gp_Pnt2d& P1, gp_Pnt2d& P2) const;
0103 
0104 
0105 
0106 
0107 protected:
0108 
0109   
0110   Standard_EXPORT void IntervalPerform (const gp_Pnt2d& P);
0111 
0112   Standard_EXPORT void AddSol(const Standard_Real theU,
0113                               const gp_Pnt2d& theP,
0114                               const Standard_Real theSqDist,
0115                               const Standard_Boolean isMin);
0116 
0117 
0118 
0119 private:
0120 
0121 
0122 
0123   Standard_Address myC;
0124   gp_Pnt2d Pf;
0125   gp_Pnt2d Pl;
0126   Extrema_ExtPElC2d myExtPElC;
0127   Extrema_SequenceOfPOnCurv2d mypoint;
0128   Standard_Boolean mydone;
0129   Standard_Real mydist1;
0130   Standard_Real mydist2;
0131   Extrema_EPCOfExtPC2d myExtPC;
0132   Standard_Real mytolu;
0133   Standard_Real mytolf;
0134   Standard_Integer mysample;
0135   Standard_Real myintuinf;
0136   Standard_Real myintusup;
0137   Standard_Real myuinf;
0138   Standard_Real myusup;
0139   GeomAbs_CurveType type;
0140   TColStd_SequenceOfBoolean myismin;
0141   TColStd_SequenceOfReal mySqDist;
0142 
0143 
0144 };
0145 
0146 
0147 
0148 
0149 
0150 
0151 
0152 #endif // _Extrema_ExtPC2d_HeaderFile