Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:20:08

0001 // Copyright (c) 2025 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _GeomEval_HypParaboloidSurface_HeaderFile
0015 #define _GeomEval_HypParaboloidSurface_HeaderFile
0016 
0017 #include <Geom_ElementarySurface.hxx>
0018 
0019 //! Describes a hyperbolic paraboloid (saddle surface).
0020 //!
0021 //! A hyperbolic paraboloid is defined by two semi-axis lengths A and B,
0022 //! and is positioned in space by a coordinate system (a gp_Ax3 object),
0023 //! the origin of which is the saddle point.
0024 //!
0025 //! The parametric equation (rectangular parametrization) is:
0026 //! @code
0027 //!   P(u,v) = O + u*XDir + v*YDir + (u^2/A^2 - v^2/B^2)*ZDir
0028 //! @endcode
0029 //! where:
0030 //! - O, XDir, YDir and ZDir are respectively the origin,
0031 //!   the "X Direction", the "Y Direction" and the "Z Direction"
0032 //!   of its local coordinate system, and
0033 //! - A and B are the semi-axis lengths (both > 0).
0034 //!
0035 //! The parametric range is:
0036 //! - (-inf, +inf) for u, and
0037 //! - (-inf, +inf) for v.
0038 //!
0039 //! The surface is doubly ruled, not periodic, and not closed.
0040 //!
0041 //! The implicit equation in local coordinates is:
0042 //! @code
0043 //!   X^2/A^2 - Y^2/B^2 - Z = 0
0044 //! @endcode
0045 class GeomEval_HypParaboloidSurface : public Geom_ElementarySurface
0046 {
0047 public:
0048   //! Creates a hyperbolic paraboloid surface with the given local coordinate system
0049   //! and semi-axis lengths.
0050   //! @param[in] thePosition the local coordinate system
0051   //! @param[in] theA the first semi-axis length (must be > 0)
0052   //! @param[in] theB the second semi-axis length (must be > 0)
0053   //! @throw Standard_ConstructionError if theA <= 0 or theB <= 0
0054   Standard_EXPORT GeomEval_HypParaboloidSurface(const gp_Ax3& thePosition,
0055                                                 double        theA,
0056                                                 double        theB);
0057 
0058   //! Returns the first semi-axis length A.
0059   Standard_EXPORT double SemiAxisA() const;
0060 
0061   //! Returns the second semi-axis length B.
0062   Standard_EXPORT double SemiAxisB() const;
0063 
0064   //! Assigns the value theA to the first semi-axis length.
0065   //! @param[in] theA the new first semi-axis length (must be > 0)
0066   //! @throw Standard_ConstructionError if theA <= 0
0067   Standard_EXPORT void SetSemiAxisA(double theA);
0068 
0069   //! Assigns the value theB to the second semi-axis length.
0070   //! @param[in] theB the new second semi-axis length (must be > 0)
0071   //! @throw Standard_ConstructionError if theB <= 0
0072   Standard_EXPORT void SetSemiAxisB(double theB);
0073 
0074   //! Reversal is not supported for this eval surface.
0075   //! @throw Standard_NotImplemented
0076   Standard_EXPORT void UReverse() final;
0077 
0078   //! Reversal is not supported for this eval surface.
0079   //! @throw Standard_NotImplemented
0080   Standard_EXPORT void VReverse() final;
0081 
0082   //! Reversal is not supported for this eval surface.
0083   //! @throw Standard_NotImplemented
0084   Standard_EXPORT double UReversedParameter(const double U) const final;
0085 
0086   //! Reversal is not supported for this eval surface.
0087   //! @throw Standard_NotImplemented
0088   Standard_EXPORT double VReversedParameter(const double V) const final;
0089 
0090   //! Returns the parametric bounds U1, U2, V1 and V2 of this surface.
0091   //! @param[out] U1 lower U bound (-Precision::Infinite())
0092   //! @param[out] U2 upper U bound (Precision::Infinite())
0093   //! @param[out] V1 lower V bound (-Precision::Infinite())
0094   //! @param[out] V2 upper V bound (Precision::Infinite())
0095   Standard_EXPORT void Bounds(double& U1, double& U2, double& V1, double& V2) const final;
0096 
0097   //! Returns False. The hyperbolic paraboloid is not closed in U.
0098   Standard_EXPORT bool IsUClosed() const final;
0099 
0100   //! Returns False. The hyperbolic paraboloid is not closed in V.
0101   Standard_EXPORT bool IsVClosed() const final;
0102 
0103   //! Returns False. The hyperbolic paraboloid is not periodic in U.
0104   Standard_EXPORT bool IsUPeriodic() const final;
0105 
0106   //! Returns False. The hyperbolic paraboloid is not periodic in V.
0107   Standard_EXPORT bool IsVPeriodic() const final;
0108 
0109   //! Computes the U isoparametric curve.
0110   //! For a hyperbolic paraboloid, no standard Geom_Curve representation is available.
0111   //! @throw Standard_NotImplemented
0112   Standard_EXPORT occ::handle<Geom_Curve> UIso(const double U) const final;
0113 
0114   //! Computes the V isoparametric curve.
0115   //! For a hyperbolic paraboloid, no standard Geom_Curve representation is available.
0116   //! @throw Standard_NotImplemented
0117   Standard_EXPORT occ::handle<Geom_Curve> VIso(const double V) const final;
0118 
0119   //! Computes the point P(U, V) on the surface.
0120   //! @code
0121   //!   P(U, V) = O + U*XDir + V*YDir + (U^2/A^2 - V^2/B^2)*ZDir
0122   //! @endcode
0123   Standard_EXPORT gp_Pnt EvalD0(const double U, const double V) const final;
0124 
0125   //! Computes the point and the first partial derivatives at (U, V).
0126   Standard_EXPORT Geom_Surface::ResD1 EvalD1(const double U, const double V) const final;
0127 
0128   //! Computes the point and partial derivatives up to 2nd order at (U, V).
0129   Standard_EXPORT Geom_Surface::ResD2 EvalD2(const double U, const double V) const final;
0130 
0131   //! Computes the point and partial derivatives up to 3rd order at (U, V).
0132   Standard_EXPORT Geom_Surface::ResD3 EvalD3(const double U, const double V) const final;
0133 
0134   //! Computes the derivative of order Nu in the direction u
0135   //! and Nv in the direction v.
0136   //! @param[in] U the u parameter
0137   //! @param[in] V the v parameter
0138   //! @param[in] Nu derivative order in u (must be >= 0)
0139   //! @param[in] Nv derivative order in v (must be >= 0)
0140   //! @return the derivative vector
0141   //! @throw Geom_UndefinedDerivative if Nu + Nv < 1 or Nu < 0 or Nv < 0
0142   Standard_EXPORT gp_Vec EvalDN(const double U,
0143                                 const double V,
0144                                 const int    Nu,
0145                                 const int    Nv) const final;
0146 
0147   //! Transformation is not supported for this eval geometry.
0148   //! @throw Standard_NotImplemented
0149   Standard_EXPORT void Transform(const gp_Trsf& T) final;
0150 
0151   //! Creates a new object which is a copy of this hyperbolic paraboloid.
0152   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final;
0153 
0154   //! Dumps the content of me into the stream.
0155   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0156 
0157   //! Returns the coefficients of the implicit equation of the
0158   //! quadric in the absolute Cartesian coordinate system:
0159   //! @code
0160   //!   A1*X^2 + A2*Y^2 + A3*Z^2 + 2*(B1*X*Y + B2*X*Z + B3*Y*Z) +
0161   //!   2*(C1*X + C2*Y + C3*Z) + D = 0
0162   //! @endcode
0163   //! In local coordinates the equation is: X^2/A^2 - Y^2/B^2 - Z = 0.
0164   Standard_EXPORT void Coefficients(double& A1,
0165                                     double& A2,
0166                                     double& A3,
0167                                     double& B1,
0168                                     double& B2,
0169                                     double& B3,
0170                                     double& C1,
0171                                     double& C2,
0172                                     double& C3,
0173                                     double& D) const;
0174 
0175   DEFINE_STANDARD_RTTIEXT(GeomEval_HypParaboloidSurface, Geom_ElementarySurface)
0176 
0177 private:
0178   double myA;
0179   double myB;
0180 };
0181 
0182 #endif // _GeomEval_HypParaboloidSurface_HeaderFile