1 // Created by: Julia GERASIMOVA
2 // Copyright (c) 2015 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <Adaptor2d_HCurve2d.hxx>
17 #include <Adaptor3d_HCurve.hxx>
18 #include <Adaptor3d_HSurface.hxx>
19 #include <BlendFunc.hxx>
20 #include <BlendFunc_ChamfInv.hxx>
21 #include <math_Matrix.hxx>
22 #include <Precision.hxx>
25 //=======================================================================
26 //function : BlendFunc_GenChamfInv
28 //=======================================================================
29 BlendFunc_GenChamfInv::BlendFunc_GenChamfInv(const Handle(Adaptor3d_HSurface)& S1,
30 const Handle(Adaptor3d_HSurface)& S2,
31 const Handle(Adaptor3d_HCurve)& C)
40 //=======================================================================
41 //function : NbEquations
43 //=======================================================================
45 Standard_Integer BlendFunc_GenChamfInv::NbEquations () const
50 //=======================================================================
53 //=======================================================================
55 void BlendFunc_GenChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
61 //=======================================================================
62 //function : GetTolerance
64 //=======================================================================
66 void BlendFunc_GenChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
68 Tolerance(1) = csurf->Resolution(Tol);
69 Tolerance(2) = curv->Resolution(Tol);
71 Tolerance(3) = surf2->UResolution(Tol);
72 Tolerance(4) = surf2->VResolution(Tol);
75 Tolerance(3) = surf1->UResolution(Tol);
76 Tolerance(4) = surf1->VResolution(Tol);
81 //=======================================================================
82 //function : GetBounds
84 //=======================================================================
86 void BlendFunc_GenChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
88 InfBound(1) = csurf->FirstParameter();
89 InfBound(2) = curv->FirstParameter();
90 SupBound(1) = csurf->LastParameter();
91 SupBound(2) = curv->LastParameter();
94 InfBound(3) = surf2->FirstUParameter();
95 InfBound(4) = surf2->FirstVParameter();
96 SupBound(3) = surf2->LastUParameter();
97 SupBound(4) = surf2->LastVParameter();
98 if(!Precision::IsInfinite(InfBound(3)) &&
99 !Precision::IsInfinite(SupBound(3))) {
100 const Standard_Real range = (SupBound(3) - InfBound(3));
101 InfBound(3) -= range;
102 SupBound(3) += range;
104 if(!Precision::IsInfinite(InfBound(4)) &&
105 !Precision::IsInfinite(SupBound(4))) {
106 const Standard_Real range = (SupBound(4) - InfBound(4));
107 InfBound(4) -= range;
108 SupBound(4) += range;
112 InfBound(3) = surf1->FirstUParameter();
113 InfBound(4) = surf1->FirstVParameter();
114 SupBound(3) = surf1->LastUParameter();
115 SupBound(4) = surf1->LastVParameter();
116 if(!Precision::IsInfinite(InfBound(3)) &&
117 !Precision::IsInfinite(SupBound(3))) {
118 const Standard_Real range = (SupBound(3) - InfBound(3));
119 InfBound(3) -= range;
120 SupBound(3) += range;
122 if(!Precision::IsInfinite(InfBound(4)) &&
123 !Precision::IsInfinite(SupBound(4))) {
124 const Standard_Real range = (SupBound(4) - InfBound(4));
125 InfBound(4) -= range;
126 SupBound(4) += range;
131 //=======================================================================
134 //=======================================================================
136 Standard_Boolean BlendFunc_GenChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
140 return Standard_True;