|
|
|||
File indexing completed on 2026-09-26 09:03:12
0001 // Created on: 1994-03-18 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 _GeomAPI_ExtremaCurveCurve_HeaderFile 0018 #define _GeomAPI_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_ExtCC.hxx> 0026 #include <GeomAdaptor_Curve.hxx> 0027 #include <gp_Pnt.hxx> 0028 class Geom_Curve; 0029 0030 //! Describes functions for computing all the extrema 0031 //! between two 3D 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 start and end points of perpendiculars 0036 //! common to the two curves (an intersection point is 0037 //! not an extremum unless the two curves are tangential at this point). 0038 //! Solutions consist of pairs of points, and an extremum 0039 //! is considered to be a segment joining the two points of a solution. 0040 //! An ExtremaCurveCurve object provides a framework for: 0041 //! - defining the construction of the extrema, 0042 //! - implementing the construction algorithm, and 0043 //! - consulting the results. 0044 //! Warning 0045 //! In some cases, the nearest points between two 0046 //! curves do not correspond to one of the computed 0047 //! extrema. Instead, they may be given by: 0048 //! - a limit point of one curve and one of the following: 0049 //! - its orthogonal projection on the other curve, 0050 //! - a limit point of the other curve; or 0051 //! - an intersection point between the two curves. 0052 class GeomAPI_ExtremaCurveCurve 0053 { 0054 public: 0055 DEFINE_STANDARD_ALLOC 0056 0057 //! Constructs an empty algorithm for computing 0058 //! extrema between two curves. Use an Init function 0059 //! to define the curves on which it is going to work. 0060 Standard_EXPORT GeomAPI_ExtremaCurveCurve(); 0061 0062 //! Computes the extrema between the curves C1 and C2. 0063 Standard_EXPORT GeomAPI_ExtremaCurveCurve(const occ::handle<Geom_Curve>& C1, 0064 const occ::handle<Geom_Curve>& C2); 0065 0066 //! Computes the portion of the curve C1 limited by the two 0067 //! points of parameter (U1min,U1max), and 0068 //! - the portion of the curve C2 limited by the two 0069 //! points of parameter (U2min,U2max). 0070 //! Warning 0071 //! Use the function NbExtrema to obtain the number 0072 //! of solutions. If this algorithm fails, NbExtrema returns 0. 0073 Standard_EXPORT GeomAPI_ExtremaCurveCurve(const occ::handle<Geom_Curve>& C1, 0074 const occ::handle<Geom_Curve>& C2, 0075 const double U1min, 0076 const double U1max, 0077 const double U2min, 0078 const double U2max); 0079 0080 //! Initializes this algorithm with the given arguments 0081 //! and computes the extrema between the curves C1 and C2 0082 Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C1, const occ::handle<Geom_Curve>& C2); 0083 0084 //! Initializes this algorithm with the given arguments 0085 //! and computes the extrema between : 0086 //! - the portion of the curve C1 limited by the two 0087 //! points of parameter (U1min,U1max), and 0088 //! - the portion of the curve C2 limited by the two 0089 //! points of parameter (U2min,U2max). 0090 //! Warning 0091 //! Use the function NbExtrema to obtain the number 0092 //! of solutions. If this algorithm fails, NbExtrema returns 0. 0093 Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C1, 0094 const occ::handle<Geom_Curve>& C2, 0095 const double U1min, 0096 const double U1max, 0097 const double U2min, 0098 const double U2max); 0099 0100 //! Returns the number of extrema computed by this algorithm. 0101 //! Note: if this algorithm fails, NbExtrema returns 0. 0102 Standard_EXPORT int NbExtrema() const; 0103 Standard_EXPORT operator int() const; 0104 0105 //! Returns the points P1 on the first curve and P2 on 0106 //! the second curve, which are the ends of the 0107 //! extremum of index Index computed by this algorithm. 0108 //! Exceptions 0109 //! Standard_OutOfRange if Index is not in the range [ 0110 //! 1,NbExtrema ], where NbExtrema is the 0111 //! number of extrema computed by this algorithm. 0112 Standard_EXPORT void Points(const int Index, gp_Pnt& P1, gp_Pnt& P2) const; 0113 0114 //! Returns the parameters U1 of the point on the first 0115 //! curve and U2 of the point on the second curve, which 0116 //! are the ends of the extremum of index Index computed by this algorithm. 0117 //! Exceptions 0118 //! Standard_OutOfRange if Index is not in the range [ 0119 //! 1,NbExtrema ], where NbExtrema is the 0120 //! number of extrema computed by this algorithm. 0121 Standard_EXPORT void Parameters(const int Index, double& U1, double& U2) const; 0122 0123 //! Computes the distance between the end points of the 0124 //! extremum of index Index computed by this algorithm. 0125 //! Exceptions 0126 //! Standard_OutOfRange if Index is not in the range [ 0127 //! 1,NbExtrema ], where NbExtrema is the 0128 //! number of extrema computed by this algorithm. 0129 Standard_EXPORT double Distance(const int Index) const; 0130 0131 //! Returns True if the two curves are parallel. 0132 bool IsParallel() const { return myExtCC.IsParallel(); } 0133 0134 //! Returns the points P1 on the first curve and P2 on 0135 //! the second curve, which are the ends of the shortest 0136 //! extremum computed by this algorithm. 0137 //! Exceptions StdFail_NotDone if this algorithm fails. 0138 Standard_EXPORT void NearestPoints(gp_Pnt& P1, gp_Pnt& P2) const; 0139 0140 //! Returns the parameters U1 of the point on the first 0141 //! curve and U2 of the point on the second curve, which 0142 //! are the ends of the shortest extremum computed by this algorithm. 0143 //! Exceptions StdFail_NotDone if this algorithm fails. 0144 Standard_EXPORT void LowerDistanceParameters(double& U1, double& U2) const; 0145 0146 //! Computes the distance between the end points of the 0147 //! shortest extremum computed by this algorithm. 0148 //! Exceptions StdFail_NotDone if this algorithm fails. 0149 Standard_EXPORT double LowerDistance() const; 0150 Standard_EXPORT operator double() const; 0151 0152 //! return the algorithmic object from Extrema 0153 const Extrema_ExtCC& Extrema() const; 0154 0155 //! set in <P1> and <P2> the couple solution points 0156 //! such a the distance [P1,P2] is the minimum. taking in account 0157 //! extremity points of curves. 0158 Standard_EXPORT bool TotalNearestPoints(gp_Pnt& P1, gp_Pnt& P2); 0159 0160 //! set in <U1> and <U2> the parameters of the couple 0161 //! solution points which represents the total nearest 0162 //! solution. 0163 Standard_EXPORT bool TotalLowerDistanceParameters(double& U1, double& U2); 0164 0165 //! return the distance of the total nearest couple solution 0166 //! point. 0167 //! if <myExtCC> is not done 0168 Standard_EXPORT double TotalLowerDistance(); 0169 0170 private: 0171 Standard_EXPORT void TotalPerform(); 0172 0173 bool myIsDone; 0174 int myIndex; 0175 Extrema_ExtCC myExtCC; 0176 GeomAdaptor_Curve myC1; 0177 GeomAdaptor_Curve myC2; 0178 bool myTotalExt; 0179 bool myIsInfinite; 0180 double myTotalDist; 0181 gp_Pnt myTotalPoints[2]; 0182 double myTotalPars[2]; 0183 }; 0184 0185 #include <GeomAPI_ExtremaCurveCurve.lxx> 0186 0187 #endif // _GeomAPI_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 |
|