0030448: Coding - add typo detection to derivation creation methods using Standard_NO...
[occt.git] / src / IntImpParGen / IntImpParGen_ImpParTool.gxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
15#include <gp_Vec2d.hxx>
16
17
18
19IntImpParGen_ImpParTool::IntImpParGen_ImpParTool(const ImpTool& ITool,
20 const ParCurve& PC):
21 TheImpTool(ITool)
22{
23 TheParCurve = (Standard_Address)(&PC);
24}
25
26
27Standard_Boolean IntImpParGen_ImpParTool::Value(const Standard_Real Param,
28 Standard_Real& ApproxDistance) {
29
30 ApproxDistance = TheImpTool.Distance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
31 return(Standard_True);
32}
33
34Standard_Boolean IntImpParGen_ImpParTool::Derivative(const Standard_Real Param,
35 Standard_Real& D_ApproxDistance_DV) {
36
37 gp_Pnt2d Pt;
38 gp_Vec2d TanParCurve;
39 gp_Vec2d Grad=TheImpTool.GradDistance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
40 ParTool::D1((*((ParCurve *)(TheParCurve))),Param,Pt,TanParCurve);
41 D_ApproxDistance_DV = Grad.Dot(TanParCurve);
42 return(Standard_True);
43}
44
45
46Standard_Boolean IntImpParGen_ImpParTool::Values(const Standard_Real Param,
47 Standard_Real& ApproxDistance,
48 Standard_Real& Deriv) {
49
50 this->Value(Param,ApproxDistance);
51 this->Derivative(Param,Deriv);
52 return(Standard_True);
53}
54
55
56