1 // Created on: 1994-03-18
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GeomAPI_ExtremaSurfaceSurface_HeaderFile
18 #define _GeomAPI_ExtremaSurfaceSurface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Extrema_ExtSS.hxx>
27 class Standard_OutOfRange;
28 class StdFail_NotDone;
34 //! Describes functions for computing all the extrema
35 //! between two surfaces.
36 //! An ExtremaSurfaceSurface algorithm minimizes or
37 //! maximizes the distance between a point on the first
38 //! surface and a point on the second surface. Results
39 //! are start and end points of perpendiculars common to the two surfaces.
40 //! Solutions consist of pairs of points, and an extremum
41 //! is considered to be a segment joining the two points of a solution.
42 //! An ExtremaSurfaceSurface object provides a framework for:
43 //! - defining the construction of the extrema,
44 //! - implementing the construction algorithm, and
45 //! - consulting the results.
47 //! In some cases, the nearest points between the two
48 //! surfaces do not correspond to one of the computed
49 //! extrema. Instead, they may be given by:
50 //! - a point of a bounding curve of one surface and one of the following:
51 //! - its orthogonal projection on the other surface,
52 //! - a point of a bounding curve of the other surface; or
53 //! - any point on intersection curves between the two surfaces.
54 class GeomAPI_ExtremaSurfaceSurface
61 //! Constructs an empty algorithm for computing
62 //! extrema between two surfaces. Use an Init function
63 //! to define the surfaces on which it is going to work.
64 Standard_EXPORT GeomAPI_ExtremaSurfaceSurface();
66 //! Computes the extrema distances between the
67 //! surfaces <S1> and <S2>
68 Standard_EXPORT GeomAPI_ExtremaSurfaceSurface(const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2);
70 //! Computes the extrema distances between
71 //! the portion of the surface S1 limited by the
72 //! two values of parameter (U1min,U1max) in
73 //! the u parametric direction, and by the two
74 //! values of parameter (V1min,V1max) in the v
75 //! parametric direction, and
76 //! - the portion of the surface S2 limited by the
77 //! two values of parameter (U2min,U2max) in
78 //! the u parametric direction, and by the two
79 //! values of parameter (V2min,V2max) in the v
80 //! parametric direction.
81 Standard_EXPORT GeomAPI_ExtremaSurfaceSurface(const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real U1min, const Standard_Real U1max, const Standard_Real V1min, const Standard_Real V1max, const Standard_Real U2min, const Standard_Real U2max, const Standard_Real V2min, const Standard_Real V2max);
83 //! Initializes this algorithm with the given arguments
84 //! and computes the extrema distances between the
85 //! surfaces <S1> and <S2>
86 Standard_EXPORT void Init (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2);
88 //! Initializes this algorithm with the given arguments
89 //! and computes the extrema distances between -
90 //! the portion of the surface S1 limited by the two
91 //! values of parameter (U1min,U1max) in the u
92 //! parametric direction, and by the two values of
93 //! parameter (V1min,V1max) in the v parametric direction, and
94 //! - the portion of the surface S2 limited by the two
95 //! values of parameter (U2min,U2max) in the u
96 //! parametric direction, and by the two values of
97 //! parameter (V2min,V2max) in the v parametric direction.
98 Standard_EXPORT void Init (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real U1min, const Standard_Real U1max, const Standard_Real V1min, const Standard_Real V1max, const Standard_Real U2min, const Standard_Real U2max, const Standard_Real V2min, const Standard_Real V2max);
100 //! Returns the number of extrema computed by this algorithm.
101 //! Note: if this algorithm fails, NbExtrema returns 0.
102 Standard_EXPORT Standard_Integer NbExtrema() const;
103 Standard_EXPORT operator Standard_Integer() const;
105 //! Returns the points P1 on the first surface and P2 on
106 //! the second surface, which are the ends of the
107 //! extremum of index Index computed by this algorithm.
109 //! Standard_OutOfRange if Index is not in the range [
110 //! 1,NbExtrema ], where NbExtrema is the
111 //! number of extrema computed by this algorithm.
112 Standard_EXPORT void Points (const Standard_Integer Index, gp_Pnt& P1, gp_Pnt& P2) const;
114 //! Returns the parameters (U1,V1) of the point on the
115 //! first surface, and (U2,V2) of the point on the second
116 //! surface, which are the ends of the extremum of index
117 //! Index computed by this algorithm.
119 //! Standard_OutOfRange if Index is not in the range [
120 //! 1,NbExtrema ], where NbExtrema is the
121 //! number of extrema computed by this algorithm.
122 Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
124 //! Computes the distance between the end points of the
125 //! extremum of index Index computed by this algorithm.
127 //! Standard_OutOfRange if Index is not in the range [
128 //! 1,NbExtrema ], where NbExtrema is the
129 //! number of extrema computed by this algorithm.
130 Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
132 //! Returns the points P1 on the first surface and P2 on
133 //! the second surface, which are the ends of the
134 //! shortest extremum computed by this algorithm.
135 //! Exceptions StdFail_NotDone if this algorithm fails.
136 Standard_EXPORT void NearestPoints (gp_Pnt& P1, gp_Pnt& P2) const;
138 //! Returns the parameters (U1,V1) of the point on the
139 //! first surface and (U2,V2) of the point on the second
140 //! surface, which are the ends of the shortest extremum
141 //! computed by this algorithm.
142 //! Exceptions - StdFail_NotDone if this algorithm fails.
143 Standard_EXPORT void LowerDistanceParameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
145 //! Computes the distance between the end points of the
146 //! shortest extremum computed by this algorithm.
147 //! Exceptions StdFail_NotDone if this algorithm fails.
148 Standard_EXPORT Standard_Real LowerDistance() const;
149 Standard_EXPORT operator Standard_Real() const;
151 //! return the algorithmic object from Extrema
152 const Extrema_ExtSS& Extrema() const;
156 Standard_Boolean myIsDone;
157 Standard_Integer myIndex;
158 Extrema_ExtSS myExtSS;
163 #include <GeomAPI_ExtremaSurfaceSurface.lxx>
169 #endif // _GeomAPI_ExtremaSurfaceSurface_HeaderFile