OCC22610 The algorithm GeomAPI_ProjectPointOnSurf produces wrong results
[occt.git] / src / Extrema / Extrema_GLocateExtCC.gxx
1 // File:        Extrema_GLocateExtCC.gxx
2 // Created:     Wed Jul  6 15:48:49 1994
3 // Author:      Laurent PAINNOT
4 //              <lpa@metrox>
5
6 #include Extrema_ELCC_hxx
7 #include Extrema_LocECC_hxx
8 #include <StdFail_NotDone.hxx>
9 #include <Extrema_POnCurv.hxx>
10 #include <Precision.hxx>
11
12 Extrema_GLocateExtCC::Extrema_GLocateExtCC (const Curve1&       C1,
13                                             const Curve2&       C2,
14                                             const Standard_Real U0,
15                                             const Standard_Real V0)
16 {
17
18 #ifdef DEB
19   GeomAbs_CurveType type1 = Tool1::GetType(C1);
20   GeomAbs_CurveType type2 = Tool2::GetType(C2);
21 #else
22   Tool1::GetType(C1);
23   Tool2::GetType(C2);
24 #endif
25   Standard_Real TolU = C1.Resolution(Precision::Confusion());
26   Standard_Real TolV = C2.Resolution(Precision::Confusion());
27   Extrema_POnCurv P1, P2;
28
29   // Non implemente pour l instant: l appel a Extrema_ELCC.
30
31
32   Extrema_LocECC Xtrem(C1, C2,
33                        U0, V0, TolU, TolV);     
34   // Exploitation
35
36   myDone = Xtrem.IsDone();
37   if (Xtrem.IsDone()) {
38     mySqDist = Xtrem.SquareDistance();
39     Xtrem.Point(P1, P2);
40     myPoint1 = P1;
41     myPoint2 = P2;
42   }
43
44 }
45
46
47
48
49 Standard_Boolean Extrema_GLocateExtCC::IsDone () const {
50
51   return myDone;
52 }
53
54
55 Standard_Real Extrema_GLocateExtCC::SquareDistance() const {
56
57   if (!myDone) { StdFail_NotDone::Raise(); }
58   return mySqDist;
59 }
60
61
62
63 void Extrema_GLocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
64
65   if (!myDone) { StdFail_NotDone::Raise(); }
66   P1 = myPoint1;
67   P2 = myPoint2;
68 }
69