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