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_Curve_HeaderFile
0018 #define _Geom2d_Curve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom2d_Geometry.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 #include <Standard_Integer.hxx>
0027 class gp_Trsf2d;
0028 class gp_Pnt2d;
0029 class gp_Vec2d;
0030 
0031 
0032 class Geom2d_Curve;
0033 DEFINE_STANDARD_HANDLE(Geom2d_Curve, Geom2d_Geometry)
0034 
0035 //! The abstract class Curve describes the common
0036 //! behavior of curves in 2D space. The Geom2d
0037 //! package provides numerous concrete classes of
0038 //! derived curves, including lines, circles, conics, Bezier
0039 //! or BSpline curves, etc.
0040 //! The main characteristic of these curves is that they
0041 //! are parameterized. The Geom2d_Curve class shows:
0042 //! - how to work with the parametric equation of a
0043 //! curve in order to calculate the point of parameter
0044 //! u, together with the vector tangent and the
0045 //! derivative vectors of order 2, 3,..., N at this point;
0046 //! - how to obtain general information about the curve
0047 //! (for example, level of continuity, closed
0048 //! characteristics, periodicity, bounds of the parameter field);
0049 //! - how the parameter changes when a geometric
0050 //! transformation is applied to the curve or when the
0051 //! orientation of the curve is inverted.
0052 //! All curves must have a geometric continuity: a curve is
0053 //! at least "C0". Generally, this property is checked at
0054 //! the time of construction or when the curve is edited.
0055 //! Where this is not the case, the documentation
0056 //! explicitly states so.
0057 //! Warning
0058 //! The Geom2d package does not prevent the
0059 //! construction of curves with null length or curves which
0060 //! self-intersect.
0061 class Geom2d_Curve : public Geom2d_Geometry
0062 {
0063 
0064 public:
0065 
0066   
0067 
0068   //! Changes the direction of parametrization of <me>.
0069   //! The "FirstParameter" and the "LastParameter" are not changed
0070   //! but the orientation  of the curve is modified. If the curve
0071   //! is bounded the StartPoint of the initial curve becomes the
0072   //! EndPoint of the reversed curve  and the EndPoint of the initial
0073   //! curve becomes the StartPoint of the reversed curve.
0074   Standard_EXPORT virtual void Reverse() = 0;
0075   
0076   //! Computes the parameter on the reversed curve for
0077   //! the point of parameter U on this curve.
0078   //! Note: The point of parameter U on this curve is
0079   //! identical to the point of parameter
0080   //! ReversedParameter(U) on the reversed curve.
0081   Standard_EXPORT virtual Standard_Real ReversedParameter (const Standard_Real U) const = 0;
0082   
0083   //! Computes the parameter on the curve transformed by
0084   //! T for the point of parameter U on this curve.
0085   //! Note: this function generally returns U but it can be
0086   //! redefined (for example, on a line).
0087   Standard_EXPORT virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf2d& T) const;
0088   
0089   //! Returns the coefficient required to compute the
0090   //! parametric transformation of this curve when
0091   //! transformation T is applied. This coefficient is the
0092   //! ratio between the parameter of a point on this curve
0093   //! and the parameter of the transformed point on the
0094   //! new curve transformed by T.
0095   //! Note: this function generally returns 1. but it can be
0096   //! redefined (for example, on a line).
0097   Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf2d& T) const;
0098   
0099   //! Creates a reversed duplicate Changes the orientation of this curve. The first and
0100   //! last parameters are not changed, but the parametric
0101   //! direction of the curve is reversed.
0102   //! If the curve is bounded:
0103   //! - the start point of the initial curve becomes the end
0104   //! point of the reversed curve, and
0105   //! - the end point of the initial curve becomes the start
0106   //! point of the reversed curve.
0107   //! - Reversed creates a new curve.
0108   Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Curve) Reversed() const;
0109   
0110   //! Returns the value of the first parameter.
0111   //! Warnings :
0112   //! It can be RealFirst or RealLast from package Standard
0113   //! if the curve is infinite
0114   Standard_EXPORT virtual Standard_Real FirstParameter() const = 0;
0115   
0116   //! Value of the last parameter.
0117   //! Warnings :
0118   //! It can be RealFirst or RealLast from package Standard
0119   //! if the curve is infinite
0120   Standard_EXPORT virtual Standard_Real LastParameter() const = 0;
0121   
0122   //! Returns true if the curve is closed.
0123   //! Examples :
0124   //! Some curves such as circle are always closed, others such as line
0125   //! are never closed (by definition).
0126   //! Some Curves such as OffsetCurve can be closed or not. These curves
0127   //! are considered as closed if the distance between the first point
0128   //! and the last point of the curve is lower or equal to the Resolution
0129   //! from package gp which is a fixed criterion independent of the
0130   //! application.
0131   Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
0132   
0133 
0134   //! Returns true if the parameter of the curve is periodic.
0135   //! It is possible only if the curve is closed and if the
0136   //! following relation is satisfied :
0137   //! for each parametric value U the distance between the point
0138   //! P(u) and the point P (u + T) is lower or equal to Resolution
0139   //! from package gp, T is the period and must be a constant.
0140   //! There are three possibilities :
0141   //! . the curve is never periodic by definition (SegmentLine)
0142   //! . the curve is always periodic by definition (Circle)
0143   //! . the curve can be defined as periodic (BSpline). In this case
0144   //! a function SetPeriodic allows you to give the shape of the
0145   //! curve.  The general rule for this case is : if a curve can be
0146   //! periodic or not the default periodicity set is non periodic
0147   //! and you have to turn (explicitly) the curve into a periodic
0148   //! curve  if you want the curve to be periodic.
0149   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
0150   
0151   //! Returns the period of this curve.
0152   //! raises if the curve is not periodic
0153   Standard_EXPORT virtual Standard_Real Period() const;
0154   
0155 
0156   //! It is the global continuity of the curve :
0157   //! C0 : only geometric continuity,
0158   //! C1 : continuity of the first derivative all along the Curve,
0159   //! C2 : continuity of the second derivative all along the Curve,
0160   //! C3 : continuity of the third derivative all along the Curve,
0161   //! G1 : tangency continuity all along the Curve,
0162   //! G2 : curvature continuity all along the Curve,
0163   //! CN : the order of continuity is infinite.
0164   Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
0165   
0166   //! Returns true if the degree of continuity of this curve is at least N.
0167   //! Exceptions Standard_RangeError if N is less than 0.
0168   Standard_EXPORT virtual Standard_Boolean IsCN (const Standard_Integer N) const = 0;
0169   
0170   //! Returns in P the point of parameter U.
0171   //! If the curve is periodic  then the returned point is P(U) with
0172   //! U = Ustart + (U - Uend)  where Ustart and Uend are the
0173   //! parametric bounds of the curve.
0174   //!
0175   //! Raised only for the "OffsetCurve" if it is not possible to
0176   //! compute the current point. For example when the first
0177   //! derivative on the basis curve and the offset direction
0178   //! are parallel.
0179   Standard_EXPORT virtual void D0 (const Standard_Real U, gp_Pnt2d& P) const = 0;
0180   
0181 
0182   //! Returns the point P of parameter U and the first derivative V1.
0183   //! Raised if the continuity of the curve is not C1.
0184   Standard_EXPORT virtual void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const = 0;
0185   
0186 
0187   //! Returns the point P of parameter U, the first and second
0188   //! derivatives V1 and V2.
0189   //! Raised if the continuity of the curve is not C2.
0190   Standard_EXPORT virtual void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const = 0;
0191   
0192 
0193   //! Returns the point P of parameter U, the first, the second
0194   //! and the third derivative.
0195   //! Raised if the continuity of the curve is not C3.
0196   Standard_EXPORT virtual void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const = 0;
0197   
0198   //! For the point of parameter U of this curve, computes
0199   //! the vector corresponding to the Nth derivative.
0200   //! Exceptions
0201   //! StdFail_UndefinedDerivative if:
0202   //! - the continuity of the curve is not "CN", or
0203   //! - the derivative vector cannot be computed easily;
0204   //! this is the case with specific types of curve (for
0205   //! example, a rational BSpline curve where N is greater than 3).
0206   //! Standard_RangeError if N is less than 1.
0207   Standard_EXPORT virtual gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const = 0;
0208   
0209   //! Computes the point of parameter U on <me>.
0210   //! If the curve is periodic  then the returned point is P(U) with
0211   //! U = Ustart + (U - Uend)  where Ustart and Uend are the
0212   //! parametric bounds of the curve.
0213   //!
0214   //! it is implemented with D0.
0215   //!
0216   //! Raised only for the "OffsetCurve" if it is not possible to
0217   //! compute the current point. For example when the first
0218   //! derivative on the basis curve and the offset direction
0219   //! are parallel.
0220   Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const;
0221 
0222   //! Dumps the content of me into the stream
0223   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0224 
0225 
0226 
0227 
0228   DEFINE_STANDARD_RTTIEXT(Geom2d_Curve,Geom2d_Geometry)
0229 
0230 protected:
0231 
0232 
0233 
0234 
0235 private:
0236 
0237 
0238 
0239 
0240 };
0241 
0242 
0243 
0244 
0245 
0246 
0247 
0248 #endif // _Geom2d_Curve_HeaderFile