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