ROOT logo
// $Id: TabletStrokeList.h 2437 2010-08-15 11:06:50Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef Tmp1_TabletStrokeList_H
#define Tmp1_TabletStrokeList_H

#include <Glasses/ZNode.h>
#include <Stones/GTSIsoMakerFunctor.h>

#include <Stones/STabletPoint.h>

#include <TKDTree.h>

class TH1I;
class TH2I;

class TabletStrokeList : public ZNode,
			 public GTSIsoMakerFunctor
{
  MAC_RNR_FRIENDS(TabletStrokeList);

public:
  enum PotentialAlgorithm_e
  {
    PA_StrongestPoint,
    PA_TwoStrongestPoints,
    PA_LinearInterpolation,
    PA_CubicInterpolation
  };

private:
  void _init();

protected:
  struct CCoefs { STabletPoint A, B, C, D; };

  // Parameters for iso-triangulation
  PotentialAlgorithm_e mAlgorithm;     // X{GS} 7 PhonyEnum()
  Double_t             mWidth;         // X{GS} 7 Value(-range=>[  0,  1, 1, 1e6])
  Double_t             mPotentialExp;  // X{GS} 7 Value(-range=>[-10,  0, 1, 1e6])
  Double_t             mPressureAlpha; // X{GS} 7 Value(-range=>[  0, 10, 1, 1e6])
  Double_t             mMaxInterPoint; // X{GS} 7 Value(-range=>[  0, 1 , 1, 1e6])
  Bool_t               bMakeCubHistos; // X{GS} 7 Bool();

  // Internal KD-tree and stuff for fast point search.
  TKDTreeIF             *mKDTree;    //!
  vector<STabletPoint*>  mPointRefs; //!
  vector<Float_t>        mArrX;      //!
  vector<Float_t>        mArrY;      //!
  vector<CCoefs>         mCCoefs;    //!
  Double_t               mSearchRad; //!

  void calculate_qubic_coeffs(const vSTabletPoint_t& vec, Int_t i, CCoefs& c);

  void distance_derivatives(Float_t t, const HPointF& P, const CCoefs& c,
			    Float_t& d1, Float_t& d2);

  bool find_closest_points(Double_t x, Double_t y, Double_t z,
			   Int_t id[2], Double_t vm[2]);

  void get_linear_approx(Double_t x, Double_t y, Double_t z,
			 Int_t id[2], Double_t vm[2],
			 Double_t& value, STabletPoint* point=0);

  void get_cubic_approx (Double_t x, Double_t y, Double_t z,
			 Int_t id[2], Double_t vm[2],
			 Double_t& value, STabletPoint* point=0);

  void add_gradient(HPointD& g, Double_t x, Double_t y, Double_t z,
		    Double_t value, STabletPoint* point);

  TH1I *mHN;             //!
  TH2I *mHCubTimevsTime; //!
  TH2I *mHCubTimevsN;    //!
  TH1I *mHCubTime20;     //!
  TH1I *mHDeriv;         //!
  TH1I *mHDeriv20;       //!

public:
  TabletStrokeList(const Text_t* n="TabletStrokeList", const Text_t* t=0);
  virtual ~TabletStrokeList();

  void MakeKDStuff();  // X{E} 7 MButt(-join=>1)
  void ClearKDStuff(); // X{E} 7 MButt()

  void PrintClose(Float_t x, Float_t y, Float_t rad);

  // --- GTSIsoMakerFunctor ---
  virtual void     GTSIsoBegin(GTSIsoMaker* maker, Double_t iso_value);
  virtual Double_t GTSIsoFunc(Double_t x, Double_t y, Double_t z);
  virtual Double_t GTSIsoGradient(Double_t x, Double_t y, Double_t z, HPointD& g);
  virtual void     GTSIsoEnd();

#include "TabletStrokeList.h7"
  ClassDef(TabletStrokeList, 1);
}; // endclass TabletStrokeList

#endif
 TabletStrokeList.h:1
 TabletStrokeList.h:2
 TabletStrokeList.h:3
 TabletStrokeList.h:4
 TabletStrokeList.h:5
 TabletStrokeList.h:6
 TabletStrokeList.h:7
 TabletStrokeList.h:8
 TabletStrokeList.h:9
 TabletStrokeList.h:10
 TabletStrokeList.h:11
 TabletStrokeList.h:12
 TabletStrokeList.h:13
 TabletStrokeList.h:14
 TabletStrokeList.h:15
 TabletStrokeList.h:16
 TabletStrokeList.h:17
 TabletStrokeList.h:18
 TabletStrokeList.h:19
 TabletStrokeList.h:20
 TabletStrokeList.h:21
 TabletStrokeList.h:22
 TabletStrokeList.h:23
 TabletStrokeList.h:24
 TabletStrokeList.h:25
 TabletStrokeList.h:26
 TabletStrokeList.h:27
 TabletStrokeList.h:28
 TabletStrokeList.h:29
 TabletStrokeList.h:30
 TabletStrokeList.h:31
 TabletStrokeList.h:32
 TabletStrokeList.h:33
 TabletStrokeList.h:34
 TabletStrokeList.h:35
 TabletStrokeList.h:36
 TabletStrokeList.h:37
 TabletStrokeList.h:38
 TabletStrokeList.h:39
 TabletStrokeList.h:40
 TabletStrokeList.h:41
 TabletStrokeList.h:42
 TabletStrokeList.h:43
 TabletStrokeList.h:44
 TabletStrokeList.h:45
 TabletStrokeList.h:46
 TabletStrokeList.h:47
 TabletStrokeList.h:48
 TabletStrokeList.h:49
 TabletStrokeList.h:50
 TabletStrokeList.h:51
 TabletStrokeList.h:52
 TabletStrokeList.h:53
 TabletStrokeList.h:54
 TabletStrokeList.h:55
 TabletStrokeList.h:56
 TabletStrokeList.h:57
 TabletStrokeList.h:58
 TabletStrokeList.h:59
 TabletStrokeList.h:60
 TabletStrokeList.h:61
 TabletStrokeList.h:62
 TabletStrokeList.h:63
 TabletStrokeList.h:64
 TabletStrokeList.h:65
 TabletStrokeList.h:66
 TabletStrokeList.h:67
 TabletStrokeList.h:68
 TabletStrokeList.h:69
 TabletStrokeList.h:70
 TabletStrokeList.h:71
 TabletStrokeList.h:72
 TabletStrokeList.h:73
 TabletStrokeList.h:74
 TabletStrokeList.h:75
 TabletStrokeList.h:76
 TabletStrokeList.h:77
 TabletStrokeList.h:78
 TabletStrokeList.h:79
 TabletStrokeList.h:80
 TabletStrokeList.h:81
 TabletStrokeList.h:82
 TabletStrokeList.h:83
 TabletStrokeList.h:84
 TabletStrokeList.h:85
 TabletStrokeList.h:86
 TabletStrokeList.h:87
 TabletStrokeList.h:88
 TabletStrokeList.h:89
 TabletStrokeList.h:90
 TabletStrokeList.h:91
 TabletStrokeList.h:92
 TabletStrokeList.h:93
 TabletStrokeList.h:94
 TabletStrokeList.h:95
 TabletStrokeList.h:96
 TabletStrokeList.h:97
 TabletStrokeList.h:98
 TabletStrokeList.h:99
 TabletStrokeList.h:100
 TabletStrokeList.h:101