1 // Created on: 1994-04-05
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Bisector_FunctionH.hxx>
19 #include <Geom2d_Curve.hxx>
20 #include <gp_Pnt2d.hxx>
21 #include <gp_Vec2d.hxx>
23 //=============================================================================
26 //=============================================================================
27 Bisector_FunctionH::Bisector_FunctionH (const Handle(Geom2d_Curve)& C2,
36 //=============================================================================
39 // F = P1P2.(||T2||T1 + T2)
40 //=============================================================================
41 Standard_Boolean Bisector_FunctionH::Value (const Standard_Real X,
44 gp_Pnt2d P2 ; // point sur C2.
45 gp_Vec2d T2 ; // tangente a C2 en V.
48 Standard_Real NormT2 = T2.Magnitude();
49 Standard_Real Ax = NormT2*t1.X() - T2.X();
50 Standard_Real Ay = NormT2*t1.Y() - T2.Y();
52 F = (p1.X() - P2.X())*Ax + (p1.Y() - P2.Y())*Ay;
57 //=============================================================================
58 //function : Derivative
60 //=============================================================================
61 Standard_Boolean Bisector_FunctionH::Derivative(const Standard_Real X,
65 return Values (X,F,D);
68 //=============================================================================
71 //=============================================================================
72 Standard_Boolean Bisector_FunctionH::Values (const Standard_Real X,
76 gp_Pnt2d P2 ; // point sur C2.
77 gp_Vec2d T2 ; // tangente a C2 en V.
78 gp_Vec2d T2v ; // derivee seconde a C2 en V.
80 curve2->D2(X,P2,T2,T2v);
82 Standard_Real NormT2 = T2.Magnitude();
83 Standard_Real Ax = NormT2*t1.X() - T2.X();
84 Standard_Real Ay = NormT2*t1.Y() - T2.Y();
86 F = (p1.X() - P2.X())*Ax + (p1.Y() - P2.Y())*Ay;
88 Standard_Real Scal = T2.Dot(T2v)/NormT2;
89 Standard_Real dAx = Scal*t1.X() - T2v.X();
90 Standard_Real dAy = Scal*t1.Y() - T2v.Y();
92 D = - T2.X()*Ax - T2.Y()*Ay + (p1.X() - P2.X())*dAx + (p1.Y() - P2.Y())*dAy;