GridUtils.h

Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2003-2007 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 #ifndef _GRIDUTILS_H_20050126
00011 #define _GRIDUTILS_H_20050126
00012 
00013 #include <vector>
00014 
00015 namespace RDGeom {
00016   class UniformGrid3D;
00017   class Point3D;
00018   
00019   //! calculate the tanimoto distance between the shapes encoded on two grids
00020   /*!
00021 
00022      tanimoto(S1,S2) =  1 - ( | S1&S2 | / | S1|S2 | )
00023 
00024   */
00025   template<class GRIDTYPE> double tanimotoDistance(const GRIDTYPE &grid1, 
00026                                                    const GRIDTYPE &grid2);
00027   //! calculate the protrude distance between the shapes encoded on two grids
00028   /*!
00029 
00030      protrude(S1,S2) = ( | S1|S2 | - | S1&S2 | ) / | S1 |
00031 
00032   */
00033   template<class GRIDTYPE> double protrudeDistance(const GRIDTYPE &grid1, 
00034                                                    const GRIDTYPE &grid2);
00035 
00036 
00037   //! calculate the grid centroid within a window of a point
00038   Point3D computeGridCentroid(const UniformGrid3D &grid,
00039                               const Point3D &pt,
00040                               double windowRadius,
00041                               double &weightSum);
00042   
00043   //! find terminal points of a shape encoded on a grid
00044   //!  this is part of the subshape implementation
00045   std::vector<Point3D> findGridTerminalPoints(const UniformGrid3D &grid,
00046                                           double windowRadius,
00047                                           double inclusionFraction);
00048 
00049   
00050 }
00051 
00052 #endif
00053