From 0cc35ad04f9c2997014d7cf62a12f697e79fb534 Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Sat, 20 Jan 2018 19:11:29 +0100 Subject: Major rewrite, templatized version --- geom_bottleneck/bottleneck/include/neighb_oracle.h | 91 ---------------------- 1 file changed, 91 deletions(-) delete mode 100644 geom_bottleneck/bottleneck/include/neighb_oracle.h (limited to 'geom_bottleneck/bottleneck/include/neighb_oracle.h') diff --git a/geom_bottleneck/bottleneck/include/neighb_oracle.h b/geom_bottleneck/bottleneck/include/neighb_oracle.h deleted file mode 100644 index f6f78b1..0000000 --- a/geom_bottleneck/bottleneck/include/neighb_oracle.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyrigth 2015, D. Morozov, M. Kerber, A. Nigmetov - - This file is part of GeomBottleneck. - - GeomBottleneck is free software: you can redistribute it and/or modify - it under the terms of the Lesser GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - GeomBottleneck is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - Lesser GNU General Public License for more details. - - You should have received a copy of the Lesser GNU General Public License - along with GeomBottleneck. If not, see . - -*/ - -#ifndef NEIGHB_ORACLE_H -#define NEIGHB_ORACLE_H - -#include -#include "basic_defs_bt.h" -#include - -namespace geom_bt { -class NeighbOracleAbstract{ -public: - virtual void deletePoint(const DiagramPoint& p) = 0; - virtual void rebuild(const DiagramPointSet& S, double rr) = 0; - // return true, if r-neighbour of q exists in pointSet, - // false otherwise. - // the neighbour is returned in result - virtual bool getNeighbour(const DiagramPoint& q, DiagramPoint& result) const = 0; - virtual void getAllNeighbours(const DiagramPoint& q, std::vector& result) = 0; - virtual ~NeighbOracleAbstract() {}; -protected: - double r; - double distEpsilon; -}; - -class NeighbOracleSimple : public NeighbOracleAbstract -{ -public: - NeighbOracleSimple(); - NeighbOracleSimple(const DiagramPointSet& S, const double rr, const double dEps); - void deletePoint(const DiagramPoint& p); - void rebuild(const DiagramPointSet& S, const double rr); - bool getNeighbour(const DiagramPoint& q, DiagramPoint& result) const; - void getAllNeighbours(const DiagramPoint& q, std::vector& result); - ~NeighbOracleSimple() {}; -private: - DiagramPointSet pointSet; -}; - -class NeighbOracleAnn : public NeighbOracleAbstract -{ -public: - NeighbOracleAnn(const DiagramPointSet& S, const double rr, const double dEps); - void deletePoint(const DiagramPoint& p); - void rebuild(const DiagramPointSet& S, const double rr); - bool getNeighbour(const DiagramPoint& q, DiagramPoint& result) const; - void getAllNeighbours(const DiagramPoint& q, std::vector& result); - ~NeighbOracleAnn(); -//private: - //DiagramPointSet originalPointSet; - std::vector allPoints; - DiagramPointSet diagonalPoints; - std::unordered_map pointIdxLookup; - // ann-stuff - static constexpr double annEpsilon {0}; - static const int annK {1}; - static const int annDim{2}; - ANNpointArray annPoints; - ANNkd_tree* kdTree; - ANNidxArray annNeigbIndices; - ANNpoint annQueryPoint; - // to use in getAllNeighbours - ANNpoint lo; - ANNpoint hi; - ANNidxArray annIndices; - ANNdistArray annDistances; -}; - -//typedef NeighbOracleSimple NeighbOracle; -typedef NeighbOracleAnn NeighbOracle; - -} -#endif -- cgit v1.2.3