Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IntImpParGen / IntImpParGen_ImpParTool.gxx
1
2 #include <gp_Vec2d.hxx>
3
4
5
6 IntImpParGen_ImpParTool::IntImpParGen_ImpParTool(const ImpTool& ITool,
7                                                  const ParCurve& PC):
8          TheImpTool(ITool) 
9 {  
10   TheParCurve = (Standard_Address)(&PC);
11 }
12
13
14 Standard_Boolean IntImpParGen_ImpParTool::Value(const Standard_Real Param,
15                                    Standard_Real& ApproxDistance) {
16   
17   ApproxDistance = TheImpTool.Distance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
18   return(Standard_True);
19 }
20
21 Standard_Boolean IntImpParGen_ImpParTool::Derivative(const Standard_Real Param,
22                                         Standard_Real& D_ApproxDistance_DV) {
23   
24   gp_Pnt2d Pt;
25   gp_Vec2d TanParCurve;
26   gp_Vec2d Grad=TheImpTool.GradDistance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
27   ParTool::D1((*((ParCurve *)(TheParCurve))),Param,Pt,TanParCurve);
28   D_ApproxDistance_DV = Grad.Dot(TanParCurve);
29   return(Standard_True);
30 }
31
32
33 Standard_Boolean IntImpParGen_ImpParTool::Values(const Standard_Real Param,
34                                     Standard_Real& ApproxDistance,
35                                     Standard_Real& Deriv) {
36   
37   this->Value(Param,ApproxDistance);
38   this->Derivative(Param,Deriv);
39   return(Standard_True);
40 }
41
42
43