Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

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