cgma
KDDTreeNode< Y > Class Template Reference

#include <KDDTreeNode.hpp>

List of all members.

Public Member Functions

 KDDTreeNode (Y aData, DIMENSION aDisc=DIMX)
 ~KDDTreeNode ()
KDDTreeNode< Y > * get_child (DIRECTION dir) const
void set_child (KDDTreeNode< Y > *node, DIRECTION dir)
double get_dist () const
void set_dist (double dist)
DISTDATA get_dist_data () const
void set_dist_data (DISTDATA distData)
DIMENSION get_disc () const
void set_disc (DIMENSION dim)
DIMENSION next_disc () const
DIRECTION compare (KDDTreeNode< Y > *Q) const
DIRECTION compare_with_equality (KDDTreeNode< Y > *Q) const

Public Attributes

KDDTreeNode< Y > * parent
KDDTreeNode< Y > * left
KDDTreeNode< Y > * right
double x
double y
double z
Y data
CubitBoolean valid
CubitBox safetyBox
CubitBox boundingBox

Private Attributes

DIMENSION myDisc
double myDist
DISTDATA myDistData

Detailed Description

template<class Y>
class KDDTreeNode< Y >

Definition at line 46 of file KDDTreeNode.hpp.


Constructor & Destructor Documentation

template<class Y>
MY_INLINE KDDTreeNode< Y >::KDDTreeNode ( Y  aData,
DIMENSION  aDisc = DIMX 
)

Definition at line 39 of file KDDTreeNode.cpp.

{
  parent = left = right = NULL;
  data = aData;

  boundingBox = data->bounding_box();
  x = boundingBox.center().x();
  y = boundingBox.center().y();
  z = boundingBox.center().z();

  myDist = CUBIT_DBL_MAX;
  myDistData = DD_SAFETY;
   
  myDisc = aDisc;

  valid = CUBIT_TRUE;
}
template<class Y >
MY_INLINE KDDTreeNode< Y >::~KDDTreeNode ( )

Definition at line 58 of file KDDTreeNode.cpp.

{  
}

Member Function Documentation

template<class Y>
MY_INLINE DIRECTION KDDTreeNode< Y >::compare ( KDDTreeNode< Y > *  Q) const

Definition at line 93 of file KDDTreeNode.cpp.

{
  if (Q->myDisc == DIMX)
  {
    if (x <= Q->x) return DIR_LEFT;
    else return DIR_RIGHT;
  }
  else if (Q->myDisc == DIMY)
  {
    if (y <= Q->y) return DIR_LEFT;
    else return DIR_RIGHT;
  }
  else if (z <= Q->z)
  {
    return DIR_LEFT;
  }
  else
  {
    return DIR_RIGHT;
  }
}
template<class Y>
MY_INLINE DIRECTION KDDTreeNode< Y >::compare_with_equality ( KDDTreeNode< Y > *  Q) const

Definition at line 116 of file KDDTreeNode.cpp.

{
  if (Q->myDisc == DIMX)
  {
    if (x < Q->x) return DIR_LEFT;
    else if (x == Q->x) return DIR_EITHER;
    else return DIR_RIGHT;
  }
  else if (Q->myDisc == DIMY)
  {
    if (y < Q->y) return DIR_LEFT;
    else if (y == Q->y) return DIR_EITHER;
    else return DIR_RIGHT;
  }
  else if (z < Q->z)
  {
    return DIR_LEFT;
  }
  else if (z == Q->z)
  {
    return DIR_EITHER;
  }
  else
  {
    return DIR_RIGHT;
  }
}
template<class Y >
MY_INLINE KDDTreeNode< Y > * KDDTreeNode< Y >::get_child ( DIRECTION  dir) const

Definition at line 62 of file KDDTreeNode.cpp.

{
  if (dir == DIR_LEFT) return left;
  return right;
}
template<class Y>
DIMENSION KDDTreeNode< Y >::get_disc ( ) const [inline]

Definition at line 81 of file KDDTreeNode.hpp.

{ return myDisc; }
template<class Y>
double KDDTreeNode< Y >::get_dist ( ) const [inline]

Definition at line 73 of file KDDTreeNode.hpp.

{ return myDist; }
template<class Y>
DISTDATA KDDTreeNode< Y >::get_dist_data ( ) const [inline]

Definition at line 77 of file KDDTreeNode.hpp.

{ return myDistData; }
template<class Y >
MY_INLINE DIMENSION KDDTreeNode< Y >::next_disc ( ) const

Definition at line 82 of file KDDTreeNode.cpp.

{
  switch (myDisc)
  {
    case DIMX: return DIMY;
    case DIMY: return DIMZ;
    default:   return DIMX;
  }
}
template<class Y>
MY_INLINE void KDDTreeNode< Y >::set_child ( KDDTreeNode< Y > *  node,
DIRECTION  dir 
)

Definition at line 69 of file KDDTreeNode.cpp.

{
  if (dir == DIR_LEFT)
  {
    left = node;
  }
  else
  {
    right = node;
  }
}
template<class Y>
void KDDTreeNode< Y >::set_disc ( DIMENSION  dim) [inline]

Definition at line 82 of file KDDTreeNode.hpp.

{ myDisc = dim; }
template<class Y>
void KDDTreeNode< Y >::set_dist ( double  dist) [inline]

Definition at line 74 of file KDDTreeNode.hpp.

{ myDist = dist; }
template<class Y>
void KDDTreeNode< Y >::set_dist_data ( DISTDATA  distData) [inline]

Definition at line 78 of file KDDTreeNode.hpp.

{ myDistData = distData; }

Member Data Documentation

template<class Y>
CubitBox KDDTreeNode< Y >::boundingBox

Definition at line 62 of file KDDTreeNode.hpp.

template<class Y>
Y KDDTreeNode< Y >::data

Definition at line 58 of file KDDTreeNode.hpp.

template<class Y>
KDDTreeNode<Y>* KDDTreeNode< Y >::left

Definition at line 55 of file KDDTreeNode.hpp.

template<class Y>
DIMENSION KDDTreeNode< Y >::myDisc [private]

Definition at line 49 of file KDDTreeNode.hpp.

template<class Y>
double KDDTreeNode< Y >::myDist [private]

Definition at line 50 of file KDDTreeNode.hpp.

template<class Y>
DISTDATA KDDTreeNode< Y >::myDistData [private]

Definition at line 51 of file KDDTreeNode.hpp.

template<class Y>
KDDTreeNode<Y>* KDDTreeNode< Y >::parent

Definition at line 54 of file KDDTreeNode.hpp.

template<class Y>
KDDTreeNode<Y>* KDDTreeNode< Y >::right

Definition at line 56 of file KDDTreeNode.hpp.

template<class Y>
CubitBox KDDTreeNode< Y >::safetyBox

Definition at line 61 of file KDDTreeNode.hpp.

template<class Y>
CubitBoolean KDDTreeNode< Y >::valid

Definition at line 59 of file KDDTreeNode.hpp.

template<class Y>
double KDDTreeNode< Y >::x

Definition at line 57 of file KDDTreeNode.hpp.

template<class Y>
double KDDTreeNode< Y >::y

Definition at line 57 of file KDDTreeNode.hpp.

template<class Y>
double KDDTreeNode< Y >::z

Definition at line 57 of file KDDTreeNode.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines