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