Integration of OCCT 6.5.0 from SVN
[occt.git] / src / gce / gce_MakeParab2d.cxx
1 // File:        gce_MakeParab2d.cxx
2 // Created:     Wed Sep  2 12:35:36 1992
3 // Author:      Remi GILET
4 //              <reg@sdsun1>
5
6 #include <gce_MakeParab2d.ixx>
7 #include <gp.hxx>
8 #include <StdFail_NotDone.hxx>
9
10 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d&     A     ,
11                                  const Standard_Real Focal ) 
12 {
13   if (Focal < 0.0) { TheError = gce_NullFocusLength; }
14   else {
15     TheParab2d = gp_Parab2d(A,Focal);
16     TheError = gce_Done;
17   }
18 }
19
20 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d&         MirrorAxis ,
21                                  const Standard_Real    Focal      ,
22                                  const Standard_Boolean Sense      ) 
23 {
24   if (Focal < 0.0) { TheError = gce_NullFocusLength; }
25   else {
26     TheParab2d = gp_Parab2d(MirrorAxis,Focal,Sense);
27     TheError = gce_Done;
28   }
29 }
30
31 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d&  D            ,
32                                  const gp_Pnt2d& F            ,
33                                  const Standard_Boolean Sense )
34 {
35   TheParab2d = gp_Parab2d(D,F,Sense);
36   TheError = gce_Done;
37 }
38
39 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d&  D ,
40                                  const gp_Pnt2d& F  )
41 {
42   TheParab2d = gp_Parab2d(D,F);
43   TheError = gce_Done;
44 }
45
46 //=========================================================================
47 //   Creation d une Parabole 2d de gp de centre <Center> et de sommet     +
48 //   <S1> .                                                               +
49 //   <CenterS1> donne le grand axe .                                      +
50 //   <S1> donne la focale.                                                +
51 //=========================================================================
52
53 gce_MakeParab2d::gce_MakeParab2d(const gp_Pnt2d&        S      ,
54                                  const gp_Pnt2d&        Center ,
55                                  const Standard_Boolean Sense  ) 
56 {
57   if (S.Distance(Center) >= gp::Resolution()) {
58     gp_Dir2d XAxis(gp_XY(S.XY()-Center.XY()));
59     TheParab2d = gp_Parab2d(gp_Ax2d(Center,XAxis),S.Distance(Center),Sense);
60     TheError = gce_Done;
61   }
62   else { TheError = gce_NullAxis; }
63 }
64
65 const gp_Parab2d& gce_MakeParab2d::Value () const
66 {
67   StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
68   return TheParab2d;
69 }
70
71 const gp_Parab2d& gce_MakeParab2d::Operator() const 
72 {
73   return Value();
74 }
75
76 gce_MakeParab2d::operator gp_Parab2d() const
77 {
78   return Value();
79 }
80