1 // Created on: 1994-09-06
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 <Geom2d_Curve.hxx>
19 #include <Geom2dLProp_Curve2dTool.hxx>
20 #include <Geom2dLProp_FuncCurExt.hxx>
22 #include <gp_Pnt2d.hxx>
23 #include <Precision.hxx>
25 //=============================================================================
28 //=============================================================================
29 Geom2dLProp_FuncCurExt::Geom2dLProp_FuncCurExt(const Handle(Geom2d_Curve)& C,
30 const Standard_Real Tol)
36 //=============================================================================
38 // purpose : KC = (V1^V2.Z) / ||V1||^3 avec V1 tangente etV2 derivee seconde.
40 //=============================================================================
41 Standard_Boolean Geom2dLProp_FuncCurExt::Value (const Standard_Real X,
47 Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
48 Standard_Real CPV1V2 = V1.Crossed(V2);
49 Standard_Real CPV1V3 = V1.Crossed(V3);
50 Standard_Real V1V2 = V1.Dot(V2);
51 Standard_Real V1V1 = V1.SquareMagnitude();
52 Standard_Real NV1 = Sqrt(V1V1);
53 Standard_Real V13 = V1V1*NV1;
54 Standard_Real V15 = V13*V1V1;
56 if (V15 < gp::Resolution()) {
57 return Standard_False;
59 F = CPV1V3/V13 - 3*CPV1V2*V1V2/V15;
64 //=============================================================================
65 //function : Derivative
67 //=============================================================================
68 Standard_Boolean Geom2dLProp_FuncCurExt::Derivative(const Standard_Real X,
72 return Values (X,F,D) ;
75 //=============================================================================
78 //=============================================================================
79 Standard_Boolean Geom2dLProp_FuncCurExt::Values (const Standard_Real X,
84 Standard_Real Dx= epsX/100.;
86 if (X+Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) {Dx = - Dx;}
96 //=============================================================================
98 // purpose : Teste si le parametere coorespond a un minimum du rayon de courbure
99 // par comparaison avec un point voisin.
100 //=============================================================================
101 Standard_Boolean Geom2dLProp_FuncCurExt::IsMinKC (const Standard_Real X) const
105 Standard_Real Dx= epsX;
108 Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
109 Standard_Real CPV1V2 = V1.Crossed(V2);
110 Standard_Real V1V1 = V1.SquareMagnitude();
111 Standard_Real NV1 = Sqrt(V1V1);
112 Standard_Real V13 = V1V1*NV1;
114 if (V13 < gp::Resolution()) {return Standard_False;}
118 if (X+Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) {Dx = - Dx;}
120 Geom2dLProp_Curve2dTool::D3(theCurve,X+Dx,P1,V1,V2,V3);
121 CPV1V2 = V1.Crossed(V2);
122 V1V1 = V1.SquareMagnitude();
126 if (V13 < gp::Resolution()) { return Standard_False;}
129 if (Abs(KC) > Abs(KP)) {return Standard_True ;}
130 else {return Standard_False;}