Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:23

0001 // Created on: 1991-09-09
0002 // Created by: Michel Chauvat
0003 // Copyright (c) 1991-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 _CSLib_HeaderFile
0018 #define _CSLib_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <CSLib_DerivativeStatus.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <CSLib_NormalStatus.hxx>
0027 #include <TColgp_Array2OfVec.hxx>
0028 class gp_Vec;
0029 class gp_Dir;
0030 
0031 
0032 //! This package implements functions for basis geometric
0033 //! computation on curves and surfaces.
0034 //! The tolerance criterions used in this package are
0035 //! Resolution from package gp and RealEpsilon from class
0036 //! Real of package Standard.
0037 class CSLib 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044 
0045   //! The following functions computes the normal to a surface
0046   //! inherits FunctionWithDerivative from math
0047   //!
0048   //! Computes the normal direction of a surface as the cross product
0049   //! between D1U and D1V.
0050   //! If D1U has null length or D1V has null length or D1U and D1V are
0051   //! parallel the normal is undefined.
0052   //! To check that D1U and D1V are colinear the sinus of the angle
0053   //! between D1U and D1V is computed and compared with SinTol.
0054   //! The normal is computed if theStatus == Done else the theStatus gives the
0055   //! reason why the computation has failed.
0056   Standard_EXPORT static void Normal (const gp_Vec& D1U, const gp_Vec& D1V, const Standard_Real SinTol, CSLib_DerivativeStatus& theStatus, gp_Dir& Normal);
0057   
0058 
0059   //! If there is a singularity on the surface  the previous method
0060   //! cannot compute the local normal.
0061   //! This method computes an approached normal direction of a surface.
0062   //! It does a limited development and needs the second derivatives
0063   //! on the surface as input data.
0064   //! It computes the normal as follow :
0065   //! N(u, v) = D1U ^ D1V
0066   //! N(u0+du,v0+dv) = N0 + DN/du(u0,v0) * du + DN/dv(u0,v0) * dv + Eps
0067   //! with Eps->0 so we can have the equivalence N ~ dN/du + dN/dv.
0068   //! DNu = ||DN/du|| and DNv = ||DN/dv||
0069   //!
0070   //! . if DNu IsNull (DNu <= Resolution from gp) the answer Done = True
0071   //! the normal direction is given by DN/dv
0072   //! . if DNv IsNull (DNv <= Resolution from gp) the answer Done = True
0073   //! the normal direction is given by DN/du
0074   //! . if the two directions DN/du and DN/dv are parallel Done = True
0075   //! the normal direction is given either by DN/du or DN/dv.
0076   //! To check that the two directions are colinear the sinus of the
0077   //! angle between these directions is computed and compared with
0078   //! SinTol.
0079   //! . if DNu/DNv or DNv/DNu is lower or equal than Real Epsilon
0080   //! Done = False, the normal is undefined
0081   //! . if DNu IsNull and DNv is Null Done = False, there is an
0082   //! indetermination and we should do a limited development at
0083   //! order 2 (it means that we cannot omit Eps).
0084   //! . if DNu Is not Null and DNv Is not Null Done = False, there are
0085   //! an infinity of normals at the considered point on the surface.
0086   Standard_EXPORT static void Normal (const gp_Vec& D1U, const gp_Vec& D1V, const gp_Vec& D2U, const gp_Vec& D2V, const gp_Vec& D2UV, const Standard_Real SinTol, Standard_Boolean& Done, CSLib_NormalStatus& theStatus, gp_Dir& Normal);
0087   
0088 
0089   //! Computes the normal direction of a surface as the cross product
0090   //! between D1U and D1V.
0091   Standard_EXPORT static void Normal (const gp_Vec& D1U, const gp_Vec& D1V, const Standard_Real MagTol, CSLib_NormalStatus& theStatus, gp_Dir& Normal);
0092   
0093   //! find the first  order k0  of deriviative of NUV
0094   //! where: foreach order < k0  all the derivatives of NUV  are
0095   //! null all the derivatives of NUV corresponding to the order
0096   //! k0 are collinear and have the same sens.
0097   //! In this case, normal at U,V is unique.
0098   Standard_EXPORT static void Normal (const Standard_Integer MaxOrder, const TColgp_Array2OfVec& DerNUV, const Standard_Real MagTol, const Standard_Real U, const Standard_Real V, const Standard_Real Umin, const Standard_Real Umax, const Standard_Real Vmin, const Standard_Real Vmax, CSLib_NormalStatus& theStatus, gp_Dir& Normal, Standard_Integer& OrderU, Standard_Integer& OrderV);
0099   
0100   //! -- Computes the derivative  of order Nu in the --
0101   //! direction U and Nv in the direction V of the not --
0102   //! normalized  normal vector at  the point  P(U,V) The
0103   //! array DerSurf contain the derivative (i,j) of the surface
0104   //! for i=0,Nu+1 ; j=0,Nv+1
0105   Standard_EXPORT static gp_Vec DNNUV (const Standard_Integer Nu, const Standard_Integer Nv, const TColgp_Array2OfVec& DerSurf);
0106   
0107   //! Computes the derivatives of order Nu in the direction Nu
0108   //! and Nv in the direction Nv of the not normalized vector
0109   //! N(u,v) = dS1/du * dS2/dv (cases where we use an osculating surface)
0110   //! DerSurf1 are the derivatives of S1
0111   Standard_EXPORT static gp_Vec DNNUV (const Standard_Integer Nu, const Standard_Integer Nv, const TColgp_Array2OfVec& DerSurf1, const TColgp_Array2OfVec& DerSurf2);
0112   
0113   //! -- Computes the derivative  of order Nu in the --
0114   //! direction   U and  Nv in the  direction  V  of the
0115   //! normalized normal vector  at the point P(U,V) array
0116   //! DerNUV contain the  derivative  (i+Iduref,j+Idvref)
0117   //! of D1U ^ D1V for i=0,Nu  ; j=0,Nv Iduref and Idvref
0118   //! correspond to a derivative  of D1U ^ D1V  which can
0119   //! be used to compute the normalized normal vector.
0120   //! In the regular cases , Iduref=Idvref=0.
0121   Standard_EXPORT static gp_Vec DNNormal (const Standard_Integer Nu, const Standard_Integer Nv, const TColgp_Array2OfVec& DerNUV, const Standard_Integer Iduref = 0, const Standard_Integer Idvref = 0);
0122 
0123 };
0124 
0125 #endif // _CSLib_HeaderFile