|
||||
File indexing completed on 2025-01-18 10:03:37
0001 // Created on: 1995-01-16 0002 // Created by: Remi LEQUETTE 0003 // Copyright (c) 1995-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 _GeomAPI_PointsToBSplineSurface_HeaderFile 0018 #define _GeomAPI_PointsToBSplineSurface_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <TColgp_Array2OfPnt.hxx> 0025 #include <Standard_Integer.hxx> 0026 #include <GeomAbs_Shape.hxx> 0027 #include <Approx_ParametrizationType.hxx> 0028 #include <TColStd_Array2OfReal.hxx> 0029 class Geom_BSplineSurface; 0030 0031 0032 //! This class is used to approximate or interpolate 0033 //! a BSplineSurface passing through an Array2 of 0034 //! points, with a given continuity. 0035 //! Describes functions for building a BSpline 0036 //! surface which approximates or interpolates a set of points. 0037 //! A PointsToBSplineSurface object provides a framework for: 0038 //! - defining the data of the BSpline surface to be built, 0039 //! - implementing the approximation algorithm 0040 //! or the interpolation algorithm, and consulting the results. 0041 //! In fact, class contains 3 algorithms, 2 for approximation and 1 0042 //! for interpolation. 0043 //! First approximation algorithm is based on usual least square criterium: 0044 //! minimization of square distance between samplimg points and result surface. 0045 //! Second approximation algorithm uses least square criterium and additional 0046 //! minimization of some local characteristic of surface (first, second and third 0047 //! partial derivative), which allows managing shape of surface. 0048 //! Interpolation algorithm produces surface, which passes through sampling points. 0049 //! 0050 //! There is accordance between parametrization of result surface S(U, V) and 0051 //! indexes of array Points(i, j): first index corresponds U parameter of surface, 0052 //! second - V parameter of surface. 0053 //! So, points of any j-th column Points(*, j) represent any V isoline of surface, 0054 //! points of any i-th row Point(i, *) represent any U isoline of surface. 0055 //! 0056 //! For each sampling point parameters U, V are calculated according to 0057 //! type of parametrization, which can be Approx_ChordLength, Approx_Centripetal 0058 //! or Approx_IsoParametric. Default value is Approx_ChordLength. 0059 //! For ChordLength parametrisation U(i) = U(i-1) + P(i).Distance(P(i-1)), 0060 //! For Centripetal type U(i) = U(i-1) + Sqrt(P(i).Distance(P(i-1))). 0061 //! Centripetal type can get better result for irregular distances between points. 0062 //! 0063 //! Approximation and interpolation algorithms can build periodical surface along U 0064 //! direction, which corresponds columns of array Points(i, j), 0065 //! if corresponding parameter (thePeriodic, see comments below) of called 0066 //! methods is set to True. Algorithm uses first row Points(1, *) as periodic boundary, 0067 //! so to avoid getting wrong surface it is necessary to keep distance between 0068 //! corresponding points of first and last rows of Points: 0069 //! Points(1, *) != Points(Upper, *). 0070 0071 class GeomAPI_PointsToBSplineSurface 0072 { 0073 public: 0074 0075 DEFINE_STANDARD_ALLOC 0076 0077 0078 //! Constructs an empty algorithm for 0079 //! approximation or interpolation of a surface. 0080 //! Use: 0081 //! - an Init function to define and build the 0082 //! BSpline surface by approximation, or 0083 //! - an Interpolate function to define and build 0084 //! the BSpline surface by interpolation. 0085 Standard_EXPORT GeomAPI_PointsToBSplineSurface(); 0086 0087 //! Approximates a BSpline Surface passing through an 0088 //! array of Points. The resulting BSpline will have 0089 //! the following properties: 0090 //! 1- his degree will be in the range [Degmin,Degmax] 0091 //! 2- his continuity will be at least <Continuity> 0092 //! 3- the distance from the point <Points> to the 0093 //! BSpline will be lower to Tol3D. 0094 0095 Standard_EXPORT GeomAPI_PointsToBSplineSurface(const TColgp_Array2OfPnt& Points, 0096 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0097 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0098 0099 //! Approximates a BSpline Surface passing through an 0100 //! array of Points. The resulting BSpline will have 0101 //! the following properties: 0102 //! 1- his degree will be in the range [Degmin,Degmax] 0103 //! 2- his continuity will be at least <Continuity> 0104 //! 3- the distance from the point <Points> to the 0105 //! BSpline will be lower to Tol3D. 0106 0107 Standard_EXPORT GeomAPI_PointsToBSplineSurface(const TColgp_Array2OfPnt& Points, 0108 const Approx_ParametrizationType ParType, 0109 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0110 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0111 0112 //! Approximates a BSpline Surface passing through an 0113 //! array of points using variational smoothing algorithm, 0114 //! which tries to minimize additional criterium: 0115 //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion. 0116 0117 Standard_EXPORT GeomAPI_PointsToBSplineSurface(const TColgp_Array2OfPnt& Points, 0118 const Standard_Real Weight1, const Standard_Real Weight2, const Standard_Real Weight3, 0119 const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, 0120 const Standard_Real Tol3D = 1.0e-3); 0121 0122 //! Approximates a BSpline Surface passing through an 0123 //! array of Points. 0124 //! 0125 //! The points will be constructed as follow: 0126 //! P(i,j) = gp_Pnt( X0 + (i-1)*dX , 0127 //! Y0 + (j-1)*dY , 0128 //! ZPoints(i,j) ) 0129 //! 0130 //! The resulting BSpline will have the following 0131 //! properties: 0132 //! 1- his degree will be in the range [Degmin,Degmax] 0133 //! 2- his continuity will be at least <Continuity> 0134 //! 3- the distance from the point <Points> to the 0135 //! BSpline will be lower to Tol3D 0136 //! 4- the parametrization of the surface will verify: 0137 //! S->Value( U, V) = gp_Pnt( U, V, Z(U,V) ); 0138 0139 Standard_EXPORT GeomAPI_PointsToBSplineSurface(const TColStd_Array2OfReal& ZPoints, 0140 const Standard_Real X0, const Standard_Real dX, 0141 const Standard_Real Y0, const Standard_Real dY, 0142 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0143 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0144 0145 //! Approximates a BSpline Surface passing through an 0146 //! array of Point. The resulting BSpline will have 0147 //! the following properties: 0148 //! 1- his degree will be in the range [Degmin,Degmax] 0149 //! 2- his continuity will be at least <Continuity> 0150 //! 3- the distance from the point <Points> to the 0151 //! BSpline will be lower to Tol3D. 0152 0153 Standard_EXPORT void Init (const TColgp_Array2OfPnt& Points, 0154 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0155 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0156 0157 //! Interpolates a BSpline Surface passing through an 0158 //! array of Point. The resulting BSpline will have 0159 //! the following properties: 0160 //! 1- his degree will be 3. 0161 //! 2- his continuity will be C2. 0162 0163 Standard_EXPORT void Interpolate (const TColgp_Array2OfPnt& Points, 0164 const Standard_Boolean thePeriodic = Standard_False); 0165 0166 //! Interpolates a BSpline Surface passing through an 0167 //! array of Point. The resulting BSpline will have 0168 //! the following properties: 0169 //! 1- his degree will be 3. 0170 //! 2- his continuity will be C2. 0171 0172 Standard_EXPORT void Interpolate (const TColgp_Array2OfPnt& Points, const Approx_ParametrizationType ParType, 0173 const Standard_Boolean thePeriodic = Standard_False); 0174 0175 //! Approximates a BSpline Surface passing through an 0176 //! array of Points. 0177 //! 0178 //! The points will be constructed as follow: 0179 //! P(i,j) = gp_Pnt( X0 + (i-1)*dX , 0180 //! Y0 + (j-1)*dY , 0181 //! ZPoints(i,j) ) 0182 //! 0183 //! The resulting BSpline will have the following 0184 //! properties: 0185 //! 1- his degree will be in the range [Degmin,Degmax] 0186 //! 2- his continuity will be at least <Continuity> 0187 //! 3- the distance from the point <Points> to the 0188 //! BSpline will be lower to Tol3D 0189 //! 4- the parametrization of the surface will verify: 0190 //! S->Value( U, V) = gp_Pnt( U, V, Z(U,V) ); 0191 0192 Standard_EXPORT void Init (const TColStd_Array2OfReal& ZPoints, 0193 const Standard_Real X0, const Standard_Real dX, 0194 const Standard_Real Y0, const Standard_Real dY, 0195 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0196 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0197 0198 //! Interpolates a BSpline Surface passing through an 0199 //! array of Points. 0200 //! 0201 //! The points will be constructed as follow: 0202 //! P(i,j) = gp_Pnt( X0 + (i-1)*dX , 0203 //! Y0 + (j-1)*dY , 0204 //! ZPoints(i,j) ) 0205 //! 0206 //! The resulting BSpline will have the following 0207 //! properties: 0208 //! 1- his degree will be 3 0209 //! 2- his continuity will be C2. 0210 //! 4- the parametrization of the surface will verify: 0211 //! S->Value( U, V) = gp_Pnt( U, V, Z(U,V) ); 0212 0213 Standard_EXPORT void Interpolate (const TColStd_Array2OfReal& ZPoints, 0214 const Standard_Real X0, const Standard_Real dX, const Standard_Real Y0, const Standard_Real dY); 0215 0216 //! Approximates a BSpline Surface passing through an 0217 //! array of Point. The resulting BSpline will have 0218 //! the following properties: 0219 //! 1- his degree will be in the range [Degmin,Degmax] 0220 //! 2- his continuity will be at least <Continuity> 0221 //! 3- the distance from the point <Points> to the 0222 //! BSpline will be lower to Tol3D. 0223 0224 Standard_EXPORT void Init (const TColgp_Array2OfPnt& Points, 0225 const Approx_ParametrizationType ParType, 0226 const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, 0227 const GeomAbs_Shape Continuity = GeomAbs_C2, 0228 const Standard_Real Tol3D = 1.0e-3, const Standard_Boolean thePeriodic = Standard_False); 0229 0230 //! Approximates a BSpline Surface passing through an 0231 //! array of point using variational smoothing algorithm, 0232 //! which tries to minimize additional criterium: 0233 //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion. 0234 0235 Standard_EXPORT void Init (const TColgp_Array2OfPnt& Points, 0236 const Standard_Real Weight1, const Standard_Real Weight2, const Standard_Real Weight3, 0237 const Standard_Integer DegMax = 8, 0238 const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3); 0239 0240 //! Returns the approximate BSpline Surface 0241 Standard_EXPORT const Handle(Geom_BSplineSurface)& Surface() const; 0242 Standard_EXPORT operator Handle(Geom_BSplineSurface)() const; 0243 0244 Standard_EXPORT Standard_Boolean IsDone() const; 0245 0246 0247 0248 0249 protected: 0250 0251 0252 0253 0254 0255 private: 0256 0257 0258 0259 Standard_Boolean myIsDone; 0260 Handle(Geom_BSplineSurface) mySurface; 0261 0262 0263 }; 0264 0265 0266 0267 0268 0269 0270 0271 #endif // _GeomAPI_PointsToBSplineSurface_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |