Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Kdtree_d< Traits >::Node Class Reference
Collaboration diagram for Kdtree_d< Traits >::Node:

Classes

class  Plane
 

Public Types

enum  { LEFT, RIGHT }
 
typedef
std::back_insert_iterator
< List_points
back_iter
 

Public Member Functions

const Planeget_hs (int side) const
 
bool is_points_in_hs (const Plane &pl) const
 
bool is_valid () const
 
void dump (int depth)
 
bool is_point () const
 
 Node ()
 
 ~Node ()
 
void copy_subtree_points (back_iter &result, const Box &rect)
 
void search (std::back_insert_iterator< List_points > result, const Box &rect, Box &region)
 

Static Public Member Functions

static void search_recursive (back_iter &result, Node *node, const Box &rect, Box &_region, Plane &plane, bool f_split_plus)
 

Public Attributes

Plane plane
 
Pointpnt
 
Nodeleft
 
Noderight
 

Detailed Description

template<class Traits>
class Kdtree_d< Traits >::Node

Definition at line 558 of file kdtree_d.h.

Member Typedef Documentation

typedef std::back_insert_iterator<List_points> back_iter

Definition at line 697 of file kdtree_d.h.

Member Enumeration Documentation

anonymous enum
Enumerator
LEFT 
RIGHT 

Definition at line 629 of file kdtree_d.h.

Constructor & Destructor Documentation

Node ( )
inline

Definition at line 699 of file kdtree_d.h.

699  : plane(), pnt(NULL), left(NULL), right(NULL)
700  {}
Point * pnt
Definition: kdtree_d.h:625
Node * right
Definition: kdtree_d.h:627
Node * left
Definition: kdtree_d.h:627
~Node ( )
inline

Definition at line 702 of file kdtree_d.h.

703  {}

Member Function Documentation

void copy_subtree_points ( back_iter result,
const Box rect 
)
inline

Definition at line 705 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::copy_subtree_points(), Kdtree_d< Traits >::Box::is_in(), Kdtree_d< Traits >::Node::is_point(), Kdtree_d< Traits >::Node::left, Kdtree_d< Traits >::Node::pnt, and Kdtree_d< Traits >::Node::right.

Referenced by Kdtree_d< Traits >::Node::copy_subtree_points(), and Kdtree_d< Traits >::Node::search_recursive().

707  {
708  if ( is_point() ) {
709  if ( rect.is_in( *pnt ) )
710  (*result++) = *pnt;
711  return;
712  }
713  if ( left != NULL )
714  left->copy_subtree_points( result, rect );
715  if ( right != NULL )
716  right->copy_subtree_points( result, rect );
717  }
Point * pnt
Definition: kdtree_d.h:625
bool is_point() const
Definition: kdtree_d.h:692
Node * right
Definition: kdtree_d.h:627
Point object that represents a single point.
Definition: datatypedef.h:68
Node * left
Definition: kdtree_d.h:627
void copy_subtree_points(back_iter &result, const Box &rect)
Definition: kdtree_d.h:705

Here is the call graph for this function:

Here is the caller graph for this function:

void dump ( int  depth)
inline

Definition at line 670 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::Plane::dump(), Kdtree_d< Traits >::Node::dump(), Kdtree_d< Traits >::Node::is_point(), Kdtree_d< Traits >::Node::left, Kdtree_d< Traits >::Node::plane, and Kdtree_d< Traits >::Node::right.

Referenced by Kdtree_d< Traits >::Node::dump(), and Kdtree_d< Traits >::dump().

671  {
672  int ind;
673 
674  for ( ind = 0; ind < depth; ind++ )
675  std::cout << " ";
676 
677  if ( is_point() ) {
678  std::cout << *pnt << "\n";
679  return;
680  }
681 
682  plane.dump();
683  std::cout << "\n";
684  left->dump( depth + 1 );
685  for ( ind = 0; ind < depth; ind++ )
686  std::cout << " ";
687 
688  std::cout << "!!!!!!!!!!!!\n";
689  right->dump( depth + 1 );
690  }
bool is_point() const
Definition: kdtree_d.h:692
Node * right
Definition: kdtree_d.h:627
Point object that represents a single point.
Definition: datatypedef.h:68
void dump(int depth)
Definition: kdtree_d.h:670
Node * left
Definition: kdtree_d.h:627

Here is the call graph for this function:

Here is the caller graph for this function:

const Plane& get_hs ( int  side) const
inline

Definition at line 631 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::LEFT, Kdtree_d< Traits >::Node::Plane::orient_half_space(), and Kdtree_d< Traits >::Node::plane.

Referenced by Kdtree_d< Traits >::Node::is_valid().

632  {
633 
634  ((Plane *)&plane)->orient_half_space( side == LEFT );
635 
636  return plane;
637  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_point ( ) const
inline
bool is_points_in_hs ( const Plane pl) const
inline

Definition at line 640 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::Plane::is_in(), Kdtree_d< Traits >::Node::is_point(), Kdtree_d< Traits >::Node::is_points_in_hs(), Kdtree_d< Traits >::Node::left, and Kdtree_d< Traits >::Node::right.

Referenced by Kdtree_d< Traits >::Node::is_points_in_hs(), and Kdtree_d< Traits >::Node::is_valid().

641  {
642  if ( is_point() )
643  return pl.is_in( *pnt );
644 
645  if ( left != NULL && ( ! left->is_points_in_hs( pl ) ) )
646  return false;
647  if ( right != NULL && ( ! right->is_points_in_hs( pl ) ) )
648  return false;
649 
650  return true;
651  }
bool is_point() const
Definition: kdtree_d.h:692
Node * right
Definition: kdtree_d.h:627
Point object that represents a single point.
Definition: datatypedef.h:68
Node * left
Definition: kdtree_d.h:627
bool is_points_in_hs(const Plane &pl) const
Definition: kdtree_d.h:640

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_valid ( ) const
inline

Definition at line 654 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::get_hs(), Kdtree_d< Traits >::Node::is_point(), Kdtree_d< Traits >::Node::is_points_in_hs(), Kdtree_d< Traits >::Node::left, Kdtree_d< Traits >::Node::LEFT, Kdtree_d< Traits >::Node::right, and Kdtree_d< Traits >::Node::RIGHT.

Referenced by Kdtree_d< Traits >::is_valid().

655  {
656  if ( is_point() )
657  return true;
658 
659  if ( left != NULL )
660  if ( ! left->is_points_in_hs( get_hs( LEFT ) ) )
661  return false;
662  if ( right != NULL )
663  if ( ! right->is_points_in_hs( get_hs( RIGHT ) ) )
664  return false;
665 
666  return true;
667  }
bool is_point() const
Definition: kdtree_d.h:692
Node * right
Definition: kdtree_d.h:627
Node * left
Definition: kdtree_d.h:627
bool is_points_in_hs(const Plane &pl) const
Definition: kdtree_d.h:640
const Plane & get_hs(int side) const
Definition: kdtree_d.h:631

Here is the call graph for this function:

Here is the caller graph for this function:

void search ( std::back_insert_iterator< List_points result,
const Box rect,
Box region 
)
inline

Definition at line 762 of file kdtree_d.h.

References Kdtree_d< Traits >::Box::is_in(), Kdtree_d< Traits >::Node::is_point(), Kdtree_d< Traits >::Node::left, Kdtree_d< Traits >::Node::plane, Kdtree_d< Traits >::Node::pnt, Kdtree_d< Traits >::Node::right, and Kdtree_d< Traits >::Node::search_recursive().

Referenced by Kdtree_d< Traits >::search(), and Kdtree_d< Traits >::Node::search_recursive().

764  {
765  if (is_point()) {
766  if ( rect.is_in( *pnt ) )
767  (*result++) = *pnt;
768  return;
769  }
770 
771  //this is not a point so it is a hypeplane
772  if ( left != NULL )
773  search_recursive( result, left, rect,
774  region, plane, true );
775  if ( right != NULL )
776  search_recursive( result, right, rect,
777  region, plane, false );
778  }
Point * pnt
Definition: kdtree_d.h:625
bool is_point() const
Definition: kdtree_d.h:692
Node * right
Definition: kdtree_d.h:627
Point object that represents a single point.
Definition: datatypedef.h:68
Node * left
Definition: kdtree_d.h:627
static void search_recursive(back_iter &result, Node *node, const Box &rect, Box &_region, Plane &plane, bool f_split_plus)
Definition: kdtree_d.h:719

Here is the call graph for this function:

Here is the caller graph for this function:

static void search_recursive ( back_iter result,
Node node,
const Box rect,
Box _region,
Plane plane,
bool  f_split_plus 
)
inlinestatic

Definition at line 719 of file kdtree_d.h.

References Kdtree_d< Traits >::Node::copy_subtree_points(), Kdtree_d< Traits >::Node::Plane::get_coord(), Kdtree_d< Traits >::Box::is_in(), Kdtree_d< Traits >::Box::is_intersect_in_dim_closed(), Kdtree_d< Traits >::Node::search(), and Kdtree_d< Traits >::Node::Plane::split().

Referenced by Kdtree_d< Traits >::Node::search().

725  {
726  //printf( "search_recusrive\n" );
727  Box * p_r = new Box( _region );
728 
729  //printf( "z" );
730  //fflush( stdout );
731 
732  plane.split( *p_r, f_split_plus );
733 
734  //printf( "c" );
735  //fflush( stdout );
736  assert( node != NULL );
737 
738  //printf( "b" );
739  //fflush( stdout );
740  if ( rect.is_in( *p_r ) )
741  {
742  //printf( "5" );
743  //fflush( stdout );
744  node->copy_subtree_points( result, rect );
745  //printf( "\tsearch_recursive done...\n" );
746  //printf( "6" );
747  //fflush( stdout );
748  delete p_r;
749  return;
750  }
751 
752  //printf( "v" );
753  //fflush( stdout );
754 
755  if ( rect.is_intersect_in_dim_closed( plane.get_coord(), *p_r ) )
756  node->search( result, rect, *p_r );
757  //printf( "x" );
758  //fflush( stdout );
759  delete p_r;
760  }
int get_coord() const
Definition: kdtree_d.h:617
void split(Box &region, bool f_neg)
Definition: kdtree_d.h:600

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following file: