1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// File: IntCurve_DistBetweenPCurvesGen.gxx
// Created: Wed Oct 21 17:39:03 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#define THECURVE1 (*((TheCurve *)thecurve1))
#define THECURVE2 (*((TheCurve *)thecurve2))
//======================================================================
IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen( const TheCurve& C1
,const TheCurve& C2) {
thecurve1 = (Standard_Address) (&C1);
thecurve2 = (Standard_Address )(&C2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const {
return(2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const {
return(2);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value
(const math_Vector& X
,math_Vector& F)
{
gp_Pnt2d P1,P2;
TheCurveTool::D0(THECURVE1,X(1),P1);
TheCurveTool::D0(THECURVE2,X(2),P2);
F(1) = P1.X() - P2.X();
F(2) = P1.Y() - P2.Y();
return(Standard_True);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives
(const math_Vector& X
,math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P;
TheCurveTool::D1(THECURVE1,X(1),P,T);
D.Value(1,1) = T.X();
D.Value(2,1) = T.Y();
TheCurveTool::D1(THECURVE2,X(2),P,T);
D.Value(1,2) = -(T.X());
D.Value(2,2) = -(T.Y());
return(Standard_True);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values
(const math_Vector& X
,math_Vector& F
,math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P1,P2;
TheCurveTool::D1(THECURVE1,X(1),P1,T);
D.Value(1,1) = T.X();
D.Value(2,1) = T.Y();
TheCurveTool::D1(THECURVE2,X(2),P2,T);
D.Value(1,2) = -(T.X());
D.Value(2,2) = -(T.Y());
F.Value(1) = P1.X() - P2.X();
F.Value(2) = P1.Y() - P2.Y();
return(Standard_True);
}
//======================================================================
|