Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:18:45

0001 // Created on: 1992-09-28
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GC_MakeConicalSurface_HeaderFile
0018 #define _GC_MakeConicalSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GC_Root.hxx>
0025 #include <Geom_ConicalSurface.hxx>
0026 
0027 class gp_Ax2;
0028 class gp_Cone;
0029 class gp_Pnt;
0030 
0031 //! Implements construction algorithms for conical surfaces.
0032 //! Supported constructions include:
0033 //! - a conical surface from axis placement and angle/radius;
0034 //! - conversion from `gp_Cone`;
0035 //! - a conical surface through four points;
0036 //! - a conical surface from two points and two radii.
0037 //! The local coordinate system of the ConicalSurface is defined
0038 //! with an axis placement (see class ElementarySurface).
0039 //!
0040 //! The "ZAxis" is the symmetry axis of the ConicalSurface,
0041 //! it gives the direction of increasing parametric value V.
0042 //! The apex of the surface is on the negative side of this axis.
0043 //!
0044 //! The parametrization range is:
0045 //! U [0, 2*PI], V ]-infinite, + infinite[
0046 //!
0047 //! The "XAxis" and the "YAxis" define the placement plane of the
0048 //! surface (Z = 0, and parametric value V = 0) perpendicular to
0049 //! the symmetry axis. The "XAxis" defines the origin of the
0050 //! parameter U = 0. The trigonometric sense gives the positive
0051 //! orientation for the parameter U.
0052 //!
0053 //! When you create a ConicalSurface the U and V directions of
0054 //! parametrization are such that at each point of the surface the
0055 //! normal is oriented towards the "outside region".
0056 class GC_MakeConicalSurface : public GC_Root
0057 {
0058 public:
0059   DEFINE_STANDARD_ALLOC
0060 
0061   //! Creates a conical surface from local frame, semi-angle and radius.
0062   //! @param[in] theA2 local coordinate system
0063   //! @param[in] theAng semi-angle
0064   //! @param[in] theRadius reference radius in placement plane
0065   //! @note `theA2` defines the local coordinate system of the conical surface.
0066   //! @note `theAng` is the conical surface semi-angle ]0, PI/2[.
0067   //! @note `theRadius` is the radius of the circle Viso in the placement plane
0068   //!       of the conical surface defined with "XAxis" and "YAxis".
0069   //! @note The "ZDirection" of `theA2` defines the direction of the surface axis
0070   //!       of symmetry.
0071   //! @note If the location point of `theA2` is the apex of the surface,
0072   //!       `theRadius` is zero.
0073   //! @note The created surface is parametrized such that the normal vector
0074   //!       (`N = D1U ^ D1V`) is oriented towards the "outside region".
0075   //! @note Status is `gce_NegativeRadius` if `theRadius < 0.0`, or
0076   //!       `gce_BadAngle` if `theAng` is outside valid range.
0077   Standard_EXPORT GC_MakeConicalSurface(const gp_Ax2& theA2,
0078                                         const double  theAng,
0079                                         const double  theRadius);
0080 
0081   //! Creates a conical surface from a `gp_Cone`.
0082   //! @param[in] theC source cone
0083   Standard_EXPORT GC_MakeConicalSurface(const gp_Cone& theC);
0084 
0085   //! Creates a conical surface from four points.
0086   //! @param[in] theP1 first point defining axis
0087   //! @param[in] theP2 second point defining axis
0088   //! @param[in] theP3 point defining first section radius
0089   //! @param[in] theP4 point defining second section radius
0090   //! @note Axis is defined by points `theP1` and `theP2`, and base radius is
0091   //!       the distance between point `theP3` and that axis.
0092   //! @note The distance between point `theP4` and that axis is the radius of
0093   //!       the section passing through P4.
0094   //! @note Construction fails if points `theP1`, `theP2`, `theP3` and `theP4` are
0095   //!       collinear, or if vector (`theP3`,`theP4`) is perpendicular/collinear
0096   //!       to vector (`theP1`,`theP2`).
0097   Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& theP1,
0098                                         const gp_Pnt& theP2,
0099                                         const gp_Pnt& theP3,
0100                                         const gp_Pnt& theP4);
0101 
0102   //! Creates a conical surface with two points and two radii.
0103   //! @param[in] theP1 first axis point
0104   //! @param[in] theP2 second axis point
0105   //! @param[in] theR1 radius at P1
0106   //! @param[in] theR2 radius at P2
0107   //! @note The axis of the solution is the line passing through `theP1` and `theP2`.
0108   //! @note `theR1` and `theR2` are radii of sections passing through
0109   //!       `theP1` and `theP2`.
0110   Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& theP1,
0111                                         const gp_Pnt& theP2,
0112                                         const double  theR1,
0113                                         const double  theR2);
0114 
0115   //! Returns the constructed cone.
0116   //! Exceptions
0117   //! StdFail_NotDone if no cone is constructed.
0118   //! @return resulting conical surface
0119   Standard_EXPORT const occ::handle<Geom_ConicalSurface>& Value() const;
0120 
0121   //! Conversion operator returning the constructed object.
0122   //! @return resulting object
0123   operator const occ::handle<Geom_ConicalSurface>&() const { return Value(); }
0124 
0125 private:
0126   occ::handle<Geom_ConicalSurface> TheCone;
0127 };
0128 
0129 #endif // _GC_MakeConicalSurface_HeaderFile