Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-04 09:18:33

0001 // Created on: 1994-07-06
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1994-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_ExtCC2d_HeaderFile
0018 #define _Extrema_ExtCC2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Extrema_SequenceOfPOnCurv2d.hxx>
0024 #include <TColStd_SequenceOfReal.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <gp_Pnt2d.hxx>
0027 
0028 class Adaptor2d_Curve2d;
0029 class Extrema_POnCurv2d;
0030 class Extrema_ExtElC2d;
0031 class Extrema_ECC2d;
0032 
0033 //! It calculates all the distance between two curves.
0034 //! These distances can be maximum or minimum.
0035 class Extrema_ExtCC2d
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   Standard_EXPORT Extrema_ExtCC2d();
0041 
0042   //! It calculates all the distances.
0043   Standard_EXPORT Extrema_ExtCC2d(const Adaptor2d_Curve2d& C1,
0044                                   const Adaptor2d_Curve2d& C2,
0045                                   const Standard_Real      TolC1 = 1.0e-10,
0046                                   const Standard_Real      TolC2 = 1.0e-10);
0047 
0048   //! It calculates all the distances.
0049   Standard_EXPORT Extrema_ExtCC2d(const Adaptor2d_Curve2d& C1,
0050                                   const Adaptor2d_Curve2d& C2,
0051                                   const Standard_Real      U1,
0052                                   const Standard_Real      U2,
0053                                   const Standard_Real      V1,
0054                                   const Standard_Real      V2,
0055                                   const Standard_Real      TolC1 = 1.0e-10,
0056                                   const Standard_Real      TolC2 = 1.0e-10);
0057 
0058   //! initializes the fields.
0059   Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& C2,
0060                                   const Standard_Real      V1,
0061                                   const Standard_Real      V2,
0062                                   const Standard_Real      TolC1 = 1.0e-10,
0063                                   const Standard_Real      TolC2 = 1.0e-10);
0064 
0065   Standard_EXPORT void Perform(const Adaptor2d_Curve2d& C1,
0066                                const Standard_Real      U1,
0067                                const Standard_Real      U2);
0068 
0069   //! Returns True if the distances are found.
0070   Standard_EXPORT Standard_Boolean IsDone() const;
0071 
0072   //! Returns the number of extremum distances.
0073   Standard_EXPORT Standard_Integer NbExt() const;
0074 
0075   //! Returns True if the two curves are parallel.
0076   Standard_EXPORT Standard_Boolean IsParallel() const;
0077 
0078   //! Returns the value of the Nth extremum square distance.
0079   Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N = 1) const;
0080 
0081   //! Returns the points of the Nth extremum distance.
0082   //! P1 is on the first curve, P2 on the second one.
0083   Standard_EXPORT void Points(const Standard_Integer N,
0084                               Extrema_POnCurv2d&     P1,
0085                               Extrema_POnCurv2d&     P2) const;
0086 
0087   //! if the curve is a trimmed curve,
0088   //! dist11 is a square distance between the point on C1
0089   //! of parameter FirstParameter and the point of
0090   //! parameter FirstParameter on C2.
0091   Standard_EXPORT void TrimmedSquareDistances(Standard_Real& dist11,
0092                                               Standard_Real& distP12,
0093                                               Standard_Real& distP21,
0094                                               Standard_Real& distP22,
0095                                               gp_Pnt2d&      P11,
0096                                               gp_Pnt2d&      P12,
0097                                               gp_Pnt2d&      P21,
0098                                               gp_Pnt2d&      P22) const;
0099 
0100   //! Set flag for single extrema computation. Works on parametric solver only.
0101   Standard_EXPORT void SetSingleSolutionFlag(const Standard_Boolean theSingleSolutionFlag);
0102 
0103   //! Get flag for single extrema computation. Works on parametric solver only.
0104   Standard_EXPORT Standard_Boolean GetSingleSolutionFlag() const;
0105 
0106 protected:
0107   Standard_EXPORT void Results(const Extrema_ExtElC2d& AlgExt,
0108                                const Standard_Real     Ut11,
0109                                const Standard_Real     Ut12,
0110                                const Standard_Real     Ut21,
0111                                const Standard_Real     Ut22,
0112                                const Standard_Real     Period1 = 0.0,
0113                                const Standard_Real     Period2 = 0.0);
0114 
0115   Standard_EXPORT void Results(const Extrema_ECC2d& AlgExt,
0116                                const Standard_Real  Ut11,
0117                                const Standard_Real  Ut12,
0118                                const Standard_Real  Ut21,
0119                                const Standard_Real  Ut22,
0120                                const Standard_Real  Period1 = 0.0,
0121                                const Standard_Real  Period2 = 0.0);
0122 
0123 private:
0124   Standard_Boolean            myIsFindSingleSolution; // Default value is false.
0125   Standard_Boolean            myDone;
0126   Standard_Boolean            myIsPar;
0127   Extrema_SequenceOfPOnCurv2d mypoints;
0128   TColStd_SequenceOfReal      mySqDist;
0129   Standard_Integer            mynbext;
0130   Standard_Boolean            inverse;
0131   const Adaptor2d_Curve2d*    myC;
0132   Standard_Real               myv1;
0133   Standard_Real               myv2;
0134   Standard_Real               mytolc1;
0135   Standard_Real               mytolc2;
0136   gp_Pnt2d                    P1f;
0137   gp_Pnt2d                    P1l;
0138   gp_Pnt2d                    P2f;
0139   gp_Pnt2d                    P2l;
0140   Standard_Real               mydist11;
0141   Standard_Real               mydist12;
0142   Standard_Real               mydist21;
0143   Standard_Real               mydist22;
0144 };
0145 
0146 #endif // _Extrema_ExtCC2d_HeaderFile