Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1992-10-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 | |
17 | #include <GC_MakeConicalSurface.ixx> | |
18 | #include <gce_MakeCone.hxx> | |
19 | #include <gp.hxx> | |
20 | #include <StdFail_NotDone.hxx> | |
21 | #include <Standard_NotImplemented.hxx> | |
22 | ||
23 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Ax2& A2 , | |
24 | const Standard_Real Ang , | |
25 | const Standard_Real Radius) | |
26 | { | |
27 | if (Radius < 0.) { TheError = gce_NegativeRadius; } | |
c6541a0c | 28 | else if (Ang <= gp::Resolution() || Ang >= M_PI/2. - gp::Resolution()) { |
7fd59977 | 29 | TheError = gce_BadAngle; |
30 | } | |
31 | else { | |
32 | TheError = gce_Done; | |
33 | TheCone = new Geom_ConicalSurface(A2,Ang,Radius); | |
34 | } | |
35 | } | |
36 | ||
37 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Cone& C) | |
38 | { | |
39 | TheError = gce_Done; | |
40 | TheCone = new Geom_ConicalSurface(C); | |
41 | } | |
42 | ||
43 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Cone& , //C, | |
44 | const gp_Pnt& ) //P ) | |
45 | { | |
46 | Standard_NotImplemented::Raise("GC_MakeConicalSurface"); | |
47 | } | |
48 | ||
49 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Cone& , //C, | |
50 | const Standard_Real) // Dist ) | |
51 | { | |
52 | Standard_NotImplemented::Raise("GC_MakeConicalSurface"); | |
53 | } | |
54 | ||
55 | //========================================================================= | |
0d969553 Y |
56 | // Creation of a cone by four points. + |
57 | // two first give the axis. + | |
58 | // the third gives the base radius. + | |
59 | // the third and the fourth the half-angle. + | |
7fd59977 | 60 | //========================================================================= |
61 | ||
62 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Pnt& P1 , | |
63 | const gp_Pnt& P2 , | |
64 | const gp_Pnt& P3 , | |
65 | const gp_Pnt& P4 ) | |
66 | { | |
67 | gce_MakeCone C = gce_MakeCone(P1,P2,P3,P4); | |
68 | TheError = C.Status(); | |
69 | if (TheError == gce_Done) { | |
70 | TheCone = new Geom_ConicalSurface(C.Value()); | |
71 | } | |
72 | } | |
73 | ||
74 | ||
75 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Ax1& , //Axis, | |
76 | const gp_Pnt& , //P1 , | |
77 | const gp_Pnt& ) //P2 ) | |
78 | { | |
79 | Standard_NotImplemented::Raise("GC_MakeConicalSurface"); | |
80 | } | |
81 | ||
82 | ||
83 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Lin& , //Axis, | |
84 | const gp_Pnt& , //P1 , | |
85 | const gp_Pnt& ) //P2 ) | |
86 | { | |
87 | Standard_NotImplemented::Raise("GC_MakeConicalSurface"); | |
88 | } | |
89 | ||
90 | ||
91 | //========================================================================= | |
92 | //========================================================================= | |
93 | ||
94 | GC_MakeConicalSurface::GC_MakeConicalSurface(const gp_Pnt& P1 , | |
95 | const gp_Pnt& P2 , | |
96 | const Standard_Real R1 , | |
97 | const Standard_Real R2 ) | |
98 | { | |
99 | gce_MakeCone C = gce_MakeCone(P1,P2,R1,R2); | |
100 | TheError = C.Status(); | |
101 | if (TheError == gce_Done) { | |
102 | TheCone = new Geom_ConicalSurface(C); | |
103 | } | |
104 | } | |
105 | ||
106 | const Handle(Geom_ConicalSurface)& GC_MakeConicalSurface::Value() const | |
107 | { | |
82fc327c | 108 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 | 109 | return TheCone; |
110 | } |