Index: Damkjer/Damkjer_Research.sln
===================================================================
--- Damkjer/Damkjer_Research.sln	(revision 9)
+++ Damkjer/Damkjer_Research.sln	(revision 10)
@@ -18,5 +18,12 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_Metrics", "Util\SpatialIndexing\Metrics\test\TestMetrics.vcxproj", "{FF08AA20-7D15-AEAB-9915-1FA343E8C993}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_VpTree", "Util\SpatialIndexing\VpTree\test\TestVpTree.vcxproj", "{84624C89-966E-4948-1393-64F0D0965AC0}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5EF24E30-9F04-4295-B259-14A8ACB6B945}"
+EndProject
 Global
+	GlobalSection(TestCaseManagementSettings) = postSolution
+		CategoryFile = Damkjer_Research.vsmdi
+	EndGlobalSection
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -88,4 +95,16 @@
 		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|x64.ActiveCfg = Release|x64
 		{FF08AA20-7D15-AEAB-9915-1FA343E8C993}.Release|x64.Build.0 = Release|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|Win32.ActiveCfg = Debug|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|Win32.Build.0 = Debug|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|x64.ActiveCfg = Debug|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Debug|x64.Build.0 = Debug|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|Win32.ActiveCfg = OpenMP|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|Win32.Build.0 = OpenMP|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|x64.ActiveCfg = OpenMP|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.OpenMP|x64.Build.0 = OpenMP|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|Win32.ActiveCfg = Release|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|Win32.Build.0 = Release|Win32
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|x64.ActiveCfg = Release|x64
+		{84624C89-966E-4948-1393-64F0D0965AC0}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
@@ -94,10 +113,11 @@
 	GlobalSection(NestedProjects) = preSolution
 		{3411130C-FC3A-47AD-9277-EEA9BDA15D28} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
+		{20FE2624-C64F-D61A-BD8F-1725A8E68A42} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
 		{3093F2E8-7C3B-4B90-8E92-C0C235FB979A} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
-		{20FE2624-C64F-D61A-BD8F-1725A8E68A42} = {27DB8DBD-623B-4593-80F3-9F25F07BBA1A}
 		{2738EE40-D034-9113-3C3F-2AD5946B372D} = {3411130C-FC3A-47AD-9277-EEA9BDA15D28}
 		{72785A79-5BD2-AAE4-6386-93F74C7E248D} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
 		{75486221-5693-30A9-18E4-ECC307F92A68} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
 		{FF08AA20-7D15-AEAB-9915-1FA343E8C993} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
+		{84624C89-966E-4948-1393-64F0D0965AC0} = {3093F2E8-7C3B-4B90-8E92-C0C235FB979A}
 	EndGlobalSection
 EndGlobal
Index: Damkjer/Util/Exception/Exception.cpp
===================================================================
--- Damkjer/Util/Exception/Exception.cpp	(revision 9)
+++ Damkjer/Util/Exception/Exception.cpp	(revision 10)
@@ -55,5 +55,5 @@
    os << "\n(" << who()
       << ", \"" << file() << "\""
-      << ", line " << line() << ")\n";
+      << ", line " << line() << ")";
 
    return os;
@@ -129,5 +129,5 @@
                        int                line)
    : Exception(why, who, file, line)
-   , std::logic_error("")
+//   , std::logic_error(why)
 {
 }
@@ -136,8 +136,8 @@
 // LogicError::what
 //*****************************************************************************
-const char* LogicError::what() const throw()
-{
-   return Exception::what();
-}
+//const char* LogicError::what() const throw()
+//{
+   //return Exception::what();
+//}
 
 //*****************************************************************************
@@ -149,5 +149,5 @@
                          int                line)
    : LogicError(why, who, file, line)
-   , std::domain_error("")
+   , std::domain_error(why)
 {
 }
@@ -169,5 +169,5 @@
                                  int                line)
    : LogicError(why, who, file, line)
-   , std::invalid_argument("")
+   , std::invalid_argument(why)
 {
 }
@@ -189,5 +189,5 @@
                          int                line)
    : LogicError(why, who, file, line)
-   , std::length_error("")
+   , std::length_error(why)
 {
 }
@@ -209,5 +209,5 @@
                        int                line)
    : LogicError(why, who, file, line)
-   , std::out_of_range("")
+   , std::out_of_range(why)
 {
 }
@@ -225,7 +225,7 @@
 //*****************************************************************************
 RethrowError::RethrowError(const std::exception& thrown,
-                                    const std::string& who,
-                                    const std::string& file,
-                                    int line)
+                           const std::string& who,
+                           const std::string& file,
+                           int line)
    : DomainError((*thrown.what() != '\0' ? thrown.what()
                                          : typeid(thrown).name()),
@@ -242,5 +242,5 @@
                            int                line)
    : Exception(why, who, file, line)
-   , std::runtime_error("")
+//   , std::runtime_error(why)
 {
 }
@@ -249,8 +249,8 @@
 // RuntimeError::what
 //*****************************************************************************
-const char* RuntimeError::what() const throw()
-{
-   return Exception::what();
-}
+//const char* RuntimeError::what() const throw()
+//{
+   //return Exception::what();
+//}
 
 //*****************************************************************************
@@ -262,5 +262,5 @@
                        int                line)
    : RuntimeError(why, who, file, line)
-   , std::range_error("")
+   , std::range_error(why)
 {
 }
@@ -282,5 +282,5 @@
                              int                line)
    : RuntimeError(why, who, file, line)
-   , std::overflow_error("")
+   , std::overflow_error(why)
 {
 }
@@ -302,5 +302,5 @@
                                int                line)
    : RuntimeError(why, who, file, line)
-   , std::underflow_error("")
+   , std::underflow_error(why)
 {
 }
Index: Damkjer/Util/Exception/Exception.h
===================================================================
--- Damkjer/Util/Exception/Exception.h	(revision 9)
+++ Damkjer/Util/Exception/Exception.h	(revision 10)
@@ -116,6 +116,6 @@
 //<
 //*****************************************************************************
-class LogicError : public Exception,
-                   public std::logic_error
+class LogicError : public Exception//,
+//                   public std::logic_error
 {
 public:
@@ -131,5 +131,5 @@
       //<
 
-   Util_API virtual const char* what() const throw();
+//   Util_API virtual const char* what() const throw();
       //>
       //<
@@ -296,6 +296,6 @@
 //<
 //*****************************************************************************
-class RuntimeError : public Exception,
-                              public std::runtime_error
+class RuntimeError : public Exception//,
+//                              public std::runtime_error
 {
 public:
@@ -311,5 +311,5 @@
       //<
 
-   Util_API virtual const char* what() const throw();
+//   Util_API virtual const char* what() const throw();
       //>
       //<
@@ -393,5 +393,6 @@
 }
 
-Util_API inline std::ostream& operator<<(std::ostream& os, const Damkjer::Exception& e)
+Util_API inline std::ostream& operator<<(std::ostream& os,
+                                         const Damkjer::Exception& e)
 {
    return os << e.what();
Index: Damkjer/Util/Exception/test/TestException.cpp
===================================================================
--- Damkjer/Util/Exception/test/TestException.cpp	(revision 9)
+++ Damkjer/Util/Exception/test/TestException.cpp	(revision 10)
@@ -31,10 +31,10 @@
 // FUNCTOR: throwTest
 //*****************************************************************************
-template <typename Type, typename DType=Type>
+template <typename CatchT, typename ThrowT=CatchT>
 class throwTest : public TestCase::TestStep
 {
 public:
-   throwTest(const DType& expected)
-      : TestCase::TestStep(typeid(Type).name())
+   throwTest(const ThrowT& expected)
+      : TestCase::TestStep(typeid(CatchT).name())
       , theExpected(expected)
    {
@@ -56,9 +56,8 @@
          return false;
       }
-      catch (const Type& e)
+      catch (const CatchT& e)
       {
          test.report() << "Caught expected exception:\n";
-
-         test.report() << blockIndent() << e.what() << endBlock;
+         test.report() << blockIndent() << e.what() << "\n" << endBlock;
 
          // If we get here, we threw the correct exception: successful test.
@@ -81,5 +80,5 @@
 
 private:
-   DType theExpected;
+   ThrowT theExpected;
       //>
       //<
@@ -177,11 +176,11 @@
    registerStep(new throwTest<OverflowError>(doe));
    registerStep(new throwTest<UnderflowError>(due));
-   registerStep(new throwTest<LogicError>(dde));
-   registerStep(new throwTest<LogicError>(dia));
-   registerStep(new throwTest<LogicError>(dle));
-   registerStep(new throwTest<LogicError>(dor));
-   registerStep(new throwTest<RuntimeError>(dre));
-   registerStep(new throwTest<RuntimeError>(doe));
-   registerStep(new throwTest<RuntimeError>(due));
+   registerStep(new throwTest<LogicError, DomainError>(dde));
+   registerStep(new throwTest<LogicError, InvalidArgument>(dia));
+   registerStep(new throwTest<LogicError, LengthError>(dle));
+   registerStep(new throwTest<LogicError, OutOfRange>(dor));
+   registerStep(new throwTest<RuntimeError, RangeError>(dre));
+   registerStep(new throwTest<RuntimeError, OverflowError>(doe));
+   registerStep(new throwTest<RuntimeError, UnderflowError>(due));
    registerStep(new throwTest<Exception, DomainError>(dde));
    registerStep(new throwTest<Exception, InvalidArgument>(dia));
Index: Damkjer/Util/Exception/test/TestException.vcxproj
===================================================================
--- Damkjer/Util/Exception/test/TestException.vcxproj	(revision 9)
+++ Damkjer/Util/Exception/test/TestException.vcxproj	(revision 10)
@@ -118,6 +118,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -131,9 +130,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -142,6 +160,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -154,9 +171,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -165,6 +201,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -179,9 +214,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -190,6 +244,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -205,9 +258,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -216,6 +288,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -229,9 +300,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -240,6 +330,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>TurnOffAllWarnings</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -254,9 +343,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
Index: Damkjer/Util/SpatialIndexing/Metrics/ChebyshevDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/ChebyshevDistance.h	(revision 10)
+++ Damkjer/Util/SpatialIndexing/Metrics/ChebyshevDistance.h	(revision 10)
@@ -0,0 +1,85 @@
+//*****************************************************************************
+// FILE:        ChebyshevDistance.h
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: ChebyshevDistance
+//    This class describes a Chebyshev distance metric. Distances between two
+//    points, p and q, in n-dimensional Chebyshev space are calculated as
+//    follows:
+//
+//    d(p,q)=max{i=0:n}(|p[i] - q[i]|).
+//
+// LIMITATIONS: ChebyshevDistance
+//    The ChebyshevDistance functor must operate on an STL container class, or
+//    a class that supports "duck" typing through a public typedef named
+//    "value_type".
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//  2013-JUL-23  K. Damkjer
+//               Modified free functions to functors to allow for "functions
+//               with state" like p-norm.
+//  2013-AUG-09  K. Damkjer
+//               Moved into its own header to improve maintainability.
+//<
+//*****************************************************************************
+
+#ifndef ChebyshevDistance_HEADER
+#define ChebyshevDistance_HEADER
+
+#include <cmath>
+#include <iterator>
+
+namespace Damkjer
+{
+
+//*****************************************************************************
+// FUNCTOR: ChebyshevDistance
+//*****************************************************************************
+template<typename PointT, typename ReturnT = PointT::value_type>
+class ChebyshevDistance
+{
+public:
+   typedef typename PointT  value_type;
+      //> Add support for "duck" typing by publishing the point type for this
+      //  functor.
+      //<
+
+   typedef typename ReturnT return_type;
+      //> Add support for "duck" typing by publishing the return type for this
+      //  functor.
+      //<
+   
+   //**************************************************************************
+   // ChebyshevDistance::operator()
+   //**************************************************************************
+   ReturnT operator()(const PointT& a, const PointT& b) const
+   {
+      // For predictable data fidelity, perform computations with the same
+      // fidelity as the point-type.
+      PointT::value_type temp, my_max = 0;
+      
+      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
+           ai != a.end() && bi != b.end();
+           ++ai, ++bi)
+      {
+         temp = std::abs(*ai - *bi);
+         my_max = (temp > my_max) ? temp : my_max;
+      }
+      
+      // Then static-cast to the desired return type.
+      return static_cast<ReturnT>(my_max);
+   }
+      //> The operator() function performs the distance calculation for
+      //  Metrics functors. Distances between two points, p and q, in
+      //  n-dimensional Chebyshev space are calculated as follows:
+      //
+      //    d(p,q)=max{i=0:n}(|p[i] - q[i]|).
+      //<
+};
+
+}
+
+#endif
Index: Damkjer/Util/SpatialIndexing/Metrics/EuclideanDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/EuclideanDistance.h	(revision 10)
+++ Damkjer/Util/SpatialIndexing/Metrics/EuclideanDistance.h	(revision 10)
@@ -0,0 +1,84 @@
+//*****************************************************************************
+// FILE:        EuclideanDistance.h
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: EuclideanDistance
+//    This class describes a Euclidean distance metric. Distances between two
+//    points, p and q, in n-dimensional Euclidean space are calculated as
+//    follows:
+//
+//    d(p,q)=sqrt(sum{i=0:n}((p[i] - q[i])^2)).
+//
+// LIMITATIONS: EuclideanDistance
+//    The EuclideanDistance functor must operate on an STL container class, or
+//    a class that supports "duck" typing through a public typedef named
+//    "value_type".
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//  2013-JUL-23  K. Damkjer
+//               Modified free functions to functors to allow for "functions
+//               with state" like p-norm.
+//  2013-AUG-09  K. Damkjer
+//               Moved into its own header to improve maintainability.
+//<
+//*****************************************************************************
+
+#ifndef EuclideanDistance_HEADER
+#define EuclideanDistance_HEADER
+
+#include <cmath>
+#include <iterator>
+
+namespace Damkjer
+{
+
+//*****************************************************************************
+// FUNCTOR: EuclideanDistance
+//*****************************************************************************
+template<typename PointT, typename ReturnT = PointT::value_type>
+class EuclideanDistance
+{
+public:
+   typedef typename PointT  value_type;
+      //> Add support for "duck" typing by publishing the point type for this
+      //  functor.
+      //<
+
+   typedef typename ReturnT return_type;
+      //> Add support for "duck" typing by publishing the return type for this
+      //  functor.
+      //<
+   
+   //**************************************************************************
+   // EuclideanDistance::operator()
+   //**************************************************************************
+   ReturnT operator()(const PointT& a, const PointT& b) const
+   {
+      // For predictable data fidelity, perform computations with the same
+      // fidelity as the point-type.
+      PointT::value_type sum = 0;
+
+      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
+           ai != a.end() && bi != b.end();
+           ++ai, ++bi)
+      {
+         sum += (*ai - *bi) * (*ai - *bi);
+      }
+
+      // Then static-cast to the desired return type.
+      return static_cast<ReturnT>(std::sqrt(sum));
+   }
+      //> The operator() function performs the distance calculation for
+      //  Metrics functors. Distances between two points, p and q, in
+      //  n-dimensional Euclidean space are calculated as follows:
+      //
+      //    d(p,q)=sqrt(sum{i=0:n}((p[i] - q[i])^2)).
+      //<
+};
+
+}
+
+#endif
Index: Damkjer/Util/SpatialIndexing/Metrics/ManhattanDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/ManhattanDistance.h	(revision 10)
+++ Damkjer/Util/SpatialIndexing/Metrics/ManhattanDistance.h	(revision 10)
@@ -0,0 +1,84 @@
+//*****************************************************************************
+// FILE:        ManhattanDistance.h
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: ManhattanDistance
+//    This class describes a Manhattan distance metric. Distances between two
+//    points, p and q, in n-dimensional Manhattan space are calculated as
+//    follows:
+//
+//    d(p,q)=sum{i=0:n}(|p[i] - q[i]|).
+//
+// LIMITATIONS: ManhattanDistance
+//    The ManhattanDistance functor must operate on an STL container class, or
+//    a class that supports "duck" typing through a public typedef named
+//    "value_type".
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//  2013-JUL-23  K. Damkjer
+//               Modified free functions to functors to allow for "functions
+//               with state" like p-norm.
+//  2013-AUG-09  K. Damkjer
+//               Moved into its own header to improve maintainability.
+//<
+//*****************************************************************************
+
+#ifndef ManhattanDistance_HEADER
+#define ManhattanDistance_HEADER
+
+#include <cmath>
+#include <iterator>
+
+namespace Damkjer
+{
+
+//*****************************************************************************
+// FUNCTOR: ManhattanDistance
+//*****************************************************************************
+template<typename PointT, typename ReturnT = PointT::value_type>
+class ManhattanDistance
+{
+public:
+   typedef typename PointT  value_type;
+      //> Add support for "duck" typing by publishing the point type for this
+      //  functor.
+      //<
+
+   typedef typename ReturnT return_type;
+      //> Add support for "duck" typing by publishing the return type for this
+      //  functor.
+      //<
+   
+   //**************************************************************************
+   // ManhattanDistance::operator()
+   //**************************************************************************
+   ReturnT operator()(const PointT& a, const PointT& b) const
+   {
+      // For predictable data fidelity, perform computations with the same
+      // fidelity as the point-type.
+      PointT::value_type sum = 0;
+      
+      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
+           ai != a.end() && bi != b.end();
+           ++ai, ++bi)
+      {
+         sum += std::abs(*ai - *bi);
+      }
+      
+      // Then static-cast to the desired return type.
+      return static_cast<ReturnT>(sum);
+   }
+      //> The operator() function performs the distance calculation for
+      //  Metrics functors. Distances between two points, p and q, in
+      //  n-dimensional Manhattan space are calculated as follows:
+      //
+      //    d(p,q)=sum{i=0:n}(|p[i] - q[i]|).
+      //<
+};
+
+}
+
+#endif
Index: Damkjer/Util/SpatialIndexing/Metrics/Metrics.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/Metrics.h	(revision 9)
+++ Damkjer/Util/SpatialIndexing/Metrics/Metrics.h	(revision 10)
@@ -4,5 +4,5 @@
 //    Copyright (C)  2012 Kristian Damkjer.
 //
-// DESCRIPTION: 
+// DESCRIPTION: This header is a convenience wrapper for metrics.
 //
 // LIMITATIONS:
@@ -14,4 +14,7 @@
 //               Modified free functions to functors to allow for "functions
 //               with state" like p-norm.
+//  2013-AUG-09  K. Damkjer
+//               Moved individual metrics into their own headers to improve
+//               maintainability.
 //<
 //*****************************************************************************
@@ -20,143 +23,8 @@
 #define Metrics_HEADER
 
-#include <cmath>
-#include <iterator>
-#include <sstream>
-
-#include "damkjerConfig.h"
-
-namespace Damkjer
-{
-//*****************************************************************************
-// FUNCTOR: EuclideanDistance
-//*****************************************************************************
-template<typename PointT, typename ReturnT = double>
-class EuclideanDistance
-{
-public:
-   typedef ReturnT value_type;
-   
-   value_type operator()(const PointT& a, const PointT& b) const
-   {
-      value_type sum = 0;
-
-      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
-           ai != a.end() && bi != b.end();
-           ++ai, ++bi)
-      {
-         sum += (*ai - *bi) * (*ai - *bi);
-      }
-
-      return std::sqrt(sum);
-   }
-};
-
-//*****************************************************************************
-// FUNCTOR: ManhattanDistance
-//*****************************************************************************
-template<typename PointT, typename ReturnT = double>
-class ManhattanDistance
-{
-public:
-   typedef ReturnT value_type;
-
-   value_type operator()(const PointT& a, const PointT& b) const
-   {
-      value_type sum = 0;
-      
-      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
-           ai != a.end() && bi != b.end();
-           ++ai, ++bi)
-      {
-         sum += std::fabs(*ai - *bi);
-      }
-      
-      return sum;
-   }
-};
-
-//*****************************************************************************
-// FUNCTOR: ChebyshevDistance
-//*****************************************************************************
-template<typename PointT, typename ReturnT = double>
-class ChebyshevDistance
-{
-public:
-   typedef ReturnT value_type;
-
-   value_type operator()(const PointT& a, const PointT& b) const
-   {
-      value_type my_max = 0;
-      
-      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
-           ai != a.end() && bi != b.end();
-           ++ai, ++bi)
-      {
-         value_type temp = std::fabs(*ai - *bi);
-         my_max = (temp > my_max) ? temp : my_max;
-      }
-      
-      return my_max;
-   }
-};
-
-//*****************************************************************************
-// FUNCTOR: MinkowskiDistance
-//*****************************************************************************
-template<typename PointT, typename ReturnT = double>
-class MinkowskiDistance
-{
-public:
-   typedef ReturnT value_type;
-
-   MinkowskiDistance() : theP(2){}
-
-   explicit MinkowskiDistance(value_type p) : theP(p)
-   {
-      EXCEPTION_TRY("Damkjer::MinkowskiDistance<PointT, ReturnT>::MinkowskiDistance");
-
-      if (theP < 1)
-      {
-         //***
-         // In released code, there's not a whole lot that the user can do
-         // about this problem. This is a logic error and should be prevented
-         // through appropriate bounds checking on the input prior to
-         // calling the constructor.
-         //***
-         std::ostringstream msg;
-
-         msg << "Context : Defining a Minkowski distance metric.\n"
-             << "Problem : Unable to define a Minkowski distance metric with "
-             << "the requested p-value.\n"
-             << "Cause   : Minkowski distance must be defined with p >= 1 to "
-             << "describe a metric space. p-value requested: " << p << "\n"
-             << "Solution: Restrict p-values to p >= 1 if possible. "
-             << "Otherwise, contact support for assitance.";
-
-         throw DomainError(msg.str(),  MODULE, __FILE__, __LINE__);
-      }
-
-      EXCEPTION_RETHROW;
-   }
-
-   value_type operator()(const PointT& a, const PointT& b) const
-   {
-      value_type sum = 0;
-   
-      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
-           ai != a.end() && bi != b.end();
-           ++ai, ++bi)
-      {
-         sum += std::pow(static_cast<value_type>(std::fabs(*ai - *bi)), theP);
-      }
-   
-      return std::pow(sum, static_cast<value_type>(1./theP));
-   }
-
-protected:
-   value_type theP;
-};
-
-}
+#include "Util/SpatialIndexing/Metrics/EuclideanDistance.h"
+#include "Util/SpatialIndexing/Metrics/ManhattanDistance.h"
+#include "Util/SpatialIndexing/Metrics/ChebyshevDistance.h"
+#include "Util/SpatialIndexing/Metrics/MinkowskiDistance.h"
 
 #endif
Index: Damkjer/Util/SpatialIndexing/Metrics/MinkowskiDistance.h
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/MinkowskiDistance.h	(revision 10)
+++ Damkjer/Util/SpatialIndexing/Metrics/MinkowskiDistance.h	(revision 10)
@@ -0,0 +1,131 @@
+//*****************************************************************************
+// FILE:        MinkowskiDistance.h
+//
+//    Copyright (C)  2012 Kristian Damkjer.
+//
+// DESCRIPTION: MinkowskiDistance
+//    This class describes a Minkowski distance metric. The Minkowski distance
+//    must be defined with a power parameter, p. Distances between two
+//    points, a and b, in n-dimensional Minkowski space are calculated as
+//    follows:
+//
+//    d(a,b)=(sum{i=0:n}((a[i] - b[i])^p))^(1/p).
+//
+// LIMITATIONS: MinkowskiDistance
+//    The MinkowskiDistance functor must operate on an STL container class, or
+//    a class that supports "duck" typing through a public typedef named
+//    "value_type".
+//
+// SOFTWARE HISTORY:
+//> 2012-SEP-11  K. Damkjer
+//               Initial Coding.
+//  2013-JUL-23  K. Damkjer
+//               Modified free functions to functors to allow for "functions
+//               with state" like p-norm.
+//  2013-AUG-09  K. Damkjer
+//               Moved into its own header to improve maintainability.
+//<
+//*****************************************************************************
+
+#ifndef MinkowskiDistance_HEADER
+#define MinkowskiDistance_HEADER
+
+#include <cmath>
+#include <iterator>
+
+#include "damkjerConfig.h"
+
+namespace Damkjer
+{
+
+//*****************************************************************************
+// FUNCTOR: MinkowskiDistance
+//*****************************************************************************
+template<typename PointT, typename ReturnT = PointT::value_type>
+class MinkowskiDistance
+{
+public:
+   typedef typename PointT  value_type;
+      //> Add support for "duck" typing by publishing the point type for this
+      //  functor.
+      //<
+
+   typedef typename ReturnT return_type;
+      //> Add support for "duck" typing by publishing the return type for this
+      //  functor.
+      //<
+   
+   //**************************************************************************
+   // MinkowskiDistance::MinkowskiDistance
+   //**************************************************************************
+   MinkowskiDistance()
+      : theP(static_cast<PointT::value_type>(2))
+   {
+   }
+
+   //**************************************************************************
+   // MinkowskiDistance::MinkowskiDistance
+   //**************************************************************************
+   explicit MinkowskiDistance(typename PointT::value_type p)
+      : theP(static_cast<PointT::value_type>(p))
+   {
+      EXCEPTION_TRY("Damkjer::MinkowskiDistance<PointT, ReturnT>::"
+                    "MinkowskiDistance");
+
+      if (theP < 1)
+      {
+         //***
+         // In released code, there's not a whole lot that the user can do
+         // about this problem. This is a logic error and should be prevented
+         // through appropriate bounds checking on the input prior to
+         // calling the constructor.
+         //***
+         std::ostringstream msg;
+
+         msg << "Error encountered while defining a Minkowski distance "
+             << "metric.\n\n"
+             << "Unable to define a Minkowski distance metric with the "
+             << "requested p-value: " << theP << ". The Minkowski distance "
+             << "must be defined with p >= 1 to describe a metric space.";
+
+         throw DomainError(msg.str(),  MODULE, __FILE__, __LINE__);
+      }
+
+      EXCEPTION_RETHROW;
+   }
+
+   //**************************************************************************
+   // MinkowskiDistance::operator()
+   //**************************************************************************
+   ReturnT operator()(const PointT& a, const PointT& b) const
+   {
+      // For predictable data fidelity, perform computations with the same
+      // fidelity as the point-type.
+      PointT::value_type sum = 0;
+   
+      for (typename PointT::const_iterator ai = a.begin(), bi = b.begin();
+           ai != a.end() && bi != b.end();
+           ++ai, ++bi)
+      {
+         sum += std::pow(std::abs(*ai - *bi), theP);
+      }
+   
+      // Then static-cast to the desired return type.
+      static const typename PointT::value_type ONE =
+         static_cast<PointT::value_type>(1.);
+      return static_cast<ReturnT>(std::pow(sum, ONE/theP));
+   }
+      //> The operator() function performs the distance calculation for
+      //  Metrics functors. Distances between two points, p and q, in
+      //  n-dimensional Minkowski space are calculated as follows:
+      //
+      //    d(a,b)=(sum{i=0:n}((a[i] - b[i])^p))^(1/p).
+      //<
+
+protected:
+   typename PointT::value_type theP;
+};
+
+}
+
+#endif
Index: Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.cpp	(revision 9)
+++ Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.cpp	(revision 10)
@@ -32,4 +32,21 @@
 
 //*****************************************************************************
+// FUNCTION: approxEqual
+//*****************************************************************************
+template<typename T>
+bool approx_equal(T a, T b, double absTol = std::numeric_limits<T>::epsilon())
+{
+   T inMax = (std::abs(a) > std::abs(b))
+             ? std::abs(a)
+             : std::abs(b);
+
+   inMax = (inMax > static_cast<T>(1.0))
+           ? inMax
+           : static_cast<T>(1.0);
+
+   return (std::abs(a - b) <= absTol * inMax);
+}
+
+//*****************************************************************************
 // FUNCTOR: testEuclidean
 //*****************************************************************************
@@ -45,22 +62,4 @@
       //>
       //<
-
-   bool approx_equal(ReturnT a, ReturnT b) const
-   {
-      double absTolI = std::numeric_limits<PointT::value_type>::epsilon();
-      double absTolO = std::numeric_limits<ReturnT>::epsilon();
-
-      double absTol = (absTolI > absTolO) ? absTolI : absTolO;
-
-      ReturnT inMax = (std::abs(a) > std::abs(b))
-                      ? std::abs(a)
-                      : std::abs(b);
-
-      inMax = (inMax > static_cast<ReturnT>(1.0))
-              ? inMax
-              : static_cast<ReturnT>(1.0);
-
-      return (std::abs(a - b) <= absTol * inMax);
-   }
 
    bool operator()(TestCase& test) const
@@ -85,5 +84,7 @@
       //                   0.5
       //***
-      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.5));
+      bool passed =
+         approx_equal(fromMetric, static_cast<ReturnT>(0.5),
+                      std::numeric_limits<PointT::value_type>::epsilon());
 
       test.report() << "Value from Euclidean Metric: " << std::setprecision(12) << fromMetric << "\n"
@@ -284,4 +285,6 @@
       return (std::abs(a - b) <= absTol * inMax);
    }
+      //>
+      //<
 
    bool operator()(TestCase& test) const
Index: Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj
===================================================================
--- Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj	(revision 9)
+++ Damkjer/Util/SpatialIndexing/Metrics/test/TestMetrics.vcxproj	(revision 10)
@@ -98,20 +98,18 @@
     <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
     <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
     <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
     <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
-    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
-  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
-    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
@@ -123,6 +121,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -136,9 +133,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -147,6 +161,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -159,9 +172,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -170,6 +200,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -184,9 +213,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -195,6 +241,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -210,9 +255,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -221,6 +283,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -234,9 +295,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -245,8 +323,7 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>TurnOffAllWarnings</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
+      <WarningLevel>Level4</WarningLevel>
     </ClCompile>
     <Link>
@@ -259,9 +336,26 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
     </PostBuildEvent>
     <CustomBuildStep />
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTree.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.h	(revision 9)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTree.h	(revision 10)
@@ -73,14 +73,14 @@
 // CLASS: VpTree
 //*****************************************************************************
-EXPORT template<typename PointT = std::vector<double>,
-                typename MetricT = EuclideanDistance<PointT> >
+
+EXPORT template<typename MetricT = EuclideanDistance<std::vector<double> > >
 class VpTree
 {
 public:
-   typedef typename PointT::value_type           CoordT;
-   typedef typename MetricT::value_type          DistT;
-   typedef std::size_t                           IndexT;
+   typedef typename MetricT::value_type  PointT;
+   typedef typename MetricT::return_type DistT;
+   typedef std::size_t                   IndexT;
    typedef std::pair<std::deque<IndexT>,
-                     std::deque<DistT> >         SearchResultsT;
+                     std::deque<DistT> > SearchResultsT;
 
    VpTree(const MetricT& metric=MetricT(),
@@ -100,7 +100,5 @@
       //<
    
-   SearchResultsT knn(
-                   const PointT&,
-                   const IndexT&,
+   SearchResultsT knn(const PointT&, const IndexT&,
                    const DistT& limit=std::numeric_limits<DistT>::max()) const;
       //> Perform a k nearest neighbor search on the tree returning the
@@ -108,7 +106,5 @@
       //<
    
-   SearchResultsT rnn(
-           const PointT&,
-           const DistT&) const;
+   SearchResultsT rnn(const PointT&, const DistT&) const;
       //> Perform a fixed radius nearest neighbor search on the tree
       //  returning the indices of and distances to the neighbors in the
@@ -151,7 +147,7 @@
 
    // All of the node-types need access to "theItems".
-   friend class VpTree<PointT, MetricT>::Node;
-   friend class VpTree<PointT, MetricT>::Internal;
-   friend class VpTree<PointT, MetricT>::Leaf;
+   friend class VpTree<MetricT>::Node;
+   friend class VpTree<MetricT>::Internal;
+   friend class VpTree<MetricT>::Leaf;
 
    Node* makeTree(const IndexT&, const IndexT&);
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTree.hpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTree.hpp	(revision 9)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTree.hpp	(revision 10)
@@ -37,6 +37,6 @@
 // CLASS: VpTree::Node
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-class VpTree<PointT, MetricT>::Node
+template<typename MetricT>
+class VpTree<MetricT>::Node
 {
 public:
@@ -69,5 +69,5 @@
 
 protected:
-   VpTree<PointT, MetricT>* theTree;
+   VpTree<MetricT>* theTree;
       //> The tree that this node belongs to.  Included to avoid reallocating
       //  contained element data for each node. As a side effect, nodes
@@ -84,6 +84,6 @@
 // CLASS: VpTree::Internal
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-class VpTree<PointT, MetricT>::Internal : public VpTree<PointT, MetricT>::Node
+template<typename MetricT>
+class VpTree<MetricT>::Internal : public VpTree<MetricT>::Node
 {
 public:
@@ -149,7 +149,6 @@
 // CLASS: VpTree::Leaf
 //*****************************************************************************
-template<typename PointT,
-         typename MetricT>
-class VpTree<PointT, MetricT>::Leaf : public VpTree<PointT, MetricT>::Node
+template<typename MetricT>
+class VpTree<MetricT>::Leaf : public VpTree<MetricT>::Node
 {
 public:
@@ -195,6 +194,6 @@
 // CLASS: VpTree::Item
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-class VpTree<PointT, MetricT>::Item
+template<typename MetricT>
+class VpTree<MetricT>::Item
 {
 public:
@@ -228,6 +227,6 @@
 // VpTree::ResultsCandidate
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-class VpTree<PointT, MetricT>::ResultsCandidate
+template<typename MetricT>
+class VpTree<MetricT>::ResultsCandidate
 {
 public:
@@ -258,7 +257,7 @@
 // VpTree::VpTree
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::VpTree(const MetricT& metric,
-                                       const IndexT& leafCapacity)
+template<typename MetricT>
+inline VpTree<MetricT>::VpTree(const MetricT& metric,
+                               const IndexT& leafCapacity)
    : theRoot(0)
    , theItems()
@@ -271,9 +270,9 @@
 // VpTree::VpTree
 //*****************************************************************************
-template<typename PointT, typename MetricT>
+template<typename MetricT>
 template<typename DatabaseT>
-inline VpTree<PointT, MetricT>::VpTree(const DatabaseT& elems,
-                                       const MetricT& metric,
-                                       const IndexT& leafCapacity)
+inline VpTree<MetricT>::VpTree(const DatabaseT& elems,
+                               const MetricT& metric,
+                               const IndexT& leafCapacity)
    : theRoot(0)
    , theItems(elems.size())
@@ -299,6 +298,6 @@
 // VpTree::~VpTree
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::~VpTree()
+template<typename MetricT>
+inline VpTree<MetricT>::~VpTree()
 {
    delete theRoot;
@@ -309,6 +308,6 @@
 // VpTree::Node::Node
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Node::Node()
+template<typename MetricT>
+inline VpTree<MetricT>::Node::Node()
    : theTree(0)
 {
@@ -318,6 +317,6 @@
 // VpTree::Node::Node
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Node::Node(VpTree* tree)
+template<typename MetricT>
+inline VpTree<MetricT>::Node::Node(VpTree* tree)
    : theTree(tree)
 {
@@ -327,6 +326,6 @@
 // VpTree::Node::~Node
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Node::~Node()
+template<typename MetricT>
+inline VpTree<MetricT>::Node::~Node()
 {
    theTree = 0;
@@ -336,6 +335,6 @@
 // VpTree::Internal::Internal
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Internal::Internal()
+template<typename MetricT>
+inline VpTree<MetricT>::Internal::Internal()
    : Node()
    , theIndex(0)
@@ -352,6 +351,6 @@
 // VpTree::Internal::Internal
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Internal::Internal(VpTree<PointT, MetricT>* tree)
+template<typename MetricT>
+inline VpTree<MetricT>::Internal::Internal(VpTree<MetricT>* tree)
    : Node(tree)
    , theIndex(0)
@@ -368,7 +367,6 @@
 // VpTree::Internal::~Internal
 //*****************************************************************************
-template<typename PointT,
-         typename MetricT>
-inline VpTree<PointT, MetricT>::Internal::~Internal()
+template<typename MetricT>
+inline VpTree<MetricT>::Internal::~Internal()
 {
    delete theInnerBranch;
@@ -381,6 +379,6 @@
 // VpTree::Leaf::Leaf
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Leaf::Leaf()
+template<typename MetricT>
+inline VpTree<MetricT>::Leaf::Leaf()
    : Node()
    , theHead(0)
@@ -392,8 +390,8 @@
 // VpTree::Leaf::Leaf
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Leaf::Leaf(VpTree* tree,
-                                           const IndexT& head,
-                                           const IndexT& tail)
+template<typename MetricT>
+inline VpTree<MetricT>::Leaf::Leaf(VpTree* tree,
+                                   const IndexT& head,
+                                   const IndexT& tail)
    : Node(tree)
    , theHead(head)
@@ -405,6 +403,6 @@
 // VpTree::Item::Item
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::Item::Item()
+template<typename MetricT>
+inline VpTree<MetricT>::Item::Item()
    : theIndex(0)
    , theElement(0)
@@ -416,6 +414,6 @@
 // VpTree::Item::operator<
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline bool VpTree<PointT, MetricT>::Item::operator<(const Item& other) const
+template<typename MetricT>
+inline bool VpTree<MetricT>::Item::operator<(const Item& other) const
 {
    return theDistance < other.theDistance;
@@ -425,8 +423,8 @@
 // VpTree::ResultsCandidate::ResultsCandidate
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline VpTree<PointT, MetricT>::ResultsCandidate::ResultsCandidate(
-                                                      const IndexT& index,
-                                                      const DistT& distance)
+template<typename MetricT>
+inline VpTree<MetricT>::ResultsCandidate::ResultsCandidate(
+                                                         const IndexT& index,
+                                                         const DistT& distance)
    : theIndex(index)
    , theDistance(distance)
@@ -437,6 +435,6 @@
 // VpTree::ResultsCandidate::operator<
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-inline bool VpTree<PointT, MetricT>::ResultsCandidate::operator<(
+template<typename MetricT>
+inline bool VpTree<MetricT>::ResultsCandidate::operator<(
                                            const ResultsCandidate& other) const
 {
@@ -447,8 +445,8 @@
 // VpTree::randomSample
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-std::set<typename VpTree<PointT, MetricT>::IndexT>
-VpTree<PointT, MetricT>::randomSample(const IndexT& start,
-                                      const IndexT& stop) const
+template<typename MetricT>
+std::set<typename VpTree<MetricT>::IndexT>
+VpTree<MetricT>::randomSample(const IndexT& start,
+                              const IndexT& stop) const
 {
    //***
@@ -518,8 +516,8 @@
 // VpTree::selectVp
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-typename VpTree<PointT, MetricT>::IndexT
-VpTree<PointT, MetricT>::selectVp(const IndexT& start,
-                                  const IndexT& stop) const
+template<typename MetricT>
+typename VpTree<MetricT>::IndexT
+VpTree<MetricT>::selectVp(const IndexT& start,
+                          const IndexT& stop) const
 {
    //***
@@ -611,7 +609,7 @@
 // VpTree::makeTree
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-typename VpTree<PointT, MetricT>::Node*
-VpTree<PointT, MetricT>::makeTree(const IndexT& start, const IndexT& stop)
+template<typename MetricT>
+typename VpTree<MetricT>::Node*
+VpTree<MetricT>::makeTree(const IndexT& start, const IndexT& stop)
 {
    if (stop <= start) return 0;
@@ -705,9 +703,9 @@
 // VpTree::knn
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-typename VpTree<PointT, MetricT>::SearchResultsT
-VpTree<PointT, MetricT>::knn(const PointT& query,
-                             const IndexT& k,
-                             const DistT& limit) const
+template<typename MetricT>
+typename VpTree<MetricT>::SearchResultsT
+VpTree<MetricT>::knn(const PointT& query,
+                     const IndexT& k,
+                     const DistT& limit) const
 {
    ResultsSetT candidates;
@@ -736,11 +734,10 @@
 // VpTree::Internal::knn
 //*****************************************************************************
-template<typename PointT, typename MetricT>
+template<typename MetricT>
 void
-VpTree<PointT, MetricT>::Internal::knn(
-        const PointT& query,
-        const IndexT& k,
-        ResultsSetT& candidates,
-        DistT& kth_closest) const
+VpTree<MetricT>::Internal::knn(const PointT& query,
+                               const IndexT& k,
+                               ResultsSetT& candidates,
+                               DistT& kth_closest) const
 {
    if (!(theTree)) return;
@@ -814,11 +811,10 @@
 // VpTree::Leaf::knn
 //*****************************************************************************
-template<typename PointT, typename MetricT>
+template<typename MetricT>
 void
-VpTree<PointT, MetricT>::Leaf::knn(
-        const PointT& query,
-        const IndexT& k,
-        ResultsSetT& candidates,
-        DistT& kth_closest) const
+VpTree<MetricT>::Leaf::knn(const PointT& query,
+                           const IndexT& k,
+                           ResultsSetT& candidates,
+                           DistT& kth_closest) const
 {
    if (!(theTree)) return;
@@ -851,8 +847,8 @@
 // VpTree::rnn
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-typename VpTree<PointT, MetricT>::SearchResultsT
-VpTree<PointT, MetricT>::rnn(const PointT& query,
-                             const DistT& range) const
+template<typename MetricT>
+typename VpTree<MetricT>::SearchResultsT
+VpTree<MetricT>::rnn(const PointT& query,
+                     const DistT& range) const
 {
    ResultsSetT candidates;
@@ -879,8 +875,8 @@
 // VpTree::Internal::rnn
 //*****************************************************************************
-template<typename PointT, typename MetricT>
-void VpTree<PointT, MetricT>::Internal::rnn(const PointT& query,
-                                            const DistT& range,
-                                            ResultsSetT& candidates) const
+template<typename MetricT>
+void VpTree<MetricT>::Internal::rnn(const PointT& query,
+                                    const DistT& range,
+                                    ResultsSetT& candidates) const
 {
    if (!(theTree)) return;
@@ -937,11 +933,10 @@
 
 //*****************************************************************************
-// Leaf::rnn
-//*****************************************************************************
-template<typename PointT, typename MetricT>
-void VpTree<PointT, MetricT>::Leaf::rnn(
-        const PointT& query,
-        const DistT& range,
-        ResultsSetT& candidates) const
+// VpTree::Leaf::rnn
+//*****************************************************************************
+template<typename MetricT>
+void VpTree<MetricT>::Leaf::rnn(const PointT& query,
+                                const DistT& range,
+                                ResultsSetT& candidates) const
 {
    if (!(theTree)) return;
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.cpp	(revision 9)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.cpp	(revision 10)
@@ -48,13 +48,14 @@
 namespace Damkjer
 {
-typedef std::vector<double>                      VPTAPI_PointT;
-typedef std::deque<VPTAPI_PointT>                VPTAPI_PointSetT;
-typedef MinkowskiDistance<VPTAPI_PointT, double> VPTAPI_MetricT;
-typedef VpTree<VPTAPI_PointT, VPTAPI_MetricT>    VPTAPI_TreeT;
+typedef double                           VPTAPI_CoordT;
+typedef std::vector<VPTAPI_CoordT>       VPTAPI_PointT;
+typedef std::deque<VPTAPI_PointT>        VPTAPI_PointSetT;
+typedef EuclideanDistance<VPTAPI_PointT> VPTAPI_MetricT;
+typedef VpTree<VPTAPI_MetricT>           VPTAPI_TreeT;
 
 //*****************************************************************************
 // FUNCTION: vpTreeCreate
 //*****************************************************************************
-void vpTreeCreate(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]);
+void vpTreeCreate(int, mxArray**, int, const mxArray**);
 //> This function provides the interface to the VpTree contructors. New objects
 //  are wrapped by the ClassHandle template to ensure that locks are managed
@@ -73,5 +74,5 @@
 // FUNCTION: vpTreeDestroy
 //*****************************************************************************
-void vpTreeDestroy(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]);
+void vpTreeDestroy(int, const mxArray**);
 //> This function provides the interface to the VpTree ClassHandle wrapper 
 //  destructor. Destroying objects through the ClassHandle wrapper ensures
@@ -89,5 +90,5 @@
 // FUNCTION: vpTreeFRANN
 //*****************************************************************************
-void vpTreeFRANN(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]);
+void vpTreeFRANN(int nlhs, mxArray**, int nrhs, const mxArray**);
 //> This function provides the interface to the VpTree fixed-radius all nearest
 //  neighbor (FRANN) search.
@@ -102,5 +103,5 @@
 // FUNCTION: vpTreeKANN
 //*****************************************************************************
-void vpTreeKANN(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]);
+void vpTreeKANN(int nlhs, mxArray**, int nrhs, const mxArray**);
 //> This function provides the interface to the VpTree k all nearest neighbor
 //  (KANN) search.
@@ -119,5 +120,5 @@
 //<
 //*****************************************************************************
-void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+void mexFunction(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
 {
    //***
@@ -147,6 +148,12 @@
    }
    else if (!strcmp("destroy", operation))
-   {  
-      Damkjer::vpTreeDestroy(nlhs, plhs, nrhs, prhs);
+   {
+      if (nlhs != 0)
+      {
+      mexErrMsgIdAndTxt("Damkjer:VpTreeAPI:nargout",
+                        "Nothing to return.");
+      }
+
+      Damkjer::vpTreeDestroy(nrhs, prhs);
    }   
    else if (!strcmp("search_frann", operation))
@@ -233,5 +240,5 @@
       for (mwSize dim = dims; dim --> 0;)
       {
-         pointData[elem][dim]=(VPTAPI_TreeT::CoordT)(data[elem*dims+dim]);
+         pointData[elem][dim]=(VPTAPI_CoordT)(data[elem*dims+dim]);
       }
    }
@@ -243,5 +250,5 @@
    try
    {
-      plhs[0] = ptrAsMat(new VPTAPI_TreeT(pointData, VPTAPI_MetricT(3.0)));
+      plhs[0] = ptrAsMat(new VPTAPI_TreeT(pointData, VPTAPI_MetricT()));
    }
    catch (const std::exception& e)
@@ -254,5 +261,5 @@
 // FUNCTION: vpTreeDestroy
 //*****************************************************************************
-void vpTreeDestroy(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+void vpTreeDestroy(int nrhs, const mxArray** prhs)
 {
    //***
@@ -275,5 +282,5 @@
 // FUNCTION: vpTreeFRANN
 //*****************************************************************************
-void vpTreeFRANN(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+void vpTreeFRANN(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
 {
    //***
@@ -349,5 +356,5 @@
       for (mwIndex dim = dims; dim --> 0;)
       {
-         queryData[elem][dim]=(VPTAPI_TreeT::CoordT)(data[elem*dims+dim]);
+         queryData[elem][dim]=(VPTAPI_CoordT)(data[elem*dims+dim]);
       }
    }
@@ -434,5 +441,4 @@
       mwSize neighbors = results[q].first.size();
 
-      mxArray* neighbor_idxs = nbr_idxs[q];
       mwIndex* idxs = point_idxs[q];
       
@@ -486,5 +492,4 @@
          mwSize neighbors = results[q].first.size();
          
-         mxArray* neighbor_dists = nbr_dists[q];
          double* dists = point_dists[q];
 
@@ -511,5 +516,5 @@
 // FUNCTION: vpTreeKANN
 //*****************************************************************************
-void vpTreeKANN(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+void vpTreeKANN(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs)
 {
    //***
@@ -594,5 +599,5 @@
       for (mwIndex dim = dims; dim --> 0;)
       {
-         queryData[elem][dim]=(VPTAPI_TreeT::CoordT)(data[elem*dims+dim]);
+         queryData[elem][dim]=(VPTAPI_CoordT)(data[elem*dims+dim]);
       }
    }
@@ -682,5 +687,4 @@
       mwSize neighbors = results[q].first.size();
 
-      mxArray* neighbor_idxs = nbr_idxs[q];
       mwIndex* idxs = point_idxs[q];
       
@@ -734,5 +738,4 @@
          mwSize neighbors = results[q].first.size();
          
-         mxArray* neighbor_dists = nbr_dists[q];
          double* dists = point_dists[q];
 
Index: Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.vcxproj
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.vcxproj	(revision 9)
+++ Damkjer/Util/SpatialIndexing/VpTree/VpTreeAPI.vcxproj	(revision 10)
@@ -120,6 +120,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -136,6 +135,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -151,6 +149,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -168,6 +165,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -186,6 +182,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -202,6 +197,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>TurnOffAllWarnings</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
Index: Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.cpp	(revision 10)
+++ Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.cpp	(revision 10)
@@ -0,0 +1,365 @@
+//*****************************************************************************
+// FILE:        TestVpTree.cpp
+//
+//    Copyright (C)  2013 Kristian Damkjer.
+//
+// DESCRIPTION: TestVpTree
+//
+//    See TestVpTree header for detailed description.
+//
+// LIMITATIONS: 
+//
+// SOFTWARE HISTORY:
+//> 2012-JUL-24  K. Damkjer
+//               Initial Coding.
+//<
+//*****************************************************************************
+
+#include <iomanip>
+#include <sstream>
+#include <limits>
+#include <cmath>
+#include <vector>
+#include <typeinfo>
+
+#include "damkjerConfig.h"
+#include "TestVpTree.h"
+#include "Util/SpatialIndexing/Metrics/Metrics.h"
+#include "Util/SpatialIndexing/VpTree/VpTree.h"
+#include "Util/Streams/BlockIndent.h"
+
+namespace Damkjer
+{
+
+//*****************************************************************************
+// FUNCTOR: testEuclidean
+//*****************************************************************************
+template <typename MetricT>
+class testKnn : public TestCase::TestStep
+{
+public:
+   testKnn()
+      : TestCase::TestStep(typeid(VpTree<MetricT>).name())
+   {
+   }
+      //>
+      //<
+
+   bool operator()(TestCase& test) const
+   {
+      EXCEPTION_TRY("Damkjer::testEuclidean::operator(TestCase&)");
+
+      typedef typename MetricT::value_type PointT;
+
+      std::deque<PointT> theData;
+      
+      for (unsigned int row = 0; row < 10; ++row)
+      {
+         for (unsigned int col = 0; col < 10; ++col)
+         {
+            PointT pt;
+            pt.push_back(static_cast<PointT::value_type>(row));
+            pt.push_back(static_cast<PointT::value_type>(col));
+            theData.push_back(pt);
+         }
+      }
+
+      typedef VpTree<MetricT> VpTreeT;
+
+      VpTreeT theDatabase(theData);
+      VpTreeT::SearchResultsT results = theDatabase.knn(theData[45], 20);
+
+      std::deque<std::size_t> idxs = results.first;
+      std::deque<MetricT::return_type> dists = results.second;
+
+      test.report() << "idxs = {";
+
+      if (!idxs.empty())
+      {
+         test.report() << idxs[0];
+         for (unsigned int idx = 1; idx < idxs.size(); ++idx)
+         {
+            test.report() << ", " << idxs[idx];
+         }
+      }
+
+      test.report() << "}\n";
+
+      test.report() << "dists = {";
+
+      if (!idxs.empty())
+      {
+         test.report() << dists[0];
+         for (unsigned int idx = 1; idx < idxs.size(); ++idx)
+         {
+            test.report() << ", " << dists[idx];
+         }
+      }
+
+      test.report() << "}\n";
+      return true;
+
+      EXCEPTION_RETHROW;
+   }
+      //> The parentheses operator represents the body of the test step
+      //  function. It will perform the necessary evaluation and return true if
+      //  and only if the test passes.
+      //<
+
+private:
+};
+
+////*****************************************************************************
+//// FUNCTOR: testManhattan
+////*****************************************************************************
+//template <typename PointT, typename ReturnT>
+//class testManhattan : public TestCase::TestStep
+//{
+//public:
+//   testManhattan()
+//      : TestCase::TestStep(typeid(theMetric).name())
+//      , theMetric()
+//   {
+//   }
+//      //>
+//      //<
+//
+//   bool approx_equal(ReturnT a, ReturnT b) const
+//   {
+//      double absTolI = std::numeric_limits<PointT::value_type>::epsilon();
+//      double absTolO = std::numeric_limits<ReturnT>::epsilon();
+//
+//      double absTol = (absTolI > absTolO) ? absTolI : absTolO;
+//
+//      ReturnT inMax = (std::abs(a) > std::abs(b))
+//                      ? std::abs(a)
+//                      : std::abs(b);
+//
+//      inMax = (inMax > static_cast<ReturnT>(1.0))
+//              ? inMax
+//              : static_cast<ReturnT>(1.0);
+//
+//      return (std::abs(a - b) <= absTol * inMax);
+//   }
+//
+//   bool operator()(TestCase& test) const
+//   {
+//      EXCEPTION_TRY("Damkjer::testManhattan::operator(TestCase&)");
+//
+//      PointT a;
+//      a.push_back(static_cast<PointT::value_type>(0.3));
+//      a.push_back(static_cast<PointT::value_type>(0.5));
+//
+//      PointT b;
+//      b.push_back(static_cast<PointT::value_type>(0.7));
+//      b.push_back(static_cast<PointT::value_type>(0.8));
+//
+//      ReturnT fromMetric = theMetric(a, b);
+//
+//      //***
+//      // Expected value is |0.7-0.3|+|0.8-0.5|
+//      //                   0.4+0.3
+//      //                   0.7
+//      //***
+//      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.7));
+//
+//      test.report() << "Value from Euclidean Metric: " << std::setprecision(12) << fromMetric << "\n"
+//                    << "Expected result            : "
+//                    << std::setprecision(12) << static_cast<ReturnT>(0.7) << "\n";
+//
+//      return passed;
+//
+//      EXCEPTION_RETHROW;
+//   }
+//      //> The parentheses operator represents the body of the test step
+//      //  function. It will perform the necessary evaluation and return true if
+//      //  and only if the test passes.
+//      //<
+//
+//private:
+//   ManhattanDistance<PointT,ReturnT> theMetric;
+//      //>
+//      //<
+//};
+//
+////*****************************************************************************
+//// FUNCTOR: testChebyshev
+////*****************************************************************************
+//template <typename PointT, typename ReturnT>
+//class testChebyshev : public TestCase::TestStep
+//{
+//public:
+//   testChebyshev()
+//      : TestCase::TestStep(typeid(theMetric).name())
+//      , theMetric()
+//   {
+//   }
+//      //>
+//      //<
+//
+//   bool approx_equal(ReturnT a, ReturnT b) const
+//   {
+//      double absTolI = std::numeric_limits<PointT::value_type>::epsilon();
+//      double absTolO = std::numeric_limits<ReturnT>::epsilon();
+//
+//      double absTol = (absTolI > absTolO) ? absTolI : absTolO;
+//
+//      ReturnT inMax = (std::abs(a) > std::abs(b))
+//                      ? std::abs(a)
+//                      : std::abs(b);
+//
+//      inMax = (inMax > static_cast<ReturnT>(1.0))
+//              ? inMax
+//              : static_cast<ReturnT>(1.0);
+//
+//      return (std::abs(a - b) <= absTol * inMax);
+//   }
+//
+//   bool operator()(TestCase& test) const
+//   {
+//      EXCEPTION_TRY("Damkjer::testChebyshev::operator(TestCase&)");
+//
+//      PointT a;
+//      a.push_back(static_cast<PointT::value_type>(0.3));
+//      a.push_back(static_cast<PointT::value_type>(0.5));
+//
+//      PointT b;
+//      b.push_back(static_cast<PointT::value_type>(0.7));
+//      b.push_back(static_cast<PointT::value_type>(0.8));
+//
+//      ReturnT fromMetric = theMetric(a, b);
+//
+//      //***
+//      // Expected value is max(|0.7-0.3|,|0.8-0.5|)
+//      //                   max(0.4,0.3)
+//      //                   0.4
+//      //***
+//      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.4));
+//
+//      test.report() << "Value from Euclidean Metric: " << std::setprecision(12) << fromMetric << "\n"
+//                    << "Expected result            : "
+//                    << std::setprecision(12) << static_cast<ReturnT>(0.4) << "\n";
+//
+//      return passed;
+//
+//      EXCEPTION_RETHROW;
+//   }
+//      //> The parentheses operator represents the body of the test step
+//      //  function. It will perform the necessary evaluation and return true if
+//      //  and only if the test passes.
+//      //<
+//
+//private:
+//   ChebyshevDistance<PointT,ReturnT> theMetric;
+//      //>
+//      //<
+//};
+//
+////*****************************************************************************
+//// FUNCTOR: testMinkowski
+////*****************************************************************************
+//template <typename PointT, typename ReturnT>
+//class testMinkowski : public TestCase::TestStep
+//{
+//public:
+//   testMinkowski()
+//      : TestCase::TestStep(typeid(theMetric).name())
+//      , theMetric(2)
+//   {
+//   }
+//      //>
+//      //<
+//
+//   bool approx_equal(ReturnT a, ReturnT b) const
+//   {
+//      double absTolI = std::numeric_limits<PointT::value_type>::epsilon();
+//      double absTolO = std::numeric_limits<ReturnT>::epsilon();
+//
+//      double absTol = (absTolI > absTolO) ? absTolI : absTolO;
+//
+//      ReturnT inMax = (std::abs(a) > std::abs(b))
+//                      ? std::abs(a)
+//                      : std::abs(b);
+//
+//      inMax = (inMax > static_cast<ReturnT>(1.0))
+//              ? inMax
+//              : static_cast<ReturnT>(1.0);
+//
+//      return (std::abs(a - b) <= absTol * inMax);
+//   }
+//
+//   bool operator()(TestCase& test) const
+//   {
+//      EXCEPTION_TRY("Damkjer::testMinkowski::operator(TestCase&)");
+//
+//      PointT a;
+//      a.push_back(static_cast<PointT::value_type>(0.3));
+//      a.push_back(static_cast<PointT::value_type>(0.5));
+//
+//      PointT b;
+//      b.push_back(static_cast<PointT::value_type>(0.7));
+//      b.push_back(static_cast<PointT::value_type>(0.8));
+//
+//      ReturnT fromMetric = theMetric(a, b);
+//
+//      //***
+//      // Expected value is sqrt((0.7-0.3)*(0.7-0.3)+(0.8-0.5)*(0.8-0.5))
+//      //                   sqrt(0.4*0.4+0.3*0.3)
+//      //                   sqrt(0.16+0.09)
+//      //                   sqrt(0.25)
+//      //                   0.5
+//      //***
+//      bool passed = approx_equal(fromMetric, static_cast<ReturnT>(0.5));
+//
+//      test.report() << "Value from Euclidean Metric: " << std::setprecision(12) << fromMetric << "\n"
+//                    << "Expected result            : "
+//                    << std::setprecision(12) << static_cast<ReturnT>(0.5) << "\n";
+//
+//      return passed;
+//
+//      EXCEPTION_RETHROW;
+//   }
+//      //> The parentheses operator represents the body of the test step
+//      //  function. It will perform the necessary evaluation and return true if
+//      //  and only if the test passes.
+//      //<
+//
+//private:
+//   MinkowskiDistance<PointT,ReturnT> theMetric;
+//      //>
+//      //<
+//};
+//
+//*****************************************************************************
+// CONSTRUCTOR: TestVpTree::TestVpTree(int, char**)
+//*****************************************************************************
+TestVpTree::TestVpTree(int argc, char** argv)
+   : TestCase(argc, argv,
+              "VpTree: Vantage Point Tree Test Suite",
+              "VpTree_01",
+              "This test case tests the vantage point tree data structure.")
+{
+   EXCEPTION_TRY("Damkjer::TestVpTree::TestVpTree(int, char**)");
+
+   typedef std::vector<float>  FltPtT;
+   typedef std::vector<double> DblPtT;
+
+   typedef EuclideanDistance<FltPtT> EuclidFltT;
+   typedef EuclideanDistance<DblPtT> EuclidDblT;
+   typedef ManhattanDistance<FltPtT> ManhattanFltT;
+   typedef ManhattanDistance<DblPtT> ManhattanDblT;
+   typedef ChebyshevDistance<FltPtT> ChebyshevFltT;
+   typedef ChebyshevDistance<DblPtT> ChebyshevDblT;
+   typedef MinkowskiDistance<DblPtT> MinkowskiDblT;
+
+   registerStep(new testKnn<EuclidFltT>());
+   registerStep(new testKnn<EuclidDblT>());
+   registerStep(new testKnn<ManhattanFltT>());
+   registerStep(new testKnn<ManhattanDblT>());
+   registerStep(new testKnn<ChebyshevFltT>());
+   registerStep(new testKnn<ChebyshevDblT>());
+
+   EXCEPTION_RETHROW;
+}
+
+}
Index: Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.h
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.h	(revision 10)
+++ Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.h	(revision 10)
@@ -0,0 +1,35 @@
+//*****************************************************************************
+// FILE:        TestVpTree.h
+//
+//    Copyright (C)  2013 Kristian Damkjer.
+//
+// DESCRIPTION: 
+//
+// LIMITATIONS: 
+//
+// SOFTWARE HISTORY:
+//> 2012-AUG-06  K. Damkjer
+//               Initial Coding.
+//<
+//*****************************************************************************
+
+#ifndef TestVpTree_HEADER
+#define TestVpTree_HEADER
+
+#include "Util/UtilAPI.h"
+#include "Util/UnitTest/TestCase.h"
+
+namespace Damkjer
+{
+
+class TestVpTree : public TestCase
+{
+public:
+   TestVpTree(int, char**);
+      //>
+      //<
+};
+
+}
+
+#endif
Index: Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj	(revision 10)
+++ Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj	(revision 10)
@@ -0,0 +1,367 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="OpenMP|Win32">
+      <Configuration>OpenMP</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="OpenMP|x64">
+      <Configuration>OpenMP</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\Util.vcxproj">
+      <Project>{20fe2624-c64f-d61a-bd8f-1725a8e68a42}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="TestVpTree.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="TestVpTree.cpp" />
+    <ClCompile Include="test_VpTree.cpp" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <Keyword>Win32Proj</Keyword>
+    <ProjectName>test_VpTree</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <CustomBuildAfterTargets>call $(TargetPath)</CustomBuildAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
+    <OutDir>$(SolutionDir)test-bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <TargetMachine>MachineX86</TargetMachine>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <TargetMachine>MachineX86</TargetMachine>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|Win32'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <OpenMPSupport>true</OpenMPSupport>
+    </ClCompile>
+    <Link>
+      <TargetMachine>MachineX86</TargetMachine>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='OpenMP|x64'">
+    <ClCompile>
+      <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <OpenMPSupport>true</OpenMPSupport>
+      <RuntimeTypeInfo>true</RuntimeTypeInfo>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>libmx.lib;libmat.lib;libmex.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Platform)\$(Configuration)\;$(MATLAB_R2012A)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <SubSystem>Console</SubSystem>
+    </Link>
+    <PostBuildEvent>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+    </PostBuildEvent>
+    <CustomBuildStep />
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
Index: Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj.filters
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj.filters	(revision 10)
+++ Damkjer/Util/SpatialIndexing/VpTree/test/TestVpTree.vcxproj.filters	(revision 10)
@@ -0,0 +1,26 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4010ed24-e68d-4e6e-97b0-8b8bb335aa86}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{0c039d31-de79-478b-9dc5-c3378145e52a}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="TestVpTree.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="test_VpTree.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="TestVpTree.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
Index: Damkjer/Util/SpatialIndexing/VpTree/test/test_VpTree.cpp
===================================================================
--- Damkjer/Util/SpatialIndexing/VpTree/test/test_VpTree.cpp	(revision 10)
+++ Damkjer/Util/SpatialIndexing/VpTree/test/test_VpTree.cpp	(revision 10)
@@ -0,0 +1,33 @@
+//*****************************************************************************
+// FILE:        test_VpTree.cpp
+//
+//    Copyright (C)  2013 Kristian Damkjer.
+//
+// DESCRIPTION: 
+//
+// LIMITATIONS: 
+//
+// SOFTWARE HISTORY:
+//> 2012-AUG-06  K. Damkjer
+//               Initial Coding.
+//<
+//*****************************************************************************
+
+#include "damkjerConfig.h"
+#include "TestVpTree.h"
+
+using namespace Damkjer;
+
+//*****************************************************************************
+// main
+//*****************************************************************************
+int main(int argc, char** argv)
+{
+   EXCEPTION_TRY("main(int, char**)");
+
+   TestVpTree driver(argc, argv);
+
+   return driver.execute();
+
+   EXCEPTION_CATCHALL;
+}
Index: Damkjer/Util/Streams/BlockIndent.cpp
===================================================================
--- Damkjer/Util/Streams/BlockIndent.cpp	(revision 9)
+++ Damkjer/Util/Streams/BlockIndent.cpp	(revision 10)
@@ -38,5 +38,4 @@
    // Blocks should always start on a new line, but we don't always need a new
    // line to start a block. What to do?
-   output << "\n";
    output.iword(INDENT_INDEX) += theIndent;
    INDENTS.push_front(theIndent);
@@ -52,5 +51,5 @@
    // Blocks should always end with a new line, but we don't always need a new
    // line to end a block. What to do?
-   output << "\n";
+//   output << "\n";
 
    if (!blockIndent::INDENTS.empty())
Index: Damkjer/Util/Streams/BlockIndent.h
===================================================================
--- Damkjer/Util/Streams/BlockIndent.h	(revision 9)
+++ Damkjer/Util/Streams/BlockIndent.h	(revision 10)
@@ -60,4 +60,6 @@
 
 private:
+   blockIndent(const blockIndent&);
+   blockIndent& operator=(const blockIndent&);
 
    friend Util_API std::ostream& endBlock(std::ostream&);
Index: Damkjer/Util/Streams/FormatFilter.cpp
===================================================================
--- Damkjer/Util/Streams/FormatFilter.cpp	(revision 9)
+++ Damkjer/Util/Streams/FormatFilter.cpp	(revision 10)
@@ -92,5 +92,5 @@
       //***
       
-      theBuffer += c;
+      theBuffer += static_cast<char_type>(c);
       theCount = 0;
       theDestinationBuf->sputn(prefix, blockIndent);
@@ -106,5 +106,5 @@
       //***
 
-      return theDestinationBuf->sputc(c);
+      return theDestinationBuf->sputc(static_cast<char_type>(c));
 
    case '\t':
@@ -114,5 +114,5 @@
       //***
 
-      theBuffer += c;
+      theBuffer += static_cast<char_type>(c);
       theCount += TAB_WIDTH - theCount % TAB_WIDTH;
 
@@ -158,5 +158,5 @@
       }
 
-      theBuffer += c;
+      theBuffer += static_cast<char_type>(c);
       ++theCount;
 
Index: Damkjer/Util/Streams/FormatFilter.h
===================================================================
--- Damkjer/Util/Streams/FormatFilter.h	(revision 9)
+++ Damkjer/Util/Streams/FormatFilter.h	(revision 10)
@@ -42,4 +42,7 @@
 
 private:
+   FormatFilter(const FormatFilter&);
+   FormatFilter& operator=(const FormatFilter&);
+
    static const int LINE_WIDTH_INDEX;
       //>
Index: Damkjer/Util/UnitTest/TestCase.cpp
===================================================================
--- Damkjer/Util/UnitTest/TestCase.cpp	(revision 9)
+++ Damkjer/Util/UnitTest/TestCase.cpp	(revision 10)
@@ -65,11 +65,8 @@
    std::ostringstream msg;
 
-   msg << "Context : Retrieving argument vector (argv) element.\n"
-       << "Problem : Unable to access requested vector element.\n"
-       << "Cause   : Requested element, " << i << ", is out of bounds: [0, "
-       << theArgc << ").\n"
-       << "Solution: Restrict argument vector requests to element indices "
-       << "that are strictly less than the argument count if possible. "
-       << "Otherwise, contact support for assitance.";
+   msg << "Error encountered while retrieving an argument vector (argv) "
+       << "element.\n\n"
+       << "Unable to access the requested element (" << i << ") because it is "
+       << "outside the valid bounds of [0, " << theArgc << ").";
 
    throw OutOfRange(msg.str(),  MODULE, __FILE__, __LINE__);
@@ -149,4 +146,6 @@
        << (elapsed-iElapsed+(iElapsed % 60));
    
+   msg.fill(cfill);
+
    std::time_t now = std::time(NULL);
 
@@ -179,5 +178,5 @@
       testPassed = (*(theSteps[i]))(*this);
       theReportStream << "\n" << ((testPassed) ? "[PASSED]" : "[FAILED]")
-                      << endBlock;
+                      << "\n" << endBlock;
 
       if (testPassed) ++passedTests;
Index: Damkjer/Util/UnitTest/TestCase.h
===================================================================
--- Damkjer/Util/UnitTest/TestCase.h	(revision 9)
+++ Damkjer/Util/UnitTest/TestCase.h	(revision 10)
@@ -18,4 +18,11 @@
 
 #if ( _WIN32 || _WIN64 )
+   #if NOMINMAX
+#include <windows.h>
+   #else
+      #define NOMINMAX
+#include <windows.h>
+      #undef NOMINMAX
+   #endif
 #include <windows.h>
 #elif ( __linux || __unix || __posix )
Index: Damkjer/Util/UnitTest/test/TestUnitTest.vcxproj
===================================================================
--- Damkjer/Util/UnitTest/test/TestUnitTest.vcxproj	(revision 9)
+++ Damkjer/Util/UnitTest/test/TestUnitTest.vcxproj	(revision 10)
@@ -118,6 +118,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -131,9 +130,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -142,6 +160,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -154,9 +171,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -165,6 +201,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -179,9 +214,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -190,6 +244,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -205,9 +258,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -216,6 +288,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -229,9 +300,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -240,6 +330,5 @@
       <PreprocessorDefinitions>_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>TurnOffAllWarnings</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)\includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -254,9 +343,28 @@
     </Link>
     <PostBuildEvent>
-      <Command>SETLOCAL
-SET PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
-call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
-ENDLOCAL</Command>
-      <Message>Run Unit Test</Message>
+      <Command>setlocal
+
+@rem Perform the unit test
+echo Running Unit Test: $(ProjectName)
+set PATH=%PATH%;$(SolutionDir)lib\$(Platform)\$(Configuration)\
+call $(TargetPath) &gt; $(TargetDir)$(TargetName).txt 2&gt;&amp;1
+
+@rem Check for success
+if errorlevel 1 goto UnitTestFailed
+
+goto UnitTestPassed
+
+:UnitTestFailed
+echo [FAILED] - Unit Test: $(ProjectName)
+exit 1
+
+:UnitTestPassed
+echo [PASSED] - Unit Test: $(ProjectName)
+exit 0
+
+endlocal
+</Command>
+      <Message>
+      </Message>
     </PostBuildEvent>
   </ItemDefinitionGroup>
Index: Damkjer/Util/Util.vcxproj
===================================================================
--- Damkjer/Util/Util.vcxproj	(revision 9)
+++ Damkjer/Util/Util.vcxproj	(revision 10)
@@ -32,5 +32,9 @@
     <ClInclude Include="MATLAB\ClassHandle.h" />
     <ClInclude Include="MATLAB\ClassHandle.hpp" />
+    <ClInclude Include="SpatialIndexing\Metrics\ChebyshevDistance.h" />
+    <ClInclude Include="SpatialIndexing\Metrics\EuclideanDistance.h" />
+    <ClInclude Include="SpatialIndexing\Metrics\ManhattanDistance.h" />
     <ClInclude Include="SpatialIndexing\Metrics\Metrics.h" />
+    <ClInclude Include="SpatialIndexing\Metrics\MinkowskiDistance.h" />
     <ClInclude Include="SpatialIndexing\VpTree\VpTree.h" />
     <ClInclude Include="SpatialIndexing\VpTree\VpTree.hpp" />
@@ -126,6 +130,5 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -142,6 +145,5 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;_DEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -157,6 +159,5 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -174,6 +175,5 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
@@ -192,6 +192,5 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <WarningLevel>Level4</WarningLevel>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
@@ -208,8 +207,8 @@
       <PreprocessorDefinitions>Util_DLL;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN64;NDEBUG;_WINDOWS;TEMPLATE_INCLUSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>$(SolutionDir);$(MATLAB_R2012A)\extern\include;$(SolutionDir)includes\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <OpenMPSupport>true</OpenMPSupport>
-      <WarningLevel>TurnOffAllWarnings</WarningLevel>
+      <WarningLevel>Level4</WarningLevel>
+      <RuntimeTypeInfo>true</RuntimeTypeInfo>
     </ClCompile>
     <Link>
Index: Damkjer/Util/Util.vcxproj.filters
===================================================================
--- Damkjer/Util/Util.vcxproj.filters	(revision 9)
+++ Damkjer/Util/Util.vcxproj.filters	(revision 10)
@@ -52,4 +52,16 @@
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="SpatialIndexing\Metrics\EuclideanDistance.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SpatialIndexing\Metrics\ChebyshevDistance.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SpatialIndexing\Metrics\ManhattanDistance.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SpatialIndexing\Metrics\MinkowskiDistance.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
