|
|
|||
File indexing completed on 2026-09-14 09:14:22
0001 // Created on: 1994-03-23 0002 // Created by: Bruno DUMORTIER 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 _Geom2dAPI_ExtremaCurveCurve_HeaderFile 0018 #define _Geom2dAPI_ExtremaCurveCurve_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Standard_Integer.hxx> 0025 #include <Extrema_ExtCC2d.hxx> 0026 #include <Geom2dAdaptor_Curve.hxx> 0027 class Geom2d_Curve; 0028 class gp_Pnt2d; 0029 0030 //! Describes functions for computing all the extrema 0031 //! between two 2D curves. 0032 //! An ExtremaCurveCurve algorithm minimizes or 0033 //! maximizes the distance between a point on the first 0034 //! curve and a point on the second curve. Thus, it 0035 //! computes the start point and end point of 0036 //! perpendiculars common to the two curves (an 0037 //! intersection point is not an extremum except where 0038 //! the two curves are tangential at this point). 0039 //! Solutions consist of pairs of points, and an extremum 0040 //! is considered to be a segment joining the two points of a solution. 0041 //! An ExtremaCurveCurve object provides a framework for: 0042 //! - defining the construction of the extrema, 0043 //! - implementing the construction algorithm, and 0044 //! - consulting the results. 0045 //! Warning 0046 //! In some cases, the nearest points between two 0047 //! curves do not correspond to one of the computed 0048 //! extrema. Instead, they may be given by: 0049 //! - a limit point of one curve and one of the following: 0050 //! - its orthogonal projection on the other curve, 0051 //! - a limit point of the other curve; or 0052 //! - an intersection point between the two curves. 0053 class Geom2dAPI_ExtremaCurveCurve 0054 { 0055 public: 0056 DEFINE_STANDARD_ALLOC 0057 0058 //! Computes the extrema between 0059 //! - the portion of the curve C1 limited by the two 0060 //! points of parameter (U1min,U1max), and 0061 //! - the portion of the curve C2 limited by the two 0062 //! points of parameter (U2min,U2max). 0063 //! Warning 0064 //! Use the function NbExtrema to obtain the number 0065 //! of solutions. If this algorithm fails, NbExtrema returns 0. 0066 Standard_EXPORT Geom2dAPI_ExtremaCurveCurve(const occ::handle<Geom2d_Curve>& C1, 0067 const occ::handle<Geom2d_Curve>& C2, 0068 const double U1min, 0069 const double U1max, 0070 const double U2min, 0071 const double U2max); 0072 0073 //! Returns the number of extrema computed by this algorithm. 0074 //! Note: if this algorithm fails, NbExtrema returns 0. 0075 Standard_EXPORT int NbExtrema() const; 0076 Standard_EXPORT operator int() const; 0077 0078 //! Returns the points P1 on the first curve and P2 on 0079 //! the second curve, which are the ends of the 0080 //! extremum of index Index computed by this algorithm. 0081 //! Exceptions 0082 //! Standard_OutOfRange if Index is not in the range [ 0083 //! 1,NbExtrema ], where NbExtrema is the 0084 //! number of extrema computed by this algorithm. 0085 Standard_EXPORT void Points(const int Index, gp_Pnt2d& P1, gp_Pnt2d& P2) const; 0086 0087 //! Returns the parameters U1 of the point on the first 0088 //! curve and U2 of the point on the second curve, which 0089 //! are the ends of the extremum of index Index 0090 //! computed by this algorithm. 0091 //! Exceptions 0092 //! Standard_OutOfRange if Index is not in the range [ 0093 //! 1,NbExtrema ], where NbExtrema is the 0094 //! number of extrema computed by this algorithm. 0095 Standard_EXPORT void Parameters(const int Index, double& U1, double& U2) const; 0096 0097 //! Computes the distance between the end points of the 0098 //! extremum of index Index computed by this algorithm. 0099 //! Exceptions 0100 //! Standard_OutOfRange if Index is not in the range [ 0101 //! 1,NbExtrema ], where NbExtrema is the 0102 //! number of extrema computed by this algorithm. 0103 Standard_EXPORT double Distance(const int Index) const; 0104 0105 //! Returns the points P1 on the first curve and P2 on 0106 //! the second curve, which are the ends of the shortest 0107 //! extremum computed by this algorithm. 0108 //! Exceptions StdFail_NotDone if this algorithm fails. 0109 Standard_EXPORT void NearestPoints(gp_Pnt2d& P1, gp_Pnt2d& P2) const; 0110 0111 //! Returns the parameters U1 of the point on the first 0112 //! curve and U2 of the point on the second curve, which 0113 //! are the ends of the shortest extremum computed by this algorithm. 0114 //! Exceptions 0115 //! StdFail_NotDone if this algorithm fails. 0116 Standard_EXPORT void LowerDistanceParameters(double& U1, double& U2) const; 0117 0118 //! Computes the distance between the end points of the 0119 //! shortest extremum computed by this algorithm. 0120 //! Exceptions - StdFail_NotDone if this algorithm fails. 0121 Standard_EXPORT double LowerDistance() const; 0122 Standard_EXPORT operator double() const; 0123 0124 const Extrema_ExtCC2d& Extrema() const; 0125 0126 private: 0127 bool myIsDone; 0128 int myIndex; 0129 Extrema_ExtCC2d myExtCC; 0130 Geom2dAdaptor_Curve myC1; 0131 Geom2dAdaptor_Curve myC2; 0132 }; 0133 0134 #include <Geom2dAPI_ExtremaCurveCurve.lxx> 0135 0136 #endif // _Geom2dAPI_ExtremaCurveCurve_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|