PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusImplicitSplineForce.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) John SH Baxter, Robarts Research Institute. All rights reserved.
4 See License.txt for details.
5 =========================================================================*/
6 
7 #ifndef __vtkPlusImplicitSplineForce_h
8 #define __vtkPlusImplicitSplineForce_h
9 
10 #include "PlusConfigure.h"
11 #include "vtkPlusHapticsExport.h"
12 
13 #include "vtkPlusForceFeedback.h"
14 
15 class vtkMatrix4x4;
16 
17 #define DIM_BASE 20
18 #define NUM_INTERVALU_S DIM_BASE+10
19 #define NUM_INTERVALV_S DIM_BASE
20 #define NUM_INTERVALW_S DIM_BASE+25
21 #define DimCPoint_U NUM_INTERVALU_S+3
22 #define DimCPoint_V NUM_INTERVALV_S+3
23 #define DimCPoint_W NUM_INTERVALW_S+3
24 #define DimKnot_U DimCPoint_U+2
25 #define DimKnot_V DimCPoint_V+2
26 #define DimKnot_W DimCPoint_W+2
27 
28 class vtkPlusHapticsExport vtkPlusImplicitSplineForce : public vtkPlusForceFeedback
29 {
30 public:
33  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
34 
35  void SetInput(int splineId);
36  void SetInput(char * controlPnt);
37  int GenerateForce(vtkMatrix4x4 * transformMatrix, double force[3]);
38  int SetGamma(double gamma);
39 
40 protected:
42  virtual ~vtkPlusImplicitSplineForce();
43 
44  int fnGaussValueDeriv(double a, double x, double& value, double& deriv);
45  int fnSigmoidValueDeriv(double a, double x, double& value, double& deriv);
46  int CalculateDistanceDerivativeBasis(double x, double y, double z, int n, int direction, double *gradient);
47  double BasisFunction3(int k, double *knot, double u, int K);
48  double BasisFunction3DerivativeD(int k, double *knot, double u, int K);
49  double CalculateDistanceBasis(double x, double y, double z, int n, int direction);
50  int CalculateKnotIu(double u, double *knot, int K, int n);
51  int ReadFile3DBSplineKnots(const std::string& fname);
52  int ReadFileControlPoints(const std::string& fname);
53 
54  double controlQ3D[DimCPoint_W][DimCPoint_V][DimCPoint_U];
55  double knot1[NUM_INTERVALU_S+1];
56  double knot2[NUM_INTERVALV_S+1];
57  double knot3[NUM_INTERVALW_S+1];
58 
59  double knot1b[DimKnot_U];
60  double knot2b[DimKnot_V];
61  double knot3b[DimKnot_W];
62 
63  double gammaSigmoid;
64  double scaleForce;
65  std::string SplineKnots;
66  std::string ControlPoints;
67 };
68 
69 #endif
#define DimKnot_V
#define NUM_INTERVALV_S
#define DimKnot_U
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define DimCPoint_U
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
#define DimKnot_W
#define DimCPoint_W
static vtkPlusForceFeedback * New()
#define DimCPoint_V
#define NUM_INTERVALU_S
int x
Definition: phidget22.h:4265
const char const char * value
Definition: phidget22.h:5111
Direction vectors of rods y
Definition: algo3.m:15
#define NUM_INTERVALW_S
virtual int GenerateForce(vtkMatrix4x4 *hapticPosition, double force[3])