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