|
|
|||
File indexing completed on 2026-10-09 09:35:02
0001 // Created on: 1999-04-27 0002 // Created by: Andrey BETENEV 0003 // Copyright (c) 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 _ShapeExtend_CompositeSurface_HeaderFile 0018 #define _ShapeExtend_CompositeSurface_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <Geom_Surface.hxx> 0024 #include <NCollection_Array2.hxx> 0025 #include <NCollection_HArray2.hxx> 0026 #include <NCollection_Array1.hxx> 0027 #include <NCollection_HArray1.hxx> 0028 #include <ShapeExtend_Parametrisation.hxx> 0029 #include <GeomAbs_Shape.hxx> 0030 class gp_Pnt2d; 0031 class gp_Trsf2d; 0032 class gp_Trsf; 0033 class Geom_Geometry; 0034 class Geom_Curve; 0035 0036 //! Composite surface is represented by a grid of surfaces 0037 //! (patches) connected geometrically. Patches may have different 0038 //! parametrisation ranges, but they should be parametrised in 0039 //! the same manner so that parameter of each patch (u,v) can be converted 0040 //! to global parameter on the whole surface (U,V) with help of linear 0041 //! transformation: 0042 //! 0043 //! for any i,j-th patch 0044 //! U = Ui + ( u - uijmin ) * ( Ui+1 - Ui ) / ( uijmax - uijmin ) 0045 //! V = Vj + ( v - vijmin ) * ( Vj+1 - Vj ) / ( vijmax - vijmin ) 0046 //! 0047 //! where 0048 //! 0049 //! [uijmin, uijmax] * [ vijmin, vijmax] - parametric range of i,j-th patch, 0050 //! 0051 //! Ui (i=1,..,Nu+1), Vi (j=1,..,Nv+1) - values defining global 0052 //! parametrisation by U and V (correspond to points between patches and 0053 //! bounds, (Ui,Uj) corresponds to (uijmin,vijmin) on i,j-th patch) and to 0054 //! (u(i-1)(j-1)max,v(i-1)(j-1)max) on (i-1),(j-1)-th patch. 0055 //! 0056 //! Geometrical connectivity is expressed via global parameters: 0057 //! S[i,j](Ui+1,V) = S[i+1,j](Ui+1,V) for any i, j, V 0058 //! S[i,j](U,Vj+1) = S[i,j+1](U,Vj+1) for any i, j, U 0059 //! It is checked with Precision::Confusion() by default. 0060 //! 0061 //! NOTE 1: This class is inherited from Geom_Surface in order to 0062 //! make it more easy to store and deal with it. However, it should 0063 //! not be passed to standard methods dealing with geometry since 0064 //! this type is not known to them. 0065 //! NOTE 2: Not all the inherited methods are implemented, and some are 0066 //! implemented not in the full form. 0067 class ShapeExtend_CompositeSurface : public Geom_Surface 0068 { 0069 0070 public: 0071 //! Empty constructor. 0072 Standard_EXPORT ShapeExtend_CompositeSurface(); 0073 0074 //! Initializes by a grid of surfaces (calls Init()). 0075 Standard_EXPORT ShapeExtend_CompositeSurface( 0076 const occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>>& GridSurf, 0077 const ShapeExtend_Parametrisation param = ShapeExtend_Natural); 0078 0079 //! Initializes by a grid of surfaces (calls Init()). 0080 Standard_EXPORT ShapeExtend_CompositeSurface( 0081 const occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>>& GridSurf, 0082 const NCollection_Array1<double>& UJoints, 0083 const NCollection_Array1<double>& VJoints); 0084 0085 //! Initializes by a grid of surfaces. 0086 //! All the Surfaces of the grid must have geometrical 0087 //! connectivity as stated above. 0088 //! If geometrical connectivity is not satisfied, method 0089 //! returns False. 0090 //! However, class is initialized even in that case. 0091 //! 0092 //! Last parameter defines how global parametrisation 0093 //! (joint values) will be computed: 0094 //! ShapeExtend_Natural: U1 = u11min, Ui+1 = Ui + (ui1max-ui1min), etc. 0095 //! ShapeExtend_Uniform: Ui = i-1, Vj = j-1 0096 //! ShapeExtend_Unitary: Ui = (i-1)/Nu, Vi = (j-1)/Nv 0097 Standard_EXPORT bool Init( 0098 const occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>>& GridSurf, 0099 const ShapeExtend_Parametrisation param = ShapeExtend_Natural); 0100 0101 //! Initializes by a grid of surfaces with given global 0102 //! parametrisation defined by UJoints and VJoints arrays, 0103 //! each having length equal to number of patches in corresponding 0104 //! direction + 1. Global joint values should be sorted in 0105 //! increasing order. 0106 //! All the Surfaces of the grid must have geometrical 0107 //! connectivity as stated above. 0108 //! If geometrical connectivity is not satisfied, method 0109 //! returns False. 0110 //! However, class is initialized even in that case. 0111 Standard_EXPORT bool Init( 0112 const occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>>& GridSurf, 0113 const NCollection_Array1<double>& UJoints, 0114 const NCollection_Array1<double>& VJoints); 0115 0116 //! Returns number of patches in U direction. 0117 Standard_EXPORT int NbUPatches() const; 0118 0119 //! Returns number of patches in V direction. 0120 Standard_EXPORT int NbVPatches() const; 0121 0122 //! Returns one surface patch 0123 Standard_EXPORT const occ::handle<Geom_Surface>& Patch(const int i, const int j) const; 0124 0125 //! Returns grid of surfaces 0126 Standard_EXPORT const occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>>& Patches() 0127 const; 0128 0129 //! Returns the array of U values corresponding to joint 0130 //! points between patches as well as to start and end points, 0131 //! which define global parametrisation of the surface 0132 Standard_EXPORT occ::handle<NCollection_HArray1<double>> UJointValues() const; 0133 0134 //! Returns the array of V values corresponding to joint 0135 //! points between patches as well as to start and end points, 0136 //! which define global parametrisation of the surface 0137 Standard_EXPORT occ::handle<NCollection_HArray1<double>> VJointValues() const; 0138 0139 //! Returns i-th joint value in U direction 0140 //! (1-st is global Umin, (NbUPatches()+1)-th is global Umax 0141 //! on the composite surface) 0142 Standard_EXPORT double UJointValue(const int i) const; 0143 0144 //! Returns j-th joint value in V direction 0145 //! (1-st is global Vmin, (NbVPatches()+1)-th is global Vmax 0146 //! on the composite surface) 0147 Standard_EXPORT double VJointValue(const int j) const; 0148 0149 //! Sets the array of U values corresponding to joint 0150 //! points, which define global parametrisation of the surface. 0151 //! Number of values in array should be equal to NbUPatches()+1. 0152 //! All the values should be sorted in increasing order. 0153 //! If this is not satisfied, does nothing and returns False. 0154 Standard_EXPORT bool SetUJointValues(const NCollection_Array1<double>& UJoints); 0155 0156 //! Sets the array of V values corresponding to joint 0157 //! points, which define global parametrisation of the surface 0158 //! Number of values in array should be equal to NbVPatches()+1. 0159 //! All the values should be sorted in increasing order. 0160 //! If this is not satisfied, does nothing and returns False. 0161 Standard_EXPORT bool SetVJointValues(const NCollection_Array1<double>& VJoints); 0162 0163 //! Changes starting value for global U parametrisation (all 0164 //! other joint values are shifted accordingly) 0165 Standard_EXPORT void SetUFirstValue(const double UFirst); 0166 0167 //! Changes starting value for global V parametrisation (all 0168 //! other joint values are shifted accordingly) 0169 Standard_EXPORT void SetVFirstValue(const double VFirst); 0170 0171 //! Returns number of col that contains given (global) parameter 0172 Standard_EXPORT int LocateUParameter(const double U) const; 0173 0174 //! Returns number of row that contains given (global) parameter 0175 Standard_EXPORT int LocateVParameter(const double V) const; 0176 0177 //! Returns number of row and col of surface that contains 0178 //! given point 0179 Standard_EXPORT void LocateUVPoint(const gp_Pnt2d& pnt, int& i, int& j) const; 0180 0181 //! Returns one surface patch that contains given (global) parameters 0182 Standard_EXPORT const occ::handle<Geom_Surface>& Patch(const double U, const double V) const; 0183 0184 //! Returns one surface patch that contains given point 0185 Standard_EXPORT const occ::handle<Geom_Surface>& Patch(const gp_Pnt2d& pnt) const; 0186 0187 //! Converts local parameter u on patch i,j to global parameter U 0188 Standard_EXPORT double ULocalToGlobal(const int i, const int j, const double u) const; 0189 0190 //! Converts local parameter v on patch i,j to global parameter V 0191 Standard_EXPORT double VLocalToGlobal(const int i, const int j, const double v) const; 0192 0193 //! Converts local parameters uv on patch i,j to global parameters UV 0194 Standard_EXPORT gp_Pnt2d LocalToGlobal(const int i, const int j, const gp_Pnt2d& uv) const; 0195 0196 //! Converts global parameter U to local parameter u on patch i,j 0197 Standard_EXPORT double UGlobalToLocal(const int i, const int j, const double U) const; 0198 0199 //! Converts global parameter V to local parameter v on patch i,j 0200 Standard_EXPORT double VGlobalToLocal(const int i, const int j, const double V) const; 0201 0202 //! Converts global parameters UV to local parameters uv on patch i,j 0203 Standard_EXPORT gp_Pnt2d GlobalToLocal(const int i, const int j, const gp_Pnt2d& UV) const; 0204 0205 //! Computes transformation operator and uFactor descrinbing affine 0206 //! transformation required to convert global parameters on composite 0207 //! surface to local parameters on patch (i,j): 0208 //! uv = ( uFactor, 1. ) X Trsf * UV; 0209 //! NOTE: Thus Trsf contains shift and scale by V, scale by U is stored in uFact. 0210 //! Returns True if transformation is not an identity 0211 Standard_EXPORT bool GlobalToLocalTransformation(const int i, 0212 const int j, 0213 double& uFact, 0214 gp_Trsf2d& Trsf) const; 0215 0216 //! Applies transformation to all the patches 0217 Standard_EXPORT void Transform(const gp_Trsf& T) override; 0218 0219 //! Returns a copy of the surface 0220 Standard_EXPORT occ::handle<Geom_Geometry> Copy() const override; 0221 0222 //! NOT IMPLEMENTED (does nothing) 0223 Standard_EXPORT void UReverse() override; 0224 0225 //! Returns U 0226 Standard_EXPORT double UReversedParameter(const double U) const override; 0227 0228 //! NOT IMPLEMENTED (does nothing) 0229 Standard_EXPORT void VReverse() override; 0230 0231 //! Returns V 0232 Standard_EXPORT double VReversedParameter(const double V) const override; 0233 0234 //! Returns the parametric bounds of grid 0235 Standard_EXPORT void Bounds(double& U1, double& U2, double& V1, double& V2) const override; 0236 0237 //! Returns True if grid is closed in U direction 0238 //! (i.e. connected with Precision::Confusion) 0239 Standard_EXPORT bool IsUClosed() const override; 0240 0241 //! Returns True if grid is closed in V direction 0242 //! (i.e. connected with Precision::Confusion) 0243 Standard_EXPORT bool IsVClosed() const override; 0244 0245 //! Returns False 0246 Standard_EXPORT bool IsUPeriodic() const override; 0247 0248 //! Returns False 0249 Standard_EXPORT bool IsVPeriodic() const override; 0250 0251 //! NOT IMPLEMENTED (returns Null curve) 0252 Standard_EXPORT occ::handle<Geom_Curve> UIso(const double U) const override; 0253 0254 //! NOT IMPLEMENTED (returns Null curve) 0255 Standard_EXPORT occ::handle<Geom_Curve> VIso(const double V) const override; 0256 0257 //! returns C0 0258 Standard_EXPORT GeomAbs_Shape Continuity() const override; 0259 0260 //! returns True if N <=0 0261 Standard_EXPORT bool IsCNu(const int N) const override; 0262 0263 //! returns True if N <=0 0264 Standard_EXPORT bool IsCNv(const int N) const override; 0265 0266 //! Computes the point of parameter U,V on the grid. 0267 Standard_EXPORT gp_Pnt EvalD0(const double U, const double V) const override; 0268 0269 //! Computes the point P and the first derivatives in the 0270 //! directions U and V at this point. 0271 Standard_EXPORT Geom_Surface::ResD1 EvalD1(const double U, const double V) const override; 0272 0273 //! Computes the point P, the first and the second derivatives in 0274 //! the directions U and V at this point. 0275 Standard_EXPORT Geom_Surface::ResD2 EvalD2(const double U, const double V) const override; 0276 0277 //! Computes the point P, the first,the second and the third 0278 //! derivatives in the directions U and V at this point. 0279 Standard_EXPORT Geom_Surface::ResD3 EvalD3(const double U, const double V) const override; 0280 0281 //! Computes the derivative of order Nu in the direction U and Nv 0282 //! in the direction V at the point P(U, V). 0283 Standard_EXPORT gp_Vec EvalDN(const double U, 0284 const double V, 0285 const int Nu, 0286 const int Nv) const override; 0287 0288 //! Computes the point of parameter pnt on the grid. 0289 Standard_EXPORT gp_Pnt Value(const gp_Pnt2d& pnt) const; 0290 0291 //! Computes Joint values according to parameter 0292 Standard_EXPORT void ComputeJointValues( 0293 const ShapeExtend_Parametrisation param = ShapeExtend_Natural); 0294 0295 //! Checks geometrical connectivity of the patches, including 0296 //! closedness (sets fields muUClosed and myVClosed) 0297 Standard_EXPORT bool CheckConnectivity(const double prec); 0298 0299 DEFINE_STANDARD_RTTIEXT(ShapeExtend_CompositeSurface, Geom_Surface) 0300 0301 private: 0302 occ::handle<NCollection_HArray2<occ::handle<Geom_Surface>>> myPatches; 0303 occ::handle<NCollection_HArray1<double>> myUJointValues; 0304 occ::handle<NCollection_HArray1<double>> myVJointValues; 0305 bool myUClosed; 0306 bool myVClosed; 0307 }; 0308 0309 #endif // _ShapeExtend_CompositeSurface_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|