b311480e |
1 | // Created on: 1992-09-02 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <gce_MakeParab2d.hxx> |
7fd59977 |
19 | #include <gp.hxx> |
42cf5bc1 |
20 | #include <gp_Ax2d.hxx> |
21 | #include <gp_Ax22d.hxx> |
22 | #include <gp_Parab2d.hxx> |
23 | #include <gp_Pnt2d.hxx> |
7fd59977 |
24 | #include <StdFail_NotDone.hxx> |
25 | |
26 | gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d& A , |
27 | const Standard_Real Focal ) |
28 | { |
29 | if (Focal < 0.0) { TheError = gce_NullFocusLength; } |
30 | else { |
31 | TheParab2d = gp_Parab2d(A,Focal); |
32 | TheError = gce_Done; |
33 | } |
34 | } |
35 | |
36 | gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d& MirrorAxis , |
37 | const Standard_Real Focal , |
38 | const Standard_Boolean Sense ) |
39 | { |
40 | if (Focal < 0.0) { TheError = gce_NullFocusLength; } |
41 | else { |
42 | TheParab2d = gp_Parab2d(MirrorAxis,Focal,Sense); |
43 | TheError = gce_Done; |
44 | } |
45 | } |
46 | |
47 | gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d& D , |
48 | const gp_Pnt2d& F , |
49 | const Standard_Boolean Sense ) |
50 | { |
51 | TheParab2d = gp_Parab2d(D,F,Sense); |
52 | TheError = gce_Done; |
53 | } |
54 | |
7fd59977 |
55 | //========================================================================= |
56 | // Creation d une Parabole 2d de gp de centre <Center> et de sommet + |
57 | // <S1> . + |
58 | // <CenterS1> donne le grand axe . + |
59 | // <S1> donne la focale. + |
60 | //========================================================================= |
61 | |
62 | gce_MakeParab2d::gce_MakeParab2d(const gp_Pnt2d& S , |
63 | const gp_Pnt2d& Center , |
64 | const Standard_Boolean Sense ) |
65 | { |
66 | if (S.Distance(Center) >= gp::Resolution()) { |
67 | gp_Dir2d XAxis(gp_XY(S.XY()-Center.XY())); |
68 | TheParab2d = gp_Parab2d(gp_Ax2d(Center,XAxis),S.Distance(Center),Sense); |
69 | TheError = gce_Done; |
70 | } |
71 | else { TheError = gce_NullAxis; } |
72 | } |
73 | |
74 | const gp_Parab2d& gce_MakeParab2d::Value () const |
75 | { |
82fc327c |
76 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 |
77 | return TheParab2d; |
78 | } |
79 | |
80 | const gp_Parab2d& gce_MakeParab2d::Operator() const |
81 | { |
82 | return Value(); |
83 | } |
84 | |
85 | gce_MakeParab2d::operator gp_Parab2d() const |
86 | { |
87 | return Value(); |
88 | } |
89 | |