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