Permalink
Browse files

Added documentation to source code

  • Loading branch information...
1 parent f7c7d15 commit 70468cdb1bce9406bb90d6913bd956479363e7a8 @stephanemagnenat stephanemagnenat committed Oct 7, 2010
Showing with 2,030 additions and 153 deletions.
  1. +13 −1 CMakeLists.txt
  2. +1,510 −0 Doxyfile.in
  3. +118 −0 UseDoxygen.cmake
  4. +1 −1 examples/trivial.cpp
  5. +17 −17 experimental/kdtree_cpu.cpp
  6. +43 −43 experimental/nabo_experimental.h
  7. +9 −4 nabo/brute_force_cpu.cpp
  8. +58 −7 nabo/index_heap.h
  9. +19 −10 nabo/kdtree_cpu.cpp
  10. +13 −8 nabo/nabo.cpp
  11. +158 −20 nabo/nabo.h
  12. +52 −23 nabo/nabo_private.h
  13. +12 −12 tests/knnbench.cpp
  14. +7 −7 tests/knnvalidate.cpp
View
@@ -1,7 +1,19 @@
cmake_minimum_required(VERSION 2.6)
-project(nabo)
+project(libnabo)
+
+# Documentation, extract version from header
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+execute_process(
+ COMMAND grep "NABO_VERSION " nabo/nabo.h
+ COMMAND sed "s/.*\"\(.*\)\"/\1/g"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE PROJECT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+include(UseDoxygen)
+# Compilation
add_definitions(-Wall)
find_package(Boost REQUIRED)
View
1,510 Doxyfile.in

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,118 @@
+# - Run Doxygen
+#
+# Adds a doxygen target that runs doxygen to generate the html
+# and optionally the LaTeX API documentation.
+# The doxygen target is added to the doc target as a dependency.
+# i.e.: the API documentation is built with:
+# make doc
+#
+# USAGE: GLOBAL INSTALL
+#
+# Install it with:
+# cmake ./ && sudo make install
+# Add the following to the CMakeLists.txt of your project:
+# include(UseDoxygen OPTIONAL)
+# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
+#
+# USAGE: INCLUDE IN PROJECT
+#
+# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+# include(UseDoxygen)
+# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
+#
+#
+# Variables you may define are:
+# DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are.
+# Defaults to the current source and binary directory.
+# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc".
+#
+# DOXYFILE_LATEX - Set to "NO" if you do not want the LaTeX documentation
+# to be built.
+# DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
+# the Doxygen LaTeX output is stored. Defaults to "latex".
+#
+# DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
+# the Doxygen html output is stored. Defaults to "html".
+#
+
+#
+# Copyright (c) 2009, 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+macro(usedoxygen_set_default name value)
+ if(NOT DEFINED "${name}")
+ set("${name}" "${value}")
+ endif()
+endmacro()
+
+find_package(Doxygen)
+
+if(DOXYGEN_FOUND)
+ find_file(DOXYFILE_IN "Doxyfile.in"
+ PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
+ NO_DEFAULT_PATH)
+ set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
+endif()
+
+if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
+ usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
+ usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
+ usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+
+ set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES
+ "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
+
+ add_custom_target(doxygen
+ COMMAND ${DOXYGEN_EXECUTABLE}
+ ${DOXYFILE}
+ COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ ## LaTeX
+ set(DOXYFILE_PDFLATEX "NO")
+ set(DOXYFILE_DOT "NO")
+
+ find_package(LATEX)
+ find_program(MAKE_PROGRAM make)
+ if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND MAKE_PROGRAM AND
+ (NOT DEFINED DOXYFILE_LATEX OR DOXYFILE_LATEX STREQUAL "YES"))
+ set(DOXYFILE_LATEX "YES")
+ usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
+
+ set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES
+ "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
+
+ if(PDFLATEX_COMPILER)
+ set(DOXYFILE_PDFLATEX "YES")
+ endif()
+ if(DOXYGEN_DOT_EXECUTABLE)
+ set(DOXYFILE_DOT "YES")
+ endif()
+
+ add_custom_command(TARGET doxygen
+ POST_BUILD
+ COMMAND ${MAKE_PROGRAM}
+ COMMENT "Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..."
+ WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
+ else()
+ set(DOXYGEN_LATEX "NO")
+ endif()
+
+
+ configure_file(${DOXYFILE_IN} Doxyfile IMMEDIATE @ONLY)
+
+ get_target_property(DOC_TARGET doc TYPE)
+ if(NOT DOC_TARGET)
+ add_custom_target(doc)
+ endif()
+
+ add_dependencies(doc doxygen)
+endif()
View
@@ -14,7 +14,7 @@ int main()
// create a kd-tree for M, note that M must stay valid during the lifetime of the kd-tree
NNSearchF* nns = NNSearchF::createKDTreeLinearHeap(M);
- // look for the 5 nearest neighbor
+ // look for the 5 nearest neighbour
const int K = 5;
VectorXi n = nns->knn(q, K);
@@ -44,7 +44,7 @@ namespace Nabo
using namespace std;
template<typename T>
- size_t argMax(const typename NearestNeighborSearch<T>::Vector& v)
+ size_t argMax(const typename NearestNeighbourSearch<T>::Vector& v)
{
T maxVal(0);
size_t maxIdx(0);
@@ -171,7 +171,7 @@ namespace Nabo
template<typename T>
KDTreeBalancedPtInNodes<T>::KDTreeBalancedPtInNodes(const Matrix& cloud):
- NearestNeighborSearch<T>::NearestNeighborSearch(cloud)
+ NearestNeighbourSearch<T>::NearestNeighbourSearch(cloud)
{
// build point vector and compute bounds
BuildPoints buildPoints;
@@ -206,7 +206,7 @@ namespace Nabo
typedef priority_queue<SearchElement> Queue;
const T maxError(1 + epsilon);
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
Queue queue;
queue.push(SearchElement(0, 0));
@@ -268,7 +268,7 @@ namespace Nabo
}
statistics.totalVisitCount += statistics.lastQueryVisitCount;
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
return cloudIndexesFromNodesIndexes(heap.getIndexes());
@@ -288,7 +288,7 @@ namespace Nabo
template<typename T>
typename KDTreeBalancedPtInNodesStack<T>::IndexVector KDTreeBalancedPtInNodesStack<T>::knn(const Vector& query, const Index k, const T epsilon, const unsigned optionFlags)
{
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
assert(nodes.size() > 0);
assert(nodes[0].pos.size() == query.size());
@@ -299,7 +299,7 @@ namespace Nabo
recurseKnn(query, 0, 0, heap, off, 1 + epsilon, allowSelfMatch);
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
statistics.totalVisitCount += statistics.lastQueryVisitCount;
@@ -443,7 +443,7 @@ namespace Nabo
template<typename T>
KDTreeBalancedPtInLeavesStack<T>::KDTreeBalancedPtInLeavesStack(const Matrix& cloud, const bool balanceVariance):
- NearestNeighborSearch<T>::NearestNeighborSearch(cloud)
+ NearestNeighbourSearch<T>::NearestNeighbourSearch(cloud)
{
// build point vector and compute bounds
BuildPoints buildPoints;
@@ -466,7 +466,7 @@ namespace Nabo
template<typename T>
typename KDTreeBalancedPtInLeavesStack<T>::IndexVector KDTreeBalancedPtInLeavesStack<T>::knn(const Vector& query, const Index k, const T epsilon, const unsigned optionFlags)
{
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
assert(nodes.size() > 0);
Heap heap(k);
@@ -476,7 +476,7 @@ namespace Nabo
recurseKnn(query, 0, 0, heap, off, 1 + epsilon, allowSelfMatch);
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
statistics.totalVisitCount += statistics.lastQueryVisitCount;
@@ -601,7 +601,7 @@ namespace Nabo
template<typename T, typename Heap>
KDTreeUnbalancedPtInLeavesImplicitBoundsStack<T, Heap>::KDTreeUnbalancedPtInLeavesImplicitBoundsStack(const Matrix& cloud):
- NearestNeighborSearch<T>::NearestNeighborSearch(cloud)
+ NearestNeighbourSearch<T>::NearestNeighbourSearch(cloud)
{
// build point vector and compute bounds
BuildPoints buildPoints;
@@ -624,7 +624,7 @@ namespace Nabo
template<typename T, typename Heap>
typename KDTreeUnbalancedPtInLeavesImplicitBoundsStack<T, Heap>::IndexVector KDTreeUnbalancedPtInLeavesImplicitBoundsStack<T, Heap>::knn(const Vector& query, const Index k, const T epsilon, const unsigned optionFlags)
{
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
assert(nodes.size() > 0);
Heap heap(k);
@@ -634,7 +634,7 @@ namespace Nabo
recurseKnn(query, 0, 0, heap, off, 1+epsilon, allowSelfMatch);
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
statistics.totalVisitCount += statistics.lastQueryVisitCount;
@@ -645,7 +645,7 @@ namespace Nabo
template<typename T, typename Heap>
typename KDTreeUnbalancedPtInLeavesImplicitBoundsStack<T, Heap>::IndexMatrix KDTreeUnbalancedPtInLeavesImplicitBoundsStack<T, Heap>::knnM(const Matrix& query, const Index k, const T epsilon, const unsigned optionFlags)
{
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
assert(nodes.size() > 0);
assert(nodes.size() > 0);
@@ -666,7 +666,7 @@ namespace Nabo
recurseKnn(q, 0, 0, heap, off, 1+epsilon, allowSelfMatch);
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
result.col(i) = heap.getIndexes();
@@ -805,7 +805,7 @@ namespace Nabo
template<typename T>
KDTreeUnbalancedPtInLeavesExplicitBoundsStack<T>::KDTreeUnbalancedPtInLeavesExplicitBoundsStack(const Matrix& cloud):
- NearestNeighborSearch<T>::NearestNeighborSearch(cloud)
+ NearestNeighbourSearch<T>::NearestNeighbourSearch(cloud)
{
// build point vector and compute bounds
BuildPoints buildPoints;
@@ -828,7 +828,7 @@ namespace Nabo
template<typename T>
typename KDTreeUnbalancedPtInLeavesExplicitBoundsStack<T>::IndexVector KDTreeUnbalancedPtInLeavesExplicitBoundsStack<T>::knn(const Vector& query, const Index k, const T epsilon, const unsigned optionFlags)
{
- const bool allowSelfMatch(optionFlags & NearestNeighborSearch<T>::ALLOW_SELF_MATCH);
+ const bool allowSelfMatch(optionFlags & NearestNeighbourSearch<T>::ALLOW_SELF_MATCH);
assert(nodes.size() > 0);
Heap heap(k);
@@ -837,7 +837,7 @@ namespace Nabo
recurseKnn(query, 0, 0, heap, 1+epsilon, allowSelfMatch);
- if (optionFlags & NearestNeighborSearch<T>::SORT_RESULTS)
+ if (optionFlags & NearestNeighbourSearch<T>::SORT_RESULTS)
heap.sort();
statistics.totalVisitCount += statistics.lastQueryVisitCount;
Oops, something went wrong.

0 comments on commit 70468cd

Please sign in to comment.