b311480e |
1 | // Created on: 1993-06-07 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <IntPatch_ArcFunction.ixx> |
23 | |
24 | #include <IntPatch_HInterTool.hxx> |
25 | |
26 | |
27 | IntPatch_ArcFunction::IntPatch_ArcFunction () |
28 | {} |
29 | |
30 | Standard_Boolean IntPatch_ArcFunction::Value(const Standard_Real X, Standard_Real& F) |
31 | { |
32 | gp_Pnt2d p2d(myArc->Value(X)); |
33 | mySurf->D0(p2d.X(),p2d.Y(),ptsol); |
34 | F = myQuad.Distance(ptsol); |
35 | return Standard_True; |
36 | } |
37 | |
38 | Standard_Boolean IntPatch_ArcFunction::Derivative(const Standard_Real X, Standard_Real& D) |
39 | { |
40 | gp_Pnt2d p2d; |
41 | gp_Vec2d d2d; |
42 | gp_Vec v,d1u,d1v; |
43 | myArc->D1(X,p2d,d2d); |
44 | mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v); |
45 | v.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v); |
46 | D = v.Dot(myQuad.Gradient(ptsol)); |
47 | return Standard_True; |
48 | } |
49 | |
50 | Standard_Boolean IntPatch_ArcFunction::Values(const Standard_Real X, Standard_Real& F, Standard_Real& D) |
51 | { |
52 | gp_Pnt2d p2d; |
53 | gp_Vec2d d2d; |
54 | gp_Vec d1u,d1v; |
55 | |
56 | gp_Vec v1,v2; |
57 | myArc->D1(X,p2d,d2d); |
58 | mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v); |
59 | v1.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v); |
60 | |
61 | myQuad.ValAndGrad(ptsol,F,v2); |
62 | D = v1.Dot(v2); |
63 | return Standard_True; |
64 | } |
65 | |
66 | Standard_Integer IntPatch_ArcFunction::GetStateNumber () |
67 | { |
68 | seqpt.Append(ptsol); |
69 | return seqpt.Length(); |
70 | } |
71 | |
72 | Standard_Integer IntPatch_ArcFunction::NbSamples () const |
73 | { |
74 | return Max(Max(IntPatch_HInterTool::NbSamplesU(mySurf,0.,0.), |
75 | IntPatch_HInterTool::NbSamplesV(mySurf,0.,0.)), |
76 | IntPatch_HInterTool::NbSamplesOnArc(myArc)); |
77 | } |