0026912: CLang 3.6.2 compiler warning [-Winconsistent-missing-override]
[occt.git] / src / Bisector / Bisector_FunctionInter.cxx
CommitLineData
b311480e 1// Created on: 1994-04-05
2// Created by: Yves FRICAUD
3// Copyright (c) 1994-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
42cf5bc1 17
7fd59977 18#include <Bisector_BisecCC.hxx>
19#include <Bisector_BisecPC.hxx>
42cf5bc1 20#include <Bisector_Curve.hxx>
21#include <Bisector_FunctionInter.hxx>
22#include <Geom2d_Curve.hxx>
23#include <gp.hxx>
7fd59977 24#include <gp_Pnt2d.hxx>
25#include <gp_Vec2d.hxx>
7fd59977 26#include <Precision.hxx>
27
28//=============================================================================
29//function :
30// purpose :
31//=============================================================================
32Bisector_FunctionInter::Bisector_FunctionInter ()
33{
34}
35
36//=============================================================================
37//function :
38// purpose :
39//=============================================================================
40Bisector_FunctionInter::Bisector_FunctionInter (const Handle(Geom2d_Curve)& C ,
41 const Handle(Bisector_Curve)& B1 ,
42 const Handle(Bisector_Curve)& B2 )
43{
44 curve = C;
45 bisector1 = B1;
46 bisector2 = B2;
47}
48
49//=============================================================================
50//function :
51// purpose :
52//=============================================================================
53void Bisector_FunctionInter::Perform (const Handle(Geom2d_Curve)& C ,
54 const Handle(Bisector_Curve)& B1 ,
55 const Handle(Bisector_Curve)& B2 )
56{
57 curve = C;
58 bisector1 = B1;
59 bisector2 = B2;
60}
61
62//=============================================================================
63// function : Value
64// purpose :
65///=============================================================================
66Standard_Boolean Bisector_FunctionInter::Value (const Standard_Real X,
67 Standard_Real& F)
68{
69 gp_Pnt2d PC = curve ->Value(X);
70 gp_Pnt2d PB1 = bisector1 ->Value(X);
71 gp_Pnt2d PB2 = bisector2 ->Value(X);
72
73 F = PC.Distance(PB1) - PC.Distance(PB2);
74
75 return Standard_True;
76}
77
78//=============================================================================
79//function : Derivative
80// purpose :
81//=============================================================================
82Standard_Boolean Bisector_FunctionInter::Derivative(const Standard_Real X,
83 Standard_Real& D)
84{
85 Standard_Real F;
86 return Values (X,F,D);
87}
88
89//=============================================================================
90//function : Values
91// purpose :
92//=============================================================================
93Standard_Boolean Bisector_FunctionInter::Values (const Standard_Real X,
94 Standard_Real& F,
95 Standard_Real& D)
96{
97 gp_Pnt2d PC, PB1, PB2;
98 gp_Vec2d TC, TB1, TB2;
99 Standard_Real F1, F2, DF1, DF2;
100
101 curve ->D1(X,PC ,TC);
102 bisector1 ->D1(X,PB1,TB1);
103 bisector2 ->D1(X,PB2,TB2);
104 F1 = PC.Distance(PB1);
105 F2 = PC.Distance(PB2);
106 F = F1 - F2;
107 if (Abs(F1) < gp::Resolution()) {
108 DF1 = Precision::Infinite();
109 }
110 else {
111 DF1 = ((PC.X() - PB1.X())*(TC.X() - TB1.X()) +
112 (PC.Y() - PB1.Y())*(TC.Y() - TB1.Y()) )/F1;
113 }
114 if (Abs(F2) < gp::Resolution()) {
115 DF2 = Precision::Infinite();
116 }
117 else {
118 DF2 = ((PC.X() - PB2.X())*(TC.X() - TB2.X()) +
119 (PC.Y() - PB2.Y())*(TC.Y() - TB2.Y()) )/F2;
120 }
121 D = DF1 - DF2;
122
123 return Standard_True;
124}
125