0032743: Coding Rules - remove unused class friends of Package classes
[occt.git] / src / CSLib / CSLib.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-09-09
2// Created by: Michel Chauvat
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _CSLib_HeaderFile
18#define _CSLib_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <CSLib_DerivativeStatus.hxx>
26#include <Standard_Boolean.hxx>
27#include <CSLib_NormalStatus.hxx>
28#include <Standard_Integer.hxx>
29#include <TColgp_Array2OfVec.hxx>
30class gp_Vec;
31class gp_Dir;
42cf5bc1 32
33
34//! This package implements functions for basis geometric
35//! computation on curves and surfaces.
36//! The tolerance criterions used in this package are
37//! Resolution from package gp and RealEpsilon from class
38//! Real of package Standard.
39class CSLib
40{
41public:
42
43 DEFINE_STANDARD_ALLOC
44
45
46
47 //! The following functions computes the normal to a surface
48 //! inherits FunctionWithDerivative from math
49 //!
50 //! Computes the normal direction of a surface as the cross product
51 //! between D1U and D1V.
52 //! If D1U has null length or D1V has null length or D1U and D1V are
53 //! parallel the normal is undefined.
54 //! To check that D1U and D1V are colinear the sinus of the angle
55 //! between D1U and D1V is computed and compared with SinTol.
9fd2d2c3 56 //! The normal is computed if theStatus == Done else the theStatus gives the
42cf5bc1 57 //! reason why the computation has failed.
9fd2d2c3 58 Standard_EXPORT static void Normal (const gp_Vec& D1U, const gp_Vec& D1V, const Standard_Real SinTol, CSLib_DerivativeStatus& theStatus, gp_Dir& Normal);
42cf5bc1 59
60
61 //! If there is a singularity on the surface the previous method
62 //! cannot compute the local normal.
b81b237f 63 //! This method computes an approached normal direction of a surface.
42cf5bc1 64 //! It does a limited development and needs the second derivatives
65 //! on the surface as input data.
66 //! It computes the normal as follow :
67 //! N(u, v) = D1U ^ D1V
68 //! N(u0+du,v0+dv) = N0 + DN/du(u0,v0) * du + DN/dv(u0,v0) * dv + Eps
69 //! with Eps->0 so we can have the equivalence N ~ dN/du + dN/dv.
70 //! DNu = ||DN/du|| and DNv = ||DN/dv||
71 //!
72 //! . if DNu IsNull (DNu <= Resolution from gp) the answer Done = True
73 //! the normal direction is given by DN/dv
74 //! . if DNv IsNull (DNv <= Resolution from gp) the answer Done = True
75 //! the normal direction is given by DN/du
76 //! . if the two directions DN/du and DN/dv are parallel Done = True
77 //! the normal direction is given either by DN/du or DN/dv.
78 //! To check that the two directions are colinear the sinus of the
79 //! angle between these directions is computed and compared with
80 //! SinTol.
81 //! . if DNu/DNv or DNv/DNu is lower or equal than Real Epsilon
82 //! Done = False, the normal is undefined
83 //! . if DNu IsNull and DNv is Null Done = False, there is an
b81b237f 84 //! indetermination and we should do a limited development at
42cf5bc1 85 //! order 2 (it means that we cannot omit Eps).
86 //! . if DNu Is not Null and DNv Is not Null Done = False, there are
87 //! an infinity of normals at the considered point on the surface.
9fd2d2c3 88 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);
42cf5bc1 89
90
91 //! Computes the normal direction of a surface as the cross product
92 //! between D1U and D1V.
9fd2d2c3 93 Standard_EXPORT static void Normal (const gp_Vec& D1U, const gp_Vec& D1V, const Standard_Real MagTol, CSLib_NormalStatus& theStatus, gp_Dir& Normal);
42cf5bc1 94
95 //! find the first order k0 of deriviative of NUV
96 //! where: foreach order < k0 all the derivatives of NUV are
97 //! null all the derivatives of NUV corresponding to the order
98 //! k0 are collinear and have the same sens.
99 //! In this case, normal at U,V is unique.
9fd2d2c3 100 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);
42cf5bc1 101
102 //! -- Computes the derivative of order Nu in the --
103 //! direction U and Nv in the direction V of the not --
104 //! normalized normal vector at the point P(U,V) The
105 //! array DerSurf contain the derivative (i,j) of the surface
106 //! for i=0,Nu+1 ; j=0,Nv+1
107 Standard_EXPORT static gp_Vec DNNUV (const Standard_Integer Nu, const Standard_Integer Nv, const TColgp_Array2OfVec& DerSurf);
108
109 //! Computes the derivatives of order Nu in the direction Nu
110 //! and Nv in the direction Nv of the not normalized vector
111 //! N(u,v) = dS1/du * dS2/dv (cases where we use an osculating surface)
112 //! DerSurf1 are the derivatives of S1
113 Standard_EXPORT static gp_Vec DNNUV (const Standard_Integer Nu, const Standard_Integer Nv, const TColgp_Array2OfVec& DerSurf1, const TColgp_Array2OfVec& DerSurf2);
114
115 //! -- Computes the derivative of order Nu in the --
116 //! direction U and Nv in the direction V of the
117 //! normalized normal vector at the point P(U,V) array
118 //! DerNUV contain the derivative (i+Iduref,j+Idvref)
119 //! of D1U ^ D1V for i=0,Nu ; j=0,Nv Iduref and Idvref
120 //! correspond to a derivative of D1U ^ D1V which can
121 //! be used to compute the normalized normal vector.
122 //! In the regular cases , Iduref=Idvref=0.
123 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);
124
42cf5bc1 125};
126
42cf5bc1 127#endif // _CSLib_HeaderFile