1 // Created on: 1994-04-05
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 #include <Bisector_FunctionH.ixx>
24 #include <Geom2d_Curve.hxx>
26 //=============================================================================
29 //=============================================================================
30 Bisector_FunctionH::Bisector_FunctionH (const Handle(Geom2d_Curve)& C2,
39 //=============================================================================
42 // F = P1P2.(||T2||T1 + T2)
43 //=============================================================================
44 Standard_Boolean Bisector_FunctionH::Value (const Standard_Real X,
47 gp_Pnt2d P2 ; // point sur C2.
48 gp_Vec2d T2 ; // tangente a C2 en V.
51 Standard_Real NormT2 = T2.Magnitude();
52 Standard_Real Ax = NormT2*t1.X() - T2.X();
53 Standard_Real Ay = NormT2*t1.Y() - T2.Y();
55 F = (p1.X() - P2.X())*Ax + (p1.Y() - P2.Y())*Ay;
60 //=============================================================================
61 //function : Derivative
63 //=============================================================================
64 Standard_Boolean Bisector_FunctionH::Derivative(const Standard_Real X,
68 return Values (X,F,D);
71 //=============================================================================
74 //=============================================================================
75 Standard_Boolean Bisector_FunctionH::Values (const Standard_Real X,
79 gp_Pnt2d P2 ; // point sur C2.
80 gp_Vec2d T2 ; // tangente a C2 en V.
81 gp_Vec2d T2v ; // derivee seconde a C2 en V.
83 curve2->D2(X,P2,T2,T2v);
85 Standard_Real NormT2 = T2.Magnitude();
86 Standard_Real Ax = NormT2*t1.X() - T2.X();
87 Standard_Real Ay = NormT2*t1.Y() - T2.Y();
89 F = (p1.X() - P2.X())*Ax + (p1.Y() - P2.Y())*Ay;
91 Standard_Real Scal = T2.Dot(T2v)/NormT2;
92 Standard_Real dAx = Scal*t1.X() - T2v.X();
93 Standard_Real dAy = Scal*t1.Y() - T2v.Y();
95 D = - T2.X()*Ax - T2.Y()*Ay + (p1.X() - P2.X())*dAx + (p1.Y() - P2.Y())*dAy;