b311480e |
1 | // Created on: 1992-10-21 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1992-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 | |
0797d9d3 |
17 | #ifndef OCCT_DEBUG |
7fd59977 |
18 | #define No_Standard_RangeError |
19 | #define No_Standard_OutOfRange |
20 | #endif |
21 | |
22 | |
23 | |
24 | #include <math_Vector.hxx> |
25 | #include <math_Matrix.hxx> |
26 | |
27 | #include <gp_Vec2d.hxx> |
28 | #include <gp_Pnt2d.hxx> |
29 | |
30 | |
31 | #define THECURVE1 (*((TheCurve *)thecurve1)) |
32 | #define THECURVE2 (*((TheCurve *)thecurve2)) |
33 | |
34 | //====================================================================== |
35 | IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen( const TheCurve& C1 |
36 | ,const TheCurve& C2) { |
37 | thecurve1 = (Standard_Address) (&C1); |
38 | thecurve2 = (Standard_Address )(&C2); |
39 | } |
40 | //====================================================================== |
41 | Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const { |
42 | return(2); |
43 | } |
44 | //====================================================================== |
45 | Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const { |
46 | return(2); |
47 | } |
48 | //====================================================================== |
49 | Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value |
50 | (const math_Vector& X |
51 | ,math_Vector& F) |
52 | { |
53 | gp_Pnt2d P1,P2; |
54 | TheCurveTool::D0(THECURVE1,X(1),P1); |
55 | TheCurveTool::D0(THECURVE2,X(2),P2); |
56 | F(1) = P1.X() - P2.X(); |
57 | F(2) = P1.Y() - P2.Y(); |
58 | return(Standard_True); |
59 | } |
60 | //====================================================================== |
61 | Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives |
62 | (const math_Vector& X |
63 | ,math_Matrix& D) |
64 | { |
65 | gp_Vec2d T; |
66 | gp_Pnt2d P; |
67 | TheCurveTool::D1(THECURVE1,X(1),P,T); |
68 | D.Value(1,1) = T.X(); |
69 | D.Value(2,1) = T.Y(); |
70 | |
71 | TheCurveTool::D1(THECURVE2,X(2),P,T); |
72 | D.Value(1,2) = -(T.X()); |
73 | D.Value(2,2) = -(T.Y()); |
74 | |
75 | return(Standard_True); |
76 | } |
77 | //====================================================================== |
78 | Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values |
79 | (const math_Vector& X |
80 | ,math_Vector& F |
81 | ,math_Matrix& D) |
82 | { |
83 | |
84 | gp_Vec2d T; |
85 | gp_Pnt2d P1,P2; |
86 | |
87 | TheCurveTool::D1(THECURVE1,X(1),P1,T); |
88 | D.Value(1,1) = T.X(); |
89 | D.Value(2,1) = T.Y(); |
90 | |
91 | TheCurveTool::D1(THECURVE2,X(2),P2,T); |
92 | D.Value(1,2) = -(T.X()); |
93 | D.Value(2,2) = -(T.Y()); |
94 | |
95 | F.Value(1) = P1.X() - P2.X(); |
96 | F.Value(2) = P1.Y() - P2.Y(); |
97 | |
98 | return(Standard_True); |
99 | } |
100 | //====================================================================== |
101 | |