From 39ceba409b4b0295f0c70872cf2592503b54eba2 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Mon, 7 Dec 2009 19:10:11 +0000 Subject: Various improvements to the docs for unsupported. * Enable compilation of examples for unsupported. * Fix use of std::vector in BVH example. * Add an example for the matrix exponential. * Bug fixes in unsupported/doc/{examples,snippets}/CMakeLists.txt . --- unsupported/doc/CMakeLists.txt | 2 ++ unsupported/doc/examples/BVH_Example.cpp | 4 +++- unsupported/doc/examples/CMakeLists.txt | 2 +- unsupported/doc/examples/MatrixExponential.cpp | 18 ++++++++++++++++++ unsupported/doc/snippets/CMakeLists.txt | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 unsupported/doc/examples/MatrixExponential.cpp (limited to 'unsupported/doc') diff --git a/unsupported/doc/CMakeLists.txt b/unsupported/doc/CMakeLists.txt index 2cff2510f..a50d07798 100644 --- a/unsupported/doc/CMakeLists.txt +++ b/unsupported/doc/CMakeLists.txt @@ -1,6 +1,8 @@ set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) + if(NOT MSVC) add_subdirectory(examples) + add_subdirectory(snippets) endif(NOT MSVC) diff --git a/unsupported/doc/examples/BVH_Example.cpp b/unsupported/doc/examples/BVH_Example.cpp index 890eb535b..0fbab5fdb 100644 --- a/unsupported/doc/examples/BVH_Example.cpp +++ b/unsupported/doc/examples/BVH_Example.cpp @@ -1,3 +1,4 @@ +#include #include using namespace Eigen; @@ -20,7 +21,8 @@ struct PointPointMinimizer //how to compute squared distances between points and int main() { - std::vector redPoints, bluePoints; + typedef std::vector > StdVectorOfVector2d; + StdVectorOfVector2d redPoints, bluePoints; for(int i = 0; i < 100; ++i) { //initialize random set of red points and blue points redPoints.push_back(Vector2d::Random()); bluePoints.push_back(Vector2d::Random()); diff --git a/unsupported/doc/examples/CMakeLists.txt b/unsupported/doc/examples/CMakeLists.txt index d78af13a9..cb42b2ab9 100644 --- a/unsupported/doc/examples/CMakeLists.txt +++ b/unsupported/doc/examples/CMakeLists.txt @@ -6,7 +6,7 @@ FOREACH(example_src ${examples_SRCS}) GET_FILENAME_COMPONENT(example ${example_src} NAME_WE) ADD_EXECUTABLE(example_${example} ${example_src}) GET_TARGET_PROPERTY(example_executable - ${example} LOCATION) + example_${example} LOCATION) ADD_CUSTOM_COMMAND( TARGET example_${example} POST_BUILD diff --git a/unsupported/doc/examples/MatrixExponential.cpp b/unsupported/doc/examples/MatrixExponential.cpp new file mode 100644 index 000000000..86062e3a6 --- /dev/null +++ b/unsupported/doc/examples/MatrixExponential.cpp @@ -0,0 +1,18 @@ +#include + +using namespace Eigen; + +int main() +{ + const double pi = std::acos(-1); + + MatrixXd A(3,3); + A << 0, -pi/4, 0, + pi/4, 0, 0, + 0, 0, 0; + std::cout << "The matrix A is:\n" << A << "\n\n"; + + MatrixXd B; + ei_matrix_exponential(A, &B); + std::cout << "The matrix exponential of A is:\n" << B << "\n\n"; +} diff --git a/unsupported/doc/snippets/CMakeLists.txt b/unsupported/doc/snippets/CMakeLists.txt index fa529d139..19e9b1a1f 100644 --- a/unsupported/doc/snippets/CMakeLists.txt +++ b/unsupported/doc/snippets/CMakeLists.txt @@ -7,7 +7,7 @@ FOREACH(snippet_src ${snippets_SRCS}) SET(compile_snippet_target compile_${snippet}) SET(compile_snippet_src ${compile_snippet_target}.cpp) FILE(READ ${snippet_src} snippet_source_code) - CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/compile_snippet.cpp.in + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/snippets/compile_snippet.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) ADD_EXECUTABLE(${compile_snippet_target} ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) -- cgit v1.2.3