0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / gce / gce_MakeCirc.hxx
1 // Created on: 1992-08-26
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 #ifndef _gce_MakeCirc_HeaderFile
18 #define _gce_MakeCirc_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <gp_Circ.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
28 class gp_Ax2;
29 class gp_Circ;
30 class gp_Pnt;
31 class gp_Dir;
32 class gp_Pln;
33 class gp_Ax1;
34
35
36 //! This class implements the following algorithms used
37 //! to create Circ from gp.
38 //!
39 //! * Create a Circ coaxial to another and passing
40 //! though a point.
41 //! * Create a Circ coaxial to another at the distance
42 //! Dist.
43 //! * Create a Circ passing through 3 points.
44 //! * Create a Circ with its center and the normal of its
45 //! plane and its radius.
46 //! * Create a Circ with its center and its plane and its
47 //! radius.
48 //! * Create a Circ with its axis and radius.
49 //! * Create a Circ with two points giving its axis and
50 //! its radius.
51 //! * Create a Circ with is Ax2 and its Radius.
52 class gce_MakeCirc  : public gce_Root
53 {
54 public:
55
56   DEFINE_STANDARD_ALLOC
57
58   
59
60   //! A2 locates the circle and gives its orientation in 3D space.
61   //! Warnings :
62   //! It is not forbidden to create a circle with Radius = 0.0
63   //! The status is "NegativeRadius" if Radius < 0.0
64   Standard_EXPORT gce_MakeCirc(const gp_Ax2& A2, const Standard_Real Radius);
65   
66   //! Makes a Circ from gp <TheCirc> coaxial to another
67   //! Circ <Circ> at a distance <Dist>.
68   //! If Dist is greater than zero the result is encloses
69   //! the circle <Circ>, else the result is enclosed by the
70   //! circle <Circ>.
71   Standard_EXPORT gce_MakeCirc(const gp_Circ& Circ, const Standard_Real Dist);
72   
73   //! Makes a Circ from gp <TheCirc> coaxial to another
74   //! Circ <Circ> and passing through a Pnt2d <Point>.
75   Standard_EXPORT gce_MakeCirc(const gp_Circ& Circ, const gp_Pnt& Point);
76   
77   //! Makes a Circ from gp <TheCirc> passing through 3
78   //! Pnt2d <P1>,<P2>,<P3>.
79   Standard_EXPORT gce_MakeCirc(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3);
80   
81   //! Makes a Circ from gp <TheCirc> with its center
82   //! <Center> and the normal of its plane <Norm> and
83   //! its radius <Radius>.
84   Standard_EXPORT gce_MakeCirc(const gp_Pnt& Center, const gp_Dir& Norm, const Standard_Real Radius);
85   
86   //! Makes a Circ from gp <TheCirc> with its center
87   //! <Center> and the normal of its plane <Plane> and
88   //! its radius <Radius>.
89   Standard_EXPORT gce_MakeCirc(const gp_Pnt& Center, const gp_Pln& Plane, const Standard_Real Radius);
90   
91   //! Makes a Circ from gp <TheCirc> with its center
92   //! <Center> and a point <Ptaxis> giving the normal
93   //! of its plane <Plane> and its radius <Radius>.
94   Standard_EXPORT gce_MakeCirc(const gp_Pnt& Center, const gp_Pnt& Ptaxis, const Standard_Real Radius);
95   
96   //! Makes a Circ from gp <TheCirc> with its center
97   //! <Center> and its radius <Radius>.
98   //! Warning
99   //! The MakeCirc class does not prevent the
100   //! construction of a circle with a null radius.
101   //! If an error occurs (that is, when IsDone returns
102   //! false), the Status function returns:
103   //! -   gce_Negative Radius if:
104   //! -   Radius is less than 0.0, or
105   //! -   Dist is less than 0.0 and the absolute value of
106   //! Dist is greater than the radius of Circ;
107   //! -   gce_IntersectionError if the points P1, P2 and
108   //! P3 are collinear, and the three are not coincident;
109   //! -   gce_ConfusedPoints if two of the three points
110   //! P1, P2 and P3 are coincident; or
111   //! -   gce_NullAxis if Center and Ptaxis are coincident.
112   Standard_EXPORT gce_MakeCirc(const gp_Ax1& Axis, const Standard_Real Radius);
113   
114   //! Returns the constructed circle.
115   //! Exceptions StdFail_NotDone if no circle is constructed.
116   Standard_EXPORT const gp_Circ& Value() const;
117   
118   Standard_EXPORT const gp_Circ& Operator() const;
119 Standard_EXPORT operator gp_Circ() const;
120
121
122
123
124 protected:
125
126
127
128
129
130 private:
131
132
133
134   gp_Circ TheCirc;
135
136
137 };
138
139
140
141
142
143
144
145 #endif // _gce_MakeCirc_HeaderFile