|
|
|||
File indexing completed on 2026-05-21 08:28:15
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 //! This package implements functions for basis geometric 0032 //! computation on curves and surfaces. 0033 //! The tolerance criterions used in this package are 0034 //! Resolution from package gp and RealEpsilon from class 0035 //! Real of package Standard. 0036 class CSLib 0037 { 0038 public: 0039 DEFINE_STANDARD_ALLOC 0040 0041 //! The following functions computes the normal to a surface 0042 //! inherits FunctionWithDerivative from math 0043 //! 0044 //! Computes the normal direction of a surface as the cross product 0045 //! between D1U and D1V. 0046 //! If D1U has null length or D1V has null length or D1U and D1V are 0047 //! parallel the normal is undefined. 0048 //! To check that D1U and D1V are colinear the sinus of the angle 0049 //! between D1U and D1V is computed and compared with SinTol. 0050 //! The normal is computed if theStatus == Done else the theStatus gives the 0051 //! reason why the computation has failed. 0052 Standard_EXPORT static void Normal(const gp_Vec& D1U, 0053 const gp_Vec& D1V, 0054 const Standard_Real SinTol, 0055 CSLib_DerivativeStatus& theStatus, 0056 gp_Dir& Normal); 0057 0058 //! If there is a singularity on the surface the previous method 0059 //! cannot compute the local normal. 0060 //! This method computes an approached normal direction of a surface. 0061 //! It does a limited development and needs the second derivatives 0062 //! on the surface as input data. 0063 //! It computes the normal as follow : 0064 //! N(u, v) = D1U ^ D1V 0065 //! N(u0+du,v0+dv) = N0 + DN/du(u0,v0) * du + DN/dv(u0,v0) * dv + Eps 0066 //! with Eps->0 so we can have the equivalence N ~ dN/du + dN/dv. 0067 //! DNu = ||DN/du|| and DNv = ||DN/dv|| 0068 //! 0069 //! . if DNu IsNull (DNu <= Resolution from gp) the answer Done = True 0070 //! the normal direction is given by DN/dv 0071 //! . if DNv IsNull (DNv <= Resolution from gp) the answer Done = True 0072 //! the normal direction is given by DN/du 0073 //! . if the two directions DN/du and DN/dv are parallel Done = True 0074 //! the normal direction is given either by DN/du or DN/dv. 0075 //! To check that the two directions are colinear the sinus of the 0076 //! angle between these directions is computed and compared with 0077 //! SinTol. 0078 //! . if DNu/DNv or DNv/DNu is lower or equal than Real Epsilon 0079 //! Done = False, the normal is undefined 0080 //! . if DNu IsNull and DNv is Null Done = False, there is an 0081 //! indetermination and we should do a limited development at 0082 //! order 2 (it means that we cannot omit Eps). 0083 //! . if DNu Is not Null and DNv Is not Null Done = False, there are 0084 //! an infinity of normals at the considered point on the surface. 0085 Standard_EXPORT static void Normal(const gp_Vec& D1U, 0086 const gp_Vec& D1V, 0087 const gp_Vec& D2U, 0088 const gp_Vec& D2V, 0089 const gp_Vec& D2UV, 0090 const Standard_Real SinTol, 0091 Standard_Boolean& Done, 0092 CSLib_NormalStatus& theStatus, 0093 gp_Dir& Normal); 0094 0095 //! Computes the normal direction of a surface as the cross product 0096 //! between D1U and D1V. 0097 Standard_EXPORT static void Normal(const gp_Vec& D1U, 0098 const gp_Vec& D1V, 0099 const Standard_Real MagTol, 0100 CSLib_NormalStatus& theStatus, 0101 gp_Dir& Normal); 0102 0103 //! find the first order k0 of deriviative of NUV 0104 //! where: foreach order < k0 all the derivatives of NUV are 0105 //! null all the derivatives of NUV corresponding to the order 0106 //! k0 are collinear and have the same sens. 0107 //! In this case, normal at U,V is unique. 0108 Standard_EXPORT static void Normal(const Standard_Integer MaxOrder, 0109 const TColgp_Array2OfVec& DerNUV, 0110 const Standard_Real MagTol, 0111 const Standard_Real U, 0112 const Standard_Real V, 0113 const Standard_Real Umin, 0114 const Standard_Real Umax, 0115 const Standard_Real Vmin, 0116 const Standard_Real Vmax, 0117 CSLib_NormalStatus& theStatus, 0118 gp_Dir& Normal, 0119 Standard_Integer& OrderU, 0120 Standard_Integer& OrderV); 0121 0122 //! -- Computes the derivative of order Nu in the -- 0123 //! direction U and Nv in the direction V of the not -- 0124 //! normalized normal vector at the point P(U,V) The 0125 //! array DerSurf contain the derivative (i,j) of the surface 0126 //! for i=0,Nu+1 ; j=0,Nv+1 0127 Standard_EXPORT static gp_Vec DNNUV(const Standard_Integer Nu, 0128 const Standard_Integer Nv, 0129 const TColgp_Array2OfVec& DerSurf); 0130 0131 //! Computes the derivatives of order Nu in the direction Nu 0132 //! and Nv in the direction Nv of the not normalized vector 0133 //! N(u,v) = dS1/du * dS2/dv (cases where we use an osculating surface) 0134 //! DerSurf1 are the derivatives of S1 0135 Standard_EXPORT static gp_Vec DNNUV(const Standard_Integer Nu, 0136 const Standard_Integer Nv, 0137 const TColgp_Array2OfVec& DerSurf1, 0138 const TColgp_Array2OfVec& DerSurf2); 0139 0140 //! -- Computes the derivative of order Nu in the -- 0141 //! direction U and Nv in the direction V of the 0142 //! normalized normal vector at the point P(U,V) array 0143 //! DerNUV contain the derivative (i+Iduref,j+Idvref) 0144 //! of D1U ^ D1V for i=0,Nu ; j=0,Nv Iduref and Idvref 0145 //! correspond to a derivative of D1U ^ D1V which can 0146 //! be used to compute the normalized normal vector. 0147 //! In the regular cases , Iduref=Idvref=0. 0148 Standard_EXPORT static gp_Vec DNNormal(const Standard_Integer Nu, 0149 const Standard_Integer Nv, 0150 const TColgp_Array2OfVec& DerNUV, 0151 const Standard_Integer Iduref = 0, 0152 const Standard_Integer Idvref = 0); 0153 }; 0154 0155 #endif // _CSLib_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|