1 // Copyright (c) 1991-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _gp_Cone_HeaderFile
16 #define _gp_Cone_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
23 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
27 class Standard_ConstructionError;
37 //! Defines an infinite conical surface.
38 //! A cone is defined by its half-angle at the apex and
39 //! positioned in space with a coordinate system (a gp_Ax3
40 //! object) and a "reference radius" where:
41 //! - the "main Axis" of the coordinate system is the axis of revolution of the cone,
42 //! - the plane defined by the origin, the "X Direction" and
43 //! the "Y Direction" of the coordinate system is the
44 //! reference plane of the cone; the intersection of the
45 //! cone with this reference plane is a circle of radius
46 //! equal to the reference radius,
47 //! if the half-angle is positive, the apex of the cone is on
48 //! the negative side of the "main Axis" of the coordinate
49 //! system. If the half-angle is negative, the apex is on the positive side.
50 //! This coordinate system is the "local coordinate system" of the cone.
51 //! Note: when a gp_Cone cone is converted into a
52 //! Geom_ConicalSurface cone, some implicit properties of
53 //! its local coordinate system are used explicitly:
54 //! - its origin, "X Direction", "Y Direction" and "main
55 //! Direction" are used directly to define the parametric
56 //! directions on the cone and the origin of the parameters,
57 //! - its implicit orientation (right-handed or left-handed)
58 //! gives the orientation (direct or indirect) of the
59 //! Geom_ConicalSurface cone.
61 //! gce_MakeCone which provides functions for more
62 //! complex cone constructions
63 //! Geom_ConicalSurface which provides additional
64 //! functions for constructing cones and works, in particular,
65 //! with the parametric equations of cones gp_Ax3
73 //! Creates an indefinite Cone.
77 //! Creates an infinite conical surface. A3 locates the cone
78 //! in the space and defines the reference plane of the surface.
79 //! Ang is the conical surface semi-angle between 0 and PI/2 radians.
80 //! Radius is the radius of the circle in the reference plane of
82 //! Raises ConstructionError
83 //! . if Radius is lower than 0.0
84 //! . Ang < Resolution from gp or Ang >= (PI/2) - Resolution.
85 gp_Cone(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
87 //! Changes the symmetry axis of the cone. Raises ConstructionError
88 //! the direction of A1 is parallel to the "XDirection"
89 //! of the coordinate system of the cone.
90 void SetAxis (const gp_Ax1& A1);
92 //! Changes the location of the cone.
93 void SetLocation (const gp_Pnt& Loc);
96 //! Changes the local coordinate system of the cone.
97 //! This coordinate system defines the reference plane of the cone.
98 void SetPosition (const gp_Ax3& A3);
101 //! Changes the radius of the cone in the reference plane of
103 //! Raised if R < 0.0
104 void SetRadius (const Standard_Real R);
107 //! Changes the semi-angle of the cone.
108 //! Ang is the conical surface semi-angle ]0,PI/2[.
109 //! Raises ConstructionError if Ang < Resolution from gp or Ang >= PI/2 - Resolution
110 void SetSemiAngle (const Standard_Real Ang);
113 //! Computes the cone's top. The Apex of the cone is on the
114 //! negative side of the symmetry axis of the cone.
117 //! Reverses the U parametrization of the cone
118 //! reversing the YAxis.
121 //! Reverses the V parametrization of the cone reversing the ZAxis.
124 //! Returns true if the local coordinate system of this cone is right-handed.
125 Standard_Boolean Direct() const;
127 //! returns the symmetry axis of the cone.
128 const gp_Ax1& Axis() const;
131 //! Computes the coefficients of the implicit equation of the quadric
132 //! in the absolute cartesian coordinates system :
133 //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
134 //! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
135 Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
137 //! returns the "Location" point of the cone.
138 const gp_Pnt& Location() const;
141 //! Returns the local coordinates system of the cone.
142 const gp_Ax3& Position() const;
145 //! Returns the radius of the cone in the reference plane.
146 Standard_Real RefRadius() const;
148 //! Returns the half-angle at the apex of this cone.
149 Standard_Real SemiAngle() const;
151 //! Returns the XAxis of the reference plane.
152 gp_Ax1 XAxis() const;
154 //! Returns the YAxis of the reference plane.
155 gp_Ax1 YAxis() const;
157 Standard_EXPORT void Mirror (const gp_Pnt& P);
160 //! Performs the symmetrical transformation of a cone
161 //! with respect to the point P which is the center of the
163 Standard_EXPORT gp_Cone Mirrored (const gp_Pnt& P) const;
165 Standard_EXPORT void Mirror (const gp_Ax1& A1);
168 //! Performs the symmetrical transformation of a cone with
169 //! respect to an axis placement which is the axis of the
171 Standard_EXPORT gp_Cone Mirrored (const gp_Ax1& A1) const;
173 Standard_EXPORT void Mirror (const gp_Ax2& A2);
176 //! Performs the symmetrical transformation of a cone with respect
177 //! to a plane. The axis placement A2 locates the plane of the
178 //! of the symmetry : (Location, XDirection, YDirection).
179 Standard_EXPORT gp_Cone Mirrored (const gp_Ax2& A2) const;
181 void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
184 //! Rotates a cone. A1 is the axis of the rotation.
185 //! Ang is the angular value of the rotation in radians.
186 gp_Cone Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
188 void Scale (const gp_Pnt& P, const Standard_Real S);
191 //! Scales a cone. S is the scaling value.
192 //! The absolute value of S is used to scale the cone
193 gp_Cone Scaled (const gp_Pnt& P, const Standard_Real S) const;
195 void Transform (const gp_Trsf& T);
198 //! Transforms a cone with the transformation T from class Trsf.
199 gp_Cone Transformed (const gp_Trsf& T) const;
201 void Translate (const gp_Vec& V);
204 //! Translates a cone in the direction of the vector V.
205 //! The magnitude of the translation is the vector's magnitude.
206 gp_Cone Translated (const gp_Vec& V) const;
208 void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
211 //! Translates a cone from the point P1 to the point P2.
212 gp_Cone Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
228 Standard_Real radius;
229 Standard_Real semiAngle;
235 #include <gp_Cone.lxx>
241 #endif // _gp_Cone_HeaderFile