0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Geom2dAPI / Geom2dAPI_ExtremaCurveCurve.hxx
CommitLineData
42cf5bc1 1// Created on: 1994-03-23
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1994-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Geom2dAPI_ExtremaCurveCurve_HeaderFile
18#define _Geom2dAPI_ExtremaCurveCurve_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <Standard_Integer.hxx>
26#include <Extrema_ExtCC2d.hxx>
27#include <Geom2dAdaptor_Curve.hxx>
28#include <Quantity_Parameter.hxx>
29#include <Quantity_Length.hxx>
30class Standard_OutOfRange;
31class StdFail_NotDone;
32class Geom2d_Curve;
33class gp_Pnt2d;
34class Extrema_ExtCC2d;
35
36
37//! Describes functions for computing all the extrema
38//! between two 2D curves.
39//! An ExtremaCurveCurve algorithm minimizes or
40//! maximizes the distance between a point on the first
41//! curve and a point on the second curve. Thus, it
42//! computes the start point and end point of
43//! perpendiculars common to the two curves (an
44//! intersection point is not an extremum except where
45//! the two curves are tangential at this point).
46//! Solutions consist of pairs of points, and an extremum
47//! is considered to be a segment joining the two points of a solution.
48//! An ExtremaCurveCurve object provides a framework for:
49//! - defining the construction of the extrema,
50//! - implementing the construction algorithm, and
51//! - consulting the results.
52//! Warning
53//! In some cases, the nearest points between two
54//! curves do not correspond to one of the computed
55//! extrema. Instead, they may be given by:
56//! - a limit point of one curve and one of the following:
57//! - its orthogonal projection on the other curve,
58//! - a limit point of the other curve; or
59//! - an intersection point between the two curves.
60class Geom2dAPI_ExtremaCurveCurve
61{
62public:
63
64 DEFINE_STANDARD_ALLOC
65
66
67 //! Computes the extrema between
68 //! - the portion of the curve C1 limited by the two
69 //! points of parameter (U1min,U1max), and
70 //! - the portion of the curve C2 limited by the two
71 //! points of parameter (U2min,U2max).
72 //! Warning
73 //! Use the function NbExtrema to obtain the number
74 //! of solutions. If this algorithm fails, NbExtrema returns 0.
75 Standard_EXPORT Geom2dAPI_ExtremaCurveCurve(const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Quantity_Parameter U1min, const Quantity_Parameter U1max, const Quantity_Parameter U2min, const Quantity_Parameter U2max);
76
77 //! Returns the number of extrema computed by this algorithm.
78 //! Note: if this algorithm fails, NbExtrema returns 0.
79 Standard_EXPORT Standard_Integer NbExtrema() const;
80Standard_EXPORT operator Standard_Integer() const;
81
82 //! Returns the points P1 on the first curve and P2 on
83 //! the second curve, which are the ends of the
84 //! extremum of index Index computed by this algorithm.
85 //! Exceptions
86 //! Standard_OutOfRange if Index is not in the range [
87 //! 1,NbExtrema ], where NbExtrema is the
88 //! number of extrema computed by this algorithm.
89 Standard_EXPORT void Points (const Standard_Integer Index, gp_Pnt2d& P1, gp_Pnt2d& P2) const;
90
91 //! Returns the parameters U1 of the point on the first
92 //! curve and U2 of the point on the second curve, which
93 //! are the ends of the extremum of index Index
94 //! computed by this algorithm.
95 //! Exceptions
96 //! Standard_OutOfRange if Index is not in the range [
97 //! 1,NbExtrema ], where NbExtrema is the
98 //! number of extrema computed by this algorithm.
99 Standard_EXPORT void Parameters (const Standard_Integer Index, Quantity_Parameter& U1, Quantity_Parameter& U2) const;
100
101 //! Computes the distance between the end points of the
102 //! extremum of index Index computed by this algorithm.
103 //! Exceptions
104 //! Standard_OutOfRange if Index is not in the range [
105 //! 1,NbExtrema ], where NbExtrema is the
106 //! number of extrema computed by this algorithm.
107 Standard_EXPORT Quantity_Length Distance (const Standard_Integer Index) const;
108
109 //! Returns the points P1 on the first curve and P2 on
110 //! the second curve, which are the ends of the shortest
111 //! extremum computed by this algorithm.
112 //! Exceptions StdFail_NotDone if this algorithm fails.
113 Standard_EXPORT void NearestPoints (gp_Pnt2d& P1, gp_Pnt2d& P2) const;
114
115 //! Returns the parameters U1 of the point on the first
116 //! curve and U2 of the point on the second curve, which
117 //! are the ends of the shortest extremum computed by this algorithm.
118 //! Exceptions
119 //! StdFail_NotDone if this algorithm fails.
120 Standard_EXPORT void LowerDistanceParameters (Quantity_Parameter& U1, Quantity_Parameter& U2) const;
121
122 //! Computes the distance between the end points of the
123 //! shortest extremum computed by this algorithm.
124 //! Exceptions - StdFail_NotDone if this algorithm fails.
125 Standard_EXPORT Quantity_Length LowerDistance() const;
126Standard_EXPORT operator Standard_Real() const;
127
128 const Extrema_ExtCC2d& Extrema() const;
129
130
131
132
133protected:
134
135
136
137
138
139private:
140
141
142
143 Standard_Boolean myIsDone;
144 Standard_Integer myIndex;
145 Extrema_ExtCC2d myExtCC;
146 Geom2dAdaptor_Curve myC1;
147 Geom2dAdaptor_Curve myC2;
148
149
150};
151
152
153#include <Geom2dAPI_ExtremaCurveCurve.lxx>
154
155
156
157
158
159#endif // _Geom2dAPI_ExtremaCurveCurve_HeaderFile