Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:15:03

0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BRepExtrema_ExtPC_HeaderFile
0015 #define _BRepExtrema_ExtPC_HeaderFile
0016 
0017 #include <Extrema_ExtPC.hxx>
0018 #include <BRepAdaptor_Curve.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 
0021 class TopoDS_Vertex;
0022 class TopoDS_Edge;
0023 
0024 class BRepExtrema_ExtPC
0025 {
0026 public:
0027   DEFINE_STANDARD_ALLOC
0028 
0029   BRepExtrema_ExtPC() = default;
0030 
0031   //! It calculates all the distances.
0032   Standard_EXPORT BRepExtrema_ExtPC(const TopoDS_Vertex& V, const TopoDS_Edge& E);
0033 
0034   Standard_EXPORT void Initialize(const TopoDS_Edge& E);
0035   //! An exception is raised if the fields have not been initialized.
0036   Standard_EXPORT void Perform(const TopoDS_Vertex& V);
0037 
0038   //! True if the distances are found.
0039   bool IsDone() const { return myExtPC.IsDone(); }
0040 
0041   //! Returns the number of extremum distances.
0042   int NbExt() const { return myExtPC.NbExt(); }
0043 
0044   //! Returns True if the <N>th extremum distance is a minimum.
0045   bool IsMin(const int N) const { return myExtPC.IsMin(N); }
0046 
0047   //! Returns the value of the <N>th extremum square distance.
0048   double SquareDistance(const int N) const { return myExtPC.SquareDistance(N); }
0049 
0050   //! Returns the parameter on the edge of the <N>th extremum distance.
0051   double Parameter(const int N) const { return myExtPC.Point(N).Parameter(); }
0052 
0053   //! Returns the Point of the <N>th extremum distance.
0054   gp_Pnt Point(const int N) const { return myExtPC.Point(N).Value(); }
0055 
0056   //! if the curve is a trimmed curve,
0057   //! dist1 is a square distance between <P> and the point
0058   //! of parameter FirstParameter <pnt1> and
0059   //! dist2 is a square distance between <P> and the point
0060   //! of parameter LastParameter <pnt2>.
0061   void TrimmedSquareDistances(double& dist1, double& dist2, gp_Pnt& pnt1, gp_Pnt& pnt2) const
0062   {
0063     myExtPC.TrimmedSquareDistances(dist1, dist2, pnt1, pnt2);
0064   }
0065 
0066 private:
0067   Extrema_ExtPC                  myExtPC;
0068   occ::handle<BRepAdaptor_Curve> myHC;
0069 };
0070 
0071 #endif