1 // Created on: 1994-09-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.
17 #include <Geom2dLProp_FuncCurNul.ixx>
19 #include <gp_Pnt2d.hxx>
20 #include <Geom2dLProp_Curve2dTool.hxx>
23 #include <Precision.hxx>
25 //=============================================================================
28 //=============================================================================
29 Geom2dLProp_FuncCurNul::Geom2dLProp_FuncCurNul(const Handle(Geom2d_Curve)& C)
34 //=============================================================================
36 // purpose : F = (V1^V2.Z)/||V1||*||V2||
37 //=============================================================================
38 Standard_Boolean Geom2dLProp_FuncCurNul::Value (const Standard_Real X,
45 //=============================================================================
46 //function : Derivative
48 //=============================================================================
49 Standard_Boolean Geom2dLProp_FuncCurNul::Derivative(const Standard_Real X,
56 //=============================================================================
58 // purpose : F = (V1^V2.Z)/||V1||*||V2||
59 //=============================================================================
60 Standard_Boolean Geom2dLProp_FuncCurNul::Values (const Standard_Real X,
66 Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
67 Standard_Real CP1 = V1.Crossed(V2);
68 Standard_Real CP2 = V1.Crossed(V3);
69 Standard_Real V1V2 = V1.Dot(V2);
70 Standard_Real V2V3 = V2.Dot(V3);
71 Standard_Real NV1 = V1.Magnitude();
72 Standard_Real NV2 = V2.Magnitude();
78 if (Abs(CP1) < 1.e-4) {
84 } else if (NV1*NV2 < gp::Resolution()) {
85 return Standard_False;
88 D = (CP2 - CP1*V1V2/(NV1*NV1) - CP1*V2V3/(NV2*NV2))/(NV1*NV2);