0027929: Methods D0 and D1 for trimmed offset surface return different values if...
[occt.git] / src / GeomEvaluator / GeomEvaluator_OffsetSurface.hxx
CommitLineData
6b84c3f7 1// Created on: 2015-09-21
2// Copyright (c) 2015 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _GeomEvaluator_OffsetSurface_HeaderFile
16#define _GeomEvaluator_OffsetSurface_HeaderFile
17
18#include <GeomEvaluator_Surface.hxx>
19
20#include <Geom_OsculatingSurface.hxx>
21#include <Geom_Surface.hxx>
22
23class GeomAdaptor_HSurface;
24
25//! Allows to calculate values and derivatives for offset surfaces
26class GeomEvaluator_OffsetSurface : public GeomEvaluator_Surface
27{
28public:
29 //! Initialize evaluator by surface
30 Standard_EXPORT GeomEvaluator_OffsetSurface(
31 const Handle(Geom_Surface)& theBase,
32 const Standard_Real theOffset,
33 const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
34 //! Initialize evaluator by surface adaptor
35 Standard_EXPORT GeomEvaluator_OffsetSurface(
36 const Handle(GeomAdaptor_HSurface)& theBase,
37 const Standard_Real theOffset,
38 const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
39
40 //! Change the offset value
41 void SetOffsetValue(Standard_Real theOffset)
42 { myOffset = theOffset; }
43
44 //! Value of surface
45 Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
46 gp_Pnt& theValue) const Standard_OVERRIDE;
47 //! Value and first derivatives of surface
48 Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
49 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
50 //! Value, first and second derivatives of surface
51 Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
52 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
53 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
54 //! Value, first, second and third derivatives of surface
55 Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
56 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
57 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
58 gp_Vec& theD3U, gp_Vec& theD3V,
59 gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
60 //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
61 //!
62 //! Raises if N < 1 or theDerU < 0 or theDerV < 0
63 Standard_EXPORT gp_Vec DN(const Standard_Real theU,
64 const Standard_Real theV,
65 const Standard_Integer theDerU,
66 const Standard_Integer theDerV) const Standard_OVERRIDE;
67
92efcf78 68 DEFINE_STANDARD_RTTIEXT(GeomEvaluator_OffsetSurface,GeomEvaluator_Surface)
6b84c3f7 69
70private:
71 //! Returns bounds of a base surface
72 void Bounds(Standard_Real& theUMin, Standard_Real& theUMax,
73 Standard_Real& theVMin, Standard_Real& theVMax) const;
74
75 //! Recalculate D1 values of base surface into D0 value of offset surface
76 void CalculateD0(const Standard_Real theU, const Standard_Real theV,
77 gp_Pnt& theValue,
78 const gp_Vec& theD1U, const gp_Vec& theD1V) const;
79 //! Recalculate D2 values of base surface into D1 values of offset surface
80 void CalculateD1(const Standard_Real theU, const Standard_Real theV,
81 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
82 const gp_Vec& theD2U, const gp_Vec& theD2V, const gp_Vec& theD2UV) const;
83 //! Recalculate D3 values of base surface into D2 values of offset surface
84 void CalculateD2(const Standard_Real theU, const Standard_Real theV,
85 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
86 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
87 const gp_Vec& theD3U, const gp_Vec& theD3V,
88 const gp_Vec& theD3UUV, const gp_Vec& theD3UVV) const;
89 //! Recalculate D3 values of base surface into D3 values of offset surface
90 void CalculateD3(const Standard_Real theU, const Standard_Real theV,
91 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
92 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
93 gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
94 //! Calculate DN of offset surface based on derivatives of base surface
95 gp_Vec CalculateDN(const Standard_Real theU, const Standard_Real theV,
96 const Standard_Integer theNu, const Standard_Integer theNv,
97 const gp_Vec& theD1U, const gp_Vec& theD1V) const;
98
99 //! Calculate value of base surface/adaptor
100 void BaseD0(const Standard_Real theU, const Standard_Real theV, gp_Pnt& theValue) const;
101 //! Calculate value and first derivatives of base surface/adaptor
102 void BaseD1(const Standard_Real theU, const Standard_Real theV,
103 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const;
104 //! Calculate value, first and second derivatives of base surface/adaptor
105 void BaseD2(const Standard_Real theU, const Standard_Real theV,
106 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
107 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const;
108 //! Calculate value, first, second and third derivatives of base surface/adaptor
109 void BaseD3(const Standard_Real theU, const Standard_Real theV,
110 gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
111 gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
112 gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
113
114 //! Replace zero derivative by the corresponding derivative in a near point.
115 //! Return true, if the derivative was replaced.
116 Standard_Boolean ReplaceDerivative(const Standard_Real theU, const Standard_Real theV,
117 gp_Vec& theDU, gp_Vec& theDV,
118 const Standard_Real theSquareTol) const;
119
120private:
121 Handle(Geom_Surface) myBaseSurf;
122 Handle(GeomAdaptor_HSurface) myBaseAdaptor;
123
124 Standard_Real myOffset; ///< offset value
125 Handle(Geom_OsculatingSurface) myOscSurf; ///< auxiliary osculating surface
126};
127
128DEFINE_STANDARD_HANDLE(GeomEvaluator_OffsetSurface, GeomEvaluator_Surface)
129
130
131#endif // _GeomEvaluator_OffsetSurface_HeaderFile