|
|
|||
File indexing completed on 2026-09-11 09:17:36
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_TrimmedCurve_HeaderFile 0018 #define _Geom2d_TrimmedCurve_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <Geom2d_BoundedCurve.hxx> 0024 #include <GeomAbs_Shape.hxx> 0025 class Geom2d_Curve; 0026 class gp_Trsf2d; 0027 class Geom2d_Geometry; 0028 0029 //! Defines a portion of a curve limited by two values of 0030 //! parameters inside the parametric domain of the curve. 0031 //! The trimmed curve is defined by: 0032 //! - the basis curve, and 0033 //! - the two parameter values which limit it. 0034 //! The trimmed curve can either have the same 0035 //! orientation as the basis curve or the opposite orientation. 0036 class Geom2d_TrimmedCurve : public Geom2d_BoundedCurve 0037 { 0038 0039 public: 0040 //! Creates a trimmed curve from the basis curve C limited between 0041 //! U1 and U2. 0042 //! 0043 //! . U1 can be greater or lower than U2. 0044 //! . The returned curve is oriented from U1 to U2. 0045 //! . If the basis curve C is periodic there is an ambiguity 0046 //! because two parts are available. In this case by default 0047 //! the trimmed curve has the same orientation as the basis 0048 //! curve (Sense = True). If Sense = False then the orientation 0049 //! of the trimmed curve is opposite to the orientation of the 0050 //! basis curve C. 0051 //! If the curve is closed but not periodic it is not possible 0052 //! to keep the part of the curve including the junction point 0053 //! (except if the junction point is at the beginning or 0054 //! at the end of the trimmed curve) because you could lose the 0055 //! fundamental characteristics of the basis curve which are 0056 //! used for example to compute the derivatives of the trimmed 0057 //! curve. So for a closed curve the rules are the same as for 0058 //! a open curve. 0059 //! Warnings : 0060 //! In this package the entities are not shared. The TrimmedCurve is 0061 //! built with a copy of the curve C. So when C is modified the 0062 //! TrimmedCurve is not modified 0063 //! Warnings : 0064 //! If <C> is periodic and <theAdjustPeriodic> is True, parametrics 0065 //! bounds of the TrimmedCurve, can be different to [<U1>;<U2>}, 0066 //! if <U1> or <U2> are not in the principal period. 0067 //! Include : 0068 //! For more explanation see the scheme given with this class. 0069 //! Raises ConstructionError the C is not periodic and U1 or U2 are out of 0070 //! the bounds of C. 0071 //! Raised if U1 = U2. 0072 Standard_EXPORT Geom2d_TrimmedCurve(const occ::handle<Geom2d_Curve>& C, 0073 const double U1, 0074 const double U2, 0075 const bool Sense = true, 0076 const bool theAdjustPeriodic = true); 0077 0078 //! Changes the direction of parametrization of <me>. The first and 0079 //! the last parametric values are modified. The "StartPoint" 0080 //! of the initial curve becomes the "EndPoint" of the reversed 0081 //! curve and the "EndPoint" of the initial curve becomes the 0082 //! "StartPoint" of the reversed curve. 0083 //! Example - If the trimmed curve is defined by: 0084 //! - a basis curve whose parameter range is [ 0.,1. ], and 0085 //! - the two trim values U1 (first parameter) and U2 (last parameter), 0086 //! the reversed trimmed curve is defined by: 0087 //! - the reversed basis curve, whose parameter range is still [ 0.,1. ], and 0088 //! - the two trim values 1. - U2 (first parameter) 0089 //! and 1. - U1 (last parameter). 0090 Standard_EXPORT void Reverse() final; 0091 0092 //! Returns the parameter on the reversed curve for 0093 //! the point of parameter U on <me>. 0094 //! 0095 //! returns UFirst + ULast - U 0096 Standard_EXPORT double ReversedParameter(const double U) const final; 0097 0098 //! Changes this trimmed curve, by redefining the 0099 //! parameter values U1 and U2, which limit its basis curve. 0100 //! Note: If the basis curve is periodic, the trimmed curve 0101 //! has the same orientation as the basis curve if Sense 0102 //! is true (default value) or the opposite orientation if Sense is false. 0103 //! Warning 0104 //! If the basis curve is periodic and theAdjustPeriodic is True, 0105 //! the bounds of the trimmed curve may be different from U1 and U2 if the 0106 //! parametric origin of the basis curve is within the arc 0107 //! of the trimmed curve. In this case, the modified 0108 //! parameter will be equal to U1 or U2 plus or minus the period. 0109 //! If theAdjustPeriodic is False, parameters U1 and U2 will stay unchanged. 0110 //! Exceptions 0111 //! Standard_ConstructionError if: 0112 //! - the basis curve is not periodic, and either U1 or U2 0113 //! are outside the bounds of the basis curve, or 0114 //! - U1 is equal to U2. 0115 Standard_EXPORT void SetTrim(const double U1, 0116 const double U2, 0117 const bool Sense = true, 0118 const bool theAdjustPeriodic = true); 0119 0120 //! Returns the basis curve. 0121 //! Warning 0122 //! This function does not return a constant reference. 0123 //! Consequently, any modification of the returned value 0124 //! directly modifies the trimmed curve. 0125 Standard_EXPORT occ::handle<Geom2d_Curve> BasisCurve() const; 0126 0127 //! Returns the global continuity of the basis curve of this trimmed curve. 0128 //! C0 : only geometric continuity, 0129 //! C1 : continuity of the first derivative all along the Curve, 0130 //! C2 : continuity of the second derivative all along the Curve, 0131 //! C3 : continuity of the third derivative all along the Curve, 0132 //! CN : the order of continuity is infinite. 0133 Standard_EXPORT GeomAbs_Shape Continuity() const final; 0134 0135 //! --- Purpose 0136 //! Returns True if the order of continuity of the 0137 //! trimmed curve is N. A trimmed curve is at least "C0" continuous. 0138 //! Warnings : 0139 //! The continuity of the trimmed curve can be greater than 0140 //! the continuity of the basis curve because you consider 0141 //! only a part of the basis curve. 0142 //! Raised if N < 0. 0143 Standard_EXPORT bool IsCN(const int N) const final; 0144 0145 //! Returns the end point of <me>. This point is the 0146 //! evaluation of the curve for the "LastParameter". 0147 Standard_EXPORT gp_Pnt2d EndPoint() const final; 0148 0149 //! Returns the value of the first parameter of <me>. 0150 //! The first parameter is the parameter of the "StartPoint" 0151 //! of the trimmed curve. 0152 Standard_EXPORT double FirstParameter() const final; 0153 0154 //! Returns TRUE if the basis curve is periodic and the trim spans 0155 //! exactly one full period, or if the distance between the StartPoint 0156 //! and the EndPoint is within computational precision. 0157 Standard_EXPORT bool IsClosed() const final; 0158 0159 //! Returns TRUE if the basis curve is periodic and the trim 0160 //! spans exactly one full period. Returns FALSE otherwise. 0161 Standard_EXPORT bool IsPeriodic() const final; 0162 0163 //! Returns the period of the basis curve of this trimmed curve. 0164 //! Exceptions 0165 //! Standard_NoSuchObject if the basis curve is not periodic. 0166 Standard_EXPORT double Period() const final; 0167 0168 //! Returns the value of the last parameter of <me>. 0169 //! The last parameter is the parameter of the "EndPoint" of the 0170 //! trimmed curve. 0171 Standard_EXPORT double LastParameter() const final; 0172 0173 //! Returns the start point of <me>. 0174 //! This point is the evaluation of the curve from the 0175 //! "FirstParameter". 0176 //! value and derivatives 0177 //! Warnings : 0178 //! The returned derivatives have the same orientation as the 0179 //! derivatives of the basis curve. 0180 Standard_EXPORT gp_Pnt2d StartPoint() const final; 0181 0182 //! If the basis curve is an OffsetCurve sometimes it is not 0183 //! possible to do the evaluation of the curve at the parameter 0184 //! U (see class OffsetCurve). 0185 Standard_EXPORT gp_Pnt2d EvalD0(const double U) const final; 0186 0187 //! Raised if the continuity of the curve is not C1. 0188 Standard_EXPORT Geom2d_Curve::ResD1 EvalD1(const double U) const final; 0189 0190 //! Raised if the continuity of the curve is not C2. 0191 Standard_EXPORT Geom2d_Curve::ResD2 EvalD2(const double U) const final; 0192 0193 //! Raised if the continuity of the curve is not C3. 0194 Standard_EXPORT Geom2d_Curve::ResD3 EvalD3(const double U) const final; 0195 0196 //! For the point of parameter U of this trimmed curve, 0197 //! computes the vector corresponding to the Nth derivative. 0198 //! Warning 0199 //! The returned derivative vector has the same 0200 //! orientation as the derivative vector of the basis curve, 0201 //! even if the trimmed curve does not have the same 0202 //! orientation as the basis curve. 0203 //! Exceptions 0204 //! Standard_RangeError if N is less than 1. 0205 //! geometric transformations 0206 Standard_EXPORT gp_Vec2d EvalDN(const double U, const int N) const final; 0207 0208 //! Applies the transformation T to this trimmed curve. 0209 //! Warning The basis curve is also modified. 0210 Standard_EXPORT void Transform(const gp_Trsf2d& T) final; 0211 0212 //! Returns the parameter on the transformed curve for 0213 //! the transform of the point of parameter U on <me>. 0214 //! 0215 //! me->Transformed(T)->Value(me->TransformedParameter(U,T)) 0216 //! 0217 //! is the same point as 0218 //! 0219 //! me->Value(U).Transformed(T) 0220 //! 0221 //! This methods calls the basis curve method. 0222 Standard_EXPORT double TransformedParameter(const double U, const gp_Trsf2d& T) const final; 0223 0224 //! Returns a coefficient to compute the parameter on 0225 //! the transformed curve for the transform of the 0226 //! point on <me>. 0227 //! 0228 //! Transformed(T)->Value(U * ParametricTransformation(T)) 0229 //! 0230 //! is the same point as 0231 //! 0232 //! Value(U).Transformed(T) 0233 //! 0234 //! This methods calls the basis curve method. 0235 Standard_EXPORT double ParametricTransformation(const gp_Trsf2d& T) const final; 0236 0237 //! Creates a new object, which is a copy of this trimmed curve. 0238 Standard_EXPORT occ::handle<Geom2d_Geometry> Copy() const final; 0239 0240 //! Dumps the content of me into the stream 0241 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final; 0242 0243 DEFINE_STANDARD_RTTIEXT(Geom2d_TrimmedCurve, Geom2d_BoundedCurve) 0244 0245 private: 0246 occ::handle<Geom2d_Curve> basisCurve; 0247 double uTrim1; 0248 double uTrim2; 0249 }; 0250 0251 #endif // _Geom2d_TrimmedCurve_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|