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) :
32 surf1(S1),surf2(S2),curv(C)
36 //=======================================================================
37 //function : NbEquations
39 //=======================================================================
41 Standard_Integer BlendFunc_GenChamfInv::NbEquations () const
46 //=======================================================================
49 //=======================================================================
51 void BlendFunc_GenChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
57 //=======================================================================
58 //function : GetTolerance
60 //=======================================================================
62 void BlendFunc_GenChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
64 Tolerance(1) = csurf->Resolution(Tol);
65 Tolerance(2) = curv->Resolution(Tol);
67 Tolerance(3) = surf2->UResolution(Tol);
68 Tolerance(4) = surf2->VResolution(Tol);
71 Tolerance(3) = surf1->UResolution(Tol);
72 Tolerance(4) = surf1->VResolution(Tol);
77 //=======================================================================
78 //function : GetBounds
80 //=======================================================================
82 void BlendFunc_GenChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
84 InfBound(1) = csurf->FirstParameter();
85 InfBound(2) = curv->FirstParameter();
86 SupBound(1) = csurf->LastParameter();
87 SupBound(2) = curv->LastParameter();
90 InfBound(3) = surf2->FirstUParameter();
91 InfBound(4) = surf2->FirstVParameter();
92 SupBound(3) = surf2->LastUParameter();
93 SupBound(4) = surf2->LastVParameter();
94 if(!Precision::IsInfinite(InfBound(3)) &&
95 !Precision::IsInfinite(SupBound(3))) {
96 const Standard_Real range = (SupBound(3) - InfBound(3));
100 if(!Precision::IsInfinite(InfBound(4)) &&
101 !Precision::IsInfinite(SupBound(4))) {
102 const Standard_Real range = (SupBound(4) - InfBound(4));
103 InfBound(4) -= range;
104 SupBound(4) += range;
108 InfBound(3) = surf1->FirstUParameter();
109 InfBound(4) = surf1->FirstVParameter();
110 SupBound(3) = surf1->LastUParameter();
111 SupBound(4) = surf1->LastVParameter();
112 if(!Precision::IsInfinite(InfBound(3)) &&
113 !Precision::IsInfinite(SupBound(3))) {
114 const Standard_Real range = (SupBound(3) - InfBound(3));
115 InfBound(3) -= range;
116 SupBound(3) += range;
118 if(!Precision::IsInfinite(InfBound(4)) &&
119 !Precision::IsInfinite(SupBound(4))) {
120 const Standard_Real range = (SupBound(4) - InfBound(4));
121 InfBound(4) -= range;
122 SupBound(4) += range;
127 //=======================================================================
130 //=======================================================================
132 Standard_Boolean BlendFunc_GenChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
136 return Standard_True;