Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:29

0001 // Created on: 1992-08-26
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 _gce_MakeCone_HeaderFile
0018 #define _gce_MakeCone_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Cone.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Ax2;
0027 class gp_Pnt;
0028 class gp_Ax1;
0029 class gp_Lin;
0030 
0031 //! This class implements construction algorithms for `gp_Cone`.
0032 //! Supported constructions include:
0033 //! - from axis placement, semi-angle and reference radius;
0034 //! - cone coaxial to another cone, through a point or at signed offset;
0035 //! - cone from four points;
0036 //! - cone from axis and two points;
0037 //! - cone from two axis points and two section radii.
0038 class gce_MakeCone : public gce_Root
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Creates a cone from axis placement, semi-angle and reference radius.
0044   //! @note `A2` defines cone position and reference section plane.
0045   //! @note `Ang` is the cone semi-angle (radians), expected in ]0, PI/2[.
0046   //! @note Construction fails with `gce_NegativeRadius` if `Radius` is negative.
0047   //! @note Construction fails with `gce_BadAngle` if
0048   //!       `Ang <= gp::Resolution()` or `PI/2 - Ang <= gp::Resolution()`.
0049   //! @param[in] A2 local coordinate system
0050   //! @param[in] Ang angle value
0051   //! @param[in] Radius radius value
0052   Standard_EXPORT gce_MakeCone(const gp_Ax2& A2, const double Ang, const double Radius);
0053 
0054   //! Creates a cone coaxial to input cone and passing through a point.
0055   //! @note Construction fails with `gce_NegativeRadius` when no non-negative
0056   //!       solution radius can be found.
0057   //! @param[in] Cone source cone
0058   //! @param[in] Point reference point
0059   Standard_EXPORT gce_MakeCone(const gp_Cone& Cone, const gp_Pnt& Point);
0060 
0061   //! Creates a cone coaxial to input cone at signed distance.
0062   //! @note Construction fails with `gce_NullAngle` if semi-angle cosine is
0063   //!       numerically too small.
0064   //! @note Construction fails with `gce_NegativeRadius` if resulting radius is negative.
0065   //! @param[in] Cone source cone
0066   //! @param[in] Dist signed distance
0067   Standard_EXPORT gce_MakeCone(const gp_Cone& Cone, const double Dist);
0068 
0069   //! Creates a cone from four points.
0070   //! @note `P1` and `P2` define the axis direction.
0071   //! @note Distance from `P3` to that axis defines base radius.
0072   //! @note Distance from `P4` to that axis defines radius of section through `P4`.
0073   //! @note Construction fails with `gce_ConfusedPoints` if `P1`/`P2` or `P3`/`P4`
0074   //!       are coincident.
0075   //! @note Construction fails with `gce_NullAngle` if section distances produce
0076   //!       zero cone angle.
0077   //! @note Construction fails with `gce_NullRadius` for degenerate right-angle
0078   //!       or zero-angle radius configuration.
0079   //! @param[in] P1 first point
0080   //! @param[in] P2 second point
0081   //! @param[in] P3 third point
0082   //! @param[in] P4 fourth point
0083   Standard_EXPORT gce_MakeCone(const gp_Pnt& P1,
0084                                const gp_Pnt& P2,
0085                                const gp_Pnt& P3,
0086                                const gp_Pnt& P4);
0087 
0088   //! Creates a cone from axis and two points.
0089   //! @note Distance from `P1` to axis gives first section radius.
0090   //! @note Distance from `P2` to axis gives second section radius.
0091   //! @note Error status is propagated from the 4-point construction.
0092   //! @param[in] Axis axis definition
0093   //! @param[in] P1 first point
0094   //! @param[in] P2 second point
0095   Standard_EXPORT gce_MakeCone(const gp_Ax1& Axis, const gp_Pnt& P1, const gp_Pnt& P2);
0096 
0097   //! Creates a cone from line axis and two points.
0098   //! @note Distance from `P1` to axis gives first section radius.
0099   //! @note Distance from `P2` to axis gives second section radius.
0100   //! @note Error status is propagated from the 4-point construction.
0101   //! @param[in] Axis axis definition
0102   //! @param[in] P1 first point
0103   //! @param[in] P2 second point
0104   Standard_EXPORT gce_MakeCone(const gp_Lin& Axis, const gp_Pnt& P1, const gp_Pnt& P2);
0105 
0106   //! Creates a cone from two axis points and two section radii.
0107   //! @note The axis is the line passing through `P1` and `P2`.
0108   //! @note `R1` is section radius at `P1`, `R2` is section radius at `P2`.
0109   //! @note Construction fails with `gce_NullAxis` if `P1` and `P2` are coincident.
0110   //! @note Construction fails with `gce_NegativeRadius` if `R1` or `R2` is negative.
0111   //! @note Construction fails with `gce_NullAngle` for degenerate zero-angle
0112   //!       or right-angle configurations.
0113   //! @param[in] P1 first point
0114   //! @param[in] P2 second point
0115   //! @param[in] R1 first radius value
0116   //! @param[in] R2 second radius value
0117   Standard_EXPORT gce_MakeCone(const gp_Pnt& P1,
0118                                const gp_Pnt& P2,
0119                                const double  R1,
0120                                const double  R2);
0121 
0122   //! Returns the constructed cone.
0123   //! Exceptions StdFail_NotDone if no cone is constructed.
0124   //! @return resulting cone
0125   Standard_EXPORT const gp_Cone& Value() const;
0126 
0127   //! Alias for Value() returning a copy.
0128   //! @return resulting object
0129   gp_Cone Operator() const { return Value(); }
0130 
0131   //! Conversion operator returning the constructed object.
0132   //! @return resulting object
0133   operator gp_Cone() const { return Operator(); }
0134 
0135 private:
0136   gp_Cone TheCone;
0137 };
0138 
0139 #endif // _gce_MakeCone_HeaderFile