Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:55

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