0030520: VIS - IVtkTools_ShapePicker::GetPickPosition() returns incorrect point
[occt.git] / src / GCE2d / GCE2d_MakeCircle.hxx
1 // Created on: 1992-09-28
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 _GCE2d_MakeCircle_HeaderFile
18 #define _GCE2d_MakeCircle_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <GCE2d_Root.hxx>
25 #include <Geom2d_Circle.hxx>
26
27 class StdFail_NotDone;
28 class gp_Circ2d;
29 class gp_Ax2d;
30 class gp_Ax22d;
31 class gp_Pnt2d;
32
33
34 //! This class implements the following algorithms used
35 //! to create Circle from Geom2d.
36 //!
37 //! * Create a Circle parallel to another and passing
38 //! though a point.
39 //! * Create a Circle parallel to another at the distance
40 //! Dist.
41 //! * Create a Circle passing through 3 points.
42 //! * Create a Circle with its center and the normal of its
43 //! plane and its radius.
44 //! * Create a Circle with its axis and radius.
45 class GCE2d_MakeCircle  : public GCE2d_Root
46 {
47 public:
48
49   DEFINE_STANDARD_ALLOC
50
51   
52   //! creates a circle from a non persistent one.
53   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& C);
54   
55
56   //! A is the "XAxis" of the circle which defines the origin
57   //! of parametrization.
58   //! It is not forbidden to create a circle with Radius = 0.0
59   //! The status is "NegativeRadius" if Radius < 0.
60   Standard_EXPORT GCE2d_MakeCircle(const gp_Ax2d& A, const Standard_Real Radius, const Standard_Boolean Sense = Standard_True);
61   
62
63   //! A is the local coordinate system of the circle which defines
64   //! the origin of parametrization.
65   //! It is not forbidden to create a circle with Radius = 0.0
66   //! The status is "NegativeRadius" if Radius < 0.
67   Standard_EXPORT GCE2d_MakeCircle(const gp_Ax22d& A, const Standard_Real Radius);
68   
69   //! Make a Circle from Geom2d <TheCirc> parallel to another
70   //! Circ <Circ> with a distance <Dist>.
71   //! If Dist is greater than zero the result is enclosing
72   //! the circle <Circ>, else the result is enclosed by the
73   //! circle <Circ>.
74   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& Circ, const Standard_Real Dist);
75   
76   //! Make a Circle from Geom2d <TheCirc> parallel to another
77   //! Circ <Circ> and passing through a Pnt <Point>.
78   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& Circ, const gp_Pnt2d& Point);
79   
80   //! Make a Circ from gp <TheCirc> passing through 3
81   //! Pnt2d <P1>,<P2>,<P3>.
82   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d& P1, const gp_Pnt2d& P2, const gp_Pnt2d& P3);
83   
84   //! Make a Circ from geom2d <TheCirc> by its center an radius.
85   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d& P, const Standard_Real Radius, const Standard_Boolean Sense = Standard_True);
86   
87   //! Makes a Circle from geom2d <TheCirc> with its center
88   //! <Center> and a point giving the radius.
89   //! If Sense is true the local coordinate system of
90   //! the solution is direct and non direct in the other case.
91   //! Warning
92   //! The MakeCircle class does not prevent the
93   //! construction of a circle with a null radius.
94   //! If an error occurs (that is, when IsDone returns
95   //! false), the Status function returns:
96   //! -   gce_NegativeRadius if Radius is less than 0.0, or
97   //! -   gce_IntersectionError if points P1, P2 and P3
98   //! are collinear and the three are not coincident.
99   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d& Center, const gp_Pnt2d& Point, const Standard_Boolean Sense = Standard_True);
100   
101   //! Returns the constructed circle.
102   //! Exceptions StdFail_NotDone if no circle is constructed.
103   Standard_EXPORT const Handle(Geom2d_Circle)& Value() const;
104
105   operator const Handle(Geom2d_Circle)& () const { return Value(); }
106
107 private:
108   Handle(Geom2d_Circle) TheCircle;
109 };
110
111 #endif // _GCE2d_MakeCircle_HeaderFile