0022312: Translation of french commentaries in OCCT files
[occt.git] / src / GccAna / GccAna_Pnt2dBisec.cxx
1 // File:        GccAna_Pnt2dBisec.cxx
2 // Created:     Fri Oct  4 09:53:31 1991
3 // Author:      Remi GILET
4 //              <reg@phobox>
5
6
7 //=========================================================================
8 //   CREATION of the BISSECTRICE between two POINTS.                         +
9 //=========================================================================
10
11 #include <GccAna_Pnt2dBisec.ixx>
12
13 #include <gp_XY.hxx>
14 #include <gp_Dir2d.hxx>
15 #include <Standard_ConstructionError.hxx>
16 #include <StdFail_NotDone.hxx>
17 #include <GccAna_NoSolution.hxx>
18 #include <gp.hxx>
19
20 //=========================================================================
21
22 GccAna_Pnt2dBisec::
23    GccAna_Pnt2dBisec (const gp_Pnt2d& Point1,
24                       const gp_Pnt2d& Point2) {
25
26    WellDone = Standard_False;
27 //   if (Point1.Distance(Point2) > gp::Resolution()) {
28    if (Point1.Distance(Point2) > 1.e-10) {
29      gp_Dir2d dir1(Point2.XY()-Point1.XY());
30      linsol = gp_Lin2d(gp_Pnt2d((Point2.X()+Point1.X())/2.,
31 //   ======================================================
32                                    (Point2.Y()+Point1.Y())/2.),
33 //                                 ============================
34                           gp_Dir2d(-dir1.Y(),dir1.X()));
35 //                        =============================
36      HasSol = Standard_True;
37      WellDone = Standard_True;
38    }
39    else { 
40      HasSol = Standard_False;
41      WellDone = Standard_True;
42    }
43  }
44
45
46 //=========================================================================
47
48 Standard_Boolean GccAna_Pnt2dBisec::
49    IsDone () const { return WellDone; }
50
51 Standard_Boolean GccAna_Pnt2dBisec::
52    HasSolution () const { return HasSol; }
53
54 gp_Lin2d GccAna_Pnt2dBisec::
55    ThisSolution () const {
56    if (!WellDone) { StdFail_NotDone::Raise(); }
57    else if (!HasSol) { GccAna_NoSolution::Raise(); }
58    return linsol;
59  }