b311480e |
1 | // Created on: 1994-07-06 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
0b85f9a6 |
17 | #include <Extrema_LocateExtCC2d.hxx> |
18 | |
7fd59977 |
19 | #include <GeomAbs_CurveType.hxx> |
20 | #include <StdFail_NotDone.hxx> |
21 | #include <Extrema_POnCurv2d.hxx> |
22 | #include <Precision.hxx> |
23 | |
0b85f9a6 |
24 | #include <Adaptor2d_Curve2d.hxx> |
25 | #include <Extrema_Curve2dTool.hxx> |
26 | #include <Extrema_LocECC2d.hxx> |
27 | |
7fd59977 |
28 | |
29 | //======================================================================= |
0b85f9a6 |
30 | //function : Extrema_LocateExtCC2d |
7fd59977 |
31 | //purpose : |
32 | //======================================================================= |
33 | |
0b85f9a6 |
34 | Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d& C1, |
35 | const Adaptor2d_Curve2d& C2, |
36 | const Standard_Real U0, |
37 | const Standard_Real V0) |
7fd59977 |
38 | { |
0b85f9a6 |
39 | Standard_Real TolU = Extrema_Curve2dTool::Resolution(C1, Precision::Confusion()); |
40 | Standard_Real TolV = Extrema_Curve2dTool::Resolution(C2, Precision::Confusion()); |
7fd59977 |
41 | Extrema_POnCurv2d P1, P2; |
42 | |
43 | // Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC. |
44 | |
45 | |
46 | Extrema_LocECC2d Xtrem(C1, C2, U0, V0, TolU, TolV); |
47 | // Exploitation |
48 | |
49 | myDone = Xtrem.IsDone(); |
50 | if (Xtrem.IsDone()) { |
51 | mySqDist = Xtrem.SquareDistance(); |
52 | Xtrem.Point(P1, P2); |
53 | myPoint1 = P1; |
54 | myPoint2 = P2; |
55 | } |
56 | |
57 | } |
58 | |
59 | |
60 | |
61 | |
62 | //======================================================================= |
63 | //function : IsDone |
64 | //purpose : |
65 | //======================================================================= |
66 | |
0b85f9a6 |
67 | Standard_Boolean Extrema_LocateExtCC2d::IsDone () const { |
7fd59977 |
68 | |
69 | return myDone; |
70 | } |
71 | |
72 | |
73 | //======================================================================= |
74 | //function : Value |
75 | //purpose : |
76 | //======================================================================= |
77 | |
0b85f9a6 |
78 | Standard_Real Extrema_LocateExtCC2d::SquareDistance() const { |
7fd59977 |
79 | |
9775fa61 |
80 | if (!myDone) { throw StdFail_NotDone(); } |
7fd59977 |
81 | return mySqDist; |
82 | } |
83 | |
84 | |
85 | |
86 | //======================================================================= |
87 | //function : Point |
88 | //purpose : |
89 | //======================================================================= |
90 | |
0b85f9a6 |
91 | void Extrema_LocateExtCC2d::Point (Extrema_POnCurv2d& P1, |
92 | Extrema_POnCurv2d& P2) const |
7fd59977 |
93 | { |
9775fa61 |
94 | if (!myDone) { throw StdFail_NotDone(); } |
7fd59977 |
95 | P1 = myPoint1; |
96 | P2 = myPoint2; |
97 | } |