b311480e |
1 | // Created on: 1992-09-02 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <gce_MakeParab2d.ixx> |
23 | #include <gp.hxx> |
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 | |
55 | gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d& D , |
56 | const gp_Pnt2d& F ) |
57 | { |
58 | TheParab2d = gp_Parab2d(D,F); |
59 | TheError = gce_Done; |
60 | } |
61 | |
62 | //========================================================================= |
63 | // Creation d une Parabole 2d de gp de centre <Center> et de sommet + |
64 | // <S1> . + |
65 | // <CenterS1> donne le grand axe . + |
66 | // <S1> donne la focale. + |
67 | //========================================================================= |
68 | |
69 | gce_MakeParab2d::gce_MakeParab2d(const gp_Pnt2d& S , |
70 | const gp_Pnt2d& Center , |
71 | const Standard_Boolean Sense ) |
72 | { |
73 | if (S.Distance(Center) >= gp::Resolution()) { |
74 | gp_Dir2d XAxis(gp_XY(S.XY()-Center.XY())); |
75 | TheParab2d = gp_Parab2d(gp_Ax2d(Center,XAxis),S.Distance(Center),Sense); |
76 | TheError = gce_Done; |
77 | } |
78 | else { TheError = gce_NullAxis; } |
79 | } |
80 | |
81 | const gp_Parab2d& gce_MakeParab2d::Value () const |
82 | { |
83 | StdFail_NotDone_Raise_if(!TheError == gce_Done,""); |
84 | return TheParab2d; |
85 | } |
86 | |
87 | const gp_Parab2d& gce_MakeParab2d::Operator() const |
88 | { |
89 | return Value(); |
90 | } |
91 | |
92 | gce_MakeParab2d::operator gp_Parab2d() const |
93 | { |
94 | return Value(); |
95 | } |
96 | |