source: GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.h @ 863

Revision 863, 19.4 KB checked in by mattausch, 18 years ago (diff)

working on preprocessor integration
added iv stuff

RevLine 
[372]1// ================================================================
2// $Id$
3// ****************************************************************
4//
5// Initial coding by
6/**
7   @author Jiri Bittner
8*/
9
10#ifndef __VSSTREE_H__
11#define __VSSTREE_H__
12
13// Standard headers
14#include <iomanip>
15#include <vector>
16#include <functional>
17#include <stack>
18
19
20// User headers
21#include "VssRay.h"
22#include "AxisAlignedBox3.h"
[860]23#include "Statistics.h"
24#include "Ray.h"
[372]25
[860]26namespace GtpVisibilityPreprocessor {
[372]27
28#define USE_KDNODE_VECTORS 1
29#define _RSS_STATISTICS
30#define _RSS_TRAVERSAL_STATISTICS
31
32
33
34// --------------------------------------------------------------
35// Static statistics for kd-tree search
36// --------------------------------------------------------------
37class VssStatistics :
38  public StatisticsBase
39{
40public: 
41  // total number of nodes
42  int nodes;
43  // number of splits along each of the axes
44  int splits[7];
45  // totals number of rays
46  int rays;
[438]47  // initial size of the pvs
[382]48  int initialPvsSize;
[438]49  // total number of query domains
[372]50  int queryDomains;
51  // total number of ray references
52  int rayRefs;
[382]53
[438]54  // max depth nodes
[372]55  int maxDepthNodes;
56  // max depth nodes
[403]57  int minPvsNodes;
58  int minRaysNodes;
[438]59  // max ray contribution nodes
[382]60  int maxRayContribNodes;
[438]61  // max depth nodes
[382]62  int minSizeNodes;
[427]63  int maxCostRatioNodes;
64
[372]65  // max number of rays per node
66  int maxRayRefs;
67  // number of dynamically added ray refs
68  int addedRayRefs;
69  // number of dynamically removed ray refs
70  int removedRayRefs;
71 
72  // Constructor
73  VssStatistics() {
74    Reset();
75  }
76
77  int Nodes() const {return nodes;}
78  int Interior() const { return nodes/2; }
79  int Leaves() const { return (nodes/2) + 1; }
80
81  void Reset() {
82    nodes = 0;
83    for (int i=0; i<7; i++)
84      splits[i] = 0;
85    rays = queryDomains = 0;
[382]86    rayRefs = 0;
[372]87    maxDepthNodes = 0;
[403]88    minPvsNodes = 0;
89    minRaysNodes = 0;
[372]90    maxRayRefs = 0;
91    addedRayRefs = removedRayRefs = 0;
[438]92        initialPvsSize = 0;
93        maxRayContribNodes = 0;
94        minSizeNodes = 0;
95        maxCostRatioNodes = 0;
[372]96  }
97
98 
99  void
100  Print(ostream &app) const;
101
102  friend ostream &operator<<(ostream &s, const VssStatistics &stat) {
103    stat.Print(s);
104    return s;
105  }
106 
107};
108
109
110
111
112class VssTreeInterior;
113
114
115// --------------------------------------------------------------
116// KD-tree node - abstract class
117// --------------------------------------------------------------
118class VssTreeNode
119{
120public:
121
[427]122#define USE_FIXEDPOINT_T 0
[372]123
[438]124  struct RayInfo
125  {
[372]126        // pointer to the actual ray
127        VssRay *mRay;
128       
129        // endpoints  - do we need them?
130#if USE_FIXEDPOINT_T
131        short mMinT, mMaxT;
132#else
133        float mMinT, mMaxT;
134#endif
135       
136        RayInfo():mRay(NULL) {}
137       
138        RayInfo(VssRay *r):mRay(r), mMinT(0),
139#if USE_FIXEDPOINT_T
140#define FIXEDPOINT_ONE 0x7FFE
[438]141                                           //                     mMaxT(0xFFFF)
142                                           mMaxT(FIXEDPOINT_ONE)
[372]143#else
[438]144          mMaxT(1.0f)
[372]145#endif
146        {}
147       
148        RayInfo(VssRay *r,
[438]149                        const float _min,
150                        const float _max
151                        ):mRay(r) {
152          SetMinT(_min);
153          SetMaxT(_max);
[372]154        }
155       
156        RayInfo(VssRay *r,
[438]157                        const short _min,
158                        const float _max
159                        ):mRay(r), mMinT(_min) {
160          SetMaxT(_max);
[372]161        }
162       
163        RayInfo(VssRay *r,
[438]164                        const float _min,
165                        const short _max
166                        ):mRay(r), mMaxT(_max) {
167          SetMinT(_min);
[372]168        }
[427]169
170        enum {
[438]171          SOURCE_RAY = 0,
172          TERMINATION_RAY,
173          PASSING_RAY,
174          CONTAINED_RAY
[427]175        };
[372]176       
[427]177        int GetRayClass() const {
178               
[438]179          bool startsBefore = GetMinT() > 0.0f;
180          bool terminatesAfter = GetMaxT() < 1.0f;
[427]181               
[438]182          if (startsBefore && terminatesAfter)
183                return PASSING_RAY;
[427]184
[438]185          if (!startsBefore && !terminatesAfter)
186                return CONTAINED_RAY;
[427]187               
[438]188          if (!startsBefore)
189                return SOURCE_RAY;
[427]190               
[438]191          return TERMINATION_RAY;
[427]192        }
193       
[372]194        friend bool operator<(const RayInfo &a, const RayInfo &b) {
[438]195          return a.mRay < b.mRay;
[372]196        }
197 
198       
199        float ExtrapOrigin(const int axis) const {
[438]200          return mRay->GetOrigin(axis) + GetMinT()*mRay->GetDir(axis);
[372]201        }
202       
203        float ExtrapTermination(const int axis) const {
[438]204          return mRay->GetOrigin(axis) + GetMaxT()*mRay->GetDir(axis);
[372]205        }
[434]206
207        Vector3 Extrap(const float t) const {
[438]208          return mRay->Extrap(t);
[434]209        }
[372]210       
211#if USE_FIXEDPOINT_T
212        float GetMinT () const { return mMinT/(float)(FIXEDPOINT_ONE); }
213        float GetMaxT () const { return mMaxT/(float)(FIXEDPOINT_ONE); }
214       
215        void SetMinT (const float t) {
[438]216          mMinT = (short) (t*(float)(FIXEDPOINT_ONE));
[372]217        }
218       
219        void SetMaxT (const float t) {
[438]220          mMaxT = (short) (t*(float)(FIXEDPOINT_ONE));
221          mMaxT++;
222          //      if (mMaxT!=0xFFFF)
223          //    mMaxT++;
[372]224        }
225#else
226        float GetMinT () const { return mMinT; }
227        float GetMaxT () const { return mMaxT; }
228       
229        void SetMinT (const float t) { mMinT = t; }
230        void SetMaxT (const float t) { mMaxT = t; }
231#endif
[382]232
233
[438]234        int ComputeRayIntersection(const int axis,
235                                                           const float position,
236                                                           float &t
237                                                           ) const {
[382]238               
[446]239#if 1
[438]240          // intersect the ray with the plane
241          float denom = mRay->GetDir(axis);
[382]242   
[438]243          if (fabs(denom) < 1e-20)
244                //if (denom == 0.0f)
245                return (mRay->GetOrigin(axis) > position) ? 1 : -1;
[382]246   
[438]247          t = (position - mRay->GetOrigin(axis))/denom;
[382]248
[438]249          if (t < GetMinT())
250                return (denom > 0) ? 1 : -1;
[382]251
[438]252          if (t > GetMaxT())
253                return (denom > 0) ? -1 : 1;
[382]254
[438]255          return 0;
[446]256#else
257          // subbdivision based only on the origin
258          t = 0;
259          float rpos = mRay->GetOrigin(axis);
260          return (rpos < position) ? -1 : 1;
261
262#endif
[382]263        }
264
265
[438]266  };
[372]267
268
[438]269  typedef vector<RayInfo> RayInfoContainer;
[372]270       
271  enum { EInterior, ELeaf };
272
273  /////////////////////////////////
274  // The actual data goes here
275 
276  // link to the parent
277  VssTreeInterior *parent;
278
279  enum {SPLIT_X=0, SPLIT_Y, SPLIT_Z, SPLIT_DIRX, SPLIT_DIRY, SPLIT_DIRZ};
280 
281  // splitting axis
282  char axis;
283       
284  // depth
285  unsigned char depth;
286 
287  //  short depth;
288  //
289  /////////////////////////////////
290 
291  inline VssTreeNode(VssTreeInterior *p);
292
293 
294  virtual ~VssTreeNode() {};
295  virtual int Type() const  = 0;
296 
297
298  bool IsLeaf() const { return axis == -1; }
299 
300  virtual void Print(ostream &s) const = 0;
301
302  virtual int GetAccessTime() {
303    return 0x7FFFFFF;
304  }
305
306 
307       
308};
309
310// --------------------------------------------------------------
311// KD-tree node - interior node
312// --------------------------------------------------------------
313class VssTreeInterior :
314  public VssTreeNode
315{
316public:
317  // plane in local modelling coordinates
318  float position;
319
320  // pointers to children
321  VssTreeNode *back, *front;
322
323  // the bbox of the node
324  AxisAlignedBox3 bbox;
325
326  // the bbox of the node
327  AxisAlignedBox3 dirBBox;
328 
329  // data for caching
330  long accesses;
331  long lastAccessTime;
332 
333  VssTreeInterior(VssTreeInterior *p):VssTreeNode(p),
[438]334                                                                          back(NULL),
335                                                                          front(NULL),
336                                                                          accesses(0),
337                                                                          lastAccessTime(-1)
[372]338  { }
339
340  virtual int GetAccessTime() {
341    return lastAccessTime;
342  }
343
344  void SetupChildLinks(VssTreeNode *b, VssTreeNode *f) {
345    back = b;
346    front = f;
347    b->parent = f->parent = this;
348  }
349
350  void ReplaceChildLink(VssTreeNode *oldChild, VssTreeNode *newChild) {
351    if (back == oldChild)
352      back = newChild;
353    else
354      front = newChild;
355  }
356
357  virtual int Type() const  { return EInterior; }
358 
359  virtual ~VssTreeInterior() {
360    if (back)
361      delete back;
362    if (front)
363      delete front;
364  }
365 
366  virtual void Print(ostream &s) const {
367    if (axis == 0)
368      s<<"x ";
369    else
370      if (axis == 1)
[438]371                s<<"y ";
[372]372      else
[438]373                s<<"z ";
[372]374    s<<position<<" ";
375    back->Print(s);
376    front->Print(s);
377  }
378
379 
[382]380       
[372]381  int ComputeRayIntersection(const RayInfo &rayData,
[438]382                                                         float &t
383                                                         ) {
384        return rayData.ComputeRayIntersection(axis, position, t);
[372]385  }
386
387};
388
389
390// --------------------------------------------------------------
391// KD-tree node - leaf node
392// --------------------------------------------------------------
393class VssTreeLeaf :
394  public VssTreeNode
395{
[395]396private:
[438]397  int mPvsSize;
[372]398public:
399  static int mailID;
400  int mailbox;
401 
402  RayInfoContainer rays;
[438]403  int mPassingRays;
[434]404       
[438]405  bool mValidPvs;
406  float mEntropyImportance;
407 
[395]408       
[382]409  VssTreeLeaf(VssTreeInterior *p,
[438]410                          const int nRays
411                          ):VssTreeNode(p), rays(), mPvsSize(0), mPassingRays(0), mValidPvs(false) {
[382]412    rays.reserve(nRays);
[372]413  }
414 
415  virtual ~VssTreeLeaf() { }
416
417  virtual int Type() const  { return ELeaf; }
418
419  virtual void Print(ostream &s) const {
[444]420    s<<endl<<"L: r="<<(int)rays.size()<<endl;
[372]421  };
422 
423  void AddRay(const RayInfo &data) {
[438]424        mValidPvs = false;
[372]425    rays.push_back(data);
426    data.mRay->Ref();
[438]427        if (data.GetRayClass() == RayInfo::PASSING_RAY)
428          mPassingRays++;
[372]429  }
[395]430       
[438]431  int GetPvsSize() const {
432        return mPvsSize;
433  }
[372]434
[438]435  void SetPvsSize(const int s) {
436        mPvsSize = s;
437        mValidPvs = true;
438  }
[395]439
[438]440  void
441  UpdatePvsSize();
442
443  float
444  ComputePvsEntropy();
445 
446  float
447  ComputeRayLengthEntropy();
448 
449  float
450  ComputeRayTerminationEntropy();
451 
452  void
453  ComputeEntropyImportance();
454
[372]455  void Mail() { mailbox = mailID; }
456  static void NewMail() { mailID++; }
457  bool Mailed() const { return mailbox == mailID; }
458 
459  bool Mailed(const int mail) {
460    return mailbox >= mailID + mail;
461  }
462
[438]463  float GetAvgRayContribution() const {
464        return GetPvsSize()/((float)rays.size() + Limits::Small);
465  }
[403]466
[435]467  float GetImportance() const;
[438]468 
469  float GetSqrRayContribution() const {
470        return sqr(GetPvsSize()/((float)rays.size() + Limits::Small));
471  }
472 
473  // comparator for the
474  struct less_contribution : public
475  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
476       
477        bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
478          return a->GetAvgRayContribution() < b->GetAvgRayContribution();
[403]479        }
[438]480  };
481 
482  struct greater_contribution : public
483  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
[427]484       
[438]485        bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
486          return a->GetAvgRayContribution() > b->GetAvgRayContribution();
[427]487        }
[438]488  };
489 
490  friend bool GreaterContribution(const VssTreeLeaf * a, const VssTreeLeaf *b) {
491        return a->GetAvgRayContribution() > b->GetAvgRayContribution();
492  }
493 
[372]494};
495
496// Inline functions
497inline
498VssTreeNode::VssTreeNode(VssTreeInterior *p):
499  parent(p), axis(-1), depth(p ? p->depth + 1 : 0) {}
500
501
502
503// ---------------------------------------------------------------
504// Main LSDS search class
505// ---------------------------------------------------------------
506class VssTree
507{
508  struct TraversalData
509  { 
510    VssTreeNode *node;
511    AxisAlignedBox3 bbox;
512    int depth;
513    float priority;
514   
515    TraversalData() {}
516
517    TraversalData(VssTreeNode *n, const float p):
518      node(n), priority(p)
519    {}
520
521    TraversalData(VssTreeNode *n,
[438]522                                  const AxisAlignedBox3 &b,
523                                  const int d):
[372]524      node(n), bbox(b), depth(d) {}
525   
526               
527    // comparator for the
528    struct less_priority : public
529    binary_function<const TraversalData, const TraversalData, bool> {
530                       
531      bool operator()(const TraversalData a, const TraversalData b) {
[438]532                return a.priority < b.priority;
[372]533      }
534     
535    };
536
537    //    ~TraversalData() {}
538    //    TraversalData(const TraversalData &s):node(s.node), bbox(s.bbox), depth(s.depth) {}
539   
540    friend bool operator<(const TraversalData &a,
[438]541                                                  const TraversalData &b) {
[372]542      //      return a.node->queries.size() < b.node->queries.size();
543      VssTreeLeaf *leafa = (VssTreeLeaf *) a.node;
544      VssTreeLeaf *leafb = (VssTreeLeaf *) b.node;
[386]545#if 0
[438]546          return
547                leafa->rays.size()*a.bbox.GetVolume()
548                <
549                leafb->rays.size()*b.bbox.GetVolume();
[386]550#endif
[434]551#if 0
[438]552          return
553                leafa->GetPvsSize()*a.bbox.GetVolume()
554                <
555                leafb->GetPvsSize()*b.bbox.GetVolume();
[386]556#endif
557#if 0
[438]558          return
559                leafa->GetPvsSize()
560                <
561                leafb->GetPvsSize();
[386]562#endif
[387]563#if 0
[438]564          return
565                leafa->GetPvsSize()/(leafa->rays.size()+1)
566                >
567                leafb->GetPvsSize()/(leafb->rays.size()+1);
[386]568#endif
[434]569#if 1
[438]570          return
571                leafa->GetPvsSize()*leafa->rays.size()
572                <
573                leafb->GetPvsSize()*leafb->rays.size();
[386]574#endif
[372]575    }
576  };
577 
578  // simplified data for ray traversal only...
579
580  struct RayTraversalData {
581   
582    VssTreeNode::RayInfo rayData;
583    VssTreeNode *node;
584   
585    RayTraversalData() {}
586    RayTraversalData(VssTreeNode *n,
[438]587                                         const VssTreeNode::RayInfo &data):
[372]588      rayData(data), node(n) {}
589  };
590       
591public:
592  /////////////////////////////
593  // The core pointer
594  VssTreeNode *root;
595 
596  /////////////////////////////
597  // Basic properties
598
599  // total number of nodes of the tree
600  int nodes;
601  // axis aligned bounding box of the scene
602  AxisAlignedBox3 bbox;
603
604  // axis aligned bounding box of directions
605  AxisAlignedBox3 dirBBox;
606 
607  /////////////////////////////
608  // Construction parameters
609
610  // epsilon used for the construction
611  float epsilon;
612
613  // ratio between traversal and intersection costs
614  float ct_div_ci;
615  // max depth of the tree
616  int termMaxDepth;
617  // minimal ratio of the volume of the cell and the query volume
618  float termMinSize;
619
[438]620  // minimal pvs per node to still get subdivided
[382]621  int termMinPvs;
622
[438]623  // minimal ray number per node to still get subdivided
[403]624  int termMinRays;
625       
[382]626  // maximal cost ration to subdivide a node
627  float termMaxCostRatio;
628       
[438]629  // maximal contribution per ray to subdivide the node
630  float termMaxRayContribution;
[382]631
632       
[372]633  // randomized construction
634  bool randomize;
[438]635 
[372]636  // type of the splitting to use fo rthe tree construction
[434]637  enum {ESplitRegular, ESplitHeuristic, ESplitHybrid };
[372]638  int splitType;
[434]639
[438]640  bool mSplitUseOnlyDrivingAxis;
641 
642  // use ray space subdivision instead of view space subdivision
643  bool mUseRss;
[434]644
[438]645  // interleave directional and spatial splits based on their costs
646  // if false directional splits are only performed after spatial splits
647  bool mInterleaveDirSplits;
648
649  // depth at which directional splits are performed if mInterleaveDirSplits is false
650  int mDirSplitDepth;
651 
[372]652  // maximal size of the box on which the refdir splitting can be performed
653  // (relative to the scene bbox
654  float refDirBoxMaxSize;
655 
656  // maximum alovable memory in MB
657  float maxTotalMemory;
658
659  // maximum alovable memory for static kd tree in MB
660  float maxStaticMemory;
661
662  // this is used during the construction depending
663  // on the type of the tree and queries...
664  float maxMemory;
665
666
667  // minimal acess time for collapse
668  int accessTimeThreshold;
669
[438]670  // minimal depth at which to perform collapse
[372]671  int minCollapseDepth;
672
673 
674  // reusable array of split candidates
[382]675  vector<SortableEntry> *splitCandidates;
[372]676  /////////////////////////////
677
[438]678  VssStatistics stat;
[372]679       
680 
681  VssTree();
682  virtual ~VssTree();
683
684  virtual void
685  Construct(
[438]686                        VssRayContainer &rays,
687                        AxisAlignedBox3 *forcedBoundingBox = NULL
688                        );
[372]689       
690  // incemental construction
691  virtual void UpdateRays(VssRayContainer &remove,
[438]692                                                  VssRayContainer &add
693                                                  );
[401]694
[438]695  virtual void AddRays(
696                                           VssRayContainer &add
697                                           )
698  {
699        VssRayContainer remove;
700        UpdateRays(remove, add);
701  }
[401]702
[372]703 
704       
705  VssTreeNode *
706  Locate(const Vector3 &v);
707       
708  VssTreeNode *
709  SubdivideNode(VssTreeLeaf *leaf,
[438]710                                const AxisAlignedBox3 &box,
711                                AxisAlignedBox3 &backBox,
712                                AxisAlignedBox3 &frontBox
713                                );
[372]714       
715  VssTreeNode *
716  Subdivide(const TraversalData &tdata);
717       
718  int
719  SelectPlane(VssTreeLeaf *leaf,
[438]720                          const AxisAlignedBox3 &box,
721                          float &position,
722                          int &raysBack,
723                          int &raysFront,
724                          int &pvsBack,
725                          int &pvsFront
726                          );
[372]727
728  void
729  SortSplitCandidates(
[438]730                                          VssTreeLeaf *node,
731                                          const int axis
732                                          );
[372]733       
734 
735  // return memory usage in MB
736  float GetMemUsage() const {
737    return
738      (sizeof(VssTree) +
739       stat.Leaves()*sizeof(VssTreeLeaf) +
740       stat.Interior()*sizeof(VssTreeInterior) +
741       stat.rayRefs*sizeof(VssTreeNode::RayInfo))/(1024.0f*1024.0f);
742  }
743       
744  float GetRayMemUsage() const {
745    return
746      stat.rays*(sizeof(VssRay))/(1024.0f*1024.0f);
747  }
748 
[386]749
[438]750  float
751  BestCostRatio(
752                                VssTreeLeaf *node,
753                                int &axis,
754                                float &position,
755                                int &raysBack,
756                                int &raysFront,
757                                int &pvsBack,
758                                int &pvsFront
759                                );
[382]760       
[438]761  float
762  EvalCostRatio(
763                                VssTreeLeaf *node,
764                                const int axis,
765                                const float position,
766                                int &raysBack,
767                                int &raysFront,
768                                int &pvsBack,
769                                int &pvsFront
770                                );
[372]771
[438]772  float
773  EvalCostRatioHeuristic(
774                                                 VssTreeLeaf *node,
775                                                 const int axis,
776                                                 float &position,
777                                                 int &raysBack,
778                                                 int &raysFront,
779                                                 int &pvsBack,
780                                                 int &pvsFront
781                                                 );
[434]782
[438]783  float
784  GetCostRatio(
785                           VssTreeLeaf *leaf,
786                           const int axis,
787                           const float position,
788                           const int raysBack,
789                           const int raysFront,
790                           const int pvsBack,
791                           const int pvsFront
792                           );
[434]793
794  AxisAlignedBox3 GetBBox(const VssTreeNode *node) const {
[372]795    if (node->parent == NULL)
796      return bbox;
797
798    if (!node->IsLeaf())
799      return ((VssTreeInterior *)node)->bbox;
800
801    if (node->parent->axis >= 3)
802      return node->parent->bbox;
803     
804    AxisAlignedBox3 box(node->parent->bbox);
805    if (node->parent->front == node)
806      box.SetMin(node->parent->axis, node->parent->position);
807    else
808      box.SetMax(node->parent->axis, node->parent->position);
809    return box;
810  }
811
[434]812  AxisAlignedBox3 GetDirBBox(const VssTreeNode *node) const {
[372]813
814    if (node->parent == NULL)
815      return dirBBox;
816   
817    if (!node->IsLeaf() )
818      return ((VssTreeInterior *)node)->dirBBox;
819
820    if (node->parent->axis < 3)
821      return node->parent->dirBBox;
822   
823    AxisAlignedBox3 dBBox(node->parent->dirBBox);
824
825    if (node->parent->front == node)
826      dBBox.SetMin(node->parent->axis - 3, node->parent->position);
827    else
828      dBBox.SetMax(node->parent->axis - 3, node->parent->position);
829    return dBBox;
830  }
831 
832  int
833  ReleaseMemory(const int time);
834
835  int
836  CollapseSubtree(VssTreeNode *node, const int time);
837
838  void
839  CountAccess(VssTreeInterior *node, const long time) {
840    node->accesses++;
841    node->lastAccessTime = time;
842  }
843
844  VssTreeNode *
845  SubdivideLeaf(
[438]846                                VssTreeLeaf *leaf
847                                );
[372]848
849  void
850  RemoveRay(VssRay *ray,
[438]851                        vector<VssTreeLeaf *> *affectedLeaves,
852                        const bool removeAllScheduledRays
853                        );
[372]854
[438]855  //  void
856  //  AddRay(VssRay *ray);
[372]857  void
[438]858  AddRay(VssTreeNode::RayInfo &info);
859 
860  void
[372]861  TraverseInternalNode(
[438]862                                           RayTraversalData &data,
863                                           stack<RayTraversalData> &tstack);
[372]864
[438]865  void
[372]866  EvaluateLeafStats(const TraversalData &data);
867
[382]868
[438]869  int
870  GetRootPvsSize() const {
871        return GetPvsSize(bbox);
872  }
873 
874  int
875  GetPvsSize(const AxisAlignedBox3 &box) const;
[401]876
[438]877  void
878  GetRayContributionStatistics(
879                                                           float &minRayContribution,
880                                                           float &maxRayContribution,
881                                                           float &avgRayContribution
882                                                           );
[401]883
[438]884  int
885  GenerateRays(const float ratioPerLeaf,
886                           SimpleRayContainer &rays);
[401]887
[438]888  int
889  GenerateRays(const int numberOfRays,
890                           const int numberOfLeaves,
891                           SimpleRayContainer &rays);
[427]892               
[438]893  float
894  GetAvgPvsSize();
[401]895
[438]896  int
897  UpdateSubdivision();
[427]898
[438]899  bool
900  TerminationCriteriaSatisfied(VssTreeLeaf *leaf);
[427]901
[438]902  void
903  CollectLeaves(vector<VssTreeLeaf *> &leaves);
[427]904
[438]905  bool
906  ClipRay(
907                  VssTreeNode::RayInfo &rayInfo,
908                  const AxisAlignedBox3 &box
909                  );
[427]910
[438]911  VssTreeNode *GetRoot() const { return root; }
[434]912
[438]913  bool
914  ValidLeaf(VssTreeLeaf *leaf) const;
[434]915
[438]916  void
917  GenerateLeafRays(VssTreeLeaf *leaf,
918                                   const int numberOfRays,
919                                   SimpleRayContainer &rays);
[434]920
[466]921  int
922  CollectRays(VssRayContainer &rays,
923                          const int number);
[434]924
[466]925  int
[863]926  CollectRays(VssRayContainer &rays);
[466]927 
[372]928};
929
[863]930};
[372]931
932#endif // __LSDS_KDTREE_H__
933
Note: See TracBrowser for help on using the repository browser.