0024624: Lost word in license statement in source files
[occt.git] / src / gce / gce_MakeHypr2d.cxx
1 // Created on: 1992-09-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <gce_MakeHypr2d.ixx>
18 #include <gp_Lin2d.hxx>
19 #include <StdFail_NotDone.hxx>
20
21 //=========================================================================
22 //   Creation d une Hyperbola 2d de gp de centre <Center> et de sommets   +
23 //   <S1> et <S2>.                                                        +
24 //   <CenterS1> donne le grand axe .                                      +
25 //   <S1> donne le grand rayon et <S2> le petit rayon.                    +
26 //=========================================================================
27
28 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Pnt2d&   S1     ,
29                                const gp_Pnt2d&   S2     ,
30                                const gp_Pnt2d&   Center )
31 {
32   gp_Dir2d XAxis(gp_XY(S1.XY()-Center.XY()));
33   gp_Dir2d YAxis(gp_XY(S2.XY()-Center.XY()));
34   gp_Ax22d Axis(Center,XAxis,YAxis);
35   gp_Lin2d L(Center,XAxis);
36   Standard_Real D1 = S1.Distance(Center);
37   Standard_Real D2 = L.Distance(S2);
38   if (D1 >= D2) {
39     TheHypr2d = gp_Hypr2d(Axis,D1,D2);
40     TheError = gce_Done;
41   }
42   else { TheError = gce_InvertAxis; }
43 }
44
45 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax2d&         MajorAxis   ,
46                                const Standard_Real    MajorRadius ,
47                                const Standard_Real    MinorRadius ,
48                                const Standard_Boolean Sense       )
49 {
50   if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
51   else {
52     TheHypr2d = gp_Hypr2d(MajorAxis,MajorRadius,MinorRadius,Sense);
53     TheError = gce_Done;
54   }
55 }
56
57 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax22d&     A           ,
58                                const Standard_Real MajorRadius ,
59                                const Standard_Real MinorRadius )
60 {
61   if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
62   else {
63     TheHypr2d = gp_Hypr2d(A,MajorRadius,MinorRadius);
64     TheError = gce_Done;
65   }
66 }
67
68 const gp_Hypr2d& gce_MakeHypr2d::Value() const
69
70   StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
71   return TheHypr2d;
72 }
73
74 const gp_Hypr2d& gce_MakeHypr2d::Operator() const 
75 {
76   return Value();
77 }
78
79 gce_MakeHypr2d::operator gp_Hypr2d() const
80 {
81   return Value();
82 }
83