1 // File: GccAna_Pnt2dBisec.cxx
2 // Created: Fri Oct 4 09:53:31 1991
7 //=========================================================================
8 // CREATION of the BISSECTRICE between two POINTS. +
9 //=========================================================================
11 #include <GccAna_Pnt2dBisec.ixx>
14 #include <gp_Dir2d.hxx>
15 #include <Standard_ConstructionError.hxx>
16 #include <StdFail_NotDone.hxx>
17 #include <GccAna_NoSolution.hxx>
20 //=========================================================================
23 GccAna_Pnt2dBisec (const gp_Pnt2d& Point1,
24 const gp_Pnt2d& Point2) {
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;
40 HasSol = Standard_False;
41 WellDone = Standard_True;
46 //=========================================================================
48 Standard_Boolean GccAna_Pnt2dBisec::
49 IsDone () const { return WellDone; }
51 Standard_Boolean GccAna_Pnt2dBisec::
52 HasSolution () const { return HasSol; }
54 gp_Lin2d GccAna_Pnt2dBisec::
55 ThisSolution () const {
56 if (!WellDone) { StdFail_NotDone::Raise(); }
57 else if (!HasSol) { GccAna_NoSolution::Raise(); }