Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Geom_TrimmedCurve.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 class Geom_Curve;
0026 class gp_Trsf;
0027 class Geom_Geometry;
0028 
0029 //! Describes a portion of a curve (termed the "basis
0030 //! curve") limited by two parameter values inside the
0031 //! parametric domain of the basis curve.
0032 //! The trimmed curve is defined by:
0033 //! - the basis curve, and
0034 //! - the two parameter values which limit it.
0035 //! The trimmed curve can either have the same
0036 //! orientation as the basis curve or the opposite orientation.
0037 class Geom_TrimmedCurve : public Geom_BoundedCurve
0038 {
0039 
0040 public:
0041   //! Constructs a trimmed curve from the basis curve C
0042   //! which is limited between parameter values U1 and U2.
0043   //! Note: - U1 can be greater or less than U2; in both cases,
0044   //! the returned curve is oriented from U1 to U2.
0045   //! - If the basis curve C is periodic, there is an
0046   //! ambiguity because two parts are available. In this
0047   //! case, the trimmed curve has the same orientation
0048   //! as the basis curve if Sense is true (default value)
0049   //! or the opposite orientation if Sense is false.
0050   //! - If the curve is closed but not periodic, it is not
0051   //! possible to keep the part of the curve which
0052   //! includes the junction point (except if the junction
0053   //! point is at the beginning or at the end of the
0054   //! trimmed curve). If you tried to do this, you could
0055   //! alter the fundamental characteristics of the basis
0056   //! curve, which are used, for example, to compute
0057   //! the derivatives of the trimmed curve. The rules
0058   //! for a closed curve are therefore the same as
0059   //! those for an open curve.
0060   //! Warning: The trimmed curve is built from a copy of curve C.
0061   //! Therefore, when C is modified, the trimmed curve
0062   //! is not modified.
0063   //! - If the basis curve is periodic and theAdjustPeriodic is True,
0064   //! the bounds of the trimmed curve may be different from U1 and U2
0065   //! if the parametric origin of the basis curve is within
0066   //! the arc of the trimmed curve. In this case, the
0067   //! modified parameter will be equal to U1 or U2
0068   //! plus or minus the period.
0069   //! When theAdjustPeriodic is False, parameters U1 and U2 will be
0070   //! the same, without adjustment into the first period.
0071   //! Exceptions
0072   //! Standard_ConstructionError if:
0073   //! - C is not periodic and U1 or U2 is outside the
0074   //! bounds of C, or
0075   //! - U1 is equal to U2.
0076   Standard_EXPORT Geom_TrimmedCurve(const occ::handle<Geom_Curve>& C,
0077                                     const double                   U1,
0078                                     const double                   U2,
0079                                     const bool                     Sense             = true,
0080                                     const bool                     theAdjustPeriodic = true);
0081 
0082   //! Changes the orientation of this trimmed curve.
0083   //! As a result:
0084   //! - the basis curve is reversed,
0085   //! - the start point of the initial curve becomes the
0086   //! end point of the reversed curve,
0087   //! - the end point of the initial curve becomes the
0088   //! start point of the reversed curve,
0089   //! - the first and last parameters are recomputed.
0090   //! If the trimmed curve was defined by:
0091   //! - a basis curve whose parameter range is [ 0., 1. ],
0092   //! - the two trim values U1 (first parameter) and U2 (last parameter),
0093   //! the reversed trimmed curve is defined by:
0094   //! - the reversed basis curve, whose parameter range is still [ 0., 1. ],
0095   //! - the two trim values 1. - U2 (first parameter) and 1. - U1 (last parameter).
0096   Standard_EXPORT void Reverse() final;
0097 
0098   //! Computes the parameter on the reversed curve for
0099   //! the point of parameter U on this trimmed curve.
0100   Standard_EXPORT double ReversedParameter(const double U) const final;
0101 
0102   //! Changes this trimmed curve, by redefining the
0103   //! parameter values U1 and U2 which limit its basis curve.
0104   //! Note: If the basis curve is periodic, the trimmed curve
0105   //! has the same orientation as the basis curve if Sense
0106   //! is true (default value) or the opposite orientation if Sense is false.
0107   //! Warning
0108   //! If the basis curve is periodic and theAdjustPeriodic is True,
0109   //! the bounds of the trimmed curve may be different from U1 and U2 if the
0110   //! parametric origin of the basis curve is within the arc of
0111   //! the trimmed curve. In this case, the modified
0112   //! parameter will be equal to U1 or U2 plus or minus the period.
0113   //! When theAdjustPeriodic is False, parameters U1 and U2 will be
0114   //! the same, without adjustment into the first period.
0115   //! Exceptions
0116   //! Standard_ConstructionError if:
0117   //! - the basis curve is not periodic, and either U1 or U2
0118   //! are outside the bounds of the basis curve, or
0119   //! - U1 is equal to U2.
0120   Standard_EXPORT void SetTrim(const double U1,
0121                                const double U2,
0122                                const bool   Sense             = true,
0123                                const bool   theAdjustPeriodic = 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 occ::handle<Geom_Curve> BasisCurve() const;
0131 
0132   //! Returns the continuity of the curve :
0133   //! C0 : only geometric continuity,
0134   //! C1 : continuity of the first derivative all along the Curve,
0135   //! C2 : continuity of the second derivative all along the Curve,
0136   //! C3 : continuity of the third derivative all along the Curve,
0137   //! CN : the order of continuity is infinite.
0138   Standard_EXPORT GeomAbs_Shape Continuity() const final;
0139 
0140   //! Returns true if the degree of continuity of the basis
0141   //! curve of this trimmed curve is at least N. A trimmed
0142   //! curve is at least "C0" continuous.
0143   //! Warnings :
0144   //! The continuity of the trimmed curve can be greater than
0145   //! the continuity of the basis curve because you consider
0146   //! only a part of the basis curve.
0147   //! Raised if N < 0.
0148   Standard_EXPORT bool IsCN(const int N) const final;
0149 
0150   //! Returns the end point of <me>. This point is the
0151   //! evaluation of the curve for the "LastParameter".
0152   Standard_EXPORT gp_Pnt EndPoint() const final;
0153 
0154   //! Returns the value of the first parameter of <me>.
0155   //! The first parameter is the parameter of the "StartPoint"
0156   //! of the trimmed curve.
0157   Standard_EXPORT double FirstParameter() const final;
0158 
0159   //! Returns TRUE if the basis curve is periodic and the trim spans
0160   //! exactly one full period, or if the distance between the StartPoint
0161   //! and the EndPoint is within computational precision.
0162   Standard_EXPORT bool IsClosed() const final;
0163 
0164   //! Returns TRUE if the basis curve is periodic and the trim
0165   //! spans exactly one full period. Returns FALSE otherwise.
0166   Standard_EXPORT bool IsPeriodic() const final;
0167 
0168   //! Returns the period of the basis curve of this trimmed curve.
0169   //! Exceptions
0170   //! Standard_NoSuchObject if the basis curve is not periodic.
0171   Standard_EXPORT double Period() const final;
0172 
0173   //! Returns the value of the last parameter of <me>.
0174   //! The last parameter is the parameter of the "EndPoint" of the
0175   //! trimmed curve.
0176   Standard_EXPORT double LastParameter() const final;
0177 
0178   //! Returns the start point of <me>.
0179   //! This point is the evaluation of the curve from the
0180   //! "FirstParameter".
0181   //! value and derivatives
0182   //! Warnings :
0183   //! The returned derivatives have the same orientation as the
0184   //! derivatives of the basis curve even if the trimmed curve
0185   //! has not the same orientation as the basis curve.
0186   Standard_EXPORT gp_Pnt StartPoint() const final;
0187 
0188   //! Returns the point of parameter U.
0189   //!
0190   //! If the basis curve is an OffsetCurve sometimes it is not
0191   //! possible to do the evaluation of the curve at the parameter
0192   //! U (see class OffsetCurve).
0193   Standard_EXPORT gp_Pnt EvalD0(const double U) const final;
0194 
0195   //! Raised if the continuity of the curve is not C1.
0196   Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double U) const final;
0197 
0198   //! Raised if the continuity of the curve is not C2.
0199   Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double U) const final;
0200 
0201   //! Raised if the continuity of the curve is not C3.
0202   Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double U) const final;
0203 
0204   //! N is the order of derivation.
0205   //! Raised if the continuity of the curve is not CN.
0206   //! Raised if N < 1.
0207   //! geometric transformations
0208   Standard_EXPORT gp_Vec EvalDN(const double U, const int N) const final;
0209 
0210   //! Applies the transformation T to this trimmed curve.
0211   //! Warning The basis curve is also modified.
0212   Standard_EXPORT void Transform(const gp_Trsf& T) final;
0213 
0214   //! Returns the parameter on the transformed curve for
0215   //! the transform of the point of parameter U on <me>.
0216   //!
0217   //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
0218   //!
0219   //! is the same point as
0220   //!
0221   //! me->Value(U).Transformed(T)
0222   //!
0223   //! This methods calls the basis curve method.
0224   Standard_EXPORT double TransformedParameter(const double U, const gp_Trsf& T) const final;
0225 
0226   //! Returns a coefficient to compute the parameter on
0227   //! the transformed curve for the transform of the
0228   //! point on <me>.
0229   //!
0230   //! Transformed(T)->Value(U * ParametricTransformation(T))
0231   //!
0232   //! is the same point as
0233   //!
0234   //! Value(U).Transformed(T)
0235   //!
0236   //! This methods calls the basis curve method.
0237   Standard_EXPORT double ParametricTransformation(const gp_Trsf& T) const final;
0238 
0239   //! Creates a new object which is a copy of this trimmed curve.
0240   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final;
0241 
0242   //! Dumps the content of me into the stream
0243   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0244 
0245   DEFINE_STANDARD_RTTIEXT(Geom_TrimmedCurve, Geom_BoundedCurve)
0246 
0247 private:
0248   occ::handle<Geom_Curve> basisCurve;
0249   double                  uTrim1;
0250   double                  uTrim2;
0251 };
0252 
0253 #endif // _Geom_TrimmedCurve_HeaderFile