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 | |
42cf5bc1 |
17 | |
18 | #include <GC_MakeCircle.hxx> |
7fd59977 |
19 | #include <gce_MakeCirc.hxx> |
42cf5bc1 |
20 | #include <Geom_Circle.hxx> |
21 | #include <gp_Ax1.hxx> |
22 | #include <gp_Ax2.hxx> |
23 | #include <gp_Circ.hxx> |
24 | #include <gp_Dir.hxx> |
25 | #include <gp_Pnt.hxx> |
7fd59977 |
26 | #include <StdFail_NotDone.hxx> |
27 | |
28 | GC_MakeCircle::GC_MakeCircle(const gp_Circ& C) |
29 | { |
30 | TheError = gce_Done; |
31 | TheCircle = new Geom_Circle(C); |
32 | } |
33 | |
34 | GC_MakeCircle::GC_MakeCircle(const gp_Ax2& A2 , |
35 | const Standard_Real Radius) |
36 | { |
37 | if (Radius < 0.) { TheError = gce_NegativeRadius; } |
38 | else { |
39 | TheError = gce_Done; |
40 | TheCircle = new Geom_Circle(gp_Circ(A2,Radius)); |
41 | } |
42 | } |
43 | |
44 | GC_MakeCircle::GC_MakeCircle(const gp_Circ& Circ , |
45 | const gp_Pnt& Point ) |
46 | { |
47 | gp_Circ C = gce_MakeCirc(Circ,Point); |
48 | TheCircle = new Geom_Circle(C); |
49 | TheError = gce_Done; |
50 | } |
51 | |
52 | GC_MakeCircle::GC_MakeCircle(const gp_Circ& Circ , |
53 | const Standard_Real Dist ) |
54 | { |
55 | gce_MakeCirc C = gce_MakeCirc(Circ,Dist); |
56 | TheError = C.Status(); |
57 | if (TheError == gce_Done) { |
58 | TheCircle = new Geom_Circle(C.Value()); |
59 | } |
60 | } |
61 | |
62 | GC_MakeCircle::GC_MakeCircle(const gp_Pnt& P1 , |
63 | const gp_Pnt& P2 , |
64 | const gp_Pnt& P3 ) |
65 | { |
66 | gce_MakeCirc C = gce_MakeCirc(P1,P2,P3); |
67 | TheError = C.Status(); |
68 | if (TheError == gce_Done) { |
69 | TheCircle = new Geom_Circle(C.Value()); |
70 | } |
71 | } |
72 | |
73 | GC_MakeCircle::GC_MakeCircle(const gp_Pnt& Point , |
74 | const gp_Dir& Norm , |
75 | const Standard_Real Radius ) |
76 | { |
77 | gce_MakeCirc C = gce_MakeCirc(Point,Norm,Radius); |
78 | TheError = C.Status(); |
79 | if (TheError == gce_Done) { |
80 | TheCircle = new Geom_Circle(C.Value()); |
81 | } |
82 | } |
83 | |
84 | GC_MakeCircle::GC_MakeCircle(const gp_Pnt& Point , |
85 | const gp_Pnt& PtAxis , |
86 | const Standard_Real Radius ) |
87 | { |
88 | gce_MakeCirc C = gce_MakeCirc(Point,PtAxis,Radius); |
89 | TheError = C.Status(); |
90 | if (TheError == gce_Done) { |
91 | TheCircle = new Geom_Circle(C.Value()); |
92 | } |
93 | } |
94 | |
95 | GC_MakeCircle::GC_MakeCircle(const gp_Ax1& Axis , |
96 | const Standard_Real Radius ) |
97 | { |
98 | gce_MakeCirc C = gce_MakeCirc(Axis,Radius); |
99 | TheError = C.Status(); |
100 | if (TheError == gce_Done) { |
101 | TheCircle = new Geom_Circle(C.Value()); |
102 | } |
103 | } |
104 | |
105 | const Handle(Geom_Circle)& GC_MakeCircle::Value() const |
106 | { |
82fc327c |
107 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 |
108 | return TheCircle; |
109 | } |