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 (can be negative) 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. Its absolute value is in range
81 //! Radius is the radius of the circle in the reference plane of
83 //! Raises ConstructionError
84 //! * if Radius is lower than 0.0
85 //! * Abs(Ang) < Resolution from gp or Abs(Ang) >= (PI/2) - Resolution.
86 gp_Cone(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
88 //! Changes the symmetry axis of the cone. Raises ConstructionError
89 //! the direction of A1 is parallel to the "XDirection"
90 //! of the coordinate system of the cone.
91 void SetAxis (const gp_Ax1& A1);
93 //! Changes the location of the cone.
94 void SetLocation (const gp_Pnt& Loc);
97 //! Changes the local coordinate system of the cone.
98 //! This coordinate system defines the reference plane of the cone.
99 void SetPosition (const gp_Ax3& A3);
102 //! Changes the radius of the cone in the reference plane of
104 //! Raised if R < 0.0
105 void SetRadius (const Standard_Real R);
108 //! Changes the semi-angle of the cone.
109 //! Semi-angle can be negative. Its absolute value
110 //! Abs(Ang) is in range ]0,PI/2[.
111 //! Raises ConstructionError if Abs(Ang) < Resolution from gp or Abs(Ang) >= PI/2 - Resolution
112 void SetSemiAngle (const Standard_Real Ang);
115 //! Computes the cone's top. The Apex of the cone is on the
116 //! negative side of the symmetry axis of the cone.
119 //! Reverses the U parametrization of the cone
120 //! reversing the YAxis.
123 //! Reverses the V parametrization of the cone reversing the ZAxis.
126 //! Returns true if the local coordinate system of this cone is right-handed.
127 Standard_Boolean Direct() const;
129 //! returns the symmetry axis of the cone.
130 const gp_Ax1& Axis() const;
133 //! Computes the coefficients of the implicit equation of the quadric
134 //! in the absolute cartesian coordinates system :
135 //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
136 //! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
137 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;
139 //! returns the "Location" point of the cone.
140 const gp_Pnt& Location() const;
143 //! Returns the local coordinates system of the cone.
144 const gp_Ax3& Position() const;
147 //! Returns the radius of the cone in the reference plane.
148 Standard_Real RefRadius() const;
150 //! Returns the half-angle at the apex of this cone.
151 //! Attention! Semi-angle can be negative.
152 Standard_Real SemiAngle() const;
154 //! Returns the XAxis of the reference plane.
155 gp_Ax1 XAxis() const;
157 //! Returns the YAxis of the reference plane.
158 gp_Ax1 YAxis() const;
160 Standard_EXPORT void Mirror (const gp_Pnt& P);
163 //! Performs the symmetrical transformation of a cone
164 //! with respect to the point P which is the center of the
166 Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Pnt& P) const;
168 Standard_EXPORT void Mirror (const gp_Ax1& A1);
171 //! Performs the symmetrical transformation of a cone with
172 //! respect to an axis placement which is the axis of the
174 Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Ax1& A1) const;
176 Standard_EXPORT void Mirror (const gp_Ax2& A2);
179 //! Performs the symmetrical transformation of a cone with respect
180 //! to a plane. The axis placement A2 locates the plane of the
181 //! of the symmetry : (Location, XDirection, YDirection).
182 Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Ax2& A2) const;
184 void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
187 //! Rotates a cone. A1 is the axis of the rotation.
188 //! Ang is the angular value of the rotation in radians.
189 Standard_NODISCARD gp_Cone Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
191 void Scale (const gp_Pnt& P, const Standard_Real S);
194 //! Scales a cone. S is the scaling value.
195 //! The absolute value of S is used to scale the cone
196 Standard_NODISCARD gp_Cone Scaled (const gp_Pnt& P, const Standard_Real S) const;
198 void Transform (const gp_Trsf& T);
201 //! Transforms a cone with the transformation T from class Trsf.
202 Standard_NODISCARD gp_Cone Transformed (const gp_Trsf& T) const;
204 void Translate (const gp_Vec& V);
207 //! Translates a cone in the direction of the vector V.
208 //! The magnitude of the translation is the vector's magnitude.
209 Standard_NODISCARD gp_Cone Translated (const gp_Vec& V) const;
211 void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
214 //! Translates a cone from the point P1 to the point P2.
215 Standard_NODISCARD gp_Cone Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
231 Standard_Real radius;
232 Standard_Real semiAngle;
238 #include <gp_Cone.lxx>
244 #endif // _gp_Cone_HeaderFile