|
|
|||
File indexing completed on 2026-10-22 09:33:30
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_OffsetCurve_HeaderFile 0018 #define _Geom_OffsetCurve_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <gp_Dir.hxx> 0024 #include <GeomAbs_Shape.hxx> 0025 #include <Geom_Curve.hxx> 0026 0027 class gp_Trsf; 0028 class Geom_Geometry; 0029 0030 namespace GeomEval_RepCurveDesc 0031 { 0032 class Base; 0033 } 0034 0035 //! This class implements the basis services for an offset curve 0036 //! in 3D space. The Offset curve in this package can be a self 0037 //! intersecting curve even if the basis curve does not 0038 //! self-intersect. The self intersecting portions are not deleted 0039 //! at the construction time. 0040 //! An offset curve is a curve at constant distance (Offset) from 0041 //! a basis curve in a reference direction V. The offset curve 0042 //! takes its parametrization from the basis curve. 0043 //! The Offset curve is in the direction of the normal N 0044 //! defined with the cross product T^V, where the vector T 0045 //! is given by the first derivative on the basis curve with 0046 //! non zero length. 0047 //! The distance offset may be positive or negative to indicate the 0048 //! preferred side of the curve : 0049 //! . distance offset >0 => the curve is in the direction of N 0050 //! . distance offset <0 => the curve is in the direction of - N 0051 //! 0052 //! On the Offset curve : 0053 //! Value (U) = BasisCurve.Value(U) + (Offset * (T ^ V)) / ||T ^ V|| 0054 //! 0055 //! At any point the Offset direction V must not be parallel to the 0056 //! vector T and the vector T must not have null length else the 0057 //! offset curve is not defined. So the offset curve has not the 0058 //! same continuity as the basis curve. 0059 //! 0060 //! Warnings : 0061 //! 0062 //! In this package we suppose that the continuity of the offset 0063 //! curve is one degree less than the continuity of the basis 0064 //! curve and we don't check that at any point ||T^V|| != 0.0 0065 //! 0066 //! So to evaluate the curve it is better to check that the offset 0067 //! curve is well defined at any point because an exception could 0068 //! be raised. The check is not done in this package at the creation 0069 //! of the offset curve because the control needs the use of an 0070 //! algorithm which cannot be implemented in this package. 0071 //! 0072 //! The OffsetCurve is closed if the first point and the last point 0073 //! are the same (The distance between these two points is lower or 0074 //! equal to the Resolution sea package gp) . The OffsetCurve can be 0075 //! closed even if the basis curve is not closed. 0076 class Geom_OffsetCurve : public Geom_Curve 0077 { 0078 0079 public: 0080 //! C is the basis curve, Offset is the distance between <me> and 0081 //! the basis curve at any point. V defines the fixed reference 0082 //! direction (offset direction). If P is a point on the basis 0083 //! curve and T the first derivative with non zero length 0084 //! at this point, the corresponding point on the offset curve is 0085 //! in the direction of the vector-product N = V ^ T 0086 //! where N is a unitary vector. 0087 //! If isNotCheckC0 = TRUE checking if basis curve has C0-continuity 0088 //! is not made. 0089 //! Warnings : 0090 //! In this package the entities are not shared. The OffsetCurve is 0091 //! built with a copy of the curve C. So when C is modified the 0092 //! OffsetCurve is not modified 0093 //! 0094 //! Raised if the basis curve C is not at least C1. 0095 //! Warnings : 0096 //! No check is done to know if ||V^T|| != 0.0 at any point. 0097 Standard_EXPORT Geom_OffsetCurve(const occ::handle<Geom_Curve>& C, 0098 const double Offset, 0099 const gp_Dir& V, 0100 const bool isNotCheckC0 = false); 0101 0102 //! Copy constructor for optimized copying without validation. 0103 //! @param[in] theOther the offset curve to copy from 0104 Standard_EXPORT Geom_OffsetCurve(const Geom_OffsetCurve& theOther); 0105 0106 //! Returns true if an evaluation representation is attached. 0107 bool HasEvalRepresentation() const { return !myEvalRep.IsNull(); } 0108 0109 //! Returns the current evaluation representation descriptor (may be null). 0110 const occ::handle<GeomEval_RepCurveDesc::Base>& EvalRepresentation() const { return myEvalRep; } 0111 0112 //! Sets a new evaluation representation. 0113 //! Validates descriptor data and ensures no circular references. 0114 Standard_EXPORT void SetEvalRepresentation( 0115 const occ::handle<GeomEval_RepCurveDesc::Base>& theDesc); 0116 0117 //! Removes the evaluation representation. 0118 void ClearEvalRepresentation() { myEvalRep.Nullify(); } 0119 0120 //! Changes the orientation of this offset curve. 0121 //! As a result: 0122 //! - the basis curve is reversed, 0123 //! - the start point of the initial curve becomes the 0124 //! end point of the reversed curve, 0125 //! - the end point of the initial curve becomes the 0126 //! start point of the reversed curve, and 0127 //! - the first and last parameters are recomputed. 0128 Standard_EXPORT void Reverse() final; 0129 0130 //! Computes the parameter on the reversed curve for 0131 //! the point of parameter U on this offset curve. 0132 Standard_EXPORT double ReversedParameter(const double U) const final; 0133 0134 //! Changes this offset curve by assigning C 0135 //! as the basis curve from which it is built. 0136 //! If isNotCheckC0 = TRUE checking if basis curve 0137 //! has C0-continuity is not made. 0138 //! Exceptions 0139 //! Standard_ConstructionError if the curve C is not at least "C1" continuous. 0140 Standard_EXPORT void SetBasisCurve(const occ::handle<Geom_Curve>& C, 0141 const bool isNotCheckC0 = false); 0142 0143 //! Changes this offset curve by assigning V as the 0144 //! reference vector used to compute the offset direction. 0145 Standard_EXPORT void SetDirection(const gp_Dir& V); 0146 0147 //! Changes this offset curve by assigning D as the offset value. 0148 Standard_EXPORT void SetOffsetValue(const double D); 0149 0150 //! Returns the basis curve of this offset curve. 0151 //! Note: The basis curve can be an offset curve. 0152 Standard_EXPORT occ::handle<Geom_Curve> BasisCurve() const; 0153 0154 //! Returns the global continuity of this offset curve as a 0155 //! value of the GeomAbs_Shape enumeration. 0156 //! The degree of continuity of this offset curve is equal 0157 //! to the degree of continuity of the basis curve minus 1. 0158 //! Continuity of the Offset curve : 0159 //! C0 : only geometric continuity, 0160 //! C1 : continuity of the first derivative all along the Curve, 0161 //! C2 : continuity of the second derivative all along the Curve, 0162 //! C3 : continuity of the third derivative all along the Curve, 0163 //! G1 : tangency continuity all along the Curve, 0164 //! G2 : curvature continuity all along the Curve, 0165 //! CN : the order of continuity is infinite. 0166 //! Warnings : 0167 //! Returns the continuity of the basis curve - 1. 0168 //! The offset curve must have a unique offset direction defined 0169 //! at any point. 0170 Standard_EXPORT GeomAbs_Shape Continuity() const final; 0171 0172 //! Returns the reference vector of this offset curve. 0173 //! Value and derivatives 0174 //! Warnings : 0175 //! The exception UndefinedValue or UndefinedDerivative is 0176 //! raised if it is not possible to compute a unique offset 0177 //! direction. 0178 //! If T is the first derivative with not null length and 0179 //! V the offset direction the relation ||T(U) ^ V|| != 0 0180 //! must be satisfied to evaluate the offset curve. 0181 //! No check is done at the creation time and we suppose 0182 //! in this package that the offset curve is well defined. 0183 Standard_EXPORT const gp_Dir& Direction() const; 0184 0185 //! Warning! this should not be called 0186 //! if the basis curve is not at least C1. Nevertheless 0187 //! if used on portion where the curve is C1, it is OK 0188 Standard_EXPORT gp_Pnt EvalD0(const double U) const final; 0189 0190 //! Warning! this should not be called 0191 //! if the continuity of the basis curve is not C2. 0192 //! Nevertheless, it's OK to use it on a portion 0193 //! where the curve is C2 0194 Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double U) const final; 0195 0196 //! Warning! this should not be called 0197 //! if the continuity of the basis curve is not C3. 0198 //! Nevertheless, it's OK to use it on a portion 0199 //! where the curve is C3 0200 Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double U) const final; 0201 0202 Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double U) const final; 0203 0204 //! The returned vector gives the value of the derivative 0205 //! for the order of derivation N. 0206 //! 0207 //! The following functions compute the value and derivatives 0208 //! on the offset curve and returns the derivatives on the 0209 //! basis curve too. 0210 //! The computation of the value and derivatives on the basis 0211 //! curve are used to evaluate the offset curve 0212 //! 0213 //! Warning: 0214 //! The exception UndefinedValue or UndefinedDerivative is 0215 //! raised if it is not possible to compute a unique offset 0216 //! direction. 0217 //! Raised if N < 1. 0218 Standard_EXPORT gp_Vec EvalDN(const double U, const int N) const final; 0219 0220 //! Returns the value of the first parameter of this 0221 //! offset curve. The first parameter corresponds to the 0222 //! start point of the curve. 0223 //! Note: the first and last parameters of this offset curve 0224 //! are also the ones of its basis curve. 0225 Standard_EXPORT double FirstParameter() const final; 0226 0227 //! Returns the value of the last parameter of this 0228 //! offset curve. The last parameter 0229 //! corresponds to the end point. 0230 //! Note: the first and last parameters of this offset curve 0231 //! are also the ones of its basis curve. 0232 Standard_EXPORT double LastParameter() const final; 0233 0234 //! Returns the offset value of this offset curve. 0235 Standard_EXPORT double Offset() const; 0236 0237 //! Returns True if the distance between the start point 0238 //! and the end point of the curve is lower or equal to 0239 //! Resolution from package gp. 0240 Standard_EXPORT bool IsClosed() const final; 0241 0242 //! Returns true if the degree of continuity of the basis 0243 //! curve of this offset curve is at least N + 1. 0244 //! This method answer True if the continuity of the basis curve 0245 //! is N + 1. We suppose in this class that a normal direction 0246 //! to the basis curve (used to compute the offset curve) is 0247 //! defined at any point on the basis curve. 0248 //! Raised if N < 0. 0249 Standard_EXPORT bool IsCN(const int N) const final; 0250 0251 //! Returns true if this offset curve is periodic, i.e. if the 0252 //! basis curve of this offset curve is periodic. 0253 Standard_EXPORT bool IsPeriodic() const final; 0254 0255 //! Returns the period of this offset curve, i.e. the period 0256 //! of the basis curve of this offset curve. 0257 //! Exceptions 0258 //! Standard_NoSuchObject if the basis curve is not periodic. 0259 Standard_EXPORT double Period() const final; 0260 0261 //! Applies the transformation T to this offset curve. 0262 //! Note: the basis curve is also modified. 0263 Standard_EXPORT void Transform(const gp_Trsf& T) final; 0264 0265 //! Returns the parameter on the transformed curve for 0266 //! the transform of the point of parameter U on <me>. 0267 //! me->Transformed(T)->Value(me->TransformedParameter(U,T)) 0268 //! is the same point as 0269 //! me->Value(U).Transformed(T) 0270 //! This methods calls the basis curve method. 0271 Standard_EXPORT double TransformedParameter(const double U, const gp_Trsf& T) const final; 0272 0273 //! Returns a coefficient to compute the parameter on 0274 //! the transformed curve for the transform of the 0275 //! point on <me>. 0276 //! 0277 //! Transformed(T)->Value(U * ParametricTransformation(T)) 0278 //! is the same point as 0279 //! Value(U).Transformed(T) 0280 //! This methods calls the basis curve method. 0281 Standard_EXPORT double ParametricTransformation(const gp_Trsf& T) const final; 0282 0283 //! Creates a new object which is a copy of this offset curve. 0284 Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final; 0285 0286 //! Returns continuity of the basis curve. 0287 Standard_EXPORT GeomAbs_Shape GetBasisCurveContinuity() const; 0288 0289 //! Dumps the content of me into the stream 0290 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final; 0291 0292 DEFINE_STANDARD_RTTIEXT(Geom_OffsetCurve, Geom_Curve) 0293 0294 private: 0295 occ::handle<Geom_Curve> basisCurve; 0296 occ::handle<GeomEval_RepCurveDesc::Base> myEvalRep; 0297 gp_Dir direction; 0298 double offsetValue; 0299 GeomAbs_Shape myBasisCurveContinuity; 0300 }; 0301 0302 #endif // _Geom_OffsetCurve_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|