Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-24
0002 // Created by: JCV
0003 // Copyright (c) 1993-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 _Geom2d_Parabola_HeaderFile
0018 #define _Geom2d_Parabola_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom2d_Conic.hxx>
0024 class gp_Parab2d;
0025 class gp_Ax2d;
0026 class gp_Ax22d;
0027 class gp_Trsf2d;
0028 class Geom2d_Geometry;
0029 
0030 //! Describes a parabola in the plane (2D space).
0031 //! A parabola is defined by its focal length (i.e. the
0032 //! distance between its focus and its apex) and is
0033 //! positioned in the plane with a coordinate system
0034 //! (gp_Ax22d object) where:
0035 //! - the origin is the apex of the parabola, and
0036 //! - the "X Axis" defines the axis of symmetry; the
0037 //! parabola is on the positive side of this axis.
0038 //! This coordinate system is the local coordinate
0039 //! system of the parabola.
0040 //! The orientation (direct or indirect) of the local
0041 //! coordinate system gives an explicit orientation to the
0042 //! parabola, determining the direction in which the
0043 //! parameter increases along the parabola.
0044 //! The Geom_Parabola parabola is parameterized as follows:
0045 //! P(U) = O + U*U/(4.*F)*XDir + U*YDir, where:
0046 //! - P is the point of parameter U,
0047 //! - O, XDir and YDir are respectively the origin, "X
0048 //! Direction" and "Y Direction" of its local coordinate system,
0049 //! - F is the focal length of the parabola.
0050 //! The parameter of the parabola is therefore its Y
0051 //! coordinate in the local coordinate system, with the "X
0052 //! Axis" of the local coordinate system defining the
0053 //! origin of the parameter.
0054 //! The parameter range is ] -infinite,+infinite [.
0055 class Geom2d_Parabola : public Geom2d_Conic
0056 {
0057 
0058 public:
0059   //! Creates a parabola from a non persistent one.
0060   Standard_EXPORT Geom2d_Parabola(const gp_Parab2d& Prb);
0061 
0062   //! Creates a parabola with its "MirrorAxis" and it's focal
0063   //! length "Focal".
0064   //! MirrorAxis is the axis of symmetry of the curve, it is the
0065   //! "XAxis". The "YAxis" is parallel to the directrix of the
0066   //! parabola and is in the direct sense if Sense is True.
0067   //! The "Location" point of "MirrorAxis" is the vertex of the parabola
0068   //! Raised if Focal < 0.0
0069   Standard_EXPORT Geom2d_Parabola(const gp_Ax2d& MirrorAxis,
0070                                   const double   Focal,
0071                                   const bool     Sense = true);
0072 
0073   //! Creates a parabola with its Axis and it's focal
0074   //! length "Focal".
0075   //! The XDirection of Axis is the axis of symmetry of the curve,
0076   //! it is the "XAxis". The "YAxis" is parallel to the directrix of the
0077   //! parabola. The "Location" point of "Axis" is the vertex
0078   //! of the parabola.
0079   //! Raised if Focal < 0.0
0080   Standard_EXPORT Geom2d_Parabola(const gp_Ax22d& Axis, const double Focal);
0081 
0082   //! D is the directrix of the parabola and F the focus point.
0083   //! The symmetry axis "XAxis" of the parabola is normal to the
0084   //! directrix and pass through the focus point F, but its
0085   //! "Location" point is the vertex of the parabola.
0086   //! The "YAxis" of the parabola is parallel to D and its "Location"
0087   //! point is the vertex of the parabola.
0088   Standard_EXPORT Geom2d_Parabola(const gp_Ax2d& D, const gp_Pnt2d& F);
0089 
0090   //! Assigns the value Focal to the focal length of this parabola.
0091   //! Exceptions Standard_ConstructionError if Focal is negative.
0092   Standard_EXPORT void SetFocal(const double Focal);
0093 
0094   //! Converts the gp_Parab2d parabola Prb into this parabola.
0095   Standard_EXPORT void SetParab2d(const gp_Parab2d& Prb);
0096 
0097   //! Returns the non persistent parabola from gp with the same
0098   //! geometric properties as <me>.
0099   Standard_EXPORT gp_Parab2d Parab2d() const;
0100 
0101   //! Computes the parameter on the reversed parabola
0102   //! for the point of parameter U on this parabola.
0103   //! For a parabola, the returned value is -U.
0104   Standard_EXPORT double ReversedParameter(const double U) const final;
0105 
0106   //! Returns RealFirst from Standard.
0107   Standard_EXPORT double FirstParameter() const final;
0108 
0109   //! Returns RealLast from Standard.
0110   Standard_EXPORT double LastParameter() const final;
0111 
0112   //! Returns False
0113   Standard_EXPORT bool IsClosed() const final;
0114 
0115   //! Returns False
0116   Standard_EXPORT bool IsPeriodic() const final;
0117 
0118   //! The directrix is parallel to the "YAxis" of the parabola.
0119   //! The "Location" point of the directrix is the intersection
0120   //! point between the directrix and the symmetry axis ("XAxis") of the parabola.
0121   Standard_EXPORT gp_Ax2d Directrix() const;
0122 
0123   //! Returns the eccentricity e = 1.0
0124   Standard_EXPORT double Eccentricity() const final;
0125 
0126   //! Computes the focus of this parabola The focus is on the
0127   //! positive side of the "X Axis" of the local coordinate system of the parabola.
0128   Standard_EXPORT gp_Pnt2d Focus() const;
0129 
0130   //! Computes the focal length of this parabola.
0131   //! The focal length is the distance between the apex and the focus of the parabola.
0132   Standard_EXPORT double Focal() const;
0133 
0134   //! Computes the parameter of this parabola, which is
0135   //! the distance between its focus and its directrix. This
0136   //! distance is twice the focal length.
0137   //! If P is the parameter of the parabola, the equation of
0138   //! the parabola in its local coordinate system is: Y**2 = 2.*P*X.
0139   Standard_EXPORT double Parameter() const;
0140 
0141   //! Returns in P the point of parameter U.
0142   //! If U = 0 the returned point is the origin of the XAxis and
0143   //! the YAxis of the parabola and it is the vertex of the parabola.
0144   //! P = S + F * (U * U * XDir + * U * YDir)
0145   //! where S is the vertex of the parabola, XDir the XDirection and
0146   //! YDir the YDirection of the parabola's local coordinate system.
0147   Standard_EXPORT gp_Pnt2d EvalD0(const double U) const final;
0148 
0149   //! Returns the point P of parameter U and the first derivative V1.
0150   Standard_EXPORT Geom2d_Curve::ResD1 EvalD1(const double U) const final;
0151 
0152   //! Returns the point P of parameter U, the first and second
0153   //! derivatives V1 and V2.
0154   Standard_EXPORT Geom2d_Curve::ResD2 EvalD2(const double U) const final;
0155 
0156   //! Returns the point P of parameter U, the first second and third
0157   //! derivatives V1 V2 and V3.
0158   Standard_EXPORT Geom2d_Curve::ResD3 EvalD3(const double U) const final;
0159 
0160   //! For the point of parameter U of this parabola,
0161   //! computes the vector corresponding to the Nth derivative.
0162   //! Exceptions Standard_RangeError if N is less than 1.
0163   Standard_EXPORT gp_Vec2d EvalDN(const double U, const int N) const final;
0164 
0165   //! Applies the transformation T to this parabola.
0166   Standard_EXPORT void Transform(const gp_Trsf2d& T) final;
0167 
0168   //! Computes the parameter on the transformed
0169   //! parabola, for the point of parameter U on this parabola.
0170   //! For a parabola, the returned value is equal to U
0171   //! multiplied by the scale factor of transformation T.
0172   Standard_EXPORT double TransformedParameter(const double U, const gp_Trsf2d& T) const final;
0173 
0174   //! Returns a coefficient to compute the parameter on
0175   //! the transformed curve for the transform of the
0176   //! point on <me>.
0177   //!
0178   //! Transformed(T)->Value(U * ParametricTransformation(T))
0179   //!
0180   //! is the same point as
0181   //!
0182   //! Value(U).Transformed(T)
0183   //!
0184   //! This methods returns T.ScaleFactor()
0185   Standard_EXPORT double ParametricTransformation(const gp_Trsf2d& T) const final;
0186 
0187   //! Creates a new object, which is a copy of this parabola.
0188   Standard_EXPORT occ::handle<Geom2d_Geometry> Copy() const final;
0189 
0190   //! Dumps the content of me into the stream
0191   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0192 
0193   DEFINE_STANDARD_RTTIEXT(Geom2d_Parabola, Geom2d_Conic)
0194 
0195 private:
0196   double focalLength;
0197 };
0198 
0199 #endif // _Geom2d_Parabola_HeaderFile