82477d85ffb2aadc4d9c576e47c2b0f78c372211
[occt.git] / src / GC / GC_MakeConicalSurface.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 _GC_MakeConicalSurface_HeaderFile
18 #define _GC_MakeConicalSurface_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <GC_Root.hxx>
25 #include <Geom_ConicalSurface.hxx>
26
27 class StdFail_NotDone;
28 class gp_Ax2;
29 class gp_Cone;
30 class gp_Pnt;
31 class gp_Ax1;
32 class gp_Lin;
33
34
35 //! This class implements the following algorithms used
36 //! to create a ConicalSurface from Geom.
37 //! * Create a ConicalSurface parallel to another and passing
38 //! through a point.
39 //! * Create a ConicalSurface parallel to another at a distance
40 //! <Dist>.
41 //! * Create a ConicalSurface by 4 points.
42 //! * Create a ConicalSurface by its axis and 2 points.
43 //! * Create a ConicalSurface by 2 points and 2 radius.
44 //! The local coordinate system of the ConicalSurface is defined
45 //! with an axis placement (see class ElementarySurface).
46 //!
47 //! The "ZAxis" is the symmetry axis of the ConicalSurface,
48 //! it gives the direction of increasing parametric value V.
49 //! The apex of the surface is on the negative side of this axis.
50 //!
51 //! The parametrization range is  :
52 //! U [0, 2*PI],  V ]-infinite, + infinite[
53 //!
54 //! The "XAxis" and the "YAxis" define the placement plane of the
55 //! surface (Z = 0, and parametric value V = 0)  perpendicular to
56 //! the symmetry axis. The "XAxis" defines the origin of the
57 //! parameter U = 0.  The trigonometric sense gives the positive
58 //! orientation for the parameter U.
59 //!
60 //! When you create a ConicalSurface the U and V directions of
61 //! parametrization are such that at each point of the surface the
62 //! normal is oriented towards the "outside region".
63 class GC_MakeConicalSurface  : public GC_Root
64 {
65 public:
66
67   DEFINE_STANDARD_ALLOC
68
69   
70
71   //! A2 defines the local coordinate system of the conical surface.
72   //! Ang is the conical surface semi-angle ]0, PI/2[.
73   //! Radius is the radius of the circle Viso in the placement plane
74   //! of the conical surface defined with "XAxis" and "YAxis".
75   //! The "ZDirection" of A2 defines the direction of the surface's
76   //! axis of symmetry.
77   //! If the location point of A2 is the apex of the surface
78   //! Radius = 0 .
79   //! At the creation the parametrization of the surface is defined
80   //! such that the normal Vector (N = D1U ^ D1V) is oriented towards
81   //! the "outside region" of the surface.
82   //! Status is "NegativeRadius" if Radius < 0.0 or "BadAngle" if
83   //! Ang < Resolution from gp or Ang >= PI/ - Resolution
84   Standard_EXPORT GC_MakeConicalSurface(const gp_Ax2& A2, const Standard_Real Ang, const Standard_Real Radius);
85   
86   //! Creates a ConicalSurface from a non persistent Cone from package gp.
87   Standard_EXPORT GC_MakeConicalSurface(const gp_Cone& C);
88   
89   //! Make a ConicalSurface from Geom <TheCone> parallel to another
90   //! ConicalSurface <Cone> and passing through a Pnt <Point>.
91   Standard_EXPORT GC_MakeConicalSurface(const gp_Cone& Cone, const gp_Pnt& Point);
92   
93   //! Make a ConicalSurface from Geom <TheCone> parallel to another
94   //! ConicalSurface <Cone> at the distance <Dist> which can
95   //! be greater or lower than zero.
96   Standard_EXPORT GC_MakeConicalSurface(const gp_Cone& Cone, const Standard_Real Dist);
97   
98   //! Make a ConicalSurface from Geom <TheCone> passing through 3
99   //! Pnt <P1>,<P2>,<P3>.
100   //! Its axis is <P1P2> and the radius of its base is
101   //! the distance between <P3> and <P1P2>.
102   //! The distance between <P4> and <P1P2> is the radius of
103   //! the section passing through <P4>.
104   //! An error iss raised if <P1>,<P2>,<P3>,<P4> are
105   //! colinear or if <P3P4> is perpendicular to <P1P2> or
106   //! <P3P4> is colinear to <P1P2>.
107   Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3, const gp_Pnt& P4);
108   
109   //! Make a ConicalSurface by its axis <Axis> and and two points.
110   Standard_EXPORT GC_MakeConicalSurface(const gp_Ax1& Axis, const gp_Pnt& P1, const gp_Pnt& P2);
111   
112   //! Make a ConicalSurface by its axis <Axis> and and two points.
113   Standard_EXPORT GC_MakeConicalSurface(const gp_Lin& Axis, const gp_Pnt& P1, const gp_Pnt& P2);
114   
115   //! Make a ConicalSurface with two points and two radius.
116   //! The axis of the solution is the line passing through
117   //! <P1> and <P2>.
118   //! <R1> is the radius of the section passing through <P1>
119   //! and <R2> the radius of the section passing through <P2>.
120   Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real R1, const Standard_Real R2);
121   
122   //! Returns the constructed cone.
123   //! Exceptions
124   //! StdFail_NotDone if no cone is constructed.
125   Standard_EXPORT const Handle(Geom_ConicalSurface)& Value() const;
126
127   operator const Handle(Geom_ConicalSurface)& () const { return Value(); }
128   operator const Handle(Geom_Surface)& () const { return Value(); }
129
130 private:
131   Handle(Geom_ConicalSurface) TheCone;
132 };
133
134 #endif // _GC_MakeConicalSurface_HeaderFile