b311480e |
1 | // Created on: 1993-06-07 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Adaptor2d_HCurve2d.hxx> |
19 | #include <Adaptor3d_HSurface.hxx> |
20 | #include <gp_Pnt.hxx> |
21 | #include <IntPatch_ArcFunction.hxx> |
7fd59977 |
22 | #include <IntPatch_HInterTool.hxx> |
42cf5bc1 |
23 | #include <IntSurf_Quadric.hxx> |
7fd59977 |
24 | |
25 | IntPatch_ArcFunction::IntPatch_ArcFunction () |
26 | {} |
27 | |
28 | Standard_Boolean IntPatch_ArcFunction::Value(const Standard_Real X, Standard_Real& F) |
29 | { |
30 | gp_Pnt2d p2d(myArc->Value(X)); |
31 | mySurf->D0(p2d.X(),p2d.Y(),ptsol); |
32 | F = myQuad.Distance(ptsol); |
33 | return Standard_True; |
34 | } |
35 | |
36 | Standard_Boolean IntPatch_ArcFunction::Derivative(const Standard_Real X, Standard_Real& D) |
37 | { |
38 | gp_Pnt2d p2d; |
39 | gp_Vec2d d2d; |
40 | gp_Vec v,d1u,d1v; |
41 | myArc->D1(X,p2d,d2d); |
42 | mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v); |
43 | v.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v); |
44 | D = v.Dot(myQuad.Gradient(ptsol)); |
45 | return Standard_True; |
46 | } |
47 | |
48 | Standard_Boolean IntPatch_ArcFunction::Values(const Standard_Real X, Standard_Real& F, Standard_Real& D) |
49 | { |
50 | gp_Pnt2d p2d; |
51 | gp_Vec2d d2d; |
52 | gp_Vec d1u,d1v; |
53 | |
54 | gp_Vec v1,v2; |
55 | myArc->D1(X,p2d,d2d); |
56 | mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v); |
57 | v1.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v); |
58 | |
59 | myQuad.ValAndGrad(ptsol,F,v2); |
60 | D = v1.Dot(v2); |
61 | return Standard_True; |
62 | } |
63 | |
64 | Standard_Integer IntPatch_ArcFunction::GetStateNumber () |
65 | { |
66 | seqpt.Append(ptsol); |
67 | return seqpt.Length(); |
68 | } |
69 | |
70 | Standard_Integer IntPatch_ArcFunction::NbSamples () const |
71 | { |
72 | return Max(Max(IntPatch_HInterTool::NbSamplesU(mySurf,0.,0.), |
73 | IntPatch_HInterTool::NbSamplesV(mySurf,0.,0.)), |
74 | IntPatch_HInterTool::NbSamplesOnArc(myArc)); |
75 | } |