Memosa-FVM  0.2
Distance Struct Reference

#include <KSearchTree.h>

Public Types

typedef MyPoint Query_item
 

Public Member Functions

double transformed_distance (const MyPoint &p1, const MyPoint &p2) const
 
template<class TreeTraits >
double min_distance_to_rectangle (const MyPoint &p, const CGAL::Kd_tree_rectangle< TreeTraits > &b) const
 
template<class TreeTraits >
double max_distance_to_rectangle (const MyPoint &p, const CGAL::Kd_tree_rectangle< TreeTraits > &b) const
 
double new_distance (double &dist, double old_off, double new_off, int) const
 
double transformed_distance (double d) const
 
double inverse_of_transformed_distance (double d)
 

Detailed Description

Definition at line 58 of file KSearchTree.h.

Member Typedef Documentation

Definition at line 60 of file KSearchTree.h.

Member Function Documentation

double Distance::inverse_of_transformed_distance ( double  d)
inline

Definition at line 111 of file KSearchTree.h.

References sqrt().

111 { return std::sqrt(d); }
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
template<class TreeTraits >
double Distance::max_distance_to_rectangle ( const MyPoint p,
const CGAL::Kd_tree_rectangle< TreeTraits > &  b 
) const
inline

Definition at line 87 of file KSearchTree.h.

References MyPoint::vec.

89  {
90  double h = p.vec[0];
91  double d0 = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ?
92  (h-b.min_coord(0))*(h-b.min_coord(0)) : (b.max_coord(0)-h)*(b.max_coord(0)-h);
93 
94  h=p.vec[1];
95  double d1 = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ?
96  (h-b.min_coord(1))*(h-b.min_coord(1)) : (b.max_coord(1)-h)*(b.max_coord(1)-h);
97 
98  h=p.vec[2];
99  double d2 = (h >= (b.min_coord(2)+b.max_coord(2))/2.0) ?
100  (h-b.min_coord(2))*(h-b.min_coord(2)) : (b.max_coord(2)-h)*(b.max_coord(2)-h);
101  return d0 + d1 + d2;
102  }
Vec3D vec
Definition: KSearchTree.h:22
template<class TreeTraits >
double Distance::min_distance_to_rectangle ( const MyPoint p,
const CGAL::Kd_tree_rectangle< TreeTraits > &  b 
) const
inline

Definition at line 71 of file KSearchTree.h.

References MyPoint::vec.

73  {
74  double distance(0.0), h = p.vec[0];
75  if (h < b.min_coord(0)) distance += (b.min_coord(0)-h)*(b.min_coord(0)-h);
76  if (h > b.max_coord(0)) distance += (h-b.max_coord(0))*(h-b.max_coord(0));
77  h=p.vec[1];
78  if (h < b.min_coord(1)) distance += (b.min_coord(1)-h)*(b.min_coord(1)-h);
79  if (h > b.max_coord(1)) distance += (h-b.max_coord(1))*(h-b.min_coord(1));
80  h=p.vec[2];
81  if (h < b.min_coord(2)) distance += (b.min_coord(2)-h)*(b.min_coord(2)-h);
82  if (h > b.max_coord(2)) distance += (h-b.max_coord(2))*(h-b.max_coord(2));
83  return distance;
84  }
Vec3D vec
Definition: KSearchTree.h:22
double Distance::new_distance ( double &  dist,
double  old_off,
double  new_off,
int   
) const
inline

Definition at line 104 of file KSearchTree.h.

105  {
106  return dist + new_off*new_off - old_off*old_off;
107  }
double Distance::transformed_distance ( const MyPoint p1,
const MyPoint p2 
) const
inline

Definition at line 62 of file KSearchTree.h.

References MyPoint::vec.

63  {
64  double distx= p1.vec[0]-p2.vec[0];
65  double disty= p1.vec[1]-p2.vec[1];
66  double distz= p1.vec[2]-p2.vec[2];
67  return distx*distx+disty*disty+distz*distz;
68  }
Vec3D vec
Definition: KSearchTree.h:22
double Distance::transformed_distance ( double  d) const
inline

Definition at line 109 of file KSearchTree.h.

109 { return d*d; }

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