93d6e5f0c31fb60236fcdb4a35661f79cc5ae9c8
[occt.git] / src / gce / gce_MakeParab2d.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_MakeParab2d.ixx>
18 #include <gp.hxx>
19 #include <StdFail_NotDone.hxx>
20
21 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d&     A     ,
22                                  const Standard_Real Focal ) 
23 {
24   if (Focal < 0.0) { TheError = gce_NullFocusLength; }
25   else {
26     TheParab2d = gp_Parab2d(A,Focal);
27     TheError = gce_Done;
28   }
29 }
30
31 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d&         MirrorAxis ,
32                                  const Standard_Real    Focal      ,
33                                  const Standard_Boolean Sense      ) 
34 {
35   if (Focal < 0.0) { TheError = gce_NullFocusLength; }
36   else {
37     TheParab2d = gp_Parab2d(MirrorAxis,Focal,Sense);
38     TheError = gce_Done;
39   }
40 }
41
42 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d&  D            ,
43                                  const gp_Pnt2d& F            ,
44                                  const Standard_Boolean Sense )
45 {
46   TheParab2d = gp_Parab2d(D,F,Sense);
47   TheError = gce_Done;
48 }
49
50 gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d&  D ,
51                                  const gp_Pnt2d& F  )
52 {
53   TheParab2d = gp_Parab2d(D,F);
54   TheError = gce_Done;
55 }
56
57 //=========================================================================
58 //   Creation d une Parabole 2d de gp de centre <Center> et de sommet     +
59 //   <S1> .                                                               +
60 //   <CenterS1> donne le grand axe .                                      +
61 //   <S1> donne la focale.                                                +
62 //=========================================================================
63
64 gce_MakeParab2d::gce_MakeParab2d(const gp_Pnt2d&        S      ,
65                                  const gp_Pnt2d&        Center ,
66                                  const Standard_Boolean Sense  ) 
67 {
68   if (S.Distance(Center) >= gp::Resolution()) {
69     gp_Dir2d XAxis(gp_XY(S.XY()-Center.XY()));
70     TheParab2d = gp_Parab2d(gp_Ax2d(Center,XAxis),S.Distance(Center),Sense);
71     TheError = gce_Done;
72   }
73   else { TheError = gce_NullAxis; }
74 }
75
76 const gp_Parab2d& gce_MakeParab2d::Value () const
77 {
78   StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
79   return TheParab2d;
80 }
81
82 const gp_Parab2d& gce_MakeParab2d::Operator() const 
83 {
84   return Value();
85 }
86
87 gce_MakeParab2d::operator gp_Parab2d() const
88 {
89   return Value();
90 }
91