diff --git a/.gitignore b/.gitignore index 9859608..5d40acb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /vxl-1.17.0.tar.gz /vxl-1.17.0-clean.tar.gz /vxl-2.0.2-clean.tar.gz -/vxl-3.5.0-clean.tar.gz diff --git a/0001-BUG-Logic-for-conditional-compilation-was-exactly-wr.patch b/0001-BUG-Logic-for-conditional-compilation-was-exactly-wr.patch new file mode 100644 index 0000000..a61aeab --- /dev/null +++ b/0001-BUG-Logic-for-conditional-compilation-was-exactly-wr.patch @@ -0,0 +1,103 @@ +From c3fd27959f51e0469a7a6075e975f245ac306f3d Mon Sep 17 00:00:00 2001 +From: Hans Johnson +Date: Thu, 29 Nov 2018 14:11:12 -0600 +Subject: [PATCH] BUG: Logic for conditional compilation was exactly wrong + +--- + core/vsl/Templates/vsl_vector_io+int_64-.cxx | 2 +- + core/vsl/vsl_binary_explicit_io.h | 4 ++-- + core/vsl/vsl_binary_io.cxx | 2 +- + core/vsl/vsl_binary_io.h | 2 +- + core/vsl/vsl_block_binary.cxx | 2 +- + core/vsl/vsl_block_binary.h | 2 +- + 6 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/core/vsl/Templates/vsl_vector_io+int_64-.cxx b/core/vsl/Templates/vsl_vector_io+int_64-.cxx +index fcdafc0270..02c7a13c36 100644 +--- a/core/vsl/Templates/vsl_vector_io+int_64-.cxx ++++ b/core/vsl/Templates/vsl_vector_io+int_64-.cxx +@@ -1,6 +1,6 @@ + #include + +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + #include + VSL_VECTOR_IO_INSTANTIATE(vxl_int_64); + +diff --git a/core/vsl/vsl_binary_explicit_io.h b/core/vsl/vsl_binary_explicit_io.h +index 9ff669fce0..49536d172c 100644 +--- a/core/vsl/vsl_binary_explicit_io.h ++++ b/core/vsl/vsl_binary_explicit_io.h +@@ -141,7 +141,7 @@ macro (int); + macro (unsigned int); + macro (long); + macro (unsigned long); +-#if VXL_HAS_INT_64 && ! ( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + macro (vxl_int_64); + macro (vxl_uint_64); + #endif +@@ -486,7 +486,7 @@ inline std::size_t vsl_convert_from_arbitrary_length(const unsigned char* buffer + + ///////////////////////////////////////////////////////////////////////// + +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + + //: Decode a buffer of arbitrary length integers + // Converts from the integers from the arbitrary length format into +diff --git a/core/vsl/vsl_binary_io.cxx b/core/vsl/vsl_binary_io.cxx +index c36142bd41..9477642b0b 100644 +--- a/core/vsl/vsl_binary_io.cxx ++++ b/core/vsl/vsl_binary_io.cxx +@@ -65,7 +65,7 @@ MACRO_MAKE_INTEGER_READ_WRITE(short); + MACRO_MAKE_INTEGER_READ_WRITE(unsigned short); + MACRO_MAKE_INTEGER_READ_WRITE(long); + MACRO_MAKE_INTEGER_READ_WRITE(unsigned long); +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG) ++#if VXL_INT_64_IS_LONGLONG + MACRO_MAKE_INTEGER_READ_WRITE(vxl_int_64); + MACRO_MAKE_INTEGER_READ_WRITE(vxl_uint_64); + #endif +diff --git a/core/vsl/vsl_binary_io.h b/core/vsl/vsl_binary_io.h +index d38478aea5..9498f844c8 100644 +--- a/core/vsl/vsl_binary_io.h ++++ b/core/vsl/vsl_binary_io.h +@@ -376,7 +376,7 @@ void vsl_b_read(vsl_b_istream& is,unsigned long& n ); + inline void vsl_print_summary(std::ostream& os, unsigned long n ) + { os << n; } + +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + + //: Write to vsl_b_ostream + void vsl_b_write(vsl_b_ostream& os,vxl_int_64 n ); +diff --git a/core/vsl/vsl_block_binary.cxx b/core/vsl/vsl_block_binary.cxx +index 017a651e99..c4220bebf6 100644 +--- a/core/vsl/vsl_block_binary.cxx ++++ b/core/vsl/vsl_block_binary.cxx +@@ -285,7 +285,7 @@ template void vsl_block_binary_write_byte_impl(vsl_b_ostream &, const unsigned c + template void vsl_block_binary_read_byte_impl(vsl_b_istream &, signed char*, std::size_t); + template void vsl_block_binary_read_byte_impl(vsl_b_istream &, unsigned char*, std::size_t); + +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + template void vsl_block_binary_write_int_impl(vsl_b_ostream &, const vxl_int_64*, std::size_t); + template void vsl_block_binary_write_int_impl(vsl_b_ostream &, const vxl_uint_64*, std::size_t); + template void vsl_block_binary_read_int_impl(vsl_b_istream &, vxl_int_64*, std::size_t); +diff --git a/core/vsl/vsl_block_binary.h b/core/vsl/vsl_block_binary.h +index 014bb8d055..2ceafb0186 100644 +--- a/core/vsl/vsl_block_binary.h ++++ b/core/vsl/vsl_block_binary.h +@@ -218,7 +218,7 @@ inline void vsl_block_binary_read(vsl_b_istream &is, unsigned long* begin, std:: + } + + ///////////////////////////////////////////////////////////////////////// +-#if VXL_HAS_INT_64 && !( VXL_INT_64_IS_LONG || VXL_INT_64_IS_LONGLONG ) ++#if VXL_INT_64_IS_LONGLONG + + //: Write a block of signed longs to a vsl_b_ostream + // This function is very speed efficient, but +-- +2.21.0 + diff --git a/0001-v3.5.0-unbundle-rply.patch b/0001-v2.0.2-unbundle-rply.patch similarity index 99% rename from 0001-v3.5.0-unbundle-rply.patch rename to 0001-v2.0.2-unbundle-rply.patch index de56a11..76af26e 100644 --- a/0001-v3.5.0-unbundle-rply.patch +++ b/0001-v2.0.2-unbundle-rply.patch @@ -1,10 +1,11 @@ -From b7944a8898b3a1aef606cf6f4047dcf11aca11a6 Mon Sep 17 00:00:00 2001 +From 03d46e9ecaae8e18c892aecded6f918f6407344d Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 15 Nov 2018 14:15:02 +0000 -Subject: [PATCH 01/18] v3.5.0: unbundle rply +Subject: [PATCH 1/9] v2.0.2: unbundle rply --- contrib/brl/bbas/bmsh3d/algo/CMakeLists.txt | 5 +- + contrib/brl/bseg/boxm/algo/CMakeLists.txt | 3 +- contrib/brl/bseg/boxm2/cpp/CMakeLists.txt | 6 +- .../brl/bseg/boxm2/cpp/algo/CMakeLists.txt | 6 +- v3p/CMakeLists.txt | 1 - @@ -20,7 +21,7 @@ Subject: [PATCH 01/18] v3.5.0: unbundle rply v3p/rply/readme.txt | 24 - v3p/rply/rply.c | 1570 ----------------- v3p/rply/rply.h | 367 ---- - 16 files changed, 11 insertions(+), 3306 deletions(-) + 17 files changed, 13 insertions(+), 3307 deletions(-) delete mode 100644 v3p/rply/CMakeLists.txt delete mode 100644 v3p/rply/LICENSE delete mode 100644 v3p/rply/etc/convert.c @@ -58,6 +59,19 @@ index 5cf355e3fe..662ec284e9 100644 if( BUILD_TESTING ) add_subdirectory(tests) +diff --git a/contrib/brl/bseg/boxm/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/CMakeLists.txt +index cee22bd271..4714624fa3 100644 +--- a/contrib/brl/bseg/boxm/algo/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/CMakeLists.txt +@@ -1,6 +1,7 @@ + # brl/bseg/boxm/algo/CMakeLists.txt ++FIND_PACKAGE(rply REQUIRED) + include_directories( ${MUL_INCLUDE_DIR} ) +-include_directories( ${VTHREEP_INCLUDE_DIR}/rply ) ++include_directories( ${RPLY_INCLUDE_DIR} ) + set(boxm_algo_sources + boxm_compute_scene_statistics.h + boxm_crop_scene.h diff --git a/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt b/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt index 92b959f740..fff9ae2d84 100644 --- a/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt @@ -3608,5 +3622,5 @@ index 3c604fd88e..0000000000 - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ---------------------------------------------------------------------- */ -- -2.46.1 +2.21.0 diff --git a/0002-v3.5.0-Use-Fedora-expat-and-expatpp.patch b/0002-v2.0.2-Use-Fedora-expat-and-expatpp.patch similarity index 80% rename from 0002-v3.5.0-Use-Fedora-expat-and-expatpp.patch rename to 0002-v2.0.2-Use-Fedora-expat-and-expatpp.patch index 37c28aa..bb26680 100644 --- a/0002-v3.5.0-Use-Fedora-expat-and-expatpp.patch +++ b/0002-v2.0.2-Use-Fedora-expat-and-expatpp.patch @@ -1,10 +1,10 @@ -From 26d548e302e9fa1bcc2986ba91f12313ccb00829 Mon Sep 17 00:00:00 2001 +From 5b1f1b76bb9c71c46ba867ce2170cb43d7ba0e2e Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 15 Nov 2018 15:20:08 +0000 -Subject: [PATCH 02/18] v3.5.0 Use Fedora expat and expatpp +Subject: [PATCH 2/9] v2.0.2 Use Fedora expat and expatpp --- - CMakeLists.txt | 2 + + CMakeLists.txt | 3 ++ config/cmake/fedora-modules/FindEXPATPP.cmake | 37 +++++++++++++++++ contrib/brl/b3p/expat/CMakeLists.txt | 3 +- contrib/brl/b3p/expatpp/CMakeLists.txt | 22 +--------- @@ -30,45 +30,55 @@ Subject: [PATCH 02/18] v3.5.0 Use Fedora expat and expatpp contrib/brl/bseg/betr_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/bmdl/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/bmdl_batch/CMakeLists.txt | 3 +- + contrib/brl/bseg/boxm/CMakeLists.txt | 3 +- + contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt | 3 +- + .../brl/bseg/boxm/algo/rt/pro/CMakeLists.txt | 3 +- + .../brl/bseg/boxm/algo/sp/pro/CMakeLists.txt | 3 +- + contrib/brl/bseg/boxm/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/boxm2/CMakeLists.txt | 3 +- .../bseg/boxm2/boxm2_bounding_box_parser.h | 2 +- contrib/brl/bseg/boxm2/boxm2_scene_parser.h | 2 +- contrib/brl/bseg/boxm2/pro/CMakeLists.txt | 3 +- - .../boxm2_ingest_convex_mesh_process.cxx | 4 +- + .../boxm2_ingest_convex_mesh_process.cxx | 2 +- contrib/brl/bseg/boxm2/volm/CMakeLists.txt | 3 +- .../brl/bseg/boxm2/volm/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/boxm2_batch/CMakeLists.txt | 3 +- .../brl/bseg/boxm2_multi/pro/CMakeLists.txt | 3 +- + contrib/brl/bseg/boxm_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/brec_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/bstm/CMakeLists.txt | 3 +- contrib/brl/bseg/bstm/bstm_scene_parser.h | 2 +- contrib/brl/bseg/bstm_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/bstm_multi/CMakeLists.txt | 3 +- .../bseg/bstm_multi/space_time_scene_parser.h | 2 +- + .../brl/bseg/bvpl/bvpl_octree/CMakeLists.txt | 3 +- + .../bseg/bvpl/bvpl_octree/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/bvpl/functors/CMakeLists.txt | 3 +- contrib/brl/bseg/bvpl/kernels/CMakeLists.txt | 3 +- .../brl/bseg/bvpl/kernels/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/bvpl/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/bvpl_batch/CMakeLists.txt | 3 +- + .../brl/bseg/bvpl_octree_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/bvxm/CMakeLists.txt | 3 +- contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt | 3 +- .../brl/bseg/bvxm/bvxm_world_params_parser.h | 2 +- contrib/brl/bseg/bvxm/grid/pro/CMakeLists.txt | 3 +- contrib/brl/bseg/bvxm/pro/CMakeLists.txt | 3 +- - contrib/brl/bseg/bvxm_batch/CMakeLists.txt | 2 + + contrib/brl/bseg/bvxm_batch/CMakeLists.txt | 3 +- contrib/brl/bseg/bvxm_bridge/CMakeLists.txt | 3 +- contrib/brl/bseg/vcon/CMakeLists.txt | 3 +- - 54 files changed, 144 insertions(+), 109 deletions(-) + 63 files changed, 162 insertions(+), 118 deletions(-) create mode 100644 config/cmake/fedora-modules/FindEXPATPP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt -index e5de354156..e52a8c0abb 100644 +index 230de81825..dfc509d8fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -75,6 +75,8 @@ SET(VXL_API_VERSION "${VXL_VERSION_MAJOR}.${VXL_VERSION_MINOR}") - SET(VXL_LIBRARY_PROPERTIES ${VXL_LIBRARY_PROPERTIES} VERSION "${VXL_VERSION}" - SOVERSION "${VXL_API_VERSION}") +@@ -50,6 +50,9 @@ project(VXL #Project name must be all caps to have properly generated VXL_VERSIO + DESCRIPTION "A multi-platform collection of C++ software libraries for Computer Vision and Image Understanding." + LANGUAGES CXX C) ++ +set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/cmake/fedora-modules") + include(CMakeDependentOption) @@ -118,7 +128,7 @@ index 0000000000..88a29681aa + EXPATPP_LIBRARY +) diff --git a/contrib/brl/b3p/expat/CMakeLists.txt b/contrib/brl/b3p/expat/CMakeLists.txt -index dad475e211..d64a8f3832 100644 +index 5b9d660530..1304b5f634 100644 --- a/contrib/brl/b3p/expat/CMakeLists.txt +++ b/contrib/brl/b3p/expat/CMakeLists.txt @@ -1,7 +1,8 @@ @@ -241,7 +251,7 @@ index 76995137ed..1cb0736454 100644 if(EXPAT_FOUND) set(bvgl_test_sources ${bvgl_test_sources} test_bvgl_labelme_parser.cxx) diff --git a/contrib/brl/bbas/bwm/CMakeLists.txt b/contrib/brl/bbas/bwm/CMakeLists.txt -index 4a16a57d9e..72ea30dc37 100644 +index dace2292e7..a05c9d0366 100644 --- a/contrib/brl/bbas/bwm/CMakeLists.txt +++ b/contrib/brl/bbas/bwm/CMakeLists.txt @@ -26,7 +26,8 @@ endif() @@ -255,10 +265,10 @@ index 4a16a57d9e..72ea30dc37 100644 # Set CMake options for using vgui include( ${VXL_CMAKE_DIR}/UseVGUI.cmake ) diff --git a/contrib/brl/bbas/bwm/io/CMakeLists.txt b/contrib/brl/bbas/bwm/io/CMakeLists.txt -index 918c196161..f0ea9a69c9 100644 +index dc2102047f..ba8c13a706 100644 --- a/contrib/brl/bbas/bwm/io/CMakeLists.txt +++ b/contrib/brl/bbas/bwm/io/CMakeLists.txt -@@ -8,7 +8,8 @@ set(bwm_io_sources +@@ -7,7 +7,8 @@ set(bwm_io_sources ) aux_source_directory(Templates bwm_io_sources) @@ -343,7 +353,7 @@ index c027dfaa28..72fed69f82 100644 if( BUILD_TESTING ) diff --git a/contrib/brl/bbas/volm/CMakeLists.txt b/contrib/brl/bbas/volm/CMakeLists.txt -index 72b3b217ea..fe8cf45b75 100644 +index cf11103557..ebb93384f9 100644 --- a/contrib/brl/bbas/volm/CMakeLists.txt +++ b/contrib/brl/bbas/volm/CMakeLists.txt @@ -6,7 +6,8 @@ @@ -355,7 +365,7 @@ index 72b3b217ea..fe8cf45b75 100644 +FIND_PACKAGE(EXPATPP REQUIRED) if(EXPAT_FOUND) if(EXPATPP_FOUND) - + include_directories( ${BRL_INCLUDE_DIR} ) diff --git a/contrib/brl/bbas/volm/volm_osm_parser.h b/contrib/brl/bbas/volm/volm_osm_parser.h index 82283250dd..289d5d5265 100644 --- a/contrib/brl/bbas/volm/volm_osm_parser.h @@ -477,30 +487,30 @@ index 013afc8146..365ef65b67 100644 include_directories( ${BRL_INCLUDE_DIR} ) diff --git a/contrib/brl/bseg/bbgm_batch/CMakeLists.txt b/contrib/brl/bseg/bbgm_batch/CMakeLists.txt -index fb0836b415..0dfcfc9795 100644 +index cbd9222c7f..b9ed6f8459 100644 --- a/contrib/brl/bseg/bbgm_batch/CMakeLists.txt +++ b/contrib/brl/bseg/bbgm_batch/CMakeLists.txt @@ -1,7 +1,8 @@ # contrib/brl/bseg/bbgm_batch/CMakeLists.txt - - if( PYTHONLIBS_FOUND ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) if(EXPATPP_FOUND) include(${VXL_CMAKE_DIR}/FindTIFF.cmake) diff --git a/contrib/brl/bseg/betr_batch/CMakeLists.txt b/contrib/brl/bseg/betr_batch/CMakeLists.txt -index 20df829930..5321bd017e 100644 +index 3c5d70e0c6..588c0df0c0 100644 --- a/contrib/brl/bseg/betr_batch/CMakeLists.txt +++ b/contrib/brl/bseg/betr_batch/CMakeLists.txt -@@ -2,7 +2,8 @@ - project( betr_batch ) +@@ -4,7 +4,8 @@ project( betr_batch ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) - if( PYTHONLIBS_FOUND ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) @@ -519,19 +529,87 @@ index 76fe0891b7..7c73fe1bb0 100644 include(${VXL_CMAKE_DIR}/FindTIFF.cmake) if(TIFF_FOUND) diff --git a/contrib/brl/bseg/bmdl_batch/CMakeLists.txt b/contrib/brl/bseg/bmdl_batch/CMakeLists.txt -index fb7fcb176d..52aa721a3f 100644 +index f341e59f07..6e8186a875 100644 --- a/contrib/brl/bseg/bmdl_batch/CMakeLists.txt +++ b/contrib/brl/bseg/bmdl_batch/CMakeLists.txt @@ -1,7 +1,8 @@ # contrib/brl/bseg/bmdl_batch/CMakeLists.txt - - if( PYTHONLIBS_FOUND ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) if(EXPATPP_FOUND) include(${VXL_CMAKE_DIR}/FindTIFF.cmake) +diff --git a/contrib/brl/bseg/boxm/CMakeLists.txt b/contrib/brl/bseg/boxm/CMakeLists.txt +index 6c9da00de1..6a0e5159f4 100644 +--- a/contrib/brl/bseg/boxm/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/CMakeLists.txt +@@ -1,5 +1,6 @@ + # contrib/brl/bseg/boxm/CMakeLists.txt +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + + include_directories( ${EXPAT_INCLUDE_DIR} ) +diff --git a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt +index 7afa616e35..c821d10a77 100644 +--- a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt +@@ -1,7 +1,8 @@ + # boxm's Process Library + + # bprb depends on expat and bvxm_pro depends on bprb primarily +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt +index 7bb150ce57..112a19f789 100644 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt +@@ -1,7 +1,8 @@ + # boxm's Process Library + + # bprb depends on expat and boxm_pro depends on bprb primarily +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt +index f9cf2251e6..41fe3f9dbd 100644 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt +@@ -1,7 +1,8 @@ + # boxm's Process Library + + # bprb depends on expat and bvxm_prodepends on bprb primarily +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +diff --git a/contrib/brl/bseg/boxm/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/pro/CMakeLists.txt +index ff6552a58c..4c0cd29038 100644 +--- a/contrib/brl/bseg/boxm/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/pro/CMakeLists.txt +@@ -1,7 +1,8 @@ + # boxm's Process Library + + # bprb depends on expat and bvxm_prodepends on bprb primarily +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) diff --git a/contrib/brl/bseg/boxm2/CMakeLists.txt b/contrib/brl/bseg/boxm2/CMakeLists.txt index 4475e418be..476d43b151 100644 --- a/contrib/brl/bseg/boxm2/CMakeLists.txt @@ -587,22 +665,20 @@ index ca91150930..7c2ec1d9c3 100644 include_directories( ${BRL_INCLUDE_DIR}/bpro/core ) include_directories( ${BRL_INCLUDE_DIR}/bpro ) diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_ingest_convex_mesh_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_ingest_convex_mesh_process.cxx -index 082696b982..605e90bb61 100644 +index 4a640a7120..43fd0d7817 100644 --- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_ingest_convex_mesh_process.cxx +++ b/contrib/brl/bseg/boxm2/pro/processes/boxm2_ingest_convex_mesh_process.cxx -@@ -31,8 +31,8 @@ - #include +@@ -32,7 +32,7 @@ #include #include --#include "vgl/vgl_intersection.h" + #include -#include -+#include +#include #include namespace boxm2_ingest_convex_mesh_process_globals diff --git a/contrib/brl/bseg/boxm2/volm/CMakeLists.txt b/contrib/brl/bseg/boxm2/volm/CMakeLists.txt -index 923e37f35f..064003f994 100644 +index 861b960f4d..24bf5c6f37 100644 --- a/contrib/brl/bseg/boxm2/volm/CMakeLists.txt +++ b/contrib/brl/bseg/boxm2/volm/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -613,9 +689,9 @@ index 923e37f35f..064003f994 100644 +FIND_PACKAGE(EXPATPP REQUIRED) if(EXPAT_FOUND) if(EXPATPP_FOUND) - + #depends on OPENCL being found... diff --git a/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt b/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt -index 6ad0bdde83..265cd5d066 100644 +index 6ade9339d0..bea0c2c32d 100644 --- a/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt +++ b/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt @@ -1,7 +1,8 @@ @@ -629,16 +705,16 @@ index 6ad0bdde83..265cd5d066 100644 include_directories( ${BRL_INCLUDE_DIR}/bpro/core ) include_directories( ${BRL_INCLUDE_DIR}/bpro ) diff --git a/contrib/brl/bseg/boxm2_batch/CMakeLists.txt b/contrib/brl/bseg/boxm2_batch/CMakeLists.txt -index 9e1c59a967..c7eb640d55 100644 +index 70e603743b..b2282b0c64 100644 --- a/contrib/brl/bseg/boxm2_batch/CMakeLists.txt +++ b/contrib/brl/bseg/boxm2_batch/CMakeLists.txt -@@ -7,7 +7,8 @@ include( ${BRL_CMAKE_DIR}/FindHadoop.cmake ) +@@ -9,7 +9,8 @@ include( ${BRL_CMAKE_DIR}/FindHadoop.cmake ) include( ${VXL_CMAKE_DIR}/UseVGUI.cmake ) - if( PYTHONLIBS_FOUND ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) @@ -656,17 +732,31 @@ index c0330db1e2..68ab30dffc 100644 if(EXPAT_FOUND) include_directories( ${BRL_INCLUDE_DIR}/bseg ) set(boxm2_multi_pro_sources +diff --git a/contrib/brl/bseg/boxm_batch/CMakeLists.txt b/contrib/brl/bseg/boxm_batch/CMakeLists.txt +index 1d57861444..643a441654 100644 +--- a/contrib/brl/bseg/boxm_batch/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm_batch/CMakeLists.txt +@@ -4,7 +4,8 @@ include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindOpenCL.cmake ) + + if( PYTHON_FOUND ) +- include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++ FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if( EXPAT_FOUND ) + include_directories( ${PYTHON_INCLUDE_DIRS} ) + include_directories( ${BRL_INCLUDE_DIR} ) diff --git a/contrib/brl/bseg/brec_batch/CMakeLists.txt b/contrib/brl/bseg/brec_batch/CMakeLists.txt -index a3ab77b316..e228152f4b 100644 +index b7e3039d7e..a47356c784 100644 --- a/contrib/brl/bseg/brec_batch/CMakeLists.txt +++ b/contrib/brl/bseg/brec_batch/CMakeLists.txt @@ -1,7 +1,8 @@ # contrib/brl/bseg/brec_batch/CMakeLists.txt - - if( PYTHONLIBS_FOUND ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) @@ -698,16 +788,16 @@ index 325aee9239..f1b519d12f 100644 #include #include diff --git a/contrib/brl/bseg/bstm_batch/CMakeLists.txt b/contrib/brl/bseg/bstm_batch/CMakeLists.txt -index e548807de5..b2b047f3b6 100644 +index c94ddbcc4c..18b5e9c5f8 100644 --- a/contrib/brl/bseg/bstm_batch/CMakeLists.txt +++ b/contrib/brl/bseg/bstm_batch/CMakeLists.txt -@@ -10,7 +10,8 @@ if(DIRECTSHOW_FOUND) +@@ -12,7 +12,8 @@ if(DIRECTSHOW_FOUND) endif() - if( PYTHONLIBS_FOUND ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) @@ -738,6 +828,34 @@ index 062a2eda8f..c5108c1018 100644 #ifdef _MSC_VER # include +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt +index a1fd1eb943..1f390f966c 100644 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt ++++ b/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt +@@ -1,7 +1,8 @@ + # This is contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt + # Brown Voxel Processing library for octrees + +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + + #option( VXL_FORCE_V3P_RPLY "Use v3p ply library" YES) + #mark_as_advanced( VXL_FORCE_V3P_RPLY ) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt +index 96064e507e..bbc90f7cea 100644 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt +@@ -2,7 +2,8 @@ + # bvxm's Process Library + + # bprb depends on expat and bvxm_pro depends on bprb primarily +-include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) diff --git a/contrib/brl/bseg/bvpl/functors/CMakeLists.txt b/contrib/brl/bseg/bvpl/functors/CMakeLists.txt index 25433e56f2..f3659d5390 100644 --- a/contrib/brl/bseg/bvpl/functors/CMakeLists.txt @@ -767,7 +885,7 @@ index 0672b5d3d8..615f02e3fa 100644 include_directories( ${EXPAT_INCLUDE_DIR} ) diff --git a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt -index 82ce0655e0..3e7108103d 100644 +index 67cdcf8e00..4279f1e47d 100644 --- a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt +++ b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt @@ -2,7 +2,8 @@ @@ -795,21 +913,35 @@ index 3f4b2b26bc..03b7df907e 100644 include_directories( ${BRL_INCLUDE_DIR}/bpro ) include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) diff --git a/contrib/brl/bseg/bvpl_batch/CMakeLists.txt b/contrib/brl/bseg/bvpl_batch/CMakeLists.txt -index 754741a408..9c629d4e5e 100644 +index 9010286745..5583214c7b 100644 --- a/contrib/brl/bseg/bvpl_batch/CMakeLists.txt +++ b/contrib/brl/bseg/bvpl_batch/CMakeLists.txt @@ -1,7 +1,8 @@ # contrib/brl/bseg/bvpl_batch/CMakeLists.txt - - if( PYTHONLIBS_FOUND ) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) + if( EXPAT_FOUND ) + include_directories( ${PYTHON_INCLUDE_DIRS} ) + include_directories( ${BRL_INCLUDE_DIR} ) +diff --git a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt b/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt +index 052a160d9c..3bf956ba6c 100644 +--- a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt ++++ b/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt +@@ -1,7 +1,8 @@ + # contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) +- include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) ++ FIND_PACKAGE(EXPAT REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) diff --git a/contrib/brl/bseg/bvxm/CMakeLists.txt b/contrib/brl/bseg/bvxm/CMakeLists.txt -index d637fead62..caa2ff3f35 100644 +index fbda67337c..6c7b6091a8 100644 --- a/contrib/brl/bseg/bvxm/CMakeLists.txt +++ b/contrib/brl/bseg/bvxm/CMakeLists.txt @@ -38,7 +38,8 @@ set(bvxm_sources @@ -823,7 +955,7 @@ index d637fead62..caa2ff3f35 100644 include_directories( ${EXPAT_INCLUDE_DIR} ) include_directories( ${BRL_INCLUDE_DIR}/b3p/expatpp ) diff --git a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt -index e07b20ebb7..3a0824d257 100644 +index 8a1789161d..4917b6eb59 100644 --- a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt +++ b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt @@ -1,7 +1,8 @@ @@ -864,7 +996,7 @@ index c2901f9c90..a41c67e514 100644 include_directories( ${BRL_INCLUDE_DIR}/bpro ) include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) diff --git a/contrib/brl/bseg/bvxm/pro/CMakeLists.txt b/contrib/brl/bseg/bvxm/pro/CMakeLists.txt -index 6c98f11cc3..e5b88b5aff 100644 +index 5d107edbd1..5c6cbc56e4 100644 --- a/contrib/brl/bseg/bvxm/pro/CMakeLists.txt +++ b/contrib/brl/bseg/bvxm/pro/CMakeLists.txt @@ -2,7 +2,8 @@ @@ -878,23 +1010,24 @@ index 6c98f11cc3..e5b88b5aff 100644 include_directories( ${EXPAT_INCLUDE_DIR} ) include_directories( ${BRL_INCLUDE_DIR}/bpro ) diff --git a/contrib/brl/bseg/bvxm_batch/CMakeLists.txt b/contrib/brl/bseg/bvxm_batch/CMakeLists.txt -index fee846b6d0..2044353da0 100644 +index 58ece0b8d3..ed25993cc7 100644 --- a/contrib/brl/bseg/bvxm_batch/CMakeLists.txt +++ b/contrib/brl/bseg/bvxm_batch/CMakeLists.txt -@@ -3,6 +3,8 @@ if(HAS_GEOTIFF) - - if( PYTHONLIBS_FOUND ) - include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) +@@ -2,7 +2,8 @@ + if(HAS_GEOTIFF) + include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) + if( PYTHON_FOUND ) +- include( ${BRL_MODULE_PATH}/FindEXPAT.cmake ) + FIND_PACKAGE(EXPAT REQUIRED) -+ FIND_PACKAGE(EXPATPP REQUIRED) ++FIND_PACKAGE(EXPATPP REQUIRED) if( EXPAT_FOUND ) include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${BRL_INCLUDE_DIR} ) diff --git a/contrib/brl/bseg/bvxm_bridge/CMakeLists.txt b/contrib/brl/bseg/bvxm_bridge/CMakeLists.txt -index 76defad7a7..1cfd293103 100644 +index b7b0636f29..efc4aa9b30 100644 --- a/contrib/brl/bseg/bvxm_bridge/CMakeLists.txt +++ b/contrib/brl/bseg/bvxm_bridge/CMakeLists.txt -@@ -5,7 +5,8 @@ if(OpenCL_FOUND) +@@ -8,7 +8,8 @@ if(OPENCL_FOUND) include_directories( ${MUL_INCLUDE_DIR} ) #find expatpp library @@ -919,5 +1052,5 @@ index 26504576be..ed189bccd7 100644 if(EXPATPP_FOUND) include_directories( ${BRL_INCLUDE_DIR} ) -- -2.46.1 +2.21.0 diff --git a/0003-v3.5.0-Use-Fedora-minizip.patch b/0003-v2.0.2-Use-Fedora-minizip.patch similarity index 88% rename from 0003-v3.5.0-Use-Fedora-minizip.patch rename to 0003-v2.0.2-Use-Fedora-minizip.patch index 6b155e9..00dd52f 100644 --- a/0003-v3.5.0-Use-Fedora-minizip.patch +++ b/0003-v2.0.2-Use-Fedora-minizip.patch @@ -1,7 +1,7 @@ -From c0cc5459f8ee3dfc40cefb26487a1449d5100d8e Mon Sep 17 00:00:00 2001 +From 2a0cd34dbe8aec011713860321a569f9ec64b7d4 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 15 Nov 2018 15:31:18 +0000 -Subject: [PATCH 03/18] v3.5.0 Use Fedora minizip +Subject: [PATCH 3/9] v2.0.2 Use Fedora minizip --- contrib/brl/b3p/CMakeLists.txt | 4 ---- @@ -21,7 +21,7 @@ index 7fefd89f41..b2f4b5f6bd 100644 - - diff --git a/contrib/brl/bseg/bmdl/pro/processes/bmdl_generate_mesh_process.cxx b/contrib/brl/bseg/bmdl/pro/processes/bmdl_generate_mesh_process.cxx -index daf78da93f..1a2241adbf 100644 +index 7a907be4a4..2cac32963a 100644 --- a/contrib/brl/bseg/bmdl/pro/processes/bmdl_generate_mesh_process.cxx +++ b/contrib/brl/bseg/bmdl/pro/processes/bmdl_generate_mesh_process.cxx @@ -38,6 +38,7 @@ @@ -33,5 +33,5 @@ index daf78da93f..1a2241adbf 100644 #define WRITEBUFFERSIZE (16384) -- -2.46.1 +2.21.0 diff --git a/0004-v2.0.2-Version-shared-objects.patch b/0004-v2.0.2-Version-shared-objects.patch new file mode 100644 index 0000000..b53cc11 --- /dev/null +++ b/0004-v2.0.2-Version-shared-objects.patch @@ -0,0 +1,38 @@ +From e1eb7b3fab1cec8dde0c09a20fa731f497be8630 Mon Sep 17 00:00:00 2001 +From: "Ankur Sinha (Ankur Sinha Gmail)" +Date: Thu, 18 Apr 2019 22:11:41 +0100 +Subject: [PATCH 4/9] v2.0.2 Version shared objects + +--- + CMakeLists.txt | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dfc509d8fc..0748a6c737 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,13 +46,19 @@ foreach(p + endforeach() + + project(VXL #Project name must be all caps to have properly generated VXL_VERSION_* variables +- VERSION 2.0.2.0 + DESCRIPTION "A multi-platform collection of C++ software libraries for Computer Vision and Image Understanding." + LANGUAGES CXX C) + +- + set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/cmake/fedora-modules") + ++SET(VXL_MAJOR_VERSION 2) ++SET(VXL_MINOR_VERSION 0) ++SET(VXL_BUILD_VERSION 2) ++SET(VXL_VERSION "${VXL_MAJOR_VERSION}.${VXL_MINOR_VERSION}.${VXL_BUILD_VERSION}") ++SET(VXL_API_VERSION "${VXL_MAJOR_VERSION}.${VXL_MINOR_VERSION}") ++SET(VXL_LIBRARY_PROPERTIES ${VXL_LIBRARY_PROPERTIES} VERSION "${VXL_VERSION}" ++ SOVERSION "${VXL_API_VERSION}") ++ + include(CMakeDependentOption) + include(${CMAKE_CURRENT_SOURCE_DIR}/config/cmake/VXLInitializeBuildType.cmake) + +-- +2.21.0 + diff --git a/0004-v3.5.0-Add-cmake-module-to-find-RPLY.patch b/0005-v2.0.2-Add-cmake-module-to-find-RPLY.patch similarity index 82% rename from 0004-v3.5.0-Add-cmake-module-to-find-RPLY.patch rename to 0005-v2.0.2-Add-cmake-module-to-find-RPLY.patch index b28b11e..5ffb79a 100644 --- a/0004-v3.5.0-Add-cmake-module-to-find-RPLY.patch +++ b/0005-v2.0.2-Add-cmake-module-to-find-RPLY.patch @@ -1,22 +1,23 @@ -From 04c541d97aeb5ccc75615dd537e8a64c1e1f3814 Mon Sep 17 00:00:00 2001 +From 0ce6048e45379a0bdac240b3b3c655f752e289c0 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 25 Apr 2019 14:11:31 +0100 -Subject: [PATCH 04/18] v3.5.0 Add cmake module to find RPLY +Subject: [PATCH 5/9] v2.0.2 Add cmake module to find RPLY --- CMakeLists.txt | 3 +- config/cmake/fedora-modules/FindRPLY.cmake | 39 +++++++++++++++++++ contrib/brl/bbas/bmsh3d/algo/CMakeLists.txt | 2 +- + contrib/brl/bseg/boxm/algo/CMakeLists.txt | 2 +- contrib/brl/bseg/boxm2/cpp/CMakeLists.txt | 2 +- .../brl/bseg/boxm2/cpp/algo/CMakeLists.txt | 2 +- - 5 files changed, 44 insertions(+), 4 deletions(-) + 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 config/cmake/fedora-modules/FindRPLY.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt -index e52a8c0abb..e1aa0390d4 100644 +index 0748a6c737..dfd9187aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -142,7 +142,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/config/cmake/doxygen/doxygen.cmake) +@@ -120,7 +120,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/config/cmake/doxygen/doxygen.cmake) # Location of VXL's FindXXX.cmake CMake modules. # This is identical to VXL_CMAKE_DIR. Perhaps we should eliminate MODULE_PATH? @@ -83,6 +84,17 @@ index 662ec284e9..1c2e6a7089 100644 include_directories( ${BRL_INCLUDE_DIR} ) include_directories( ${RPLY_INCLUDE_DIR} ) +diff --git a/contrib/brl/bseg/boxm/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/CMakeLists.txt +index 4714624fa3..16694fbbc4 100644 +--- a/contrib/brl/bseg/boxm/algo/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/CMakeLists.txt +@@ -1,5 +1,5 @@ + # brl/bseg/boxm/algo/CMakeLists.txt +-FIND_PACKAGE(rply REQUIRED) ++FIND_PACKAGE(RPLY REQUIRED) + include_directories( ${MUL_INCLUDE_DIR} ) + include_directories( ${RPLY_INCLUDE_DIR} ) + set(boxm_algo_sources diff --git a/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt b/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt index fff9ae2d84..d7ef6ed5fa 100644 --- a/contrib/brl/bseg/boxm2/cpp/CMakeLists.txt @@ -104,5 +116,5 @@ index c3ed4ed27d..19763fbd71 100644 include_directories( ${BRL_INCLUDE_DIR}/bseg ) include_directories( ${MUL_INCLUDE_DIR} ) -- -2.46.1 +2.21.0 diff --git a/0006-v2.0.2-bbas-baio-Update-function-arguments-in-declar.patch b/0006-v2.0.2-bbas-baio-Update-function-arguments-in-declar.patch new file mode 100644 index 0000000..e2a392e --- /dev/null +++ b/0006-v2.0.2-bbas-baio-Update-function-arguments-in-declar.patch @@ -0,0 +1,34 @@ +From 3297b7f7dc864aca4f0a1df822d6c657a7c67abd Mon Sep 17 00:00:00 2001 +From: "Ankur Sinha (Ankur Sinha Gmail)" +Date: Thu, 25 Apr 2019 16:16:56 +0100 +Subject: [PATCH 6/9] v2.0.2 bbas-baio Update function arguments in declaration + +--- + contrib/brl/bbas/baio/baio_unix.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/contrib/brl/bbas/baio/baio_unix.cxx b/contrib/brl/bbas/baio/baio_unix.cxx +index e8af7199f2..98fc110276 100644 +--- a/contrib/brl/bbas/baio/baio_unix.cxx ++++ b/contrib/brl/bbas/baio/baio_unix.cxx +@@ -34,7 +34,7 @@ baio::~baio() + } + + //: Opens and reads file asynchronously +-bool baio::read(std::string filename, char* buff, long BUFSIZE) ++bool baio::read(const std::string& filename, char* buff, long BUFSIZE) + { + // 1. call c open to get standard file handle + int fhandle = open(filename.c_str(), O_RDONLY); +@@ -68,7 +68,7 @@ bool baio::read(std::string filename, char* buff, long BUFSIZE) + } + + //: opens and writes file asynchronously +-bool baio::write(std::string filename, char* buff, long BUFSIZE) ++bool baio::write(const std::string& filename, char* buff, long BUFSIZE) + { + // 1. call c open to get standard file handle + int fhandle = open(filename.c_str(), O_WRONLY | O_CREAT, 0666); +-- +2.21.0 + diff --git a/0005-v3.5.0-fix-bkml-test.patch b/0007-v2.0.2-fix-bkml-test.patch similarity index 94% rename from 0005-v3.5.0-fix-bkml-test.patch rename to 0007-v2.0.2-fix-bkml-test.patch index 90dd9a0..8b6a2f2 100644 --- a/0005-v3.5.0-fix-bkml-test.patch +++ b/0007-v2.0.2-fix-bkml-test.patch @@ -1,7 +1,7 @@ -From 8697b5c51bf883e04634d49c45421f2776f59fd3 Mon Sep 17 00:00:00 2001 +From 220d1ca54a2cc737d921472c4fe554e0fd52e770 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 25 Apr 2019 17:05:39 +0100 -Subject: [PATCH 05/18] v3.5.0 fix bkml test +Subject: [PATCH 7/9] v2.0.2 fix bkml test --- contrib/brl/bbas/bkml/CMakeLists.txt | 1 + @@ -54,5 +54,5 @@ index 84c36469a4..9eddec1f66 100644 + target_link_libraries( bkml_test_include bkml ) +endif() -- -2.46.1 +2.21.0 diff --git a/0007-v3.5.0-remove-triangle.patch b/0007-v3.5.0-remove-triangle.patch deleted file mode 100644 index 7c34082..0000000 --- a/0007-v3.5.0-remove-triangle.patch +++ /dev/null @@ -1,20107 +0,0 @@ -From 80bdd447db20e28e08adeaa35a6528957e286902 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 23 Oct 2023 10:48:40 +0100 -Subject: [PATCH 07/18] v3.5.0: remove triangle - -Reference: -https://github.com/InsightSoftwareConsortium/ITK/pull/1920/files ---- - config/cmake/Modules/FindNetlib.cmake | 2 +- - v3p/netlib/CMakeLists.txt | 19 - - v3p/netlib/examples/.NoDartCoverage | 0 - v3p/netlib/examples/A.poly | 62 - - v3p/netlib/examples/CMakeLists.txt | 14 - - v3p/netlib/examples/showme.c | 3392 ----- - v3p/netlib/tests/CMakeLists.txt | 4 - - v3p/netlib/triangle.README | 198 - - v3p/netlib/triangle.c | 16011 ------------------------ - v3p/netlib/triangle.h | 299 - - 10 files changed, 1 insertion(+), 20000 deletions(-) - delete mode 100644 v3p/netlib/examples/.NoDartCoverage - delete mode 100644 v3p/netlib/examples/A.poly - delete mode 100644 v3p/netlib/examples/CMakeLists.txt - delete mode 100644 v3p/netlib/examples/showme.c - delete mode 100644 v3p/netlib/triangle.README - delete mode 100644 v3p/netlib/triangle.c - delete mode 100644 v3p/netlib/triangle.h - -diff --git a/config/cmake/Modules/FindNetlib.cmake b/config/cmake/Modules/FindNetlib.cmake -index c953a8bbc3..0fba6dddf2 100644 ---- a/config/cmake/Modules/FindNetlib.cmake -+++ b/config/cmake/Modules/FindNetlib.cmake -@@ -9,4 +9,4 @@ - set( NETLIB_FOUND "YES" ) - set( NETLIB_INCLUDE_DIR ${VXL_ROOT_SOURCE_DIR}/v3p/netlib ) - set( NETLIB_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/vxl/v3p/netlib ) --set( NETLIB_LIBRARIES ${VXL_LIB_PREFIX}netlib ${VXL_LIB_PREFIX}v3p_netlib ) -+set( NETLIB_LIBRARIES ${VXL_LIB_PREFIX}v3p_netlib ) -diff --git a/v3p/netlib/CMakeLists.txt b/v3p/netlib/CMakeLists.txt -index 1c3df5db0c..05941c9ed0 100644 ---- a/v3p/netlib/CMakeLists.txt -+++ b/v3p/netlib/CMakeLists.txt -@@ -2,21 +2,6 @@ - - project( netlib C ) - --set(netlib_sources -- # The "Triangle" program of Jonathan Richard Shewchuk -- triangle.c triangle.h -- ) -- --vxl_add_library( -- LIBRARY_NAME ${VXL_LIB_PREFIX}netlib -- LIBRARY_SOURCES ${netlib_sources} -- DISABLE_MSVC_MP --) -- --if(UNIX) -- target_link_libraries( ${VXL_LIB_PREFIX}netlib m ) --endif() -- - # Allow sources in subdirectories to see the include files. - include_directories(${netlib_SOURCE_DIR}) - -@@ -447,10 +432,6 @@ if(BUILD_TESTING) - add_subdirectory(tests) - endif() - --if(VXL_BUILD_EXAMPLES) -- add_subdirectory(examples) --endif() -- - if (VXL_BUILD_OBJECT_LIBRARIES) - add_library(v3p_netlib-obj OBJECT ${v3p_netlib_sources}) - endif() -diff --git a/v3p/netlib/examples/.NoDartCoverage b/v3p/netlib/examples/.NoDartCoverage -deleted file mode 100644 -index e69de29bb2..0000000000 -diff --git a/v3p/netlib/examples/A.poly b/v3p/netlib/examples/A.poly -deleted file mode 100644 -index 166a71773a..0000000000 ---- a/v3p/netlib/examples/A.poly -+++ /dev/null -@@ -1,62 +0,0 @@ --29 2 1 0 --1 0.200000 -0.776400 -0.57 --2 0.220000 -0.773200 -0.55 --3 0.245600 -0.756400 -0.51 --4 0.277600 -0.702000 -0.53 --5 0.488800 -0.207600 0.28 --6 0.504800 -0.207600 0.30 --7 0.740800 -0.739600 0 --8 0.756000 -0.761200 -0.01 --9 0.774400 -0.772400 0 --10 0.800000 -0.776400 0.02 --11 0.800000 -0.792400 0.01 --12 0.579200 -0.792400 -0.21 --13 0.579200 -0.776400 -0.2 --14 0.621600 -0.771600 -0.15 --15 0.633600 -0.762800 -0.13 --16 0.639200 -0.744400 -0.1 --17 0.620800 -0.684400 -0.06 --18 0.587200 -0.604400 -0.01 --19 0.360800 -0.604400 -0.24 --20 0.319200 -0.706800 -0.39 --21 0.312000 -0.739600 -0.43 --22 0.318400 -0.761200 -0.44 --23 0.334400 -0.771600 -0.44 --24 0.371200 -0.776400 -0.41 --25 0.371200 -0.792400 -0.42 --26 0.374400 -0.570000 -0.2 --27 0.574400 -0.570000 0 --28 0.473600 -0.330800 0.14 --29 0.200000 -0.792400 -0.59 --29 0 --1 29 1 --2 1 2 --3 2 3 --4 3 4 --5 4 5 --6 5 6 --7 6 7 --8 7 8 --9 8 9 --10 9 10 --11 10 11 --12 11 12 --13 12 13 --14 13 14 --15 14 15 --16 15 16 --17 16 17 --18 17 18 --19 18 19 --20 19 20 --21 20 21 --22 21 22 --23 22 23 --24 23 24 --25 24 25 --26 25 29 --27 26 27 --28 27 28 --29 28 26 --1 --1 0.47 -0.5 -diff --git a/v3p/netlib/examples/CMakeLists.txt b/v3p/netlib/examples/CMakeLists.txt -deleted file mode 100644 -index 1021aa2877..0000000000 ---- a/v3p/netlib/examples/CMakeLists.txt -+++ /dev/null -@@ -1,14 +0,0 @@ --link_libraries(netlib) -- --include(${VXL_CMAKE_DIR}/FindNetlib.cmake) --if(NETLIB_FOUND) -- include_directories(${NETLIB_INCLUDE_DIR}) -- -- find_package(X11) -- if(X11_FOUND) -- include_directories(${X11_INCLUDE_DIR}) -- add_executable(netlib_showme showme.c) -- target_link_libraries(netlib_showme ${X11_LIBRARIES}) -- endif() -- --endif() -diff --git a/v3p/netlib/examples/showme.c b/v3p/netlib/examples/showme.c -deleted file mode 100644 -index 815d63a0fd..0000000000 ---- a/v3p/netlib/examples/showme.c -+++ /dev/null -@@ -1,3392 +0,0 @@ --/*****************************************************************************/ --/* */ --/* ,d88^^o 888 o o */ --/* 8888 888o^88, o88^^o Y88b o / d8b d8b o88^^8o */ --/* "Y88b 888 888 d888 b Y88b d8b / d888bdY88b d888 88b */ --/* "Y88b, 888 888 8888 8 Y888/Y88b/ / Y88Y Y888b 8888oo888 */ --/* o 8888 888 888 q888 p Y8/ Y8/ / YY Y888b q888 */ --/* "oo88P" 888 888 "88oo" Y Y / Y888b "88oooo" */ --/* */ --/* A Display Program for Meshes and More. */ --/* (showme.c) */ --/* */ --/* Version 1.3 */ --/* July 20, 1996 */ --/* */ --/* Copyright 1996 */ --/* Jonathan Richard Shewchuk */ --/* School of Computer Science */ --/* Carnegie Mellon University */ --/* 5000 Forbes Avenue */ --/* Pittsburgh, Pennsylvania 15213-3891 */ --/* jrs@cs.cmu.edu */ --/* */ --/* This program may be freely redistributed under the condition that the */ --/* copyright notices (including this entire header and the copyright */ --/* notice printed when the `-h' switch is selected) are not removed, and */ --/* no compensation is received. Private, research, and institutional */ --/* use is free. You may distribute modified versions of this code UNDER */ --/* THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE */ --/* SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE */ --/* AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR */ --/* NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as */ --/* part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT */ --/* WITH THE AUTHOR. (If you are not directly supplying this code to a */ --/* customer, and you are instead telling them how they can obtain it for */ --/* free, then you are not required to make any arrangement with me.) */ --/* */ --/* Hypertext instructions for Triangle are available on the Web at */ --/* */ --/* http://www.cs.cmu.edu/~quake/showme.html */ --/* */ --/* Show Me was created as part of the Archimedes project in the School of */ --/* Computer Science at Carnegie Mellon University. Archimedes is a */ --/* system for compiling parallel finite element solvers. For further */ --/* information, see Anja Feldmann, Omar Ghattas, John R. Gilbert, Gary L. */ --/* Miller, David R. O'Hallaron, Eric J. Schwabe, Jonathan R. Shewchuk, */ --/* and Shang-Hua Teng. "Automated Parallel Solution of Unstructured PDE */ --/* Problems." To appear in Communications of the ACM, we hope. */ --/* */ --/* If you make any improvements to this code, please please please let me */ --/* know, so that I may obtain the improvements. Even if you don't change */ --/* the code, I'd still love to hear what it's being used for. */ --/* */ --/* Disclaimer: Neither I nor Carnegie Mellon warrant this code in any way */ --/* whatsoever. Use at your own risk. */ --/* */ --/*****************************************************************************/ -- --/* For single precision (which will save some memory and reduce paging), */ --/* write "#define SINGLE" below. */ --/* */ --/* For double precision (which will allow you to display triangulations of */ --/* a finer resolution), leave SINGLE undefined. */ -- --/* #define SINGLE */ -- --#ifdef SINGLE --#define REAL float --#else --#define REAL double --#endif -- --/* Maximum number of characters in a file name (including the null). */ -- --#define FILENAMESIZE 1024 -- --/* Maximum number of characters in a line read from a file (including the */ --/* null). */ -- --#define INPUTLINESIZE 512 -- --#define STARTWIDTH 414 --#define STARTHEIGHT 414 --#define MINWIDTH 50 --#define MINHEIGHT 50 --#define BUTTONHEIGHT 21 --#define BUTTONROWS 3 --#define PANELHEIGHT (BUTTONHEIGHT * BUTTONROWS) --#define MAXCOLORS 64 -- --#define IMAGE_TYPES 7 --#define NOTHING -1 --#define NODE 0 --#define POLY 1 --#define ELE 2 --#define EDGE 3 --#define PART 4 --#define ADJ 5 --#define VORO 6 -- --#define STARTEXPLOSION 0.5 -- --#include --#include --#include --#include --#include --#include -- --/* The following obscenity seems to be necessary to ensure that this program */ --/* will port to Dec Alphas running OSF/1, because their stdio.h file commits */ --/* the unpardonable sin of including stdlib.h. Hence, malloc(), free(), and */ --/* exit() may or may not already be defined at this point. I declare these */ --/* functions explicitly because some non-ANSI C compilers lack stdlib.h. */ -- --#if !defined(_STDLIB_H_) && !defined(_STDLIB_H) && defined(__need_malloc_and_calloc) --extern char *malloc(); --extern void free(); --extern void exit(); --extern double strtod(); --extern long strtol(); --#endif -- --/* A necessary forward declaration. */ -- --int load_image(); -- --Display *display; --int screen; --Window rootwindow; --Window mainwindow; --Window quitwin; --Window leftwin; --Window rightwin; --Window upwin; --Window downwin; --Window resetwin; --Window pswin; --Window epswin; --Window expwin; --Window exppluswin; --Window expminuswin; --Window widthpluswin; --Window widthminuswin; --Window versionpluswin; --Window versionminuswin; --Window fillwin; --Window nodewin[2]; --Window polywin[2]; --Window elewin[2]; --Window edgewin[2]; --Window partwin[2]; --Window adjwin[2]; --Window voronoiwin[2]; -- --int windowdepth; --XEvent event; --Colormap rootmap; --XFontStruct *font; --int width, height; --int black, white; --int showme_foreground; --GC fontgc; --GC blackfontgc; --GC linegc; --GC trianglegc; --int colors[MAXCOLORS]; --XColor rgb[MAXCOLORS]; --int color; -- --int start_image, current_image; --int start_inc, current_inc; --int loweriteration; --int line_width; --int loaded[2][IMAGE_TYPES]; --REAL xlo[2][IMAGE_TYPES], ylo[2][IMAGE_TYPES]; --REAL xhi[2][IMAGE_TYPES], yhi[2][IMAGE_TYPES]; --REAL xscale, yscale; --REAL xoffset, yoffset; --int zoom; -- --int nodes[2], node_dim[2]; --REAL *nodeptr[2]; --int polynodes[2], poly_dim[2], polyedges[2], polyholes[2]; --REAL *polynodeptr[2], *polyholeptr[2]; --int *polyedgeptr[2]; --int elems[2], ele_corners[2]; --int *eleptr[2]; --int edges[2]; --int *edgeptr[2]; --REAL *normptr[2]; --int subdomains[2]; --int *partpart[2]; --REAL *partcenter[2], *partshift[2]; --int adjsubdomains[2]; --int *adjptr[2]; --int vnodes[2], vnode_dim[2]; --REAL *vnodeptr[2]; --int vedges[2]; --int *vedgeptr[2]; --REAL *vnormptr[2]; --int firstnumber[2]; -- --int quiet, fillelem, bw_ps, explode; --REAL explosion; -- --char filename[FILENAMESIZE]; --char nodefilename[2][FILENAMESIZE]; --char polyfilename[2][FILENAMESIZE]; --char elefilename[2][FILENAMESIZE]; --char edgefilename[2][FILENAMESIZE]; --char partfilename[2][FILENAMESIZE]; --char adjfilename[2][FILENAMESIZE]; --char vnodefilename[2][FILENAMESIZE]; --char vedgefilename[2][FILENAMESIZE]; -- --const --char *colorname[] = {"aquamarine", "red", "green yellow", "magenta", -- "yellow", "green", "orange", "blue", -- "white", "sandy brown", "cyan", "moccasin", -- "cadet blue", "coral", "cornflower blue", "sky blue", -- "firebrick", "forest green", "gold", "goldenrod", -- "gray", "hot pink", "chartreuse", "pale violet red", -- "indian red", "khaki", "lavender", "light blue", -- "light gray", "light steel blue", "lime green", "azure", -- "maroon", "medium aquamarine", "dodger blue", "honeydew", -- "medium orchid", "medium sea green", "moccasin", -- "medium slate blue", "medium spring green", -- "medium turquoise", "medium violet red", -- "orange red", "chocolate", "light goldenrod", -- "orchid", "pale green", "pink", "plum", -- "purple", "salmon", "sea green", -- "sienna", "slate blue", "spring green", -- "steel blue", "tan", "thistle", "turquoise", -- "violet", "violet red", "wheat", -- "yellow green"}; -- --void syntax() --{ -- printf("showme [-bfw_Qh] input_file\n"); -- printf(" -b Black and white PostScript (default is color).\n"); -- printf(" -f Fill triangles of partitioned mesh with color.\n"); -- printf(" -w Set line width to some specified number.\n"); -- printf(" -Q Quiet: No terminal output except errors.\n"); -- printf(" -h Help: Detailed instructions for Show Me.\n"); -- exit(0); --} -- --void info() --{ -- printf("Show Me\n"); -- printf("A Display Program for Meshes and More.\n"); -- printf("Version 1.3\n\n"); -- printf( --"Copyright 1996 Jonathan Richard Shewchuk (bugs/comments to jrs@cs.cmu.edu)\n" --); -- printf("School of Computer Science / Carnegie Mellon University\n"); -- printf("5000 Forbes Avenue / Pittsburgh, Pennsylvania 15213-3891\n"); -- printf( --"Created as part of the Archimedes project (tools for parallel FEM).\n"); -- printf( --"Supported in part by NSF Grant CMS-9318163 and an NSERC 1967 Scholarship.\n"); -- printf("There is no warranty whatsoever. Use at your own risk.\n"); --#ifdef SINGLE -- printf("This executable is compiled for single precision arithmetic.\n\n\n"); --#else -- printf("This executable is compiled for double precision arithmetic.\n\n\n"); --#endif -- printf( --"Show Me graphically displays the contents of geometric files, especially\n"); -- printf( --"those generated by Triangle, my two-dimensional quality mesh generator and\n" --); -- printf( --"Delaunay triangulator. Show Me can also write images in PostScript form.\n"); -- printf( --"Show Me is also useful for checking the consistency of the files you create\n" --); -- printf( --"as input to Triangle; Show Me does these checks more thoroughly than\n"); -- printf("Triangle does. The command syntax is:\n\n"); -- printf("showme [-bfw_Qh] input_file\n\n"); -- printf( --"The underscore indicates that a number should follow the -w switch.\n"); -- printf( --"input_file may be one of several types of file. It must have extension\n"); -- printf( --".node, .poly, .ele, .edge, .part, or .adj. If no extension is provided,\n"); -- printf( --"Show Me will assume the extension .ele. A .node file represents a set of\n"); -- printf( --"points; a .poly file represents a Planar Straight Line Graph; an .ele file\n" --); -- printf( --"(coupled with a .node file) represents the elements of a mesh or the\n"); -- printf( --"triangles of a triangulation; an .edge file (coupled with a .node file)\n"); -- printf( --"represents a set of edges; a .part file specifies a partition of a mesh;\n"); -- printf( --"and a .adj file represents the adjacency graph defined by a partition.\n"); -- printf("\n"); -- printf("Command Line Switches:\n"); -- printf("\n"); -- printf( --" -b Makes all PostScript output black and white. If this switch is not\n" --); -- printf( --" selected, color PostScript is used for partitioned meshes and\n"); -- printf(" adjacency graphs (.part and .adj files).\n"); -- printf( --" -f On color displays and in color PostScript, displays partitioned\n"); -- printf( --" meshes by filling triangles with color, rather than by coloring the\n" --); -- printf( --" edges. This switch will result in a clearer picture if all\n"); -- printf( --" triangles are reasonably large, and a less clear picture if small\n"); -- printf( --" triangles are present. (There is also a button to toggle this\n"); -- printf(" behavior.)\n"); -- printf( --" -w Followed by an integer, specifies the line width used in all\n"); -- printf( --" images. (There are also buttons to change the line width.)\n"); -- printf( --" -Q Quiet: Suppresses all explanation of what Show Me is doing, unless\n" --); -- printf(" an error occurs.\n"); -- printf(" -h Help: Displays these instructions.\n"); -- printf("\n"); -- printf("Controls:\n"); -- printf("\n"); -- printf( --" To zoom in on an image, point at the location where you want a closer\n"); -- printf( --" look, and click the left mouse button. To zoom out, click the right\n"); -- printf( --" mouse button. In either case, the point you click on will be centered in\n" --); -- printf( --" the window. If you want to know the coordinates of a point, click the\n"); -- printf( --" middle mouse button; the coordinates will be printed on the terminal you\n" --); -- printf(" invoked Show Me from.\n\n"); -- printf( --" If you resize the window, the image will grow or shrink to match.\n"); -- printf("\n"); -- printf( --" There is a panel of control buttons at the bottom of the Show Me window:\n" --); -- printf("\n"); -- printf(" Quit: Shuts down Show Me.\n"); -- printf(" <, >, ^, v: Moves the image in the indicated direction.\n"); -- printf( --" Reset: Unzooms and centers the image in the window. When you switch from\n" --); -- printf( --" one image to another, the viewing region does not change, so you may\n"); -- printf( --" need to reset the new image to make it fully visible. This often is\n"); -- printf( --" the case when switching between Delaunay triangulations and their\n"); -- printf( --" corresponding Voronoi diagrams, as Voronoi vertices can be far from the\n" --); -- printf(" initial point set.\n"); -- printf( --" Width+, -: Increases or decreases the width of all lines and points.\n"); -- printf( --" Exp, +, -: These buttons appear only when you are viewing a partitioned\n" --); -- printf( --" mesh (.part file). `Exp' toggles between an exploded and non-exploded\n" --); -- printf( --" image of the mesh. The non-exploded image will not show the partition\n" --); -- printf( --" on a black and white monitor. `+' and `-' allow you to adjust the\n"); -- printf( --" spacing between pieces of the mesh to better distinguish them.\n"); -- printf( --" Fill: This button appears only when you are viewing a partitioned mesh\n"); -- printf( --" (.part file). It toggles between color-filled triangles and colored\n"); -- printf( --" edges (as the -f switch does). Filled triangles look better when all\n"); -- printf( --" triangles are reasonably large; colored edges look better when there\n"); -- printf(" are very small triangles present.\n"); -- printf( --" PS: Creates a PostScript file containing the image you are viewing. If\n" --); -- printf( --" the -b switch is selected, all PostScript output will be black and\n"); -- printf( --" white; otherwise, .part.ps and .adj.ps files will be color, independent\n" --); -- printf( --" of whether you are using a color monitor. Normally the output will\n"); -- printf( --" preserve the properties of the image you see on the screen, including\n"); -- printf( --" zoom and line width; however, if black and white output is selected (-b\n" --); -- printf( --" switch), partitioned meshes will always be drawn exploded. The output\n" --); -- printf( --" file name depends on the image being viewed. If you want several\n"); -- printf( --" different snapshots (zooming in on different parts) of the same object,\n" --); -- printf( --" you'll have to rename each file after Show Me creates it so that it\n"); -- printf(" isn't overwritten by the next snapshot.\n"); -- printf( --" EPS: Creates an encapsulated PostScript file, suitable for inclusion in\n" --); -- printf( --" documents. Otherwise, this button is just like the PS button. (The\n"); -- printf( --" main difference is that .eps files lack a `showpage' command at the\n"); -- printf(" end.)\n\n"); -- printf( --" There are two nearly-identical rows of buttons that load different images\n" --); -- printf(" from disk. Each row contains the following buttons:\n\n"); -- printf(" node: Loads a .node file.\n"); -- printf( --" poly: Loads a .poly file (and possibly an associated .node file).\n"); -- printf(" ele: Loads an .ele file (and associated .node file).\n"); -- printf(" edge: Loads an .edge file (and associated .node file).\n"); -- printf( --" part: Loads a .part file (and associated .node and .ele files).\n"); -- printf( --" adj: Loads an .adj file (and associated .node, .ele, and .part files).\n"); -- printf(" voro: Loads a .v.node and .v.edge file for a Voronoi diagram.\n"); -- printf("\n"); -- printf( --" Each row represents a different iteration number of the geometry files.\n"); -- printf( --" For a full explanation of iteration numbers, read the instructions for\n"); -- printf( --" Triangle. Briefly, iteration numbers are used to allow a user to easily\n" --); -- printf( --" represent a sequence of related triangulations. Iteration numbers are\n"); -- printf( --" used in the names of geometry files; for instance, mymesh.3.ele is a\n"); -- printf( --" triangle file with iteration number three, and mymesh.ele has an implicit\n" --); -- printf(" iteration number of zero.\n\n"); -- printf( --" The control buttons at the right end of each row display the two\n"); -- printf( --" iterations currently under view. These buttons can be clicked to\n"); -- printf( --" increase or decrease the iteration numbers, and thus conveniently view\n"); -- printf(" a sequence of meshes.\n\n"); -- printf( --" Show Me keeps each file in memory after loading it, but you can force\n"); -- printf( --" Show Me to reread a set of files (for one iteration number) by reclicking\n" --); -- printf( --" the button that corresponds to the current image. This is convenient if\n" --); -- printf(" you have changed a geometry file.\n\n"); -- printf("File Formats:\n\n"); -- printf( --" All files may contain comments prefixed by the character '#'. Points,\n"); -- printf( --" segments, holes, triangles, edges, and subdomains must be numbered\n"); -- printf( --" consecutively, starting from either 1 or 0. Whichever you choose, all\n"); -- printf( --" input files must be consistent (for any single iteration number); if the\n" --); -- printf( --" nodes are numbered from 1, so must be all other objects. Show Me\n"); -- printf( --" automatically detects your choice while reading a .node (or .poly) file.\n" --); -- printf(" Examples of these file formats are given below.\n\n"); -- printf(" .node files:\n"); -- printf( --" First line: <# of points> <# of attributes>\n"); -- printf( --" <# of boundary markers (0 or 1)>\n" --); -- printf( --" Remaining lines: [attributes] [boundary marker]\n"); -- printf("\n"); -- printf( --" The attributes, which are typically floating-point values of physical\n"); -- printf( --" quantities (such as mass or conductivity) associated with the nodes of\n" --); -- printf( --" a finite element mesh, are ignored by Show Me. Show Me also ignores\n"); -- printf( --" boundary markers. See the instructions for Triangle to find out what\n"); -- printf(" attributes and boundary markers are.\n\n"); -- printf(" .poly files:\n"); -- printf( --" First line: <# of points> <# of attributes>\n"); -- printf( --" <# of boundary markers (0 or 1)>\n" --); -- printf( --" Following lines: [attributes] [boundary marker]\n"); -- printf(" One line: <# of segments> <# of boundary markers (0 or 1)>\n"); -- printf( --" Following lines: [boundary marker]\n"); -- printf(" One line: <# of holes>\n"); -- printf(" Following lines: \n"); -- printf(" [Optional additional lines that are ignored]\n\n"); -- printf( --" A .poly file represents a Planar Straight Line Graph (PSLG), an idea\n"); -- printf( --" familiar to computational geometers. By definition, a PSLG is just a\n"); -- printf( --" list of points and edges. A .poly file also contains some additional\n"); -- printf(" information.\n\n"); -- printf( --" The first section lists all the points, and is identical to the format\n" --); -- printf( --" of .node files. <# of points> may be set to zero to indicate that the\n" --); -- printf( --" points are listed in a separate .node file; .poly files produced by\n"); -- printf( --" Triangle always have this format. When Show Me reads such a file, it\n"); -- printf(" also reads the corresponding .node file.\n\n"); -- printf( --" The second section lists the segments. Segments are edges whose\n"); -- printf( --" presence in a triangulation produced from the PSLG is enforced. Each\n"); -- printf( --" segment is specified by listing the indices of its two endpoints. This\n" --); -- printf( --" means that its endpoints must be included in the point list. Each\n"); -- printf( --" segment, like each point, may have a boundary marker, which is ignored\n" --); -- printf(" by Show Me.\n\n"); -- printf( --" The third section lists holes and concavities that are desired in any\n"); -- printf( --" triangulation generated from the PSLG. Holes are specified by\n"); -- printf(" identifying a point inside each hole.\n\n"); -- printf(" .ele files:\n"); -- printf( --" First line: <# of triangles> <# of attributes>\n"); -- printf( --" Remaining lines: ... [attributes]\n" --); -- printf("\n"); -- printf( --" Points are indices into the corresponding .node file. Show Me ignores\n" --); -- printf( --" all but the first three points of each triangle; these should be the\n"); -- printf( --" corners listed in counterclockwise order around the triangle. The\n"); -- printf(" attributes are ignored by Show Me.\n\n"); -- printf(" .edge files:\n"); -- printf(" First line: <# of edges> <# of boundary markers (0 or 1)>\n"); -- printf( --" Following lines: [boundary marker]\n"); -- printf("\n"); -- printf( --" Endpoints are indices into the corresponding .node file. The boundary\n" --); -- printf(" markers are ignored by Show Me.\n\n"); -- printf( --" In Voronoi diagrams, one also finds a special kind of edge that is an\n"); -- printf( --" infinite ray with only one endpoint. For these edges, a different\n"); -- printf(" format is used:\n\n"); -- printf(" -1 \n\n"); -- printf( --" The `direction' is a floating-point vector that indicates the direction\n" --); -- printf(" of the infinite ray.\n\n"); -- printf(" .part files:\n"); -- printf(" First line: <# of triangles> <# of subdomains>\n"); -- printf(" Remaining lines: \n\n"); -- printf( --" The set of triangles is partitioned by a .part file; each triangle is\n"); -- printf(" mapped to a subdomain.\n\n"); -- printf(" .adj files:\n"); -- printf(" First line: <# of subdomains>\n"); -- printf(" Remaining lines: \n\n"); -- printf( --" An .adj file represents adjacencies between subdomains (presumably\n"); -- printf(" computed by a partitioner). The first line is followed by\n"); -- printf( --" (subdomains X subdomains) lines, each containing one entry of the\n"); -- printf( --" adjacency matrix. A nonzero entry indicates that two subdomains are\n"); -- printf(" adjacent (share a point).\n\n"); -- printf("Example:\n\n"); -- printf( --" Here is a sample file `box.poly' describing a square with a square hole:\n" --); -- printf("\n"); -- printf( --" # A box with eight points in 2D, no attributes, no boundary marker.\n"); -- printf(" 8 2 0 0\n"); -- printf(" # Outer box has these vertices:\n"); -- printf(" 1 0 0\n"); -- printf(" 2 0 3\n"); -- printf(" 3 3 0\n"); -- printf(" 4 3 3\n"); -- printf(" # Inner square has these vertices:\n"); -- printf(" 5 1 1\n"); -- printf(" 6 1 2\n"); -- printf(" 7 2 1\n"); -- printf(" 8 2 2\n"); -- printf(" # Five segments without boundary markers.\n"); -- printf(" 5 0\n"); -- printf(" 1 1 2 # Left side of outer box.\n"); -- printf(" 2 5 7 # Segments 2 through 5 enclose the hole.\n"); -- printf(" 3 7 8\n"); -- printf(" 4 8 6\n"); -- printf(" 5 6 5\n"); -- printf(" # One hole in the middle of the inner square.\n"); -- printf(" 1\n"); -- printf(" 1 1.5 1.5\n\n"); -- printf( --" After this PSLG is triangulated by Triangle, the resulting triangulation\n" --); -- printf( --" consists of a .node and .ele file. Here is the former, `box.1.node',\n"); -- printf(" which duplicates the points of the PSLG:\n\n"); -- printf(" 8 2 0 0\n"); -- printf(" 1 0 0\n"); -- printf(" 2 0 3\n"); -- printf(" 3 3 0\n"); -- printf(" 4 3 3\n"); -- printf(" 5 1 1\n"); -- printf(" 6 1 2\n"); -- printf(" 7 2 1\n"); -- printf(" 8 2 2\n"); -- printf(" # Generated by triangle -pcBev box\n"); -- printf("\n"); -- printf(" Here is the triangulation file, `box.1.ele'.\n"); -- printf("\n"); -- printf(" 8 3 0\n"); -- printf(" 1 1 5 6\n"); -- printf(" 2 5 1 3\n"); -- printf(" 3 2 6 8\n"); -- printf(" 4 6 2 1\n"); -- printf(" 5 7 3 4\n"); -- printf(" 6 3 7 5\n"); -- printf(" 7 8 4 2\n"); -- printf(" 8 4 8 7\n"); -- printf(" # Generated by triangle -pcBev box\n\n"); -- printf(" Here is the edge file for the triangulation, `box.1.edge'.\n\n"); -- printf(" 16 0\n"); -- printf(" 1 1 5\n"); -- printf(" 2 5 6\n"); -- printf(" 3 6 1\n"); -- printf(" 4 1 3\n"); -- printf(" 5 3 5\n"); -- printf(" 6 2 6\n"); -- printf(" 7 6 8\n"); -- printf(" 8 8 2\n"); -- printf(" 9 2 1\n"); -- printf(" 10 7 3\n"); -- printf(" 11 3 4\n"); -- printf(" 12 4 7\n"); -- printf(" 13 7 5\n"); -- printf(" 14 8 4\n"); -- printf(" 15 4 2\n"); -- printf(" 16 8 7\n"); -- printf(" # Generated by triangle -pcBev box\n"); -- printf("\n"); -- printf( --" Here's a file `box.1.part' that partitions the mesh into four subdomains.\n" --); -- printf("\n"); -- printf(" 8 4\n"); -- printf(" 1 3\n"); -- printf(" 2 3\n"); -- printf(" 3 4\n"); -- printf(" 4 4\n"); -- printf(" 5 1\n"); -- printf(" 6 1\n"); -- printf(" 7 2\n"); -- printf(" 8 2\n"); -- printf(" # Generated by slice -s4 box.1\n\n"); -- printf( --" Here's a file `box.1.adj' that represents the resulting adjacencies.\n"); -- printf("\n"); -- printf(" 4\n"); -- printf(" 9\n"); -- printf(" 2\n"); -- printf(" 2\n"); -- printf(" 0\n"); -- printf(" 2\n"); -- printf(" 9\n"); -- printf(" 0\n"); -- printf(" 2\n"); -- printf(" 2\n"); -- printf(" 0\n"); -- printf(" 9\n"); -- printf(" 2\n"); -- printf(" 0\n"); -- printf(" 2\n"); -- printf(" 2\n"); -- printf(" 9\n"); -- printf("\n"); -- printf("Display Speed:\n"); -- printf("\n"); -- printf( --" It is worthwhile to note that .edge files typically plot and print twice\n" --); -- printf( --" as quickly as .ele files, because .ele files cause each internal edge to\n" --); -- printf( --" be drawn twice. For the same reason, PostScript files created from edge\n" --); -- printf(" sets are smaller than those created from triangulations.\n\n"); -- printf("Show Me on the Web:\n\n"); -- printf( --" To see an illustrated, updated version of these instructions, check out\n"); -- printf("\n"); -- printf(" http://www.cs.cmu.edu/~quake/showme.html\n"); -- printf("\n"); -- printf("A Brief Plea:\n"); -- printf("\n"); -- printf( --" If you use Show Me (or Triangle), and especially if you use it to\n"); -- printf( --" accomplish real work, I would like very much to hear from you. A short\n"); -- printf( --" letter or email (to jrs@cs.cmu.edu) describing how you use Show Me (and\n"); -- printf( --" its sister programs) will mean a lot to me. The more people I know\n"); -- printf( --" are using my programs, the more easily I can justify spending time on\n"); -- printf( --" improvements, which in turn will benefit you. Also, I can put you\n"); -- printf( --" on a list to receive email whenever new versions are available.\n"); -- printf("\n"); -- printf( --" If you use a PostScript file generated by Show Me in a publication,\n"); -- printf(" please include an acknowledgment as well.\n\n"); -- exit(0); --} -- --void set_filenames(filename, lowermeshnumber) --char *filename; --int lowermeshnumber; --{ -- char numberstring[100]; -- int i; -- -- for (i = 0; i < 2; i++) { -- strcpy(nodefilename[i], filename); -- strcpy(polyfilename[i], filename); -- strcpy(elefilename[i], filename); -- strcpy(edgefilename[i], filename); -- strcpy(partfilename[i], filename); -- strcpy(adjfilename[i], filename); -- strcpy(vnodefilename[i], filename); -- strcpy(vedgefilename[i], filename); -- -- if (lowermeshnumber + i > 0) { -- sprintf(numberstring, ".%d", lowermeshnumber + i); -- strcat(nodefilename[i], numberstring); -- strcat(polyfilename[i], numberstring); -- strcat(elefilename[i], numberstring); -- strcat(edgefilename[i], numberstring); -- strcat(partfilename[i], numberstring); -- strcat(adjfilename[i], numberstring); -- strcat(vnodefilename[i], numberstring); -- strcat(vedgefilename[i], numberstring); -- } -- -- strcat(nodefilename[i], ".node"); -- strcat(polyfilename[i], ".poly"); -- strcat(elefilename[i], ".ele"); -- strcat(edgefilename[i], ".edge"); -- strcat(partfilename[i], ".part"); -- strcat(adjfilename[i], ".adj"); -- strcat(vnodefilename[i], ".v.node"); -- strcat(vedgefilename[i], ".v.edge"); -- } --} -- --#if 1 /* This function is already in netlib.lib, see triangle.c */ --void parsecommandline(int argc, char **argv); --#else --void parsecommandline(argc, argv) --int argc; --char **argv; --{ -- int increment; -- int meshnumber; -- int i, j; -- -- quiet = 0; -- fillelem = 0; -- line_width = 1; -- bw_ps = 0; -- start_image = ELE; -- filename[0] = '\0'; -- for (i = 1; i < argc; i++) { -- if (argv[i][0] == '-') { -- for (j = 1; argv[i][j] != '\0'; j++) { -- if (argv[i][j] == 'f') { -- fillelem = 1; -- } -- if (argv[i][j] == 'w') { -- if ((argv[i][j + 1] >= '1') && (argv[i][j + 1] <= '9')) { -- line_width = 0; -- while ((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) { -- j++; -- line_width = line_width * 10 + (int) (argv[i][j] - '0'); -- } -- if (line_width > 100) { -- printf("Error: Line width cannot exceed 100.\n"); -- line_width = 1; -- } -- } -- } -- if (argv[i][j] == 'b') { -- bw_ps = 1; -- } -- if (argv[i][j] == 'Q') { -- quiet = 1; -- } -- if ((argv[i][j] == 'h') || (argv[i][j] == 'H') || -- (argv[i][j] == '?')) { -- info(); -- } -- } -- } else { -- strcpy(filename, argv[i]); -- } -- } -- if (filename[0] == '\0') { -- syntax(); -- } -- if (!strcmp(&filename[strlen(filename) - 5], ".node")) { -- filename[strlen(filename) - 5] = '\0'; -- start_image = NODE; -- } -- if (!strcmp(&filename[strlen(filename) - 5], ".poly")) { -- filename[strlen(filename) - 5] = '\0'; -- start_image = POLY; -- } -- if (!strcmp(&filename[strlen(filename) - 4], ".ele")) { -- filename[strlen(filename) - 4] = '\0'; -- start_image = ELE; -- } -- if (!strcmp(&filename[strlen(filename) - 5], ".edge")) { -- filename[strlen(filename) - 5] = '\0'; -- start_image = EDGE; -- } -- if (!strcmp(&filename[strlen(filename) - 5], ".part")) { -- filename[strlen(filename) - 5] = '\0'; -- start_image = PART; -- } -- if (!strcmp(&filename[strlen(filename) - 4], ".adj")) { -- filename[strlen(filename) - 4] = '\0'; -- start_image = ADJ; -- } -- -- increment = 0; -- j = 1; -- while (filename[j] != '\0') { -- if ((filename[j] == '.') && (filename[j + 1] != '\0')) { -- increment = j + 1; -- } -- j++; -- } -- meshnumber = 0; -- if (increment > 0) { -- j = increment; -- do { -- if ((filename[j] >= '0') && (filename[j] <= '9')) { -- meshnumber = meshnumber * 10 + (int) (filename[j] - '0'); -- } else { -- increment = 0; -- } -- j++; -- } while (filename[j] != '\0'); -- } -- if (increment > 0) { -- filename[increment - 1] = '\0'; -- } -- -- if (meshnumber == 0) { -- start_inc = 0; -- loweriteration = 0; -- } else { -- start_inc = 1; -- loweriteration = meshnumber - 1; -- } -- set_filenames(filename, loweriteration); --} --#endif /* 0 */ -- --void free_inc(inc) --int inc; --{ -- if (loaded[inc][NODE]) { -- free(nodeptr[inc]); -- } -- if (loaded[inc][POLY]) { -- if (polynodes[inc] > 0) { -- free(polynodeptr[inc]); -- } -- free(polyedgeptr[inc]); -- free(polyholeptr[inc]); -- } -- if (loaded[inc][ELE]) { -- free(eleptr[inc]); -- } -- if (loaded[inc][PART]) { -- free(partpart[inc]); -- free(partcenter[inc]); -- free(partshift[inc]); -- } -- if (loaded[inc][EDGE]) { -- free(edgeptr[inc]); -- free(normptr[inc]); -- } -- if (loaded[inc][ADJ]) { -- free(adjptr[inc]); -- } -- if (loaded[inc][VORO]) { -- free(vnodeptr[inc]); -- free(vedgeptr[inc]); -- free(vnormptr[inc]); -- } --} -- --void move_inc(inc) --int inc; --{ -- int i; -- -- free_inc(1 - inc); -- for (i = 0; i < IMAGE_TYPES; i++) { -- loaded[1 - inc][i] = loaded[inc][i]; -- loaded[inc][i] = 0; -- xlo[1 - inc][i] = xlo[inc][i]; -- ylo[1 - inc][i] = ylo[inc][i]; -- xhi[1 - inc][i] = xhi[inc][i]; -- yhi[1 - inc][i] = yhi[inc][i]; -- } -- nodes[1 - inc] = nodes[inc]; -- node_dim[1 - inc] = node_dim[inc]; -- nodeptr[1 - inc] = nodeptr[inc]; -- polynodes[1 - inc] = polynodes[inc]; -- poly_dim[1 - inc] = poly_dim[inc]; -- polyedges[1 - inc] = polyedges[inc]; -- polyholes[1 - inc] = polyholes[inc]; -- polynodeptr[1 - inc] = polynodeptr[inc]; -- polyedgeptr[1 - inc] = polyedgeptr[inc]; -- polyholeptr[1 - inc] = polyholeptr[inc]; -- elems[1 - inc] = elems[inc]; -- ele_corners[1 - inc] = ele_corners[inc]; -- eleptr[1 - inc] = eleptr[inc]; -- edges[1 - inc] = edges[inc]; -- edgeptr[1 - inc] = edgeptr[inc]; -- normptr[1 - inc] = normptr[inc]; -- subdomains[1 - inc] = subdomains[inc]; -- partpart[1 - inc] = partpart[inc]; -- partcenter[1 - inc] = partcenter[inc]; -- partshift[1 - inc] = partshift[inc]; -- adjsubdomains[1 - inc] = adjsubdomains[inc]; -- adjptr[1 - inc] = adjptr[inc]; -- vnodes[1 - inc] = vnodes[inc]; -- vnode_dim[1 - inc] = vnode_dim[inc]; -- vnodeptr[1 - inc] = vnodeptr[inc]; -- vedges[1 - inc] = vedges[inc]; -- vedgeptr[1 - inc] = vedgeptr[inc]; -- vnormptr[1 - inc] = vnormptr[inc]; -- firstnumber[1 - inc] = firstnumber[inc]; -- firstnumber[inc] = -1; --} -- --void unload_inc(inc) --int inc; --{ -- int i; -- -- current_image = NOTHING; -- for (i = 0; i < IMAGE_TYPES; i++) { -- loaded[inc][i] = 0; -- firstnumber[inc] = -1; -- } --} -- --void showme_init() --{ -- current_image = NOTHING; -- current_inc = 0; -- explosion = STARTEXPLOSION; -- unload_inc(0); -- unload_inc(1); --} -- --char *readline(string, infile, infilename) --char *string; --FILE *infile; --char *infilename; --{ -- char *result; -- -- do { -- result = fgets(string, INPUTLINESIZE, infile); -- if (result == (char *) NULL) { -- printf(" Error: Unexpected end of file in %s.\n", -- infilename); -- exit(1); -- } -- while ((*result != '\0') && (*result != '#') -- && (*result != '.') && (*result != '+') && (*result != '-') -- && ((*result < '0') || (*result > '9'))) { -- result++; -- } -- } while ((*result == '#') || (*result == '\0')); -- return result; --} -- --char *findfield(string) --char *string; --{ -- char *result; -- -- result = string; -- while ((*result != '\0') && (*result != '#') -- && (*result != ' ') && (*result != '\t')) { -- result++; -- } -- while ((*result != '\0') && (*result != '#') -- && (*result != '.') && (*result != '+') && (*result != '-') -- && ((*result < '0') || (*result > '9'))) { -- result++; -- } -- if (*result == '#') { -- *result = '\0'; -- } -- return result; --} -- --int load_node(fname, firstnumber, nodes, dim, ptr, xmin, ymin, xmax, ymax) --char *fname; --int *firstnumber; --int *nodes; --int *dim; --REAL **ptr; --REAL *xmin; --REAL *ymin; --REAL *xmax; --REAL *ymax; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int extras; -- int nodemarks; -- int index; -- int nodenumber; -- int i, j; -- int smallerr; -- REAL x, y; -- -- *xmin = *ymin = 0.0; -- *xmax = *ymax = 1.0; -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- *nodes = (int) strtol (stringptr, &stringptr, 0); -- if (*nodes < 3) { -- printf(" Error: %s contains %d points.\n", fname, *nodes); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- *dim = 2; -- } else { -- *dim = (int) strtol (stringptr, &stringptr, 0); -- } -- if (*dim < 1) { -- printf(" Error: %s has dimensionality %d.\n", fname, *dim); -- return 1; -- } -- if (*dim != 2) { -- printf(" I only understand two-dimensional meshes.\n"); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- extras = 0; -- } else { -- extras = (int) strtol (stringptr, &stringptr, 0); -- } -- if (extras < 0) { -- printf(" Error: %s has negative value for number of attributes.\n", -- fname); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- nodemarks = 0; -- } else { -- nodemarks = (int) strtol (stringptr, &stringptr, 0); -- } -- if (nodemarks < 0) { -- printf(" Warning: %s has negative value for number of point markers.\n", -- fname); -- } -- if (nodemarks > 1) { -- printf( -- " Warning: %s has value greater than one for number of point markers.\n", -- fname); -- } -- *ptr = (REAL *) malloc((*nodes + 1) * *dim * sizeof(REAL)); -- if (*ptr == (REAL *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- index = *dim; -- smallerr = 1; -- for (i = 0; i < *nodes; i++) { -- stringptr = readline(inputline, infile, fname); -- nodenumber = (int) strtol (stringptr, &stringptr, 0); -- if ((i == 0) && (*firstnumber == -1)) { -- if (nodenumber == 0) { -- *firstnumber = 0; -- } else { -- *firstnumber = 1; -- } -- } -- if ((nodenumber != *firstnumber + i) && (smallerr)) { -- printf(" Warning: Points in %s are not numbered correctly\n", fname); -- printf(" (starting with point %d).\n", *firstnumber + i); -- smallerr = 0; -- } -- for (j = 0; j < *dim; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Point %d is missing a coordinate in %s.\n", -- *firstnumber + i, fname); -- free(*ptr); -- return 1; -- } -- (*ptr)[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- } -- fclose(infile); -- index = *dim; -- *xmin = *xmax = (*ptr)[index]; -- *ymin = *ymax = (*ptr)[index + 1]; -- for (i = 2; i <= *nodes; i++) { -- index += *dim; -- x = (*ptr)[index]; -- y = (*ptr)[index + 1]; -- if (x < *xmin) { -- *xmin = x; -- } -- if (y < *ymin) { -- *ymin = y; -- } -- if (x > *xmax) { -- *xmax = x; -- } -- if (y > *ymax) { -- *ymax = y; -- } -- } -- if (*xmin == *xmax) { -- *xmin -= 0.5; -- *xmax += 0.5; -- } -- if (*ymin == *ymax) { -- *ymin -= 0.5; -- *ymax += 0.5; -- } -- return 0; --} -- --int load_poly(inc, fname, firstnumber, pnodes, dim, edges, holes, nodeptr, -- edgeptr, holeptr, xmin, ymin, xmax, ymax) --int inc; --char *fname; --int *firstnumber; --int *pnodes; --int *dim; --int *edges; --int *holes; --REAL **nodeptr; --int **edgeptr; --REAL **holeptr; --REAL *xmin; --REAL *ymin; --REAL *xmax; --REAL *ymax; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int extras; -- int nodemarks; -- int segmentmarks; -- int index; -- int nodenumber, edgenumber, holenumber; -- int maxnode; -- int i, j; -- int smallerr; -- REAL x, y; -- -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- *pnodes = (int) strtol (stringptr, &stringptr, 0); -- if (*pnodes == 0) { -- if (!loaded[inc][NODE]) { -- if (load_image(inc, NODE)) { -- return 1; -- } -- } -- maxnode = nodes[inc]; -- *xmin = xlo[inc][NODE]; -- *ymin = ylo[inc][NODE]; -- *xmax = xhi[inc][NODE]; -- *ymax = yhi[inc][NODE]; -- } else { -- if (*pnodes < 1) { -- printf(" Error: %s contains %d points.\n", fname, *pnodes); -- return 1; -- } -- maxnode = *pnodes; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- *dim = 2; -- } else { -- *dim = (int) strtol (stringptr, &stringptr, 0); -- } -- if (*dim < 1) { -- printf(" Error: %s has dimensionality %d.\n", fname, *dim); -- return 1; -- } -- if (*dim != 2) { -- printf(" I only understand two-dimensional meshes.\n"); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- extras = 0; -- } else { -- extras = (int) strtol (stringptr, &stringptr, 0); -- } -- if (extras < 0) { -- printf(" Error: %s has negative value for number of attributes.\n", -- fname); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- nodemarks = 0; -- } else { -- nodemarks = (int) strtol (stringptr, &stringptr, 0); -- } -- if (nodemarks < 0) { -- printf(" Warning: %s has negative value for number of point markers.\n", -- fname); -- } -- if (nodemarks > 1) { -- printf( -- " Warning: %s has value greater than one for number of point markers.\n", -- fname); -- } -- if (*pnodes > 0) { -- *nodeptr = (REAL *) malloc((*pnodes + 1) * *dim * sizeof(REAL)); -- if (*nodeptr == (REAL *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- index = *dim; -- smallerr = 1; -- for (i = 0; i < *pnodes; i++) { -- stringptr = readline(inputline, infile, fname); -- nodenumber = (int) strtol (stringptr, &stringptr, 0); -- if ((i == 0) && (*firstnumber == -1)) { -- if (nodenumber == 0) { -- *firstnumber = 0; -- } else { -- *firstnumber = 1; -- } -- } -- if ((nodenumber != *firstnumber + i) && (smallerr)) { -- printf(" Warning: Points in %s are not numbered correctly.\n", -- fname); -- printf(" (starting with point %d).\n", *firstnumber + i); -- smallerr = 0; -- } -- for (j = 0; j < *dim; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Point %d is missing a coordinate in %s.\n", -- *firstnumber + i, fname); -- free(*nodeptr); -- return 1; -- } -- (*nodeptr)[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- } -- } -- stringptr = readline(inputline, infile, fname); -- *edges = (int) strtol (stringptr, &stringptr, 0); -- if (*edges < 0) { -- printf(" Error: %s contains %d segments.\n", fname, *edges); -- free(*nodeptr); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- segmentmarks = 0; -- } else { -- segmentmarks = (int) strtol (stringptr, &stringptr, 0); -- } -- if (segmentmarks < 0) { -- printf(" Error: %s has negative value for number of segment markers.\n", -- fname); -- free(*nodeptr); -- return 1; -- } -- if (segmentmarks > 1) { -- printf( -- " Error: %s has value greater than one for number of segment markers.\n", -- fname); -- free(*nodeptr); -- return 1; -- } -- *edgeptr = (int *) malloc(((*edges + 1) << 1) * sizeof(int)); -- if (*edgeptr == (int *) NULL) { -- printf(" Out of memory.\n"); -- free(*nodeptr); -- return 1; -- } -- index = 2; -- smallerr = 1; -- for (i = *firstnumber; i < *firstnumber + *edges; i++) { -- stringptr = readline(inputline, infile, fname); -- edgenumber = (int) strtol (stringptr, &stringptr, 0); -- if ((edgenumber != i) && (smallerr)) { -- printf(" Warning: Segments in %s are not numbered correctly.\n", -- fname); -- printf(" (starting with segment %d).\n", i); -- smallerr = 0; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %d is missing its endpoints in %s.\n", i, fname); -- free(*nodeptr); -- free(*edgeptr); -- return 1; -- } -- (*edgeptr)[index] = (int) strtol (stringptr, &stringptr, 0) + 1 - -- *firstnumber; -- if (((*edgeptr)[index] < 1) || ((*edgeptr)[index] > maxnode)) { -- printf("Error: Segment %d has invalid endpoint in %s.\n", i, fname); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %d is missing an endpoint in %s.\n", i, fname); -- free(*nodeptr); -- free(*edgeptr); -- return 1; -- } -- (*edgeptr)[index + 1] = (int) strtol (stringptr, &stringptr, 0) + 1 - -- *firstnumber; -- if (((*edgeptr)[index + 1] < 1) || ((*edgeptr)[index + 1] > maxnode)) { -- printf("Error: Segment %d has invalid endpoint in %s.\n", i, fname); -- return 1; -- } -- index += 2; -- } -- stringptr = readline(inputline, infile, fname); -- *holes = (int) strtol (stringptr, &stringptr, 0); -- if (*holes < 0) { -- printf(" Error: %s contains %d holes.\n", fname, *holes); -- free(*nodeptr); -- free(*edgeptr); -- return 1; -- } -- *holeptr = (REAL *) malloc((*holes + 1) * *dim * sizeof(REAL)); -- if (*holeptr == (REAL *) NULL) { -- printf(" Out of memory.\n"); -- free(*nodeptr); -- free(*edgeptr); -- return 1; -- } -- index = *dim; -- smallerr = 1; -- for (i = *firstnumber; i < *firstnumber + *holes; i++) { -- stringptr = readline(inputline, infile, fname); -- holenumber = (int) strtol (stringptr, &stringptr, 0); -- if ((holenumber != i) && (smallerr)) { -- printf(" Warning: Holes in %s are not numbered correctly.\n", fname); -- printf(" (starting with hole %d).\n", i); -- smallerr = 0; -- } -- for (j = 0; j < *dim; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Hole %d is missing a coordinate in %s.\n", i, -- fname); -- free(*nodeptr); -- free(*edgeptr); -- free(*holeptr); -- return 1; -- } -- (*holeptr)[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- } -- fclose(infile); -- if (*pnodes > 0) { -- index = *dim; -- *xmin = *xmax = (*nodeptr)[index]; -- *ymin = *ymax = (*nodeptr)[index + 1]; -- for (i = 2; i <= *pnodes; i++) { -- index += *dim; -- x = (*nodeptr)[index]; -- y = (*nodeptr)[index + 1]; -- if (x < *xmin) { -- *xmin = x; -- } -- if (y < *ymin) { -- *ymin = y; -- } -- if (x > *xmax) { -- *xmax = x; -- } -- if (y > *ymax) { -- *ymax = y; -- } -- } -- } -- index = *dim; -- for (i = 1; i <= *holes; i++) { -- x = (*holeptr)[index]; -- y = (*holeptr)[index + 1]; -- if (x < *xmin) { -- *xmin = x; -- } -- if (y < *ymin) { -- *ymin = y; -- } -- if (x > *xmax) { -- *xmax = x; -- } -- if (y > *ymax) { -- *ymax = y; -- } -- index += *dim; -- } -- return 0; --} -- --int load_ele(fname, firstnumber, nodes, elems, corners, ptr) --char *fname; --int firstnumber; --int nodes; --int *elems; --int *corners; --int **ptr; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int extras; -- int index; -- int elemnumber; -- int i, j; -- int smallerr; -- -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- *elems = (int) strtol (stringptr, &stringptr, 0); -- if (*elems < 1) { -- printf(" Error: %s contains %d triangles.\n", fname, *elems); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- *corners = 3; -- } else { -- *corners = (int) strtol (stringptr, &stringptr, 0); -- } -- if (*corners < 3) { -- printf(" Error: Triangles in %s have only %d corners.\n", fname, -- *corners); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- extras = 0; -- } else { -- extras = (int) strtol (stringptr, &stringptr, 0); -- } -- if (extras < 0) { -- printf(" Error: %s has negative value for extra fields.\n", fname); -- return 1; -- } -- *ptr = (int *) malloc((*elems + 1) * 3 * sizeof(int)); -- if (*ptr == (int *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- index = 3; -- smallerr = 1; -- for (i = firstnumber; i < firstnumber + *elems; i++) { -- stringptr = readline(inputline, infile, fname); -- elemnumber = (int) strtol (stringptr, &stringptr, 0); -- if ((elemnumber != i) && (smallerr)) { -- printf(" Warning: Triangles in %s are not numbered correctly.\n", -- fname); -- printf(" (starting with triangle %d).\n", i); -- smallerr = 0; -- } -- for (j = 0; j < 3; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Triangle %d is missing a corner in %s.\n", i, fname); -- free(*ptr); -- return 1; -- } -- (*ptr)[index] = (int) strtol (stringptr, &stringptr, 0) + 1 - -- firstnumber; -- if (((*ptr)[index] < 1) || ((*ptr)[index] > nodes)) { -- printf("Error: Triangle %d has invalid corner in %s.\n", i, fname); -- return 1; -- } -- index++; -- } -- } -- fclose(infile); -- return 0; --} -- --int load_edge(fname, firstnumber, nodes, edges, edgeptr, normptr) --char *fname; --int firstnumber; --int nodes; --int *edges; --int **edgeptr; --REAL **normptr; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int index; -- int edgenumber; -- int edgemarks; -- int i; -- int smallerr; -- -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- *edges = (int) strtol (stringptr, &stringptr, 0); -- if (*edges < 1) { -- printf(" Error: %s contains %d edges.\n", fname, *edges); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- edgemarks = 0; -- } else { -- edgemarks = (int) strtol (stringptr, &stringptr, 0); -- } -- if (edgemarks < 0) { -- printf(" Error: %s has negative value for number of edge markers.\n", -- fname); -- return 1; -- } -- if (edgemarks > 1) { -- printf( -- " Error: %s has value greater than one for number of edge markers.\n", -- fname); -- return 1; -- } -- *edgeptr = (int *) malloc(((*edges + 1) << 1) * sizeof(int)); -- if (*edgeptr == (int *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- *normptr = (REAL *) malloc(((*edges + 1) << 1) * sizeof(REAL)); -- if (*normptr == (REAL *) NULL) { -- printf(" Out of memory.\n"); -- free(*edgeptr); -- return 1; -- } -- index = 2; -- smallerr = 1; -- for (i = firstnumber; i < firstnumber + *edges; i++) { -- stringptr = readline(inputline, infile, fname); -- edgenumber = (int) strtol (stringptr, &stringptr, 0); -- if ((edgenumber != i) && (smallerr)) { -- printf(" Warning: Edges in %s are not numbered correctly.\n", fname); -- printf(" (starting with edge %d).\n", i); -- smallerr = 0; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Edge %d is missing its endpoints in %s.\n", i, fname); -- free(*edgeptr); -- free(*normptr); -- return 1; -- } -- (*edgeptr)[index] = (int) strtol (stringptr, &stringptr, 0) + 1 - -- firstnumber; -- if (((*edgeptr)[index] < 1) || ((*edgeptr)[index] > nodes)) { -- printf("Error: Edge %d has invalid endpoint in %s.\n", i, fname); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Edge %d is missing an endpoint in %s.\n", i, fname); -- free(*edgeptr); -- free(*normptr); -- return 1; -- } -- (*edgeptr)[index + 1] = (int) strtol (stringptr, &stringptr, 0); -- if ((*edgeptr)[index + 1] == -1) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Edge %d is missing its direction in %s.\n", i, fname); -- free(*edgeptr); -- free(*normptr); -- return 1; -- } -- (*normptr)[index] = (REAL) strtod(stringptr, &stringptr); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Edge %d is missing a direction coordinate in %s.\n", -- i, fname); -- free(*edgeptr); -- free(*normptr); -- return 1; -- } -- (*normptr)[index + 1] = (REAL) strtod(stringptr, &stringptr); -- } else { -- (*edgeptr)[index + 1] += 1 - firstnumber; -- if (((*edgeptr)[index + 1] < 1) || ((*edgeptr)[index + 1] > nodes)) { -- printf("Error: Edge %d has invalid endpoint in %s.\n", i, fname); -- return 1; -- } -- } -- index += 2; -- } -- fclose(infile); -- return 0; --} -- --int load_part(fname, dim, firstnumber, elems, nodeptr, eleptr, parts, -- partition, partcenter, partshift) --char *fname; --int dim; --int firstnumber; --int elems; --REAL *nodeptr; --int *eleptr; --int *parts; --int **partition; --REAL **partcenter; --REAL **partshift; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int partelems; -- int index; -- int elemnumber; -- int i, j; -- int smallerr; -- int *partsize; -- -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- partelems = (int) strtol (stringptr, &stringptr, 0); -- if (partelems != elems) { -- printf( -- " Error: .ele and .part files do not agree on number of triangles.\n"); -- return 1; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- *parts = 1; -- } else { -- *parts = (int) strtol (stringptr, &stringptr, 0); -- } -- if (*parts < 1) { -- printf(" Error: %s specifies %d subdomains.\n", fname, *parts); -- return 1; -- } -- *partition = (int *) malloc((elems + 1) * sizeof(int)); -- if (*partition == (int *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- smallerr = 1; -- for (i = firstnumber; i < firstnumber + partelems; i++) { -- stringptr = readline(inputline, infile, fname); -- elemnumber = (int) strtol (stringptr, &stringptr, 0); -- if ((elemnumber != i) && (smallerr)) { -- printf(" Warning: Triangles in %s are not numbered correctly.\n", -- fname); -- printf(" (starting with triangle %d).\n", i); -- smallerr = 0; -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Triangle %d has no subdomain in %s.\n", i, fname); -- free(*partition); -- return 1; -- } -- (*partition)[i] = (int) strtol (stringptr, &stringptr, 0) - firstnumber; -- if (((*partition)[i] >= *parts) || ((*partition)[i] < 0)) { -- printf(" Error: Triangle %d of %s has an invalid subdomain.\n", -- i, fname); -- free(*partition); -- return 1; -- } -- } -- fclose(infile); -- *partcenter = (REAL *) malloc(((*parts + 1) << 1) * sizeof(REAL)); -- if (*partcenter == (REAL *) NULL) { -- printf("Error: Out of memory.\n"); -- free(*partition); -- return 1; -- } -- *partshift = (REAL *) malloc((*parts << 1) * sizeof(REAL)); -- if (*partshift == (REAL *) NULL) { -- printf("Error: Out of memory.\n"); -- free(*partition); -- free(*partcenter); -- return 1; -- } -- partsize = (int *) malloc((*parts + 1) * sizeof(int)); -- if (partsize == (int *) NULL) { -- printf("Error: Out of memory.\n"); -- free(*partition); -- free(*partcenter); -- free(*partshift); -- return 1; -- } -- index = 3; -- for (i = 0; i <= *parts; i++) { -- partsize[i] = 0; -- (*partcenter)[i << 1] = 0.0; -- (*partcenter)[(i << 1) + 1] = 0.0; -- } -- for (i = 1; i <= elems; i++) { -- partsize[(*partition)[i]] += 3; -- for (j = 0; j < 3; j++) { -- (*partcenter)[(*partition)[i] << 1] += -- nodeptr[eleptr[index] * dim]; -- (*partcenter)[((*partition)[i] << 1) + 1] += -- nodeptr[eleptr[index++] * dim + 1]; -- } -- } -- for (i = 0; i < *parts; i++) { -- (*partcenter)[i << 1] /= (REAL) partsize[i]; -- (*partcenter)[(i << 1) + 1] /= (REAL) partsize[i]; -- (*partcenter)[*parts << 1] += (*partcenter)[i << 1]; -- (*partcenter)[(*parts << 1) + 1] += (*partcenter)[(i << 1) + 1]; -- } -- (*partcenter)[*parts << 1] /= (REAL) *parts; -- (*partcenter)[(*parts << 1) + 1] /= (REAL) *parts; -- free(partsize); -- return 0; --} -- --int load_adj(fname, subdomains, ptr) --char *fname; --int *subdomains; --int **ptr; --{ -- FILE *infile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int i, j; -- -- if (!quiet) { -- printf("Opening %s.\n", fname); -- } -- infile = fopen(fname, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", fname); -- return 1; -- } -- stringptr = readline(inputline, infile, fname); -- *subdomains = (int) strtol (stringptr, &stringptr, 0); -- if (*subdomains < 1) { -- printf(" Error: %s contains %d subdomains.\n", fname, *subdomains); -- return 1; -- } -- *ptr = (int *) malloc(*subdomains * *subdomains * sizeof(int)); -- if (*ptr == (int *) NULL) { -- printf(" Out of memory.\n"); -- return 1; -- } -- for (i = 0; i < *subdomains; i++) { -- for (j = 0; j < *subdomains; j++) { -- stringptr = readline(inputline, infile, fname); -- (*ptr)[i * *subdomains + j] = (int) strtol (stringptr, &stringptr, 0); -- } -- } -- return 0; --} -- --void findpartshift(parts, explosion, partcenter, partshift) --int parts; --REAL explosion; --REAL *partcenter; --REAL *partshift; --{ -- int i; -- -- for (i = 0; i < parts; i++) { -- partshift[i << 1] = explosion * -- (partcenter[i << 1] - partcenter[parts << 1]); -- partshift[(i << 1) + 1] = explosion * -- (partcenter[(i << 1) + 1] - partcenter[(parts << 1) + 1]); -- } --} -- --int load_image(inc, image) --int inc; --int image; --{ -- int error; -- -- switch (image) { -- case NODE: -- error = load_node(nodefilename[inc], &firstnumber[inc], &nodes[inc], -- &node_dim[inc], &nodeptr[inc], &xlo[inc][NODE], -- &ylo[inc][NODE], &xhi[inc][NODE], &yhi[inc][NODE]); -- break; -- case POLY: -- error = load_poly(inc, polyfilename[inc], &firstnumber[inc], -- &polynodes[inc], &poly_dim[inc], &polyedges[inc], -- &polyholes[inc], &polynodeptr[inc], &polyedgeptr[inc], -- &polyholeptr[inc], -- &xlo[inc][POLY], &ylo[inc][POLY], -- &xhi[inc][POLY], &yhi[inc][POLY]); -- break; -- case ELE: -- error = load_ele(elefilename[inc], firstnumber[inc], nodes[inc], -- &elems[inc], &ele_corners[inc], &eleptr[inc]); -- xlo[inc][ELE] = xlo[inc][NODE]; -- ylo[inc][ELE] = ylo[inc][NODE]; -- xhi[inc][ELE] = xhi[inc][NODE]; -- yhi[inc][ELE] = yhi[inc][NODE]; -- break; -- case EDGE: -- error = load_edge(edgefilename[inc], firstnumber[inc], nodes[inc], -- &edges[inc], &edgeptr[inc], &normptr[inc]); -- xlo[inc][EDGE] = xlo[inc][NODE]; -- ylo[inc][EDGE] = ylo[inc][NODE]; -- xhi[inc][EDGE] = xhi[inc][NODE]; -- yhi[inc][EDGE] = yhi[inc][NODE]; -- break; -- case PART: -- error = load_part(partfilename[inc], node_dim[inc], firstnumber[inc], -- elems[inc], nodeptr[inc], eleptr[inc], -- &subdomains[inc], &partpart[inc], &partcenter[inc], -- &partshift[inc]); -- if (!error) { -- findpartshift(subdomains[inc], explosion, partcenter[inc], -- partshift[inc]); -- } -- xlo[inc][PART] = xlo[inc][NODE]; -- ylo[inc][PART] = ylo[inc][NODE]; -- xhi[inc][PART] = xhi[inc][NODE]; -- yhi[inc][PART] = yhi[inc][NODE]; -- break; -- case ADJ: -- error = load_adj(adjfilename[inc], &adjsubdomains[inc], &adjptr[inc]); -- xlo[inc][ADJ] = xlo[inc][NODE]; -- ylo[inc][ADJ] = ylo[inc][NODE]; -- xhi[inc][ADJ] = xhi[inc][NODE]; -- yhi[inc][ADJ] = yhi[inc][NODE]; -- break; -- case VORO: -- error = load_node(vnodefilename[inc], &firstnumber[inc], &vnodes[inc], -- &vnode_dim[inc], &vnodeptr[inc], &xlo[inc][VORO], -- &ylo[inc][VORO], &xhi[inc][VORO], &yhi[inc][VORO]); -- if (!error) { -- error = load_edge(vedgefilename[inc], firstnumber[inc], vnodes[inc], -- &vedges[inc], &vedgeptr[inc], &vnormptr[inc]); -- } -- break; -- default: -- error = 1; -- } -- if (!error) { -- loaded[inc][image] = 1; -- } -- return error; --} -- --void choose_image(inc, image) --int inc; --int image; --{ -- if (!loaded[inc][image]) { -- if ((image == ELE) || (image == EDGE) || (image == PART) -- || (image == ADJ)) { -- if (!loaded[inc][NODE]) { -- if (load_image(inc, NODE)) { -- return; -- } -- } -- } -- if ((image == PART) || (image == ADJ)) { -- if (!loaded[inc][ELE]) { -- if (load_image(inc, ELE)) { -- return; -- } -- } -- } -- if (image == ADJ) { -- if (!loaded[inc][PART]) { -- if (load_image(inc, PART)) { -- return; -- } -- } -- } -- if (load_image(inc, image)) { -- return; -- } -- } -- current_inc = inc; -- current_image = image; --} -- --Window make_button(name, x, y, width) --char *name; --int x; --int y; --int width; --{ -- XSetWindowAttributes attr; -- XSizeHints hints; -- Window button; -- -- attr.background_pixel = black; -- attr.border_pixel = white; -- attr.backing_store = NotUseful; -- attr.event_mask = ExposureMask | ButtonReleaseMask | ButtonPressMask; -- attr.bit_gravity = SouthWestGravity; -- attr.win_gravity = SouthWestGravity; -- attr.save_under = False; -- button = XCreateWindow(display, mainwindow, x, y, width, BUTTONHEIGHT - 4, -- 2, 0, InputOutput, CopyFromParent, -- CWBackPixel | CWBorderPixel | CWEventMask | -- CWBitGravity | CWWinGravity | CWBackingStore | -- CWSaveUnder, &attr); -- hints.width = width; -- hints.height = BUTTONHEIGHT - 4; -- hints.min_width = 0; -- hints.min_height = BUTTONHEIGHT - 4; -- hints.max_width = width; -- hints.max_height = BUTTONHEIGHT - 4; -- hints.width_inc = 1; -- hints.height_inc = 1; -- hints.flags = PMinSize | PMaxSize | PSize | PResizeInc; -- XSetStandardProperties(display, button, name, "showme", None, (char **) NULL, -- 0, &hints); -- return button; --} -- --void make_buttons(y) --int y; --{ -- int i; -- -- for (i = 1; i >= 0; i--) { -- nodewin[i] = make_button("node", 0, y + (1 - i) * BUTTONHEIGHT, 42); -- XMapWindow(display, nodewin[i]); -- polywin[i] = make_button("poly", 44, y + (1 - i) * BUTTONHEIGHT, 42); -- XMapWindow(display, polywin[i]); -- elewin[i] = make_button("ele", 88, y + (1 - i) * BUTTONHEIGHT, 33); -- XMapWindow(display, elewin[i]); -- edgewin[i] = make_button("edge", 123, y + (1 - i) * BUTTONHEIGHT, 42); -- XMapWindow(display, edgewin[i]); -- partwin[i] = make_button("part", 167, y + (1 - i) * BUTTONHEIGHT, 42); -- XMapWindow(display, partwin[i]); -- adjwin[i] = make_button("adj", 211, y + (1 - i) * BUTTONHEIGHT, 33); -- XMapWindow(display, adjwin[i]); -- voronoiwin[i] = make_button("voro", 246, y + (1 - i) * BUTTONHEIGHT, 42); -- XMapWindow(display, voronoiwin[i]); -- } -- versionpluswin = make_button(" +", 290, y, 52); -- XMapWindow(display, versionpluswin); -- versionminuswin = make_button(" -", 290, y + BUTTONHEIGHT, 52); -- XMapWindow(display, versionminuswin); -- -- quitwin = make_button("Quit", 0, y + 2 * BUTTONHEIGHT, 42); -- XMapWindow(display, quitwin); -- leftwin = make_button("<", 44, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, leftwin); -- rightwin = make_button(">", 60, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, rightwin); -- upwin = make_button("^", 76, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, upwin); -- downwin = make_button("v", 92, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, downwin); -- resetwin = make_button("Reset", 108, y + 2 * BUTTONHEIGHT, 52); -- XMapWindow(display, resetwin); -- widthpluswin = make_button("Width+", 162, y + 2 * BUTTONHEIGHT, 61); -- XMapWindow(display, widthpluswin); -- widthminuswin = make_button("-", 225, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, widthminuswin); -- expwin = make_button("Exp", 241, y + 2 * BUTTONHEIGHT, 33); -- XMapWindow(display, expwin); -- exppluswin = make_button("+", 276, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, exppluswin); -- expminuswin = make_button("-", 292, y + 2 * BUTTONHEIGHT, 14); -- XMapWindow(display, expminuswin); -- fillwin = make_button("Fill", 308, y + 2 * BUTTONHEIGHT, 41); -- XMapWindow(display, fillwin); -- pswin = make_button("PS", 351, y + 2 * BUTTONHEIGHT, 24); -- XMapWindow(display, pswin); -- epswin = make_button("EPS", 377, y + 2 * BUTTONHEIGHT, 33); -- XMapWindow(display, epswin); --} -- --void fill_button(button) --Window button; --{ -- int x, y; -- unsigned int w, h, d, b; -- Window rootw; -- -- XGetGeometry(display, button, &rootw, &x, &y, &w, &h, &d, &b); -- XFillRectangle(display, button, fontgc, 0, 0, w, h); --} -- --void draw_buttons() --{ -- char numberstring[32]; -- char buttonstring[6]; -- int i; -- -- for (i = 1; i >= 0; i--) { -- if ((current_image == NODE) && (current_inc == i)) { -- fill_button(nodewin[i]); -- XDrawString(display, nodewin[i], blackfontgc, 2, 13, "node", 4); -- } else { -- XClearWindow(display, nodewin[i]); -- XDrawString(display, nodewin[i], fontgc, 2, 13, "node", 4); -- } -- if ((current_image == POLY) && (current_inc == i)) { -- fill_button(polywin[i]); -- XDrawString(display, polywin[i], blackfontgc, 2, 13, "poly", 4); -- } else { -- XClearWindow(display, polywin[i]); -- XDrawString(display, polywin[i], fontgc, 2, 13, "poly", 4); -- } -- if ((current_image == ELE) && (current_inc == i)) { -- fill_button(elewin[i]); -- XDrawString(display, elewin[i], blackfontgc, 2, 13, "ele", 3); -- } else { -- XClearWindow(display, elewin[i]); -- XDrawString(display, elewin[i], fontgc, 2, 13, "ele", 3); -- } -- if ((current_image == EDGE) && (current_inc == i)) { -- fill_button(edgewin[i]); -- XDrawString(display, edgewin[i], blackfontgc, 2, 13, "edge", 4); -- } else { -- XClearWindow(display, edgewin[i]); -- XDrawString(display, edgewin[i], fontgc, 2, 13, "edge", 4); -- } -- if ((current_image == PART) && (current_inc == i)) { -- fill_button(partwin[i]); -- XDrawString(display, partwin[i], blackfontgc, 2, 13, "part", 4); -- } else { -- XClearWindow(display, partwin[i]); -- XDrawString(display, partwin[i], fontgc, 2, 13, "part", 4); -- } -- if ((current_image == ADJ) && (current_inc == i)) { -- fill_button(adjwin[i]); -- XDrawString(display, adjwin[i], blackfontgc, 2, 13, "adj", 3); -- } else { -- XClearWindow(display, adjwin[i]); -- XDrawString(display, adjwin[i], fontgc, 2, 13, "adj", 3); -- } -- if ((current_image == VORO) && (current_inc == i)) { -- fill_button(voronoiwin[i]); -- XDrawString(display, voronoiwin[i], blackfontgc, 2, 13, "voro", 4); -- } else { -- XClearWindow(display, voronoiwin[i]); -- XDrawString(display, voronoiwin[i], fontgc, 2, 13, "voro", 4); -- } -- } -- -- XClearWindow(display, versionpluswin); -- sprintf(numberstring, "%d", loweriteration + 1); -- sprintf(buttonstring, "%-4.4s+", numberstring); -- XDrawString(display, versionpluswin, fontgc, 2, 13, buttonstring, 5); -- XClearWindow(display, versionminuswin); -- sprintf(numberstring, "%d", loweriteration); -- if (loweriteration == 0) { -- sprintf(buttonstring, "%-4.4s", numberstring); -- } else { -- sprintf(buttonstring, "%-4.4s-", numberstring); -- } -- XDrawString(display, versionminuswin, fontgc, 2, 13, buttonstring, 5); -- -- XClearWindow(display, quitwin); -- XDrawString(display, quitwin, fontgc, 2, 13, "Quit", 4); -- XClearWindow(display, leftwin); -- XDrawString(display, leftwin, fontgc, 2, 13, "<", 1); -- XClearWindow(display, rightwin); -- XDrawString(display, rightwin, fontgc, 2, 13, ">", 1); -- XClearWindow(display, upwin); -- XDrawString(display, upwin, fontgc, 2, 13, "^", 1); -- XClearWindow(display, downwin); -- XDrawString(display, downwin, fontgc, 2, 13, "v", 1); -- XClearWindow(display, resetwin); -- XDrawString(display, resetwin, fontgc, 2, 13, "Reset", 6); -- XClearWindow(display, widthpluswin); -- if (line_width < 100) { -- XDrawString(display, widthpluswin, fontgc, 2, 13, "Width+", 6); -- } else { -- XDrawString(display, widthpluswin, fontgc, 2, 13, "Width ", 6); -- } -- XClearWindow(display, widthminuswin); -- if (line_width > 1) { -- XDrawString(display, widthminuswin, fontgc, 2, 13, "-", 1); -- } -- XClearWindow(display, expwin); -- XClearWindow(display, exppluswin); -- XClearWindow(display, expminuswin); -- XClearWindow(display, fillwin); -- if (current_image == PART) { -- if (explode) { -- fill_button(expwin); -- XDrawString(display, expwin, blackfontgc, 2, 13, "Exp", 3); -- } else { -- XDrawString(display, expwin, fontgc, 2, 13, "Exp", 3); -- } -- XDrawString(display, exppluswin, fontgc, 2, 13, "+", 1); -- XDrawString(display, expminuswin, fontgc, 2, 13, "-", 1); -- if (fillelem) { -- fill_button(fillwin); -- XDrawString(display, fillwin, blackfontgc, 2, 13, "Fill", 4); -- } else { -- XDrawString(display, fillwin, fontgc, 2, 13, "Fill", 4); -- } -- } -- XClearWindow(display, pswin); -- XDrawString(display, pswin, fontgc, 2, 13, "PS", 2); -- XClearWindow(display, epswin); -- XDrawString(display, epswin, fontgc, 2, 13, "EPS", 3); --} -- --void showme_window(argc, argv) --int argc; --char **argv; --{ -- XSetWindowAttributes attr; -- XSizeHints hints; -- XGCValues fontvalues, linevalues; -- XColor alloc_color, exact_color; -- int i; -- -- display = XOpenDisplay((char *) NULL); -- if (!display) { -- printf("Error: Cannot open display.\n"); -- exit(1); -- } -- screen = DefaultScreen(display); -- rootwindow = DefaultRootWindow(display); -- black = BlackPixel(display, screen); -- white = WhitePixel(display, screen); -- windowdepth = DefaultDepth(display, screen); -- rootmap = DefaultColormap(display, screen); -- width = STARTWIDTH; -- height = STARTHEIGHT; -- attr.background_pixel = black; -- attr.border_pixel = white; -- attr.backing_store = NotUseful; -- attr.event_mask = ExposureMask | ButtonReleaseMask | ButtonPressMask | -- StructureNotifyMask; -- attr.bit_gravity = NorthWestGravity; -- attr.win_gravity = NorthWestGravity; -- attr.save_under = False; -- mainwindow = XCreateWindow(display, rootwindow, 0, 0, width, -- height + PANELHEIGHT, 3, 0, -- InputOutput, CopyFromParent, -- CWBackPixel | CWBorderPixel | CWEventMask | -- CWBitGravity | CWWinGravity | CWBackingStore | -- CWSaveUnder, &attr); -- hints.width = width; -- hints.height = height + PANELHEIGHT; -- hints.min_width = MINWIDTH; -- hints.min_height = MINHEIGHT + PANELHEIGHT; -- hints.width_inc = 1; -- hints.height_inc = 1; -- hints.flags = PMinSize | PSize | PResizeInc; -- XSetStandardProperties(display, mainwindow, "Show Me", "showme", None, -- argv, argc, &hints); -- -- static const unsigned char temp_show_me_achimedes_local[18] = {'s','h','o','w','m','e','\0','A','r','c','h','i','m','e','d','e','s','\0'}; -- XChangeProperty(display, mainwindow, XA_WM_CLASS, XA_STRING, 8, -- PropModeReplace, temp_show_me_achimedes_local, 18U); -- XClearWindow(display, mainwindow); -- XMapWindow(display, mainwindow); -- if ((windowdepth > 1) && -- XAllocNamedColor(display, rootmap, "yellow", &alloc_color, -- &exact_color)) { -- color = 1; -- explode = bw_ps; -- fontvalues.foreground = alloc_color.pixel; -- linevalues.foreground = alloc_color.pixel; -- showme_foreground = alloc_color.pixel; -- for (i = 0; i < 64; i++) { -- if (XAllocNamedColor(display, rootmap, colorname[i], &alloc_color, -- &rgb[i])) { -- colors[i] = alloc_color.pixel; -- } else { -- colors[i] = white; -- rgb[i].red = alloc_color.red; -- rgb[i].green = alloc_color.green; -- rgb[i].blue = alloc_color.blue; -- if (!quiet) { -- printf("Warning: I could not allocate %s.\n", colorname[i]); -- } -- } -- } -- } else { -- color = 0; -- fillelem = 0; -- explode = 1; -- fontvalues.foreground = white; -- linevalues.foreground = white; -- showme_foreground = white; -- } -- font = XLoadQueryFont(display, "9x15"); -- fontvalues.background = black; -- fontvalues.font = font->fid; -- fontvalues.fill_style = FillSolid; -- fontvalues.line_width = 2; -- fontgc = XCreateGC(display, rootwindow, GCForeground | GCBackground | -- GCFont | GCLineWidth | GCFillStyle, &fontvalues); -- fontvalues.foreground = black; -- blackfontgc = XCreateGC(display, rootwindow, GCForeground | GCBackground | -- GCFont | GCLineWidth | GCFillStyle, &fontvalues); -- linevalues.background = black; -- linevalues.line_width = line_width; -- linevalues.cap_style = CapRound; -- linevalues.join_style = JoinRound; -- linevalues.fill_style = FillSolid; -- linegc = XCreateGC(display, rootwindow, GCForeground | GCBackground | -- GCLineWidth | GCCapStyle | GCJoinStyle | GCFillStyle, -- &linevalues); -- trianglegc = XCreateGC(display, rootwindow, GCForeground | GCBackground | -- GCLineWidth | GCCapStyle | GCJoinStyle | GCFillStyle, -- &linevalues); -- make_buttons(height); -- XFlush(display); --} -- --void draw_node(nodes, dim, ptr, xscale, yscale, xoffset, yoffset) --int nodes; --int dim; --REAL *ptr; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i; -- int index; -- -- index = dim; -- for (i = 1; i <= nodes; i++) { -- XFillRectangle(display, mainwindow, linegc, -- (int) (ptr[index] * xscale + xoffset) - (line_width >> 1), -- (int) (ptr[index + 1] * yscale + yoffset) - -- (line_width >> 1), line_width, line_width); -- index += dim; -- } --} -- --void draw_poly(nodes, dim, edges, holes, nodeptr, edgeptr, holeptr, -- xscale, yscale, xoffset, yoffset) --int nodes; --int dim; --int edges; --int holes; --REAL *nodeptr; --int *edgeptr; --REAL *holeptr; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i; -- int index; -- REAL *point1, *point2; -- int x1, y1, x2, y2; -- -- index = dim; -- for (i = 1; i <= nodes; i++) { -- XFillRectangle(display, mainwindow, linegc, -- (int) (nodeptr[index] * xscale + xoffset) - -- (line_width >> 1), -- (int) (nodeptr[index + 1] * yscale + yoffset) - -- (line_width >> 1), line_width, line_width); -- index += dim; -- } -- index = 2; -- for (i = 1; i <= edges; i++) { -- point1 = &nodeptr[edgeptr[index++] * dim]; -- point2 = &nodeptr[edgeptr[index++] * dim]; -- XDrawLine(display, mainwindow, linegc, -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } -- index = dim; -- if (color) { -- XSetForeground(display, linegc, colors[0]); -- } -- for (i = 1; i <= holes; i++) { -- x1 = (int) (holeptr[index] * xscale + xoffset) - 3; -- y1 = (int) (holeptr[index + 1] * yscale + yoffset) - 3; -- x2 = x1 + 6; -- y2 = y1 + 6; -- XDrawLine(display, mainwindow, linegc, x1, y1, x2, y2); -- XDrawLine(display, mainwindow, linegc, x1, y2, x2, y1); -- index += dim; -- } -- XSetForeground(display, linegc, showme_foreground); --} -- --void draw_ele(inc, elems, corners, ptr, partition, shift, -- xscale, yscale, xoffset, yoffset) --int inc; --int elems; --int corners; /* unused */ --int *ptr; --int *partition; --REAL *shift; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i, j; -- int index; -- REAL shiftx = 0.0, shifty = 0.0; -- REAL *prevpoint, *nowpoint; -- XPoint *vertices = (XPoint *) NULL; -- -- if (color && fillelem && (partition != (int *) NULL)) { -- vertices = (XPoint *) malloc(3 * sizeof(XPoint)); -- if (vertices == (XPoint *) NULL) { -- printf("Error: Out of memory.\n"); -- exit(1); -- } -- } -- index = 3; -- for (i = 1; i <= elems; i++) { -- if ((partition != (int *) NULL) && explode) { -- shiftx = shift[partition[i] << 1]; -- shifty = shift[(partition[i] << 1) + 1]; -- } -- if (color && (partition != (int *) NULL)) { -- if (fillelem) { -- XSetForeground(display, trianglegc, colors[partition[i] & 63]); -- } else { -- XSetForeground(display, linegc, colors[partition[i] & 63]); -- } -- } -- if (color && fillelem && (partition != (int *) NULL)) { -- if ((partition != (int *) NULL) && explode) { -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[inc][ptr[index + j] * node_dim[inc]]; -- vertices[j].x = (nowpoint[0] + shiftx) * xscale + xoffset; -- vertices[j].y = (nowpoint[1] + shifty) * yscale + yoffset; -- } -- } else { -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[inc][ptr[index + j] * node_dim[inc]]; -- vertices[j].x = nowpoint[0] * xscale + xoffset; -- vertices[j].y = nowpoint[1] * yscale + yoffset; -- } -- } -- XFillPolygon(display, mainwindow, trianglegc, vertices, 3, -- Convex, CoordModeOrigin); -- } -- prevpoint = &nodeptr[inc][ptr[index + 2] * node_dim[inc]]; -- if ((partition != (int *) NULL) && explode) { -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[inc][ptr[index++] * node_dim[inc]]; -- XDrawLine(display, mainwindow, linegc, -- (int) ((prevpoint[0] + shiftx) * xscale + xoffset), -- (int) ((prevpoint[1] + shifty) * yscale + yoffset), -- (int) ((nowpoint[0] + shiftx) * xscale + xoffset), -- (int) ((nowpoint[1] + shifty) * yscale + yoffset)); -- prevpoint = nowpoint; -- } -- } else { -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[inc][ptr[index++] * node_dim[inc]]; -- XDrawLine(display, mainwindow, linegc, -- (int) (prevpoint[0] * xscale + xoffset), -- (int) (prevpoint[1] * yscale + yoffset), -- (int) (nowpoint[0] * xscale + xoffset), -- (int) (nowpoint[1] * yscale + yoffset)); -- prevpoint = nowpoint; -- } -- } -- } -- if (color && fillelem && (partition != (int *) NULL)) { -- free(vertices); -- } -- XSetForeground(display, linegc, showme_foreground); --} -- --void draw_edge(nodes, dim, edges, nodeptr, edgeptr, normptr, -- xscale, yscale, xoffset, yoffset) --int nodes; /* unused */ --int dim; --int edges; --REAL *nodeptr; --int *edgeptr; --REAL *normptr; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i; -- int index; -- REAL *point1, *point2; -- REAL normx, normy; -- REAL normmult, normmultx, normmulty; -- REAL windowxmin, windowymin, windowxmax, windowymax; -- -- index = 2; -- for (i = 1; i <= edges; i++) { -- point1 = &nodeptr[edgeptr[index++] * dim]; -- if (edgeptr[index] == -1) { -- normx = normptr[index - 1]; -- normy = normptr[index++]; -- normmultx = 0.0; -- if (normx > 0) { -- windowxmax = (width - 1 - xoffset) / xscale; -- normmultx = (windowxmax - point1[0]) / normx; -- } else if (normx < 0) { -- windowxmin = -xoffset / xscale; -- normmultx = (windowxmin - point1[0]) / normx; -- } -- normmulty = 0.0; -- if (normy > 0) { -- windowymax = -yoffset / yscale; -- normmulty = (windowymax - point1[1]) / normy; -- } else if (normy < 0) { -- windowymin = (height - 1 - yoffset) / yscale; -- normmulty = (windowymin - point1[1]) / normy; -- } -- if (normmultx == 0.0) { -- normmult = normmulty; -- } else if (normmulty == 0.0) { -- normmult = normmultx; -- } else if (normmultx < normmulty) { -- normmult = normmultx; -- } else { -- normmult = normmulty; -- } -- if (normmult > 0.0) { -- XDrawLine(display, mainwindow, linegc, -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- (int) ((point1[0] + normmult * normx) * xscale + xoffset), -- (int) ((point1[1] + normmult * normy) * yscale + yoffset)); -- } -- } else { -- point2 = &nodeptr[edgeptr[index++] * dim]; -- XDrawLine(display, mainwindow, linegc, -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } -- } --} -- --void draw_adj(dim, subdomains, ptr, center, xscale, yscale, -- xoffset, yoffset) --int dim; --int subdomains; --int *ptr; --REAL *center; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i, j; -- REAL *point1, *point2; -- -- for (i = 0; i < subdomains; i++) { -- for (j = i + 1; j < subdomains; j++) { -- if (ptr[i * subdomains + j]) { -- point1 = ¢er[i * dim]; -- point2 = ¢er[j * dim]; -- XDrawLine(display, mainwindow, linegc, -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } -- } -- } -- for (i = 0; i < subdomains; i++) { -- point1 = ¢er[i * dim]; -- if (color) { -- XSetForeground(display, linegc, colors[i & 63]); -- } -- XFillArc(display, mainwindow, linegc, -- (int) (point1[0] * xscale + xoffset) - 5 - (line_width >> 1), -- (int) (point1[1] * yscale + yoffset) - 5 - (line_width >> 1), -- line_width + 10, line_width + 10, 0, 23040); -- } -- XSetForeground(display, linegc, showme_foreground); --} -- --void draw(inc, image, xmin, ymin, xmax, ymax) --int inc; --int image; --REAL xmin; --REAL ymin; --REAL xmax; --REAL ymax; --{ -- draw_buttons(); -- XClearWindow(display, mainwindow); -- if (image == NOTHING) { -- return; -- } -- if (!loaded[inc][image]) { -- return; -- } -- if ((image == PART) && explode) { -- xmin += (xmin - partcenter[inc][subdomains[inc] << 1]) * explosion; -- xmax += (xmax - partcenter[inc][subdomains[inc] << 1]) * explosion; -- ymin += (ymin - partcenter[inc][(subdomains[inc] << 1) + 1]) * explosion; -- ymax += (ymax - partcenter[inc][(subdomains[inc] << 1) + 1]) * explosion; -- } -- xscale = (REAL) (width - line_width - 4) / (xmax - xmin); -- yscale = (REAL) (height - line_width - 4) / (ymax - ymin); -- if (xscale > yscale) { -- xscale = yscale; -- } else { -- yscale = xscale; -- } -- xoffset = 0.5 * ((REAL) width - xscale * (xmax - xmin)) - -- xscale * xmin; -- yoffset = (REAL) height - 0.5 * ((REAL) height - yscale * (ymax - ymin)) + -- yscale * ymin; -- yscale = - yscale; -- switch(image) { -- case NODE: -- draw_node(nodes[inc], node_dim[inc], nodeptr[inc], -- xscale, yscale, xoffset, yoffset); -- break; -- case POLY: -- if (polynodes[inc] > 0) { -- draw_poly(polynodes[inc], poly_dim[inc], polyedges[inc], -- polyholes[inc], polynodeptr[inc], polyedgeptr[inc], -- polyholeptr[inc], -- xscale, yscale, xoffset, yoffset); -- } else { -- draw_poly(nodes[inc], node_dim[inc], polyedges[inc], -- polyholes[inc], nodeptr[inc], polyedgeptr[inc], -- polyholeptr[inc], -- xscale, yscale, xoffset, yoffset); -- } -- break; -- case ELE: -- draw_ele(inc, elems[inc], ele_corners[inc], eleptr[inc], -- (int *) NULL, (REAL *) NULL, -- xscale, yscale, xoffset, yoffset); -- break; -- case EDGE: -- draw_edge(nodes[inc], node_dim[inc], edges[inc], -- nodeptr[inc], edgeptr[inc], normptr[inc], -- xscale, yscale, xoffset, yoffset); -- break; -- case PART: -- draw_ele(inc, elems[inc], ele_corners[inc], eleptr[inc], -- partpart[inc], partshift[inc], -- xscale, yscale, xoffset, yoffset); -- break; -- case ADJ: -- draw_adj(node_dim[inc], adjsubdomains[inc], adjptr[inc], partcenter[inc], -- xscale, yscale, xoffset, yoffset); -- break; -- case VORO: -- if (loaded[inc][NODE]) { -- draw_node(nodes[inc], node_dim[inc], nodeptr[inc], -- xscale, yscale, xoffset, yoffset); -- } -- draw_edge(vnodes[inc], vnode_dim[inc], vedges[inc], -- vnodeptr[inc], vedgeptr[inc], vnormptr[inc], -- xscale, yscale, xoffset, yoffset); -- break; -- default: -- break; -- } --} -- --void addps(instring, outstring, eps) --char *instring; --char *outstring; --int eps; --{ -- strcpy(outstring, instring); -- if (eps) { -- strcat(outstring, ".eps"); -- } else { -- strcat(outstring, ".ps"); -- } --} -- --int print_head(fname, file, llcornerx, llcornery, eps) --char *fname; --FILE **file; --int llcornerx; --int llcornery; --int eps; --{ -- if (!quiet) { -- printf("Writing %s\n", fname); -- } -- *file = fopen(fname, "w"); -- if (*file == (FILE *) NULL) { -- printf(" Error: Could not open %s\n", fname); -- return 1; -- } -- if (eps) { -- fprintf(*file, "%%!PS-Adobe-2.0 EPSF-2.0\n"); -- } else { -- fprintf(*file, "%%!PS-Adobe-2.0\n"); -- } -- fprintf(*file, "%%%%BoundingBox: %d %d %d %d\n", llcornerx, llcornery, -- 612 - llcornerx, 792 - llcornery); -- fprintf(*file, "%%%%Creator: Show Me\n"); -- fprintf(*file, "%%%%EndComments\n\n"); -- fprintf(*file, "1 setlinecap\n"); -- fprintf(*file, "1 setlinejoin\n"); -- fprintf(*file, "%d setlinewidth\n", line_width); -- fprintf(*file, "%d %d moveto\n", llcornerx, llcornery); -- fprintf(*file, "%d %d lineto\n", 612 - llcornerx, llcornery); -- fprintf(*file, "%d %d lineto\n", 612 - llcornerx, 792 - llcornery); -- fprintf(*file, "%d %d lineto\n", llcornerx, 792 - llcornery); -- fprintf(*file, "closepath\nclip\nnewpath\n"); -- return 0; --} -- --void print_node(nodefile, nodes, dim, ptr, xscale, yscale, -- xoffset, yoffset) --FILE *nodefile; --int nodes; --int dim; --REAL *ptr; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i; -- int index; -- -- index = dim; -- for (i = 1; i <= nodes; i++) { -- fprintf(nodefile, "%d %d %d 0 360 arc\nfill\n", -- (int) (ptr[index] * xscale + xoffset), -- (int) (ptr[index + 1] * yscale + yoffset), -- 1 + (line_width >> 1)); -- index += dim; -- } --} -- --void print_poly(polyfile, nodes, dim, edges, holes, nodeptr, edgeptr, holeptr, -- xscale, yscale, xoffset, yoffset) --FILE *polyfile; --int nodes; --int dim; --int edges; --int holes; /* unused */ --REAL *nodeptr; --int *edgeptr; --REAL *holeptr; /* unused */ --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --{ -- int i; -- int index; -- REAL *point1, *point2; -- -- index = dim; -- for (i = 1; i <= nodes; i++) { -- fprintf(polyfile, "%d %d %d 0 360 arc\nfill\n", -- (int) (nodeptr[index] * xscale + xoffset), -- (int) (nodeptr[index + 1] * yscale + yoffset), -- 1 + (line_width >> 1)); -- index += dim; -- } -- index = 2; -- for (i = 1; i <= edges; i++) { -- point1 = &nodeptr[edgeptr[index++] * dim]; -- point2 = &nodeptr[edgeptr[index++] * dim]; -- fprintf(polyfile, "%d %d moveto\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset)); -- fprintf(polyfile, "%d %d lineto\nstroke\n", -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } --} -- --void print_ele(elefile, nodes, dim, elems, corners, nodeptr, eleptr, -- partition, shift, -- xscale, yscale, xoffset, yoffset, llcornerx, llcornery) --FILE *elefile; --int nodes; /* unused */ --int dim; --int elems; --int corners; /* unused */ --REAL *nodeptr; --int *eleptr; --int *partition; --REAL *shift; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --int llcornerx; --int llcornery; --{ -- int i, j; -- int index, colorindex; -- REAL shiftx, shifty; -- REAL *nowpoint; -- -- index = 3; -- if ((partition != (int *) NULL) && !bw_ps) { -- fprintf(elefile, "0 0 0 setrgbcolor\n"); -- fprintf(elefile, "%d %d moveto\n", llcornerx, llcornery); -- fprintf(elefile, "%d %d lineto\n", 612 - llcornerx, llcornery); -- fprintf(elefile, "%d %d lineto\n", 612 - llcornerx, 792 - llcornery); -- fprintf(elefile, "%d %d lineto\n", llcornerx, 792 - llcornery); -- fprintf(elefile, "fill\n"); -- } -- for (i = 1; i <= elems; i++) { -- if ((partition != (int *) NULL) && !bw_ps) { -- colorindex = partition[i] & 63; -- fprintf(elefile, "%6.3f %6.3f %6.3f setrgbcolor\n", -- (REAL) rgb[colorindex].red / 65535.0, -- (REAL) rgb[colorindex].green / 65535.0, -- (REAL) rgb[colorindex].blue / 65535.0); -- } -- nowpoint = &nodeptr[eleptr[index + 2] * dim]; -- if ((partition != (int *) NULL) && (explode || bw_ps)) { -- shiftx = shift[partition[i] << 1]; -- shifty = shift[(partition[i] << 1) + 1]; -- fprintf(elefile, "%d %d moveto\n", -- (int) ((nowpoint[0] + shiftx) * xscale + xoffset), -- (int) ((nowpoint[1] + shifty) * yscale + yoffset)); -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[eleptr[index++] * dim]; -- fprintf(elefile, "%d %d lineto\n", -- (int) ((nowpoint[0] + shiftx) * xscale + xoffset), -- (int) ((nowpoint[1] + shifty) * yscale + yoffset)); -- } -- } else { -- fprintf(elefile, "%d %d moveto\n", -- (int) (nowpoint[0] * xscale + xoffset), -- (int) (nowpoint[1] * yscale + yoffset)); -- for (j = 0; j < 3; j++) { -- nowpoint = &nodeptr[eleptr[index++] * dim]; -- fprintf(elefile, "%d %d lineto\n", -- (int) (nowpoint[0] * xscale + xoffset), -- (int) (nowpoint[1] * yscale + yoffset)); -- } -- } -- if (fillelem && !bw_ps) { -- fprintf(elefile, "gsave\nfill\ngrestore\n1 1 0 setrgbcolor\n"); -- } -- fprintf(elefile, "stroke\n"); -- } --} -- --void print_edge(edgefile, nodes, dim, edges, nodeptr, edgeptr, normptr, -- xscale, yscale, xoffset, yoffset, llcornerx, llcornery) --FILE *edgefile; --int nodes; /* unused */ --int dim; --int edges; --REAL *nodeptr; --int *edgeptr; --REAL *normptr; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --int llcornerx; --int llcornery; --{ -- int i; -- int index; -- REAL *point1, *point2; -- REAL normx, normy; -- REAL normmult, normmultx, normmulty; -- REAL windowxmin, windowymin, windowxmax, windowymax; -- -- index = 2; -- for (i = 1; i <= edges; i++) { -- point1 = &nodeptr[edgeptr[index++] * dim]; -- if (edgeptr[index] == -1) { -- normx = normptr[index - 1]; -- normy = normptr[index++]; -- normmultx = 0.0; -- if (normx > 0) { -- windowxmax = ((REAL) (612 - llcornerx) - xoffset) / xscale; -- normmultx = (windowxmax - point1[0]) / normx; -- } else if (normx < 0) { -- windowxmin = ((REAL) llcornerx - xoffset) / xscale; -- normmultx = (windowxmin - point1[0]) / normx; -- } -- normmulty = 0.0; -- if (normy > 0) { -- windowymax = ((REAL) (792 - llcornery) - yoffset) / yscale; -- normmulty = (windowymax - point1[1]) / normy; -- } else if (normy < 0) { -- windowymin = ((REAL) llcornery - yoffset) / yscale; -- normmulty = (windowymin - point1[1]) / normy; -- } -- if (normmultx == 0.0) { -- normmult = normmulty; -- } else if (normmulty == 0.0) { -- normmult = normmultx; -- } else if (normmultx < normmulty) { -- normmult = normmultx; -- } else { -- normmult = normmulty; -- } -- if (normmult > 0.0) { -- fprintf(edgefile, "%d %d moveto\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset)); -- fprintf(edgefile, "%d %d lineto\nstroke\n", -- (int) ((point1[0] + normmult * normx) * xscale + xoffset), -- (int) ((point1[1] + normmult * normy) * yscale + yoffset)); -- } -- } else { -- point2 = &nodeptr[edgeptr[index++] * dim]; -- fprintf(edgefile, "%d %d moveto\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset)); -- fprintf(edgefile, "%d %d lineto\nstroke\n", -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } -- } --} -- --void print_adj(adjfile, dim, subdomains, ptr, center, xscale, yscale, -- xoffset, yoffset, llcornerx, llcornery) --FILE *adjfile; --int dim; --int subdomains; --int *ptr; --REAL *center; --REAL xscale; --REAL yscale; --REAL xoffset; --REAL yoffset; --int llcornerx; --int llcornery; --{ -- int i, j; -- REAL *point1, *point2; -- int colorindex; -- -- if (!bw_ps) { -- fprintf(adjfile, "0 0 0 setrgbcolor\n"); -- fprintf(adjfile, "%d %d moveto\n", llcornerx, llcornery); -- fprintf(adjfile, "%d %d lineto\n", 612 - llcornerx, llcornery); -- fprintf(adjfile, "%d %d lineto\n", 612 - llcornerx, 792 - llcornery); -- fprintf(adjfile, "%d %d lineto\n", llcornerx, 792 - llcornery); -- fprintf(adjfile, "fill\n"); -- fprintf(adjfile, "1 1 0 setrgbcolor\n"); -- } -- for (i = 0; i < subdomains; i++) { -- for (j = i + 1; j < subdomains; j++) { -- if (ptr[i * subdomains + j]) { -- point1 = ¢er[i * dim]; -- point2 = ¢er[j * dim]; -- fprintf(adjfile, "%d %d moveto\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset)); -- fprintf(adjfile, "%d %d lineto\nstroke\n", -- (int) (point2[0] * xscale + xoffset), -- (int) (point2[1] * yscale + yoffset)); -- } -- } -- } -- for (i = 0; i < subdomains; i++) { -- point1 = ¢er[i * dim]; -- if (!bw_ps) { -- colorindex = i & 63; -- fprintf(adjfile, "%6.3f %6.3f %6.3f setrgbcolor\n", -- (REAL) rgb[colorindex].red / 65535.0, -- (REAL) rgb[colorindex].green / 65535.0, -- (REAL) rgb[colorindex].blue / 65535.0); -- fprintf(adjfile, "%d %d %d 0 360 arc\nfill\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- 5 + (line_width >> 1)); -- } else { -- fprintf(adjfile, "%d %d %d 0 360 arc\nfill\n", -- (int) (point1[0] * xscale + xoffset), -- (int) (point1[1] * yscale + yoffset), -- 3 + (line_width >> 1)); -- } -- } --} -- --void print(inc, image, xmin, ymin, xmax, ymax, eps) --int inc; --int image; --REAL xmin; --REAL ymin; --REAL xmax; --REAL ymax; --int eps; --{ -- REAL xxscale, yyscale, xxoffset, yyoffset; -- char psfilename[FILENAMESIZE]; -- int llcornerx, llcornery; -- FILE *psfile; -- -- if (image == NOTHING) { -- return; -- } -- if (!loaded[inc][image]) { -- return; -- } -- if ((image == PART) && (explode || bw_ps)) { -- xmin += (xmin - partcenter[inc][subdomains[inc] << 1]) * explosion; -- xmax += (xmax - partcenter[inc][subdomains[inc] << 1]) * explosion; -- ymin += (ymin - partcenter[inc][(subdomains[inc] << 1) + 1]) * explosion; -- ymax += (ymax - partcenter[inc][(subdomains[inc] << 1) + 1]) * explosion; -- } -- xxscale = (460.0 - (REAL) line_width) / (xmax - xmin); -- yyscale = (640.0 - (REAL) line_width) / (ymax - ymin); -- if (xxscale > yyscale) { -- xxscale = yyscale; -- llcornerx = (604 - (int) (yyscale * (xmax - xmin)) - line_width) >> 1; -- llcornery = 72; -- } else { -- yyscale = xxscale; -- llcornerx = 72; -- llcornery = (784 - (int) (xxscale * (ymax - ymin)) - line_width) >> 1; -- } -- xxoffset = 0.5 * (612.0 - xxscale * (xmax - xmin)) - xxscale * xmin + -- (line_width >> 1); -- yyoffset = 0.5 * (792.0 - yyscale * (ymax - ymin)) - yyscale * ymin + -- (line_width >> 1); -- switch(image) { -- case NODE: -- addps(nodefilename[inc], psfilename, eps); -- break; -- case POLY: -- addps(polyfilename[inc], psfilename, eps); -- break; -- case ELE: -- addps(elefilename[inc], psfilename, eps); -- break; -- case EDGE: -- addps(edgefilename[inc], psfilename, eps); -- break; -- case PART: -- addps(partfilename[inc], psfilename, eps); -- break; -- case ADJ: -- addps(adjfilename[inc], psfilename, eps); -- break; -- case VORO: -- addps(vedgefilename[inc], psfilename, eps); -- break; -- default: -- break; -- } -- if (print_head(psfilename, &psfile, llcornerx, llcornery, eps)) { -- return; -- } -- switch (image) { -- case NODE: -- print_node(psfile, nodes[inc], node_dim[inc], nodeptr[inc], -- xxscale, yyscale, xxoffset, yyoffset); -- break; -- case POLY: -- if (polynodes[inc] > 0) { -- print_poly(psfile, polynodes[inc], poly_dim[inc], polyedges[inc], -- polyholes[inc], polynodeptr[inc], polyedgeptr[inc], -- polyholeptr[inc], xxscale, yyscale, xxoffset, yyoffset); -- } else { -- print_poly(psfile, nodes[inc], node_dim[inc], polyedges[inc], -- polyholes[inc], nodeptr[inc], polyedgeptr[inc], -- polyholeptr[inc], xxscale, yyscale, xxoffset, yyoffset); -- } -- break; -- case ELE: -- print_ele(psfile, nodes[inc], node_dim[inc], elems[inc], -- ele_corners[inc], nodeptr[inc], eleptr[inc], -- (int *) NULL, (REAL *) NULL, -- xxscale, yyscale, xxoffset, yyoffset, llcornerx, llcornery); -- break; -- case EDGE: -- print_edge(psfile, nodes[inc], node_dim[inc], edges[inc], -- nodeptr[inc], edgeptr[inc], normptr[inc], -- xxscale, yyscale, xxoffset, yyoffset, llcornerx, llcornery); -- break; -- case PART: -- print_ele(psfile, nodes[inc], node_dim[inc], elems[inc], -- ele_corners[inc], nodeptr[inc], eleptr[inc], -- partpart[inc], partshift[inc], -- xxscale, yyscale, xxoffset, yyoffset, llcornerx, llcornery); -- break; -- case ADJ: -- print_adj(psfile, node_dim[inc], adjsubdomains[inc], adjptr[inc], -- partcenter[inc], -- xxscale, yyscale, xxoffset, yyoffset, llcornerx, llcornery); -- break; -- case VORO: -- print_edge(psfile, vnodes[inc], vnode_dim[inc], vedges[inc], -- vnodeptr[inc], vedgeptr[inc], vnormptr[inc], -- xxscale, yyscale, xxoffset, yyoffset, llcornerx, llcornery); -- break; -- default: -- break; -- } -- if (!eps) { -- fprintf(psfile, "showpage\n"); -- } -- fclose(psfile); --} -- --int main(argc, argv) --int argc; --char **argv; --{ -- REAL xmin = 0.0, ymin = 0.0, xmax = 0.0, ymax = 0.0; -- REAL xptr, yptr, xspan, yspan; -- int past_image; -- int new_image = 0; -- int new_inc = 0; -- -- parsecommandline(argc, argv); -- showme_init(); -- choose_image(start_inc, start_image); -- showme_window(argc, argv); -- -- if (current_image != NOTHING) { -- xmin = xlo[current_inc][current_image]; -- ymin = ylo[current_inc][current_image]; -- xmax = xhi[current_inc][current_image]; -- ymax = yhi[current_inc][current_image]; -- zoom = 0; -- } -- -- XMaskEvent(display, ExposureMask, &event); -- while (1) { -- switch (event.type) { -- case ButtonRelease: -- if (event.xany.window == quitwin) { -- XDestroyWindow(display, mainwindow); -- XCloseDisplay(display); -- return 0; -- } else if (event.xany.window == leftwin) { -- xspan = 0.25 * (xmax - xmin); -- xmin += xspan; -- xmax += xspan; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xany.window == rightwin) { -- xspan = 0.25 * (xmax - xmin); -- xmin -= xspan; -- xmax -= xspan; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xany.window == upwin) { -- yspan = 0.25 * (ymax - ymin); -- ymin -= yspan; -- ymax -= yspan; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xany.window == downwin) { -- yspan = 0.25 * (ymax - ymin); -- ymin += yspan; -- ymax += yspan; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xany.window == resetwin) { -- xmin = xlo[current_inc][current_image]; -- ymin = ylo[current_inc][current_image]; -- xmax = xhi[current_inc][current_image]; -- ymax = yhi[current_inc][current_image]; -- zoom = 0; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xany.window == widthpluswin) { -- if (line_width < 100) { -- line_width++; -- XSetLineAttributes(display, linegc, line_width, LineSolid, -- CapRound, JoinRound); -- XSetLineAttributes(display, trianglegc, line_width, LineSolid, -- CapRound, JoinRound); -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == widthminuswin) { -- if (line_width > 1) { -- line_width--; -- XSetLineAttributes(display, linegc, line_width, LineSolid, -- CapRound, JoinRound); -- XSetLineAttributes(display, trianglegc, line_width, LineSolid, -- CapRound, JoinRound); -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == expwin) { -- if ((current_image == PART) && loaded[current_inc][PART]) { -- explode = !explode; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == exppluswin) { -- if ((current_image == PART) && loaded[current_inc][PART] && explode) { -- explosion += 0.125; -- findpartshift(subdomains[current_inc], explosion, -- partcenter[current_inc], partshift[current_inc]); -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == expminuswin) { -- if ((current_image == PART) && loaded[current_inc][PART] && explode && -- (explosion >= 0.125)) { -- explosion -= 0.125; -- findpartshift(subdomains[current_inc], explosion, -- partcenter[current_inc], partshift[current_inc]); -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == fillwin) { -- if ((current_image == PART) && loaded[current_inc][PART]) { -- fillelem = !fillelem; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } -- } else if (event.xany.window == pswin) { -- fill_button(pswin); -- XFlush(display); -- print(current_inc, current_image, xmin, ymin, xmax, ymax, 0); -- XClearWindow(display, pswin); -- XDrawString(display, pswin, fontgc, 2, 13, "PS", 2); -- } else if (event.xany.window == epswin) { -- fill_button(epswin); -- XFlush(display); -- print(current_inc, current_image, xmin, ymin, xmax, ymax, 1); -- XClearWindow(display, epswin); -- XDrawString(display, epswin, fontgc, 2, 13, "EPS", 3); -- } else if (event.xany.window == versionpluswin) { -- move_inc(1); -- loweriteration++; -- set_filenames(filename, loweriteration); -- if (current_inc == 1) { -- current_inc = 0; -- } else { -- current_image = NOTHING; -- XClearWindow(display, mainwindow); -- } -- draw_buttons(); -- } else if (event.xany.window == versionminuswin) { -- if (loweriteration > 0) { -- move_inc(0); -- loweriteration--; -- set_filenames(filename, loweriteration); -- if (current_inc == 0) { -- current_inc = 1; -- } else { -- current_image = NOTHING; -- XClearWindow(display, mainwindow); -- } -- draw_buttons(); -- } -- } else if ((event.xany.window == nodewin[0]) || -- (event.xany.window == polywin[0]) || -- (event.xany.window == elewin[0]) || -- (event.xany.window == edgewin[0]) || -- (event.xany.window == partwin[0]) || -- (event.xany.window == adjwin[0]) || -- (event.xany.window == voronoiwin[0]) || -- (event.xany.window == nodewin[1]) || -- (event.xany.window == polywin[1]) || -- (event.xany.window == elewin[1]) || -- (event.xany.window == edgewin[1]) || -- (event.xany.window == partwin[1]) || -- (event.xany.window == adjwin[1]) || -- (event.xany.window == voronoiwin[1])) { -- if (event.xany.window == nodewin[0]) { -- new_inc = 0; -- new_image = NODE; -- } -- if (event.xany.window == polywin[0]) { -- new_inc = 0; -- new_image = POLY; -- } -- if (event.xany.window == elewin[0]) { -- new_inc = 0; -- new_image = ELE; -- } -- if (event.xany.window == edgewin[0]) { -- new_inc = 0; -- new_image = EDGE; -- } -- if (event.xany.window == partwin[0]) { -- new_inc = 0; -- new_image = PART; -- } -- if (event.xany.window == adjwin[0]) { -- new_inc = 0; -- new_image = ADJ; -- } -- if (event.xany.window == voronoiwin[0]) { -- new_inc = 0; -- new_image = VORO; -- } -- if (event.xany.window == nodewin[1]) { -- new_inc = 1; -- new_image = NODE; -- } -- if (event.xany.window == polywin[1]) { -- new_inc = 1; -- new_image = POLY; -- } -- if (event.xany.window == elewin[1]) { -- new_inc = 1; -- new_image = ELE; -- } -- if (event.xany.window == edgewin[1]) { -- new_inc = 1; -- new_image = EDGE; -- } -- if (event.xany.window == partwin[1]) { -- new_inc = 1; -- new_image = PART; -- } -- if (event.xany.window == adjwin[1]) { -- new_inc = 1; -- new_image = ADJ; -- } -- if (event.xany.window == voronoiwin[1]) { -- new_inc = 1; -- new_image = VORO; -- } -- past_image = current_image; -- if ((current_inc == new_inc) && (current_image == new_image)) { -- free_inc(new_inc); -- unload_inc(new_inc); -- } -- choose_image(new_inc, new_image); -- if ((past_image == NOTHING) && (current_image != NOTHING)) { -- xmin = xlo[current_inc][current_image]; -- ymin = ylo[current_inc][current_image]; -- xmax = xhi[current_inc][current_image]; -- ymax = yhi[current_inc][current_image]; -- zoom = 0; -- } -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else { -- xptr = ((REAL) event.xbutton.x - xoffset) / xscale; -- yptr = ((REAL) event.xbutton.y - yoffset) / yscale; -- if ((current_image == PART) && loaded[current_inc][PART] && explode) { -- xptr = (xptr + partcenter[current_inc] -- [subdomains[current_inc] << 1] -- * explosion) / (1.0 + explosion); -- yptr = (yptr + partcenter[current_inc] -- [(subdomains[current_inc] << 1) + 1] -- * explosion) / (1.0 + explosion); -- } -- if ((event.xbutton.button == Button1) -- || (event.xbutton.button == Button3)) { -- if (event.xbutton.button == Button1) { -- xspan = 0.25 * (xmax - xmin); -- yspan = 0.25 * (ymax - ymin); -- zoom++; -- } else { -- xspan = xmax - xmin; -- yspan = ymax - ymin; -- zoom--; -- } -- xmin = xptr - xspan; -- ymin = yptr - yspan; -- xmax = xptr + xspan; -- ymax = yptr + yspan; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- } else if (event.xbutton.button == Button2) { -- printf("x = %.4g, y = %.4g\n", xptr, yptr); -- } -- } -- break; -- case DestroyNotify: -- XDestroyWindow(display, mainwindow); -- XCloseDisplay(display); -- return 0; -- case ConfigureNotify: -- if ((width != event.xconfigure.width) || -- (height != event.xconfigure.height - PANELHEIGHT)) { -- width = event.xconfigure.width; -- height = event.xconfigure.height - PANELHEIGHT; -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- while (XCheckMaskEvent(display, ExposureMask, &event)); -- } -- break; -- case Expose: -- draw(current_inc, current_image, xmin, ymin, xmax, ymax); -- while (XCheckMaskEvent(display, ExposureMask, &event)); -- break; -- default: -- break; -- } -- XNextEvent(display, &event); -- } --} -diff --git a/v3p/netlib/tests/CMakeLists.txt b/v3p/netlib/tests/CMakeLists.txt -index d23be0c165..a7471ffdf2 100644 ---- a/v3p/netlib/tests/CMakeLists.txt -+++ b/v3p/netlib/tests/CMakeLists.txt -@@ -24,10 +24,6 @@ if(BUILD_TESTING) - add_test( NAME netlib_test_slamch COMMAND netlib_slamch_test ) - target_link_libraries(netlib_slamch_test ${VXL_LIB_PREFIX}v3p_netlib) - # test -- add_executable( netlib_tricall tricall.c ) -- add_test( NAME netlib_test_tricall COMMAND netlib_tricall ) -- target_link_libraries(netlib_tricall ${VXL_LIB_PREFIX}netlib) -- # test - add_executable( netlib_integral_test integral-test.c ) - add_test( NAME netlib_test_integral COMMAND netlib_integral_test ) - target_link_libraries(netlib_integral_test ${VXL_LIB_PREFIX}v3p_netlib) -diff --git a/v3p/netlib/triangle.README b/v3p/netlib/triangle.README -deleted file mode 100644 -index b33ea00948..0000000000 ---- a/v3p/netlib/triangle.README -+++ /dev/null -@@ -1,198 +0,0 @@ --Triangle --A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator. --Version 1.6 -- --Show Me --A Display Program for Meshes and More. --Version 1.6 -- --Copyright 1993, 1995, 1997, 1998, 2002, 2005 Jonathan Richard Shewchuk --2360 Woolsey #H --Berkeley, California 94705-1927 --Please send bugs and comments to jrs@cs.berkeley.edu -- --Created as part of the Quake project (tools for earthquake simulation). --Supported in part by NSF Grant CMS-9318163 and an NSERC 1967 Scholarship. --There is no warranty whatsoever. Use at your own risk. -- -- --Triangle generates exact Delaunay triangulations, constrained Delaunay --triangulations, conforming Delaunay triangulations, Voronoi diagrams, and --high-quality triangular meshes. The latter can be generated with no small --or large angles, and are thus suitable for finite element analysis. --Show Me graphically displays the contents of the geometric files used by --Triangle. Show Me can also write images in PostScript form. -- --Information on the algorithms used by Triangle, including complete --references, can be found in the comments at the beginning of the triangle.c --source file. Another listing of these references, with PostScript copies --of some of the papers, is available from the Web page -- -- http://www.cs.cmu.edu/~quake/triangle.research.html -- -------------------------------------------------------------------------------- -- --These programs may be freely redistributed under the condition that the --copyright notices (including the copy of this notice in the code comments --and the copyright notice printed when the `-h' switch is selected) are --not removed, and no compensation is received. Private, research, and --institutional use is free. You may distribute modified versions of this --code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT --IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH --SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND --CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as --part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT --WITH THE AUTHOR. (If you are not directly supplying this code to a --customer, and you are instead telling them how they can obtain it for --free, then you are not required to make any arrangement with me.) -- -------------------------------------------------------------------------------- -- --The files included in this distribution are: -- -- README The file you're reading now. -- triangle.c Complete C source code for Triangle. -- showme.c Complete C source code for Show Me. -- triangle.h Include file for calling Triangle from another program. -- tricall.c Sample program that calls Triangle. -- makefile Makefile for compiling Triangle and Show Me. -- A.poly A sample input file. -- --Each of Triangle and Show Me is a single portable C file. The easiest way --to compile them is to edit and use the included makefile. Before --compiling, read the makefile, which describes your options, and edit it --accordingly. You should specify: -- -- The source and binary directories. -- -- The C compiler and level of optimization. -- -- The "correct" directories for include files (especially X include files), -- if necessary. -- -- Do you want single precision or double? (The default is double.) Do you -- want to leave out some of Triangle's features to reduce the size of the -- executable file? Investigate the SINGLE, REDUCED, and CDT_ONLY symbols. -- -- If yours is not a Unix system, define the NO_TIMER symbol to remove the -- Unix-specific timing code. Also, don't try to compile Show Me; it only -- works with X Windows. -- -- If you are compiling on an Intel x86 CPU and using gcc w/Linux or -- Microsoft C, be sure to define the LINUX or CPU86 (for Microsoft) symbol -- during compilation so that the exact arithmetic works right. -- --Once you've done this, type "make" to compile the programs. Alternatively, --the files are usually easy to compile without a makefile: -- -- cc -O -o triangle triangle.c -lm -- cc -O -o showme showme.c -lX11 -- --On some systems, the C compiler won't be able to find the X include files --or libraries, and you'll need to specify an include path or library path: -- -- cc -O -I/usr/local/include -o showme showme.c -L/usr/local/lib -lX11 -- --Some processors, including Intel x86 family and possibly Motorola 68xxx --family chips, are IEEE conformant but have extended length internal --floating-point registers that may defeat Triangle's exact arithmetic --routines by failing to cause enough roundoff error! Typically, there is a --way to set these internal registers so that they are rounded off to IEEE --single or double precision format. I believe (but I'm not certain) that --Triangle has the right incantations for x86 chips, if you have gcc running --under Linux (define the LINUX compiler symbol) or Microsoft C (define the --CPU86 compiler symbol). -- --If you have a different processor or operating system, or if I got the --incantations wrong, you should check your C compiler or system manuals to --find out how to configure these internal registers to the precision you are --using. Otherwise, the exact arithmetic routines won't be exact at all. --See http://www.cs.cmu.edu/~quake/robust.pc.html for details. Triangle's --exact arithmetic hasn't a hope of working on machines like the Cray C90 or --Y-MP, which are not IEEE conformant and have inaccurate rounding. -- --Triangle and Show Me have both text and HTML documentation. The latter is --illustrated. Find it on the Web at -- -- http://www.cs.cmu.edu/~quake/triangle.html -- http://www.cs.cmu.edu/~quake/showme.html -- --Complete text instructions are printed by invoking each program with the --`-h' switch: -- -- triangle -h -- showme -h -- --The instructions are long; you'll probably want to pipe the output to --`more' or `lpr' or redirect it to a file. -- --Both programs give a short list of command line options if they are invoked --without arguments (that is, just type `triangle' or `showme'). -- --Try out Triangle on the enclosed sample file, A.poly: -- -- triangle -p A -- showme A.poly & -- --Triangle will read the Planar Straight Line Graph defined by A.poly, and --write its constrained Delaunay triangulation to A.1.node and A.1.ele. --Show Me will display the figure defined by A.poly. There are two buttons --marked "ele" in the Show Me window; click on the top one. This will cause --Show Me to load and display the triangulation. -- --For contrast, try running -- -- triangle -pq A -- --Now, click on the same "ele" button. A new triangulation will be loaded; --this one having no angles smaller than 20 degrees. -- --To see a Voronoi diagram, try this: -- -- cp A.poly A.node -- triangle -v A -- --Click the "ele" button again. You will see the Delaunay triangulation of --the points in A.poly, without the segments. Now click the top "voro" button. --You will see the Voronoi diagram corresponding to that Delaunay triangulation. --Click the "Reset" button to see the full extent of the diagram. -- -------------------------------------------------------------------------------- -- --If you wish to call Triangle from another program, instructions for doing --so are contained in the file `triangle.h' (but read Triangle's regular --instructions first!). Also look at `tricall.c', which provides an example --of how to call Triangle. -- --Type "make trilibrary" to create triangle.o, a callable object file. --Alternatively, the object file is usually easy to compile without a --makefile: -- -- cc -DTRILIBRARY -O -c triangle.c -- --Type "make distclean" to remove all the object and executable files created --by make. -- -------------------------------------------------------------------------------- -- --If you use Triangle, and especially if you use it to accomplish real work, --I would like very much to hear from you. A short letter or email (to --jrs@cs.berkeley.edu) describing how you use Triangle will mean a lot to me. --The more people I know are using this program, the more easily I can --justify spending time on improvements and on the three-dimensional --successor to Triangle, which in turn will benefit you. Also, I can put you --on a list to receive email whenever a new version of Triangle is available. -- --If you use a mesh generated by Triangle or plotted by Show Me in a --publication, please include an acknowledgment as well. And please spell --Triangle with a capital `T'! If you want to include a citation, use --`Jonathan Richard Shewchuk, ``Triangle: Engineering a 2D Quality Mesh --Generator and Delaunay Triangulator,'' in Applied Computational Geometry: --Towards Geometric Engineering (Ming C. Lin and Dinesh Manocha, editors), --volume 1148 of Lecture Notes in Computer Science, pages 203-222, --Springer-Verlag, Berlin, May 1996. (From the First ACM Workshop on Applied --Computational Geometry.)' -- -- --Jonathan Richard Shewchuk --July 27, 2005 -diff --git a/v3p/netlib/triangle.c b/v3p/netlib/triangle.c -deleted file mode 100644 -index 017dbe1fae..0000000000 ---- a/v3p/netlib/triangle.c -+++ /dev/null -@@ -1,16011 +0,0 @@ --/*****************************************************************************/ --/* */ --/* 888888888 ,o, / 888 */ --/* 888 88o88o " o8888o 88o8888o o88888o 888 o88888o */ --/* 888 888 888 88b 888 888 888 888 888 d888 88b */ --/* 888 888 888 o88^o888 888 888 "88888" 888 8888oo888 */ --/* 888 888 888 C888 888 888 888 / 888 q888 */ --/* 888 888 888 "88o^888 888 888 Cb 888 "88oooo" */ --/* "8oo8D */ --/* */ --/* A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator. */ --/* (triangle.c) */ --/* */ --/* Version 1.6 */ --/* July 28, 2005 */ --/* */ --/* Copyright 1993, 1995, 1997, 1998, 2002, 2005 */ --/* Jonathan Richard Shewchuk */ --/* 2360 Woolsey #H */ --/* Berkeley, California 94705-1927 */ --/* jrs@cs.berkeley.edu */ --/* */ --/* This program may be freely redistributed under the condition that the */ --/* copyright notices (including this entire header and the copyright */ --/* notice printed when the `-h' switch is selected) are not removed, and */ --/* no compensation is received. Private, research, and institutional */ --/* use is free. You may distribute modified versions of this code UNDER */ --/* THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE */ --/* SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE */ --/* AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR */ --/* NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as */ --/* part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT */ --/* WITH THE AUTHOR. (If you are not directly supplying this code to a */ --/* customer, and you are instead telling them how they can obtain it for */ --/* free, then you are not required to make any arrangement with me.) */ --/* */ --/* Hypertext instructions for Triangle are available on the Web at */ --/* */ --/* http://www.cs.cmu.edu/~quake/triangle.html */ --/* */ --/* Disclaimer: Neither I nor Carnegie Mellon warrant this code in any way */ --/* whatsoever. This code is provided "as-is". Use at your own risk. */ --/* */ --/* Some of the references listed below are marked with an asterisk. [*] */ --/* These references are available for downloading from the Web page */ --/* */ --/* http://www.cs.cmu.edu/~quake/triangle.research.html */ --/* */ --/* Three papers discussing aspects of Triangle are available. A short */ --/* overview appears in "Triangle: Engineering a 2D Quality Mesh */ --/* Generator and Delaunay Triangulator," in Applied Computational */ --/* Geometry: Towards Geometric Engineering, Ming C. Lin and Dinesh */ --/* Manocha, editors, Lecture Notes in Computer Science volume 1148, */ --/* pages 203-222, Springer-Verlag, Berlin, May 1996 (from the First ACM */ --/* Workshop on Applied Computational Geometry). [*] */ --/* */ --/* The algorithms are discussed in the greatest detail in "Delaunay */ --/* Refinement Algorithms for Triangular Mesh Generation," Computational */ --/* Geometry: Theory and Applications 22(1-3):21-74, May 2002. [*] */ --/* */ --/* More detail about the data structures may be found in my dissertation: */ --/* "Delaunay Refinement Mesh Generation," Ph.D. thesis, Technical Report */ --/* CMU-CS-97-137, School of Computer Science, Carnegie Mellon University, */ --/* Pittsburgh, Pennsylvania, 18 May 1997. [*] */ --/* */ --/* Triangle was created as part of the Quake Project in the School of */ --/* Computer Science at Carnegie Mellon University. For further */ --/* information, see Hesheng Bao, Jacobo Bielak, Omar Ghattas, Loukas F. */ --/* Kallivokas, David R. O'Hallaron, Jonathan R. Shewchuk, and Jifeng Xu, */ --/* "Large-scale Simulation of Elastic Wave Propagation in Heterogeneous */ --/* Media on Parallel Computers," Computer Methods in Applied Mechanics */ --/* and Engineering 152(1-2):85-102, 22 January 1998. */ --/* */ --/* Triangle's Delaunay refinement algorithm for quality mesh generation is */ --/* a hybrid of one due to Jim Ruppert, "A Delaunay Refinement Algorithm */ --/* for Quality 2-Dimensional Mesh Generation," Journal of Algorithms */ --/* 18(3):548-585, May 1995 [*], and one due to L. Paul Chew, "Guaranteed- */ --/* Quality Mesh Generation for Curved Surfaces," Proceedings of the Ninth */ --/* Annual Symposium on Computational Geometry (San Diego, California), */ --/* pages 274-280, Association for Computing Machinery, May 1993, */ --/* http://portal.acm.org/citation.cfm?id=161150 . */ --/* */ --/* The Delaunay refinement algorithm has been modified so that it meshes */ --/* domains with small input angles well, as described in Gary L. Miller, */ --/* Steven E. Pav, and Noel J. Walkington, "When and Why Ruppert's */ --/* Algorithm Works," Twelfth International Meshing Roundtable, pages */ --/* 91-102, Sandia National Laboratories, September 2003. [*] */ --/* */ --/* My implementation of the divide-and-conquer and incremental Delaunay */ --/* triangulation algorithms follows closely the presentation of Guibas */ --/* and Stolfi, even though I use a triangle-based data structure instead */ --/* of their quad-edge data structure. (In fact, I originally implemented */ --/* Triangle using the quad-edge data structure, but the switch to a */ --/* triangle-based data structure sped Triangle by a factor of two.) The */ --/* mesh manipulation primitives and the two aforementioned Delaunay */ --/* triangulation algorithms are described by Leonidas J. Guibas and Jorge */ --/* Stolfi, "Primitives for the Manipulation of General Subdivisions and */ --/* the Computation of Voronoi Diagrams," ACM Transactions on Graphics */ --/* 4(2):74-123, April 1985, http://portal.acm.org/citation.cfm?id=282923 .*/ --/* */ --/* Their O(n log n) divide-and-conquer algorithm is adapted from Der-Tsai */ --/* Lee and Bruce J. Schachter, "Two Algorithms for Constructing the */ --/* Delaunay Triangulation," International Journal of Computer and */ --/* Information Science 9(3):219-242, 1980. Triangle's improvement of the */ --/* divide-and-conquer algorithm by alternating between vertical and */ --/* horizontal cuts was introduced by Rex A. Dwyer, "A Faster Divide-and- */ --/* Conquer Algorithm for Constructing Delaunay Triangulations," */ --/* Algorithmica 2(2):137-151, 1987. */ --/* */ --/* The incremental insertion algorithm was first proposed by C. L. Lawson, */ --/* "Software for C1 Surface Interpolation," in Mathematical Software III, */ --/* John R. Rice, editor, Academic Press, New York, pp. 161-194, 1977. */ --/* For point location, I use the algorithm of Ernst P. Mucke, Isaac */ --/* Saias, and Binhai Zhu, "Fast Randomized Point Location Without */ --/* Preprocessing in Two- and Three-Dimensional Delaunay Triangulations," */ --/* Proceedings of the Twelfth Annual Symposium on Computational Geometry, */ --/* ACM, May 1996. [*] If I were to randomize the order of vertex */ --/* insertion (I currently don't bother), their result combined with the */ --/* result of Kenneth L. Clarkson and Peter W. Shor, "Applications of */ --/* Random Sampling in Computational Geometry II," Discrete & */ --/* Computational Geometry 4(1):387-421, 1989, would yield an expected */ --/* O(n^{4/3}) bound on running time. */ --/* */ --/* The O(n log n) sweepline Delaunay triangulation algorithm is taken from */ --/* Steven Fortune, "A Sweepline Algorithm for Voronoi Diagrams", */ --/* Algorithmica 2(2):153-174, 1987. A random sample of edges on the */ --/* boundary of the triangulation are maintained in a splay tree for the */ --/* purpose of point location. Splay trees are described by Daniel */ --/* Dominic Sleator and Robert Endre Tarjan, "Self-Adjusting Binary Search */ --/* Trees," Journal of the ACM 32(3):652-686, July 1985, */ --/* http://portal.acm.org/citation.cfm?id=3835 . */ --/* */ --/* The algorithms for exact computation of the signs of determinants are */ --/* described in Jonathan Richard Shewchuk, "Adaptive Precision Floating- */ --/* Point Arithmetic and Fast Robust Geometric Predicates," Discrete & */ --/* Computational Geometry 18(3):305-363, October 1997. (Also available */ --/* as Technical Report CMU-CS-96-140, School of Computer Science, */ --/* Carnegie Mellon University, Pittsburgh, Pennsylvania, May 1996.) [*] */ --/* An abbreviated version appears as Jonathan Richard Shewchuk, "Robust */ --/* Adaptive Floating-Point Geometric Predicates," Proceedings of the */ --/* Twelfth Annual Symposium on Computational Geometry, ACM, May 1996. [*] */ --/* Many of the ideas for my exact arithmetic routines originate with */ --/* Douglas M. Priest, "Algorithms for Arbitrary Precision Floating Point */ --/* Arithmetic," Tenth Symposium on Computer Arithmetic, pp. 132-143, IEEE */ --/* Computer Society Press, 1991. [*] Many of the ideas for the correct */ --/* evaluation of the signs of determinants are taken from Steven Fortune */ --/* and Christopher J. Van Wyk, "Efficient Exact Arithmetic for Computa- */ --/* tional Geometry," Proceedings of the Ninth Annual Symposium on */ --/* Computational Geometry, ACM, pp. 163-172, May 1993, and from Steven */ --/* Fortune, "Numerical Stability of Algorithms for 2D Delaunay Triangu- */ --/* lations," International Journal of Computational Geometry & Applica- */ --/* tions 5(1-2):193-213, March-June 1995. */ --/* */ --/* The method of inserting new vertices off-center (not precisely at the */ --/* circumcenter of every poor-quality triangle) is from Alper Ungor, */ --/* "Off-centers: A New Type of Steiner Points for Computing Size-Optimal */ --/* Quality-Guaranteed Delaunay Triangulations," Proceedings of LATIN */ --/* 2004 (Buenos Aires, Argentina), April 2004. */ --/* */ --/* For definitions of and results involving Delaunay triangulations, */ --/* constrained and conforming versions thereof, and other aspects of */ --/* triangular mesh generation, see the excellent survey by Marshall Bern */ --/* and David Eppstein, "Mesh Generation and Optimal Triangulation," in */ --/* Computing and Euclidean Geometry, Ding-Zhu Du and Frank Hwang, */ --/* editors, World Scientific, Singapore, pp. 23-90, 1992. [*] */ --/* */ --/* The time for incrementally adding PSLG (planar straight line graph) */ --/* segments to create a constrained Delaunay triangulation is probably */ --/* O(t^2) per segment in the worst case and O(t) per segment in the */ --/* common case, where t is the number of triangles that intersect the */ --/* segment before it is inserted. This doesn't count point location, */ --/* which can be much more expensive. I could improve this to O(d log d) */ --/* time, but d is usually quite small, so it's not worth the bother. */ --/* (This note does not apply when the -s switch is used, invoking a */ --/* different method is used to insert segments.) */ --/* */ --/* The time for deleting a vertex from a Delaunay triangulation is O(d^2) */ --/* in the worst case and O(d) in the common case, where d is the degree */ --/* of the vertex being deleted. I could improve this to O(d log d) time, */ --/* but d is usually quite small, so it's not worth the bother. */ --/* */ --/* Ruppert's Delaunay refinement algorithm typically generates triangles */ --/* at a linear rate (constant time per triangle) after the initial */ --/* triangulation is formed. There may be pathological cases where */ --/* quadratic time is required, but these never arise in practice. */ --/* */ --/* The geometric predicates (circumcenter calculations, segment */ --/* intersection formulae, etc.) appear in my "Lecture Notes on Geometric */ --/* Robustness" at http://www.cs.berkeley.edu/~jrs/mesh . */ --/* */ --/* If you make any improvements to this code, please please please let me */ --/* know, so that I may obtain the improvements. Even if you don't change */ --/* the code, I'd still love to hear what it's being used for. */ --/* */ --/*****************************************************************************/ -- --/* For single precision (which will save some memory and reduce paging), */ --/* define the symbol SINGLE by using the -DSINGLE compiler switch or by */ --/* writing "#define SINGLE" below. */ --/* */ --/* For double precision (which will allow you to refine meshes to a smaller */ --/* edge length), leave SINGLE undefined. */ --/* */ --/* Double precision uses more memory, but improves the resolution of the */ --/* meshes you can generate with Triangle. It also reduces the likelihood */ --/* of a floating exception due to overflow. Finally, it is much faster */ --/* than single precision on 64-bit architectures like the DEC Alpha. I */ --/* recommend double precision unless you want to generate a mesh for which */ --/* you do not have enough memory. */ -- --/* #define SINGLE */ -- --#ifdef SINGLE --#define REAL float --#else /* not SINGLE */ --#define REAL double --#endif /* not SINGLE */ -- --#define TRIANGLE_PTRINT size_t -- --/* If yours is not a Unix system, define the NO_TIMER compiler switch to */ --/* remove the Unix-specific timing code. */ -- --#define NO_TIMER -- --/* To insert lots of self-checks for internal errors, define the SELF_CHECK */ --/* symbol. This will slow down the program significantly. It is best to */ --/* define the symbol using the -DSELF_CHECK compiler switch, but you could */ --/* write "#define SELF_CHECK" below. If you are modifying this code, I */ --/* recommend you turn self-checks on until your work is debugged. */ -- --/* #define SELF_CHECK */ -- --/* To compile Triangle as a callable object library (triangle.o), define the */ --/* TRILIBRARY symbol. Read the file triangle.h for details on how to call */ --/* the procedure triangulate() that results. */ -- --#define TRILIBRARY -- --/* It is possible to generate a smaller version of Triangle using one or */ --/* both of the following symbols. Define the REDUCED symbol to eliminate */ --/* all features that are primarily of research interest; specifically, the */ --/* -i, -F, -s, and -C switches. Define the CDT_ONLY symbol to eliminate */ --/* all meshing algorithms above and beyond constrained Delaunay */ --/* triangulation; specifically, the -r, -q, -a, -u, -D, -S, and -s */ --/* switches. These reductions are most likely to be useful when */ --/* generating an object library (triangle.o) by defining the TRILIBRARY */ --/* symbol. */ -- --/* #define REDUCED */ --/* #define CDT_ONLY */ -- --/* On some machines, my exact arithmetic routines might be defeated by the */ --/* use of internal extended precision floating-point registers. The best */ --/* way to solve this problem is to set the floating-point registers to use */ --/* single or double precision internally. On 80x86 processors, this may */ --/* be accomplished by setting the CPU86 symbol for the Microsoft C */ --/* compiler, or the LINUX symbol for the gcc compiler running on Linux. */ --/* */ --/* An inferior solution is to declare certain values as `volatile', thus */ --/* forcing them to be stored to memory and rounded off. Unfortunately, */ --/* this solution might slow Triangle down quite a bit. To use volatile */ --/* values, write "#define INEXACT volatile" below. Normally, however, */ --/* INEXACT should be defined to be nothing. ("#define INEXACT".) */ --/* */ --/* For more discussion, see http://www.cs.cmu.edu/~quake/robust.pc.html . */ --/* For yet more discussion, see Section 5 of my paper, "Adaptive Precision */ --/* Floating-Point Arithmetic and Fast Robust Geometric Predicates" (also */ --/* available as Section 6.6 of my dissertation). */ -- --/* #define CPU86 */ --/* #define LINUX */ -- --#define INEXACT /* Nothing */ --/* #define INEXACT volatile */ -- --/* Maximum number of characters in a file name (including the null). */ -- --#define FILENAMESIZE 2048 -- --/* Maximum number of characters in a line read from a file (including the */ --/* null). */ -- --#define INPUTLINESIZE 4096 -- --/* For efficiency, a variety of data structures are allocated in bulk. The */ --/* following constants determine how many of each structure is allocated */ --/* at once. */ -- --#define TRIPERBLOCK 4092 /* Number of triangles allocated at once. */ --#define SUBSEGPERBLOCK 508 /* Number of subsegments allocated at once. */ --#define VERTEXPERBLOCK 4092 /* Number of vertices allocated at once. */ --#define VIRUSPERBLOCK 1020 /* Number of virus triangles allocated at once. */ --/* Number of encroached subsegments allocated at once. */ --#define BADSUBSEGPERBLOCK 252 --/* Number of skinny triangles allocated at once. */ --#define BADTRIPERBLOCK 4092 --/* Number of flipped triangles allocated at once. */ --#define FLIPSTACKERPERBLOCK 252 --/* Number of splay tree nodes allocated at once. */ --#define SPLAYNODEPERBLOCK 508 -- --/* The vertex types. A DEADVERTEX has been deleted entirely. An */ --/* UNDEADVERTEX is not part of the mesh, but is written to the output */ --/* .node file and affects the node indexing in the other output files. */ -- --#define INPUTVERTEX 0 --#define SEGMENTVERTEX 1 --#define FREEVERTEX 2 --#define DEADVERTEX -32768 --#define UNDEADVERTEX -32767 -- --/* The next line is used to outsmart some very stupid compilers. If your */ --/* compiler is smarter, feel free to replace the "int" with "void". */ --/* Not that it matters. */ -- --/*#define void int */ -- --/* Two constants for algorithms based on random sampling. Both constants */ --/* have been chosen empirically to optimize their respective algorithms. */ -- --/* Used for the point location scheme of Mucke, Saias, and Zhu, to decide */ --/* how large a random sample of triangles to inspect. */ -- --#define SAMPLEFACTOR 11 -- --/* Used in Fortune's sweepline Delaunay algorithm to determine what fraction */ --/* of boundary edges should be maintained in the splay tree for point */ --/* location on the front. */ -- --#define SAMPLERATE 10 -- --/* A number that speaks for itself, every kissable digit. */ -- --#define PI 3.141592653589793238462643383279502884197169399375105820974944592308 -- --/* Another fave. */ -- --#define SQUAREROOTTWO 1.4142135623730950488016887242096980785696718753769480732 -- --/* And here's one for those of you who are intimidated by math. */ -- --#define ONETHIRD 0.333333333333333333333333333333333333333333333333333333333333 -- --#include --#include --#include --#include --#ifndef NO_TIMER --#include --#endif /* not NO_TIMER */ --#ifdef CPU86 --#include --#endif /* CPU86 */ --#ifdef LINUX --#include --#endif /* LINUX */ --#ifdef TRILIBRARY --#include "triangle.h" --#endif /* TRILIBRARY */ -- --/* A few forward declarations. */ -- --#ifndef TRILIBRARY --char *readline(); --char *findfield(); --#endif /* not TRILIBRARY */ -- --/* Labels that signify the result of point location. The result of a */ --/* search indicates that the point falls in the interior of a triangle, on */ --/* an edge, on a vertex, or outside the mesh. */ -- --enum locateresult {INTRIANGLE, ONEDGE, ONVERTEX, OUTSIDE}; -- --/* Labels that signify the result of vertex insertion. The result indicates */ --/* that the vertex was inserted with complete success, was inserted but */ --/* encroaches upon a subsegment, was not inserted because it lies on a */ --/* segment, or was not inserted because another vertex occupies the same */ --/* location. */ -- --enum insertvertexresult {SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX, -- DUPLICATEVERTEX}; -- --/* Labels that signify the result of direction finding. The result */ --/* indicates that a segment connecting the two query points falls within */ --/* the direction triangle, along the left edge of the direction triangle, */ --/* or along the right edge of the direction triangle. */ -- --enum finddirectionresult {WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR}; -- --/* Labels that signify the result of the circumcenter computation routine. */ --/* The return value indicates which edge of the triangle is shortest. */ -- --enum circumcenterresult {OPPOSITEORG, OPPOSITEDEST, OPPOSITEAPEX}; -- --/*****************************************************************************/ --/* */ --/* The basic mesh data structures */ --/* */ --/* There are three: vertices, triangles, and subsegments (abbreviated */ --/* `subseg'). These three data structures, linked by pointers, comprise */ --/* the mesh. A vertex simply represents a mesh vertex and its properties. */ --/* A triangle is a triangle. A subsegment is a special data structure used */ --/* to represent an impenetrable edge of the mesh (perhaps on the outer */ --/* boundary, on the boundary of a hole, or part of an internal boundary */ --/* separating two triangulated regions). Subsegments represent boundaries, */ --/* defined by the user, that triangles may not lie across. */ --/* */ --/* A triangle consists of a list of three vertices, a list of three */ --/* adjoining triangles, a list of three adjoining subsegments (when */ --/* segments exist), an arbitrary number of optional user-defined */ --/* floating-point attributes, and an optional area constraint. The latter */ --/* is an upper bound on the permissible area of each triangle in a region, */ --/* used for mesh refinement. */ --/* */ --/* For a triangle on a boundary of the mesh, some or all of the neighboring */ --/* triangles may not be present. For a triangle in the interior of the */ --/* mesh, often no neighboring subsegments are present. Such absent */ --/* triangles and subsegments are never represented by NULL pointers; they */ --/* are represented by two special records: `dummytri', the triangle that */ --/* fills "outer space", and `dummysub', the omnipresent subsegment. */ --/* `dummytri' and `dummysub' are used for several reasons; for instance, */ --/* they can be dereferenced and their contents examined without violating */ --/* protected memory. */ --/* */ --/* However, it is important to understand that a triangle includes other */ --/* information as well. The pointers to adjoining vertices, triangles, and */ --/* subsegments are ordered in a way that indicates their geometric relation */ --/* to each other. Furthermore, each of these pointers contains orientation */ --/* information. Each pointer to an adjoining triangle indicates which face */ --/* of that triangle is contacted. Similarly, each pointer to an adjoining */ --/* subsegment indicates which side of that subsegment is contacted, and how */ --/* the subsegment is oriented relative to the triangle. */ --/* */ --/* The data structure representing a subsegment may be thought to be */ --/* abutting the edge of one or two triangle data structures: either */ --/* sandwiched between two triangles, or resting against one triangle on an */ --/* exterior boundary or hole boundary. */ --/* */ --/* A subsegment consists of a list of four vertices--the vertices of the */ --/* subsegment, and the vertices of the segment it is a part of--a list of */ --/* two adjoining subsegments, and a list of two adjoining triangles. One */ --/* of the two adjoining triangles may not be present (though there should */ --/* always be one), and neighboring subsegments might not be present. */ --/* Subsegments also store a user-defined integer "boundary marker". */ --/* Typically, this integer is used to indicate what boundary conditions are */ --/* to be applied at that location in a finite element simulation. */ --/* */ --/* Like triangles, subsegments maintain information about the relative */ --/* orientation of neighboring objects. */ --/* */ --/* Vertices are relatively simple. A vertex is a list of floating-point */ --/* numbers, starting with the x, and y coordinates, followed by an */ --/* arbitrary number of optional user-defined floating-point attributes, */ --/* followed by an integer boundary marker. During the segment insertion */ --/* phase, there is also a pointer from each vertex to a triangle that may */ --/* contain it. Each pointer is not always correct, but when one is, it */ --/* speeds up segment insertion. These pointers are assigned values once */ --/* at the beginning of the segment insertion phase, and are not used or */ --/* updated except during this phase. Edge flipping during segment */ --/* insertion will render some of them incorrect. Hence, don't rely upon */ --/* them for anything. */ --/* */ --/* Other than the exception mentioned above, vertices have no information */ --/* about what triangles, subfacets, or subsegments they are linked to. */ --/* */ --/*****************************************************************************/ -- --/*****************************************************************************/ --/* */ --/* Handles */ --/* */ --/* The oriented triangle (`otri') and oriented subsegment (`osub') data */ --/* structures defined below do not themselves store any part of the mesh. */ --/* The mesh itself is made of `triangle's, `subseg's, and `vertex's. */ --/* */ --/* Oriented triangles and oriented subsegments will usually be referred to */ --/* as "handles." A handle is essentially a pointer into the mesh; it */ --/* allows you to "hold" one particular part of the mesh. Handles are used */ --/* to specify the regions in which one is traversing and modifying the mesh.*/ --/* A single `triangle' may be held by many handles, or none at all. (The */ --/* latter case is not a memory leak, because the triangle is still */ --/* connected to other triangles in the mesh.) */ --/* */ --/* An `otri' is a handle that holds a triangle. It holds a specific edge */ --/* of the triangle. An `osub' is a handle that holds a subsegment. It */ --/* holds either the left or right side of the subsegment. */ --/* */ --/* Navigation about the mesh is accomplished through a set of mesh */ --/* manipulation primitives, further below. Many of these primitives take */ --/* a handle and produce a new handle that holds the mesh near the first */ --/* handle. Other primitives take two handles and glue the corresponding */ --/* parts of the mesh together. The orientation of the handles is */ --/* important. For instance, when two triangles are glued together by the */ --/* bond() primitive, they are glued at the edges on which the handles lie. */ --/* */ --/* Because vertices have no information about which triangles they are */ --/* attached to, I commonly represent a vertex by use of a handle whose */ --/* origin is the vertex. A single handle can simultaneously represent a */ --/* triangle, an edge, and a vertex. */ --/* */ --/*****************************************************************************/ -- --/* The triangle data structure. Each triangle contains three pointers to */ --/* adjoining triangles, plus three pointers to vertices, plus three */ --/* pointers to subsegments (declared below; these pointers are usually */ --/* `dummysub'). It may or may not also contain user-defined attributes */ --/* and/or a floating-point "area constraint." It may also contain extra */ --/* pointers for nodes, when the user asks for high-order elements. */ --/* Because the size and structure of a `triangle' is not decided until */ --/* runtime, I haven't simply declared the type `triangle' as a struct. */ -- --typedef REAL **triangle; /* Really: typedef triangle *triangle */ -- --/* An oriented triangle: includes a pointer to a triangle and orientation. */ --/* The orientation denotes an edge of the triangle. Hence, there are */ --/* three possible orientations. By convention, each edge always points */ --/* counterclockwise about the corresponding triangle. */ -- --struct otri { -- triangle *tri; -- int orient; /* Ranges from 0 to 2. */ --}; -- --/* The subsegment data structure. Each subsegment contains two pointers to */ --/* adjoining subsegments, plus four pointers to vertices, plus two */ --/* pointers to adjoining triangles, plus one boundary marker, plus one */ --/* segment number. */ -- --typedef REAL **subseg; /* Really: typedef subseg *subseg */ -- --/* An oriented subsegment: includes a pointer to a subsegment and an */ --/* orientation. The orientation denotes a side of the edge. Hence, there */ --/* are two possible orientations. By convention, the edge is always */ --/* directed so that the "side" denoted is the right side of the edge. */ -- --struct osub { -- subseg *ss; -- int ssorient; /* Ranges from 0 to 1. */ --}; -- --/* The vertex data structure. Each vertex is actually an array of REALs. */ --/* The number of REALs is unknown until runtime. An integer boundary */ --/* marker, and sometimes a pointer to a triangle, is appended after the */ --/* REALs. */ -- --typedef REAL *vertex; -- --/* A queue used to store encroached subsegments. Each subsegment's vertices */ --/* are stored so that we can check whether a subsegment is still the same. */ -- --struct badsubseg { -- subseg encsubseg; /* An encroached subsegment. */ -- vertex subsegorg, subsegdest; /* Its two vertices. */ --}; -- --/* A queue used to store bad triangles. The key is the square of the cosine */ --/* of the smallest angle of the triangle. Each triangle's vertices are */ --/* stored so that one can check whether a triangle is still the same. */ -- --struct badtriang { -- triangle poortri; /* A skinny or too-large triangle. */ -- REAL key; /* cos^2 of smallest (apical) angle. */ -- vertex triangorg, triangdest, triangapex; /* Its three vertices. */ -- struct badtriang *nexttriang; /* Pointer to next bad triangle. */ --}; -- --/* A stack of triangles flipped during the most recent vertex insertion. */ --/* The stack is used to undo the vertex insertion if the vertex encroaches */ --/* upon a subsegment. */ -- --struct flipstacker { -- triangle flippedtri; /* A recently flipped triangle. */ -- struct flipstacker *prevflip; /* Previous flip in the stack. */ --}; -- --/* A node in a heap used to store events for the sweepline Delaunay */ --/* algorithm. Nodes do not point directly to their parents or children in */ --/* the heap. Instead, each node knows its position in the heap, and can */ --/* look up its parent and children in a separate array. The `eventptr' */ --/* points either to a `vertex' or to a triangle (in encoded format, so */ --/* that an orientation is included). In the latter case, the origin of */ --/* the oriented triangle is the apex of a "circle event" of the sweepline */ --/* algorithm. To distinguish site events from circle events, all circle */ --/* events are given an invalid (smaller than `xmin') x-coordinate `xkey'. */ -- --struct event { -- REAL xkey, ykey; /* Coordinates of the event. */ -- void *eventptr; /* Can be a vertex or the location of a circle event. */ -- int heapposition; /* Marks this event's position in the heap. */ --}; -- --/* A node in the splay tree. Each node holds an oriented ghost triangle */ --/* that represents a boundary edge of the growing triangulation. When a */ --/* circle event covers two boundary edges with a triangle, so that they */ --/* are no longer boundary edges, those edges are not immediately deleted */ --/* from the tree; rather, they are lazily deleted when they are next */ --/* encountered. (Since only a random sample of boundary edges are kept */ --/* in the tree, lazy deletion is faster.) `keydest' is used to verify */ --/* that a triangle is still the same as when it entered the splay tree; if */ --/* it has been rotated (due to a circle event), it no longer represents a */ --/* boundary edge and should be deleted. */ -- --struct splaynode { -- struct otri keyedge; /* Lprev of an edge on the front. */ -- vertex keydest; /* Used to verify that splay node is still live. */ -- struct splaynode *lchild, *rchild; /* Children in splay tree. */ --}; -- --/* A type used to allocate memory. firstblock is the first block of items. */ --/* nowblock is the block from which items are currently being allocated. */ --/* nextitem points to the next slab of free memory for an item. */ --/* deaditemstack is the head of a linked list (stack) of deallocated items */ --/* that can be recycled. unallocateditems is the number of items that */ --/* remain to be allocated from nowblock. */ --/* */ --/* Traversal is the process of walking through the entire list of items, and */ --/* is separate from allocation. Note that a traversal will visit items on */ --/* the "deaditemstack" stack as well as live items. pathblock points to */ --/* the block currently being traversed. pathitem points to the next item */ --/* to be traversed. pathitemsleft is the number of items that remain to */ --/* be traversed in pathblock. */ --/* */ --/* alignbytes determines how new records should be aligned in memory. */ --/* itembytes is the length of a record in bytes (after rounding up). */ --/* itemsperblock is the number of items allocated at once in a single */ --/* block. itemsfirstblock is the number of items in the first block, */ --/* which can vary from the others. items is the number of currently */ --/* allocated items. maxitems is the maximum number of items that have */ --/* been allocated at once; it is the current number of items plus the */ --/* number of records kept on deaditemstack. */ -- --struct memorypool { -- void **firstblock, **nowblock; -- void *nextitem; -- void *deaditemstack; -- void **pathblock; -- void *pathitem; -- int alignbytes; -- int itembytes; -- int itemsperblock; -- int itemsfirstblock; -- long items, maxitems; -- int unallocateditems; -- int pathitemsleft; --}; -- -- --/* Global constants. */ -- --REAL splitter; /* Used to split REAL factors for exact multiplication. */ --REAL epsilon; /* Floating-point machine epsilon. */ --REAL resulterrbound; --REAL ccwerrboundA, ccwerrboundB, ccwerrboundC; --REAL iccerrboundA, iccerrboundB, iccerrboundC; --REAL o3derrboundA, o3derrboundB, o3derrboundC; -- --/* Random number seed is not constant, but I've made it global anyway. */ -- --TRIANGLE_PTRINT randomseed; /* Current random number seed. */ -- -- --/* Mesh data structure. Triangle operates on only one mesh, but the mesh */ --/* structure is used (instead of global variables) to allow reentrancy. */ -- --struct mesh { -- --/* Variables used to allocate memory for triangles, subsegments, vertices, */ --/* viri (triangles being eaten), encroached segments, bad (skinny or too */ --/* large) triangles, and splay tree nodes. */ -- -- struct memorypool triangles; -- struct memorypool subsegs; -- struct memorypool vertices; -- struct memorypool viri; -- struct memorypool badsubsegs; -- struct memorypool badtriangles; -- struct memorypool flipstackers; -- struct memorypool splaynodes; -- --/* Variables that maintain the bad triangle queues. The queues are */ --/* ordered from 4095 (highest priority) to 0 (lowest priority). */ -- -- struct badtriang *queuefront[4096]; -- struct badtriang *queuetail[4096]; -- int nextnonemptyq[4096]; -- int firstnonemptyq; -- --/* Variable that maintains the stack of recently flipped triangles. */ -- -- struct flipstacker *lastflip; -- --/* Other variables. */ -- -- REAL xmin, xmax, ymin, ymax; /* x and y bounds. */ -- REAL xminextreme; /* Nonexistent x value used as a flag in sweepline. */ -- int invertices; /* Number of input vertices. */ -- int inelements; /* Number of input triangles. */ -- int insegments; /* Number of input segments. */ -- int holes; /* Number of input holes. */ -- int regions; /* Number of input regions. */ -- int undeads; /* Number of input vertices that don't appear in the mesh. */ -- long edges; /* Number of output edges. */ -- int mesh_dim; /* Dimension (ought to be 2). */ -- int nextras; /* Number of attributes per vertex. */ -- int eextras; /* Number of attributes per triangle. */ -- long hullsize; /* Number of edges in convex hull. */ -- int steinerleft; /* Number of Steiner points not yet used. */ -- int vertexmarkindex; /* Index to find boundary marker of a vertex. */ -- int vertex2triindex; /* Index to find a triangle adjacent to a vertex. */ -- int highorderindex; /* Index to find extra nodes for high-order elements. */ -- int elemattribindex; /* Index to find attributes of a triangle. */ -- int areaboundindex; /* Index to find area bound of a triangle. */ -- int checksegments; /* Are there segments in the triangulation yet? */ -- int checkquality; /* Has quality triangulation begun yet? */ -- int readnodefile; /* Has a .node file been read? */ -- long samples; /* Number of random samples for point location. */ -- -- long incirclecount; /* Number of incircle tests performed. */ -- long counterclockcount; /* Number of counterclockwise tests performed. */ -- long orient3dcount; /* Number of 3D orientation tests performed. */ -- long hyperbolacount; /* Number of right-of-hyperbola tests performed. */ -- long circumcentercount; /* Number of circumcenter calculations performed. */ -- long circletopcount; /* Number of circle top calculations performed. */ -- --/* Triangular bounding box vertices. */ -- -- vertex infvertex1, infvertex2, infvertex3; -- --/* Pointer to the `triangle' that occupies all of "outer space." */ -- -- triangle *dummytri; -- triangle *dummytribase; /* Keep base address so we can free() it later. */ -- --/* Pointer to the omnipresent subsegment. Referenced by any triangle or */ --/* subsegment that isn't really connected to a subsegment at that */ --/* location. */ -- -- subseg *dummysub; -- subseg *dummysubbase; /* Keep base address so we can free() it later. */ -- --/* Pointer to a recently visited triangle. Improves point location if */ --/* proximate vertices are inserted sequentially. */ -- -- struct otri recenttri; -- --}; /* End of `struct mesh'. */ -- -- --/* Data structure for command line switches and file names. This structure */ --/* is used (instead of global variables) to allow reentrancy. */ -- --struct behavior { -- --/* Switches for the triangulator. */ --/* poly: -p switch. refine: -r switch. */ --/* quality: -q switch. */ --/* minangle: minimum angle bound, specified after -q switch. */ --/* goodangle: cosine squared of minangle. */ --/* offconstant: constant used to place off-center Steiner points. */ --/* vararea: -a switch without number. */ --/* fixedarea: -a switch with number. */ --/* maxarea: maximum area bound, specified after -a switch. */ --/* usertest: -u switch. */ --/* regionattrib: -A switch. convex: -c switch. */ --/* weighted: 1 for -w switch, 2 for -W switch. jettison: -j switch */ --/* firstnumber: inverse of -z switch. All items are numbered starting */ --/* from `firstnumber'. */ --/* edgesout: -e switch. voronoi: -v switch. */ --/* neighbors: -n switch. geomview: -g switch. */ --/* nobound: -B switch. nopolywritten: -P switch. */ --/* nonodewritten: -N switch. noelewritten: -E switch. */ --/* noiterationnum: -I switch. noholes: -O switch. */ --/* noexact: -X switch. */ --/* order: element order, specified after -o switch. */ --/* nobisect: count of how often -Y switch is selected. */ --/* steiner: maximum number of Steiner points, specified after -S switch. */ --/* incremental: -i switch. sweepline: -F switch. */ --/* dwyer: inverse of -l switch. */ --/* splitseg: -s switch. */ --/* conformdel: -D switch. docheck: -C switch. */ --/* quiet: -Q switch. verbose: count of how often -V switch is selected. */ --/* usesegments: -p, -r, -q, or -c switch; determines whether segments are */ --/* used at all. */ --/* */ --/* Read the instructions to find out the meaning of these switches. */ -- -- int poly, refine, quality, vararea, fixedarea, usertest; -- int regionattrib, convex, weighted, jettison; -- int firstnumber; -- int edgesout, voronoi, neighbors, geomview; -- int nobound, nopolywritten, nonodewritten, noelewritten, noiterationnum; -- int noholes, noexact, conformdel; -- int incremental, sweepline, dwyer; -- int splitseg; -- int docheck; -- int quiet, verbose; -- int usesegments; -- int order; -- int nobisect; -- int steiner; -- REAL minangle, goodangle, offconstant; -- REAL maxarea; -- --/* Variables for file names. */ -- --#ifndef TRILIBRARY -- char innodefilename[FILENAMESIZE]; -- char inelefilename[FILENAMESIZE]; -- char inpolyfilename[FILENAMESIZE]; -- char areafilename[FILENAMESIZE]; -- char outnodefilename[FILENAMESIZE]; -- char outelefilename[FILENAMESIZE]; -- char outpolyfilename[FILENAMESIZE]; -- char edgefilename[FILENAMESIZE]; -- char vnodefilename[FILENAMESIZE]; -- char vedgefilename[FILENAMESIZE]; -- char neighborfilename[FILENAMESIZE]; -- char offfilename[FILENAMESIZE]; --#endif /* not TRILIBRARY */ -- --}; /* End of `struct behavior'. */ -- -- --/*****************************************************************************/ --/* */ --/* Mesh manipulation primitives. Each triangle contains three pointers to */ --/* other triangles, with orientations. Each pointer points not to the */ --/* first byte of a triangle, but to one of the first three bytes of a */ --/* triangle. It is necessary to extract both the triangle itself and the */ --/* orientation. To save memory, I keep both pieces of information in one */ --/* pointer. To make this possible, I assume that all triangles are aligned */ --/* to four-byte boundaries. The decode() routine below decodes a pointer, */ --/* extracting an orientation (in the range 0 to 2) and a pointer to the */ --/* beginning of a triangle. The encode() routine compresses a pointer to a */ --/* triangle and an orientation into a single pointer. My assumptions that */ --/* triangles are four-byte-aligned and that the `TRIANGLE_PTRINT' type is */ --/* long enough to hold a pointer are two of the few kludges in this program.*/ --/* */ --/* Subsegments are manipulated similarly. A pointer to a subsegment */ --/* carries both an address and an orientation in the range 0 to 1. */ --/* */ --/* The other primitives take an oriented triangle or oriented subsegment, */ --/* and return an oriented triangle or oriented subsegment or vertex; or */ --/* they change the connections in the data structure. */ --/* */ --/* Below, triangles and subsegments are denoted by their vertices. The */ --/* triangle abc has origin (org) a, destination (dest) b, and apex (apex) */ --/* c. These vertices occur in counterclockwise order about the triangle. */ --/* The handle abc may simultaneously denote vertex a, edge ab, and triangle */ --/* abc. */ --/* */ --/* Similarly, the subsegment ab has origin (sorg) a and destination (sdest) */ --/* b. If ab is thought to be directed upward (with b directly above a), */ --/* then the handle ab is thought to grasp the right side of ab, and may */ --/* simultaneously denote vertex a and edge ab. */ --/* */ --/* An asterisk (*) denotes a vertex whose identity is unknown. */ --/* */ --/* Given this notation, a partial list of mesh manipulation primitives */ --/* follows. */ --/* */ --/* */ --/* For triangles: */ --/* */ --/* sym: Find the abutting triangle; same edge. */ --/* sym(abc) -> ba* */ --/* */ --/* lnext: Find the next edge (counterclockwise) of a triangle. */ --/* lnext(abc) -> bca */ --/* */ --/* lprev: Find the previous edge (clockwise) of a triangle. */ --/* lprev(abc) -> cab */ --/* */ --/* onext: Find the next edge counterclockwise with the same origin. */ --/* onext(abc) -> ac* */ --/* */ --/* oprev: Find the next edge clockwise with the same origin. */ --/* oprev(abc) -> a*b */ --/* */ --/* dnext: Find the next edge counterclockwise with the same destination. */ --/* dnext(abc) -> *ba */ --/* */ --/* dprev: Find the next edge clockwise with the same destination. */ --/* dprev(abc) -> cb* */ --/* */ --/* rnext: Find the next edge (counterclockwise) of the adjacent triangle. */ --/* rnext(abc) -> *a* */ --/* */ --/* rprev: Find the previous edge (clockwise) of the adjacent triangle. */ --/* rprev(abc) -> b** */ --/* */ --/* org: Origin dest: Destination apex: Apex */ --/* org(abc) -> a dest(abc) -> b apex(abc) -> c */ --/* */ --/* bond: Bond two triangles together at the resepective handles. */ --/* bond(abc, bad) */ --/* */ --/* */ --/* For subsegments: */ --/* */ --/* ssym: Reverse the orientation of a subsegment. */ --/* ssym(ab) -> ba */ --/* */ --/* spivot: Find adjoining subsegment with the same origin. */ --/* spivot(ab) -> a* */ --/* */ --/* snext: Find next subsegment in sequence. */ --/* snext(ab) -> b* */ --/* */ --/* sorg: Origin sdest: Destination */ --/* sorg(ab) -> a sdest(ab) -> b */ --/* */ --/* sbond: Bond two subsegments together at the respective origins. */ --/* sbond(ab, ac) */ --/* */ --/* */ --/* For interacting tetrahedra and subfacets: */ --/* */ --/* tspivot: Find a subsegment abutting a triangle. */ --/* tspivot(abc) -> ba */ --/* */ --/* stpivot: Find a triangle abutting a subsegment. */ --/* stpivot(ab) -> ba* */ --/* */ --/* tsbond: Bond a triangle to a subsegment. */ --/* tsbond(abc, ba) */ --/* */ --/*****************************************************************************/ -- --/********* Mesh manipulation primitives begin here *********/ --/** **/ --/** **/ -- --/* Fast lookup arrays to speed some of the mesh manipulation primitives. */ -- --int plus1mod3[3] = {1, 2, 0}; --int minus1mod3[3] = {2, 0, 1}; -- --/********* Primitives for triangles *********/ --/* */ --/* */ -- --/* decode() converts a pointer to an oriented triangle. The orientation is */ --/* extracted from the two least significant bits of the pointer. */ -- --#define decode(ptr, otri) \ -- (otri).orient = (int) ((TRIANGLE_PTRINT) (ptr) & (TRIANGLE_PTRINT) 3l); \ -- (otri).tri = (triangle *) \ -- ((TRIANGLE_PTRINT) (ptr) ^ (TRIANGLE_PTRINT) (otri).orient) -- --/* encode() compresses an oriented triangle into a single pointer. It */ --/* relies on the assumption that all triangles are aligned to four-byte */ --/* boundaries, so the two least significant bits of (otri).tri are zero. */ -- --#define encode(otri) \ -- (triangle) ((TRIANGLE_PTRINT) (otri).tri | (TRIANGLE_PTRINT) (otri).orient) -- --/* The following handle manipulation primitives are all described by Guibas */ --/* and Stolfi. However, Guibas and Stolfi use an edge-based data */ --/* structure, whereas I use a triangle-based data structure. */ -- --/* sym() finds the abutting triangle, on the same edge. Note that the edge */ --/* direction is necessarily reversed, because the handle specified by an */ --/* oriented triangle is directed counterclockwise around the triangle. */ -- --#define sym(otri1, otri2) \ -- ptr = (otri1).tri[(otri1).orient]; \ -- decode(ptr, otri2); -- --#define symself(otri) \ -- ptr = (otri).tri[(otri).orient]; \ -- decode(ptr, otri); -- --/* lnext() finds the next edge (counterclockwise) of a triangle. */ -- --#define lnext(otri1, otri2) \ -- (otri2).tri = (otri1).tri; \ -- (otri2).orient = plus1mod3[(otri1).orient] -- --#define lnextself(otri) \ -- (otri).orient = plus1mod3[(otri).orient] -- --/* lprev() finds the previous edge (clockwise) of a triangle. */ -- --#define lprev(otri1, otri2) \ -- (otri2).tri = (otri1).tri; \ -- (otri2).orient = minus1mod3[(otri1).orient] -- --#define lprevself(otri) \ -- (otri).orient = minus1mod3[(otri).orient] -- --/* onext() spins counterclockwise around a vertex; that is, it finds the */ --/* next edge with the same origin in the counterclockwise direction. This */ --/* edge is part of a different triangle. */ -- --#define onext(otri1, otri2) \ -- lprev(otri1, otri2); \ -- symself(otri2); -- --#define onextself(otri) \ -- lprevself(otri); \ -- symself(otri); -- --/* oprev() spins clockwise around a vertex; that is, it finds the next edge */ --/* with the same origin in the clockwise direction. This edge is part of */ --/* a different triangle. */ -- --#define oprev(otri1, otri2) \ -- sym(otri1, otri2); \ -- lnextself(otri2); -- --#define oprevself(otri) \ -- symself(otri); \ -- lnextself(otri); -- --/* dnext() spins counterclockwise around a vertex; that is, it finds the */ --/* next edge with the same destination in the counterclockwise direction. */ --/* This edge is part of a different triangle. */ -- --#define dnext(otri1, otri2) \ -- sym(otri1, otri2); \ -- lprevself(otri2); -- --#define dnextself(otri) \ -- symself(otri); \ -- lprevself(otri); -- --/* dprev() spins clockwise around a vertex; that is, it finds the next edge */ --/* with the same destination in the clockwise direction. This edge is */ --/* part of a different triangle. */ -- --#define dprev(otri1, otri2) \ -- lnext(otri1, otri2); \ -- symself(otri2); -- --#define dprevself(otri) \ -- lnextself(otri); \ -- symself(otri); -- --/* rnext() moves one edge counterclockwise about the adjacent triangle. */ --/* (It's best understood by reading Guibas and Stolfi. It involves */ --/* changing triangles twice.) */ -- --#define rnext(otri1, otri2) \ -- sym(otri1, otri2); \ -- lnextself(otri2); \ -- symself(otri2); -- --#define rnextself(otri) \ -- symself(otri); \ -- lnextself(otri); \ -- symself(otri); -- --/* rprev() moves one edge clockwise about the adjacent triangle. */ --/* (It's best understood by reading Guibas and Stolfi. It involves */ --/* changing triangles twice.) */ -- --#define rprev(otri1, otri2) \ -- sym(otri1, otri2); \ -- lprevself(otri2); \ -- symself(otri2); -- --#define rprevself(otri) \ -- symself(otri); \ -- lprevself(otri); \ -- symself(otri); -- --/* These primitives determine or set the origin, destination, or apex of a */ --/* triangle. */ -- --#define org(otri, vertexptr) \ -- vertexptr = (vertex) (otri).tri[plus1mod3[(otri).orient] + 3] -- --#define dest(otri, vertexptr) \ -- vertexptr = (vertex) (otri).tri[minus1mod3[(otri).orient] + 3] -- --#define apex(otri, vertexptr) \ -- vertexptr = (vertex) (otri).tri[(otri).orient + 3] -- --#define setorg(otri, vertexptr) \ -- (otri).tri[plus1mod3[(otri).orient] + 3] = (triangle) vertexptr -- --#define setdest(otri, vertexptr) \ -- (otri).tri[minus1mod3[(otri).orient] + 3] = (triangle) vertexptr -- --#define setapex(otri, vertexptr) \ -- (otri).tri[(otri).orient + 3] = (triangle) vertexptr -- --/* Bond two triangles together. */ -- --#define bond(otri1, otri2) \ -- (otri1).tri[(otri1).orient] = encode(otri2); \ -- (otri2).tri[(otri2).orient] = encode(otri1) -- --/* Dissolve a bond (from one side). Note that the other triangle will still */ --/* think it's connected to this triangle. Usually, however, the other */ --/* triangle is being deleted entirely, or bonded to another triangle, so */ --/* it doesn't matter. */ -- --#define dissolve(otri) \ -- (otri).tri[(otri).orient] = (triangle) m->dummytri -- --/* Copy an oriented triangle. */ -- --#define otricopy(otri1, otri2) \ -- (otri2).tri = (otri1).tri; \ -- (otri2).orient = (otri1).orient -- --/* Test for equality of oriented triangles. */ -- --#define otriequal(otri1, otri2) \ -- (((otri1).tri == (otri2).tri) && \ -- ((otri1).orient == (otri2).orient)) -- --/* Primitives to infect or cure a triangle with the virus. These rely on */ --/* the assumption that all subsegments are aligned to four-byte boundaries.*/ -- --#define infect(otri) \ -- (otri).tri[6] = (triangle) \ -- ((TRIANGLE_PTRINT) (otri).tri[6] | (TRIANGLE_PTRINT) 2l) -- --#define uninfect(otri) \ -- (otri).tri[6] = (triangle) \ -- ((TRIANGLE_PTRINT) (otri).tri[6] & ~ (TRIANGLE_PTRINT) 2l) -- --/* Test a triangle for viral infection. */ -- --#define infected(otri) \ -- (((TRIANGLE_PTRINT) (otri).tri[6] & (TRIANGLE_PTRINT) 2l) != 0l) -- --/* Check or set a triangle's attributes. */ -- --#define elemattribute(otri, attnum) \ -- ((REAL *) (otri).tri)[m->elemattribindex + (attnum)] -- --#define setelemattribute(otri, attnum, value) \ -- ((REAL *) (otri).tri)[m->elemattribindex + (attnum)] = value -- --/* Check or set a triangle's maximum area bound. */ -- --#define areabound(otri) ((REAL *) (otri).tri)[m->areaboundindex] -- --#define setareabound(otri, value) \ -- ((REAL *) (otri).tri)[m->areaboundindex] = value -- --/* Check or set a triangle's deallocation. Its second pointer is set to */ --/* NULL to indicate that it is not allocated. (Its first pointer is used */ --/* for the stack of dead items.) Its fourth pointer (its first vertex) */ --/* is set to NULL in case a `badtriang' structure points to it. */ -- --#define deadtri(tria) ((tria)[1] == (triangle) NULL) -- --#define killtri(tria) \ -- (tria)[1] = (triangle) NULL; \ -- (tria)[3] = (triangle) NULL -- --/********* Primitives for subsegments *********/ --/* */ --/* */ -- --/* sdecode() converts a pointer to an oriented subsegment. The orientation */ --/* is extracted from the least significant bit of the pointer. The two */ --/* least significant bits (one for orientation, one for viral infection) */ --/* are masked out to produce the real pointer. */ -- --#define sdecode(sptr, osub) \ -- (osub).ssorient = (int) ((TRIANGLE_PTRINT) (sptr) & (TRIANGLE_PTRINT) 1l); \ -- (osub).ss = (subseg *) \ -- ((TRIANGLE_PTRINT) (sptr) & ~ (TRIANGLE_PTRINT) 3l) -- --/* sencode() compresses an oriented subsegment into a single pointer. It */ --/* relies on the assumption that all subsegments are aligned to two-byte */ --/* boundaries, so the least significant bit of (osub).ss is zero. */ -- --#define sencode(osub) \ -- (subseg) ((TRIANGLE_PTRINT) (osub).ss | (TRIANGLE_PTRINT) (osub).ssorient) -- --/* ssym() toggles the orientation of a subsegment. */ -- --#define ssym(osub1, osub2) \ -- (osub2).ss = (osub1).ss; \ -- (osub2).ssorient = 1 - (osub1).ssorient -- --#define ssymself(osub) \ -- (osub).ssorient = 1 - (osub).ssorient -- --/* spivot() finds the other subsegment (from the same segment) that shares */ --/* the same origin. */ -- --#define spivot(osub1, osub2) \ -- sptr = (osub1).ss[(osub1).ssorient]; \ -- sdecode(sptr, osub2) -- --#define spivotself(osub) \ -- sptr = (osub).ss[(osub).ssorient]; \ -- sdecode(sptr, osub) -- --/* snext() finds the next subsegment (from the same segment) in sequence; */ --/* one whose origin is the input subsegment's destination. */ -- --#define snext(osub1, osub2) \ -- sptr = (osub1).ss[1 - (osub1).ssorient]; \ -- sdecode(sptr, osub2) -- --#define snextself(osub) \ -- sptr = (osub).ss[1 - (osub).ssorient]; \ -- sdecode(sptr, osub) -- --/* These primitives determine or set the origin or destination of a */ --/* subsegment or the segment that includes it. */ -- --#define sorg(osub, vertexptr) \ -- vertexptr = (vertex) (osub).ss[2 + (osub).ssorient] -- --#define sdest(osub, vertexptr) \ -- vertexptr = (vertex) (osub).ss[3 - (osub).ssorient] -- --#define setsorg(osub, vertexptr) \ -- (osub).ss[2 + (osub).ssorient] = (subseg) vertexptr -- --#define setsdest(osub, vertexptr) \ -- (osub).ss[3 - (osub).ssorient] = (subseg) vertexptr -- --#define segorg(osub, vertexptr) \ -- vertexptr = (vertex) (osub).ss[4 + (osub).ssorient] -- --#define segdest(osub, vertexptr) \ -- vertexptr = (vertex) (osub).ss[5 - (osub).ssorient] -- --#define setsegorg(osub, vertexptr) \ -- (osub).ss[4 + (osub).ssorient] = (subseg) vertexptr -- --#define setsegdest(osub, vertexptr) \ -- (osub).ss[5 - (osub).ssorient] = (subseg) vertexptr -- --/* These primitives read or set a boundary marker. Boundary markers are */ --/* used to hold user-defined tags for setting boundary conditions in */ --/* finite element solvers. */ -- --#define mark(osub) (* (int *) ((osub).ss + 8)) -- --#define setmark(osub, value) \ -- * (int *) ((osub).ss + 8) = value -- --/* Bond two subsegments together. */ -- --#define sbond(osub1, osub2) \ -- (osub1).ss[(osub1).ssorient] = sencode(osub2); \ -- (osub2).ss[(osub2).ssorient] = sencode(osub1) -- --/* Dissolve a subsegment bond (from one side). Note that the other */ --/* subsegment will still think it's connected to this subsegment. */ -- --#define sdissolve(osub) \ -- (osub).ss[(osub).ssorient] = (subseg) m->dummysub -- --/* Copy a subsegment. */ -- --#define subsegcopy(osub1, osub2) \ -- (osub2).ss = (osub1).ss; \ -- (osub2).ssorient = (osub1).ssorient -- --/* Test for equality of subsegments. */ -- --#define subsegequal(osub1, osub2) \ -- (((osub1).ss == (osub2).ss) && \ -- ((osub1).ssorient == (osub2).ssorient)) -- --/* Check or set a subsegment's deallocation. Its second pointer is set to */ --/* NULL to indicate that it is not allocated. (Its first pointer is used */ --/* for the stack of dead items.) Its third pointer (its first vertex) */ --/* is set to NULL in case a `badsubseg' structure points to it. */ -- --#define deadsubseg(sub) ((sub)[1] == (subseg) NULL) -- --#define killsubseg(sub) \ -- (sub)[1] = (subseg) NULL; \ -- (sub)[2] = (subseg) NULL -- --/********* Primitives for interacting triangles and subsegments *********/ --/* */ --/* */ -- --/* tspivot() finds a subsegment abutting a triangle. */ -- --#define tspivot(otri, osub) \ -- sptr = (subseg) (otri).tri[6 + (otri).orient]; \ -- sdecode(sptr, osub) -- --/* stpivot() finds a triangle abutting a subsegment. It requires that the */ --/* variable `ptr' of type `triangle' be defined. */ -- --#define stpivot(osub, otri) \ -- ptr = (triangle) (osub).ss[6 + (osub).ssorient]; \ -- decode(ptr, otri) -- --/* Bond a triangle to a subsegment. */ -- --#define tsbond(otri, osub) \ -- (otri).tri[6 + (otri).orient] = (triangle) sencode(osub); \ -- (osub).ss[6 + (osub).ssorient] = (subseg) encode(otri) -- --/* Dissolve a bond (from the triangle side). */ -- --#define tsdissolve(otri) \ -- (otri).tri[6 + (otri).orient] = (triangle) m->dummysub -- --/* Dissolve a bond (from the subsegment side). */ -- --#define stdissolve(osub) \ -- (osub).ss[6 + (osub).ssorient] = (subseg) m->dummytri -- --/********* Primitives for vertices *********/ --/* */ --/* */ -- --#define vertexmark(vx) ((int *) (vx))[m->vertexmarkindex] -- --#define setvertexmark(vx, value) \ -- ((int *) (vx))[m->vertexmarkindex] = value -- --#define vertextype(vx) ((int *) (vx))[m->vertexmarkindex + 1] -- --#define setvertextype(vx, value) \ -- ((int *) (vx))[m->vertexmarkindex + 1] = value -- --#define vertex2tri(vx) ((triangle *) (vx))[m->vertex2triindex] -- --#define setvertex2tri(vx, value) \ -- ((triangle *) (vx))[m->vertex2triindex] = value -- --/** **/ --/** **/ --/********* Mesh manipulation primitives end here *********/ -- --/********* User-defined triangle evaluation routine begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* triunsuitable() Determine if a triangle is unsuitable, and thus must */ --/* be further refined. */ --/* */ --/* You may write your own procedure that decides whether or not a selected */ --/* triangle is too big (and needs to be refined). There are two ways to do */ --/* this. */ --/* */ --/* (1) Modify the procedure `triunsuitable' below, then recompile */ --/* Triangle. */ --/* */ --/* (2) Define the symbol EXTERNAL_TEST (either by adding the definition */ --/* to this file, or by using the appropriate compiler switch). This way, */ --/* you can compile triangle.c separately from your test. Write your own */ --/* `triunsuitable' procedure in a separate C file (using the same prototype */ --/* as below). Compile it and link the object code with triangle.o. */ --/* */ --/* This procedure returns 1 if the triangle is too large and should be */ --/* refined; 0 otherwise. */ --/* */ --/*****************************************************************************/ -- --#ifdef EXTERNAL_TEST -- --int triunsuitable(); -- --#else /* not EXTERNAL_TEST */ -- --#ifdef ANSI_DECLARATORS --int triunsuitable(vertex triorg, vertex tridest, vertex triapex, REAL area) --#else /* not ANSI_DECLARATORS */ --int triunsuitable(triorg, tridest, triapex, area) --vertex triorg; /* The triangle's origin vertex. */ --vertex tridest; /* The triangle's destination vertex. */ --vertex triapex; /* The triangle's apex vertex. */ --REAL area; /* The area of the triangle. */ --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL dxoa, dxda, dxod; -- REAL dyoa, dyda, dyod; -- REAL oalen, dalen, odlen; -- REAL maxlen; -- -- dxoa = triorg[0] - triapex[0]; -- dyoa = triorg[1] - triapex[1]; -- dxda = tridest[0] - triapex[0]; -- dyda = tridest[1] - triapex[1]; -- dxod = triorg[0] - tridest[0]; -- dyod = triorg[1] - tridest[1]; -- /* Find the squares of the lengths of the triangle's three edges. */ -- oalen = dxoa * dxoa + dyoa * dyoa; -- dalen = dxda * dxda + dyda * dyda; -- odlen = dxod * dxod + dyod * dyod; -- /* Find the square of the length of the longest edge. */ -- maxlen = (dalen > oalen) ? dalen : oalen; -- maxlen = (odlen > maxlen) ? odlen : maxlen; -- -- if (maxlen > 0.05 * (triorg[0] * triorg[0] + triorg[1] * triorg[1]) + 0.02) { -- return 1; -- } else { -- return 0; -- } --} -- --#endif /* not EXTERNAL_TEST */ -- --/** **/ --/** **/ --/********* User-defined triangle evaluation routine ends here *********/ -- --/********* Memory allocation and program exit wrappers begin here *********/ --/** **/ --/** **/ -- --#ifdef ANSI_DECLARATORS --void triexit(int status) --#else /* not ANSI_DECLARATORS */ --void triexit(status) --int status; --#endif /* not ANSI_DECLARATORS */ -- --{ -- exit(status); --} -- --#ifdef ANSI_DECLARATORS --void *trimalloc(int size) --#else /* not ANSI_DECLARATORS */ --void *trimalloc(size) --int size; --#endif /* not ANSI_DECLARATORS */ -- --{ -- void *memptr; -- -- memptr = (void *) malloc((unsigned int) size); -- if (memptr == (void *) NULL) { -- printf("Error: Out of memory.\n"); -- triexit(1); -- } -- return(memptr); --} -- --#ifdef ANSI_DECLARATORS --void trifree(void *memptr) --#else /* not ANSI_DECLARATORS */ --void trifree(memptr) --void *memptr; --#endif /* not ANSI_DECLARATORS */ -- --{ -- free(memptr); --} -- --/** **/ --/** **/ --/********* Memory allocation and program exit wrappers end here *********/ -- --/********* User interaction routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* syntax() Print list of command line switches. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --void syntax() --{ --#ifdef CDT_ONLY --#ifdef REDUCED -- printf("triangle [-pAcjevngBPNEIOXzo_lQVh] input_file\n"); --#else /* not REDUCED */ -- printf("triangle [-pAcjevngBPNEIOXzo_iFlCQVh] input_file\n"); --#endif /* not REDUCED */ --#else /* not CDT_ONLY */ --#ifdef REDUCED -- printf("triangle [-prq__a__uAcDjevngBPNEIOXzo_YS__lQVh] input_file\n"); --#else /* not REDUCED */ -- printf("triangle [-prq__a__uAcDjevngBPNEIOXzo_YS__iFlsCQVh] input_file\n"); --#endif /* not REDUCED */ --#endif /* not CDT_ONLY */ -- -- printf(" -p Triangulates a Planar Straight Line Graph (.poly file).\n"); --#ifndef CDT_ONLY -- printf(" -r Refines a previously generated mesh.\n"); -- printf( -- " -q Quality mesh generation. A minimum angle may be specified.\n"); -- printf(" -a Applies a maximum triangle area constraint.\n"); -- printf(" -u Applies a user-defined triangle constraint.\n"); --#endif /* not CDT_ONLY */ -- printf( -- " -A Applies attributes to identify triangles in certain regions.\n"); -- printf(" -c Encloses the convex hull with segments.\n"); --#ifndef CDT_ONLY -- printf(" -D Conforming Delaunay: all triangles are truly Delaunay.\n"); --#endif /* not CDT_ONLY */ --/* -- printf(" -w Weighted Delaunay triangulation.\n"); -- printf(" -W Regular triangulation (lower hull of a height field).\n"); --*/ -- printf(" -j Jettison unused vertices from output .node file.\n"); -- printf(" -e Generates an edge list.\n"); -- printf(" -v Generates a Voronoi diagram.\n"); -- printf(" -n Generates a list of triangle neighbors.\n"); -- printf(" -g Generates an .off file for Geomview.\n"); -- printf(" -B Suppresses output of boundary information.\n"); -- printf(" -P Suppresses output of .poly file.\n"); -- printf(" -N Suppresses output of .node file.\n"); -- printf(" -E Suppresses output of .ele file.\n"); -- printf(" -I Suppresses mesh iteration numbers.\n"); -- printf(" -O Ignores holes in .poly file.\n"); -- printf(" -X Suppresses use of exact arithmetic.\n"); -- printf(" -z Numbers all items starting from zero (rather than one).\n"); -- printf(" -o2 Generates second-order subparametric elements.\n"); --#ifndef CDT_ONLY -- printf(" -Y Suppresses boundary segment splitting.\n"); -- printf(" -S Specifies maximum number of added Steiner points.\n"); --#endif /* not CDT_ONLY */ --#ifndef REDUCED -- printf(" -i Uses incremental method, rather than divide-and-conquer.\n"); -- printf(" -F Uses Fortune's sweepline algorithm, rather than d-and-c.\n"); --#endif /* not REDUCED */ -- printf(" -l Uses vertical cuts only, rather than alternating cuts.\n"); --#ifndef REDUCED --#ifndef CDT_ONLY -- printf( -- " -s Force segments into mesh by splitting (instead of using CDT).\n"); --#endif /* not CDT_ONLY */ -- printf(" -C Check consistency of final mesh.\n"); --#endif /* not REDUCED */ -- printf(" -Q Quiet: No terminal output except errors.\n"); -- printf(" -V Verbose: Detailed information on what I'm doing.\n"); -- printf(" -h Help: Detailed instructions for Triangle.\n"); -- triexit(0); --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* info() Print out complete instructions. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --void info() --{ -- printf("Triangle\n"); -- printf( --"A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator.\n"); -- printf("Version 1.6\n\n"); -- printf( --"Copyright 1993, 1995, 1997, 1998, 2002, 2005 Jonathan Richard Shewchuk\n"); -- printf("2360 Woolsey #H / Berkeley, California 94705-1927\n"); -- printf("Bugs/comments to jrs@cs.berkeley.edu\n"); -- printf( --"Created as part of the Quake project (tools for earthquake simulation).\n"); -- printf( --"Supported in part by NSF Grant CMS-9318163 and an NSERC 1967 Scholarship.\n"); -- printf("There is no warranty whatsoever. Use at your own risk.\n"); --#ifdef SINGLE -- printf("This executable is compiled for single precision arithmetic.\n\n\n"); --#else /* not SINGLE */ -- printf("This executable is compiled for double precision arithmetic.\n\n\n"); --#endif /* not SINGLE */ -- printf( --"Triangle generates exact Delaunay triangulations, constrained Delaunay\n"); -- printf( --"triangulations, conforming Delaunay triangulations, Voronoi diagrams, and\n"); -- printf( --"high-quality triangular meshes. The latter can be generated with no small\n" --); -- printf( --"or large angles, and are thus suitable for finite element analysis. If no\n" --); -- printf( --"command line switch is specified, your .node input file is read, and the\n"); -- printf( --"Delaunay triangulation is returned in .node and .ele output files. The\n"); -- printf("command syntax is:\n\n"); -- printf("triangle [-prq__a__uAcDjevngBPNEIOXzo_YS__iFlsCQVh] input_file\n\n"); -- printf( --"Underscores indicate that numbers may optionally follow certain switches.\n"); -- printf( --"Do not leave any space between a switch and its numeric parameter.\n"); -- printf( --"input_file must be a file with extension .node, or extension .poly if the\n"); -- printf( --"-p switch is used. If -r is used, you must supply .node and .ele files,\n"); -- printf( --"and possibly a .poly file and an .area file as well. The formats of these\n" --); -- printf("files are described below.\n\n"); -- printf("Command Line Switches:\n\n"); -- printf( --" -p Reads a Planar Straight Line Graph (.poly file), which can specify\n" --); -- printf( --" vertices, segments, holes, regional attributes, and regional area\n"); -- printf( --" constraints. Generates a constrained Delaunay triangulation (CDT)\n" --); -- printf( --" fitting the input; or, if -s, -q, -a, or -u is used, a conforming\n"); -- printf( --" constrained Delaunay triangulation (CCDT). If you want a truly\n"); -- printf( --" Delaunay (not just constrained Delaunay) triangulation, use -D as\n"); -- printf( --" well. When -p is not used, Triangle reads a .node file by default.\n" --); -- printf( --" -r Refines a previously generated mesh. The mesh is read from a .node\n" --); -- printf( --" file and an .ele file. If -p is also used, a .poly file is read\n"); -- printf( --" and used to constrain segments in the mesh. If -a is also used\n"); -- printf( --" (with no number following), an .area file is read and used to\n"); -- printf( --" impose area constraints on the mesh. Further details on refinement\n" --); -- printf(" appear below.\n"); -- printf( --" -q Quality mesh generation by Delaunay refinement (a hybrid of Paul\n"); -- printf( --" Chew's and Jim Ruppert's algorithms). Adds vertices to the mesh to\n" --); -- printf( --" ensure that all angles are between 20 and 140 degrees. An\n"); -- printf( --" alternative bound on the minimum angle, replacing 20 degrees, may\n"); -- printf( --" be specified after the `q'. The specified angle may include a\n"); -- printf( --" decimal point, but not exponential notation. Note that a bound of\n" --); -- printf( --" theta degrees on the smallest angle also implies a bound of\n"); -- printf( --" (180 - 2 theta) on the largest angle. If the minimum angle is 28.6\n" --); -- printf( --" degrees or smaller, Triangle is mathematically guaranteed to\n"); -- printf( --" terminate (assuming infinite precision arithmetic--Triangle may\n"); -- printf( --" fail to terminate if you run out of precision). In practice,\n"); -- printf( --" Triangle often succeeds for minimum angles up to 34 degrees. For\n"); -- printf( --" some meshes, however, you might need to reduce the minimum angle to\n" --); -- printf( --" avoid problems associated with insufficient floating-point\n"); -- printf(" precision.\n"); -- printf( --" -a Imposes a maximum triangle area. If a number follows the `a', no\n"); -- printf( --" triangle is generated whose area is larger than that number. If no\n" --); -- printf( --" number is specified, an .area file (if -r is used) or .poly file\n"); -- printf( --" (if -r is not used) specifies a set of maximum area constraints.\n"); -- printf( --" An .area file contains a separate area constraint for each\n"); -- printf( --" triangle, and is useful for refining a finite element mesh based on\n" --); -- printf( --" a posteriori error estimates. A .poly file can optionally contain\n" --); -- printf( --" an area constraint for each segment-bounded region, thereby\n"); -- printf( --" controlling triangle densities in a first triangulation of a PSLG.\n" --); -- printf( --" You can impose both a fixed area constraint and a varying area\n"); -- printf( --" constraint by invoking the -a switch twice, once with and once\n"); -- printf( --" without a number following. Each area specified may include a\n"); -- printf(" decimal point.\n"); -- printf( --" -u Imposes a user-defined constraint on triangle size. There are two\n" --); -- printf( --" ways to use this feature. One is to edit the triunsuitable()\n"); -- printf( --" procedure in triangle.c to encode any constraint you like, then\n"); -- printf( --" recompile Triangle. The other is to compile triangle.c with the\n"); -- printf( --" EXTERNAL_TEST symbol set (compiler switch -DEXTERNAL_TEST), then\n"); -- printf( --" link Triangle with a separate object file that implements\n"); -- printf( --" triunsuitable(). In either case, the -u switch causes the user-\n"); -- printf(" defined test to be applied to every triangle.\n"); -- printf( --" -A Assigns an additional floating-point attribute to each triangle\n"); -- printf( --" that identifies what segment-bounded region each triangle belongs\n"); -- printf( --" to. Attributes are assigned to regions by the .poly file. If a\n"); -- printf( --" region is not explicitly marked by the .poly file, triangles in\n"); -- printf( --" that region are assigned an attribute of zero. The -A switch has\n"); -- printf( --" an effect only when the -p switch is used and the -r switch is not.\n" --); -- printf( --" -c Creates segments on the convex hull of the triangulation. If you\n"); -- printf( --" are triangulating a vertex set, this switch causes a .poly file to\n" --); -- printf( --" be written, containing all edges of the convex hull. If you are\n"); -- printf( --" triangulating a PSLG, this switch specifies that the whole convex\n"); -- printf( --" hull of the PSLG should be triangulated, regardless of what\n"); -- printf( --" segments the PSLG has. If you do not use this switch when\n"); -- printf( --" triangulating a PSLG, Triangle assumes that you have identified the\n" --); -- printf( --" region to be triangulated by surrounding it with segments of the\n"); -- printf( --" input PSLG. Beware: if you are not careful, this switch can cause\n" --); -- printf( --" the introduction of an extremely thin angle between a PSLG segment\n" --); -- printf( --" and a convex hull segment, which can cause overrefinement (and\n"); -- printf( --" possibly failure if Triangle runs out of precision). If you are\n"); -- printf( --" refining a mesh, the -c switch works differently: it causes a\n"); -- printf( --" .poly file to be written containing the boundary edges of the mesh\n" --); -- printf(" (useful if no .poly file was read).\n"); -- printf( --" -D Conforming Delaunay triangulation: use this switch if you want to\n" --); -- printf( --" ensure that all the triangles in the mesh are Delaunay, and not\n"); -- printf( --" merely constrained Delaunay; or if you want to ensure that all the\n" --); -- printf( --" Voronoi vertices lie within the triangulation. (Some finite volume\n" --); -- printf( --" methods have this requirement.) This switch invokes Ruppert's\n"); -- printf( --" original algorithm, which splits every subsegment whose diametral\n"); -- printf( --" circle is encroached. It usually increases the number of vertices\n" --); -- printf(" and triangles.\n"); -- printf( --" -j Jettisons vertices that are not part of the final triangulation\n"); -- printf( --" from the output .node file. By default, Triangle copies all\n"); -- printf( --" vertices in the input .node file to the output .node file, in the\n"); -- printf( --" same order, so their indices do not change. The -j switch prevents\n" --); -- printf( --" duplicated input vertices, or vertices `eaten' by holes, from\n"); -- printf( --" appearing in the output .node file. Thus, if two input vertices\n"); -- printf( --" have exactly the same coordinates, only the first appears in the\n"); -- printf( --" output. If any vertices are jettisoned, the vertex numbering in\n"); -- printf( --" the output .node file differs from that of the input .node file.\n"); -- printf( --" -e Outputs (to an .edge file) a list of edges of the triangulation.\n"); -- printf( --" -v Outputs the Voronoi diagram associated with the triangulation.\n"); -- printf( --" Does not attempt to detect degeneracies, so some Voronoi vertices\n"); -- printf( --" may be duplicated. See the discussion of Voronoi diagrams below.\n"); -- printf( --" -n Outputs (to a .neigh file) a list of triangles neighboring each\n"); -- printf(" triangle.\n"); -- printf( --" -g Outputs the mesh to an Object File Format (.off) file, suitable for\n" --); -- printf(" viewing with the Geometry Center's Geomview package.\n"); -- printf( --" -B No boundary markers in the output .node, .poly, and .edge output\n"); -- printf( --" files. See the detailed discussion of boundary markers below.\n"); -- printf( --" -P No output .poly file. Saves disk space, but you lose the ability\n"); -- printf( --" to maintain constraining segments on later refinements of the mesh.\n" --); -- printf(" -N No output .node file.\n"); -- printf(" -E No output .ele file.\n"); -- printf( --" -I No iteration numbers. Suppresses the output of .node and .poly\n"); -- printf( --" files, so your input files won't be overwritten. (If your input is\n" --); -- printf( --" a .poly file only, a .node file is written.) Cannot be used with\n"); -- printf( --" the -r switch, because that would overwrite your input .ele file.\n"); -- printf( --" Shouldn't be used with the -q, -a, -u, or -s switch if you are\n"); -- printf( --" using a .node file for input, because no .node file is written, so\n" --); -- printf(" there is no record of any added Steiner points.\n"); -- printf(" -O No holes. Ignores the holes in the .poly file.\n"); -- printf( --" -X No exact arithmetic. Normally, Triangle uses exact floating-point\n" --); -- printf( --" arithmetic for certain tests if it thinks the inexact tests are not\n" --); -- printf( --" accurate enough. Exact arithmetic ensures the robustness of the\n"); -- printf( --" triangulation algorithms, despite floating-point roundoff error.\n"); -- printf( --" Disabling exact arithmetic with the -X switch causes a small\n"); -- printf( --" improvement in speed and creates the possibility that Triangle will\n" --); -- printf(" fail to produce a valid mesh. Not recommended.\n"); -- printf( --" -z Numbers all items starting from zero (rather than one). Note that\n" --); -- printf( --" this switch is normally overridden by the value used to number the\n" --); -- printf( --" first vertex of the input .node or .poly file. However, this\n"); -- printf( --" switch is useful when calling Triangle from another program.\n"); -- printf( --" -o2 Generates second-order subparametric elements with six nodes each.\n" --); -- printf( --" -Y No new vertices on the boundary. This switch is useful when the\n"); -- printf( --" mesh boundary must be preserved so that it conforms to some\n"); -- printf( --" adjacent mesh. Be forewarned that you will probably sacrifice much\n" --); -- printf( --" of the quality of the mesh; Triangle will try, but the resulting\n"); -- printf( --" mesh may contain poorly shaped triangles. Works well if all the\n"); -- printf( --" boundary vertices are closely spaced. Specify this switch twice\n"); -- printf( --" (`-YY') to prevent all segment splitting, including internal\n"); -- printf(" boundaries.\n"); -- printf( --" -S Specifies the maximum number of Steiner points (vertices that are\n"); -- printf( --" not in the input, but are added to meet the constraints on minimum\n" --); -- printf( --" angle and maximum area). The default is to allow an unlimited\n"); -- printf( --" number. If you specify this switch with no number after it,\n"); -- printf( --" the limit is set to zero. Triangle always adds vertices at segment\n" --); -- printf( --" intersections, even if it needs to use more vertices than the limit\n" --); -- printf( --" you set. When Triangle inserts segments by splitting (-s), it\n"); -- printf( --" always adds enough vertices to ensure that all the segments of the\n" --); -- printf(" PLSG are recovered, ignoring the limit if necessary.\n"); -- printf( --" -i Uses an incremental rather than a divide-and-conquer algorithm to\n"); -- printf( --" construct a Delaunay triangulation. Try it if the divide-and-\n"); -- printf(" conquer algorithm fails.\n"); -- printf( --" -F Uses Steven Fortune's sweepline algorithm to construct a Delaunay\n"); -- printf( --" triangulation. Warning: does not use exact arithmetic for all\n"); -- printf(" calculations. An exact result is not guaranteed.\n"); -- printf( --" -l Uses only vertical cuts in the divide-and-conquer algorithm. By\n"); -- printf( --" default, Triangle alternates between vertical and horizontal cuts,\n" --); -- printf( --" which usually improve the speed except with vertex sets that are\n"); -- printf( --" small or short and wide. This switch is primarily of theoretical\n"); -- printf(" interest.\n"); -- printf( --" -s Specifies that segments should be forced into the triangulation by\n" --); -- printf( --" recursively splitting them at their midpoints, rather than by\n"); -- printf( --" generating a constrained Delaunay triangulation. Segment splitting\n" --); -- printf( --" is true to Ruppert's original algorithm, but can create needlessly\n" --); -- printf( --" small triangles. This switch is primarily of theoretical interest.\n" --); -- printf( --" -C Check the consistency of the final mesh. Uses exact arithmetic for\n" --); -- printf( --" checking, even if the -X switch is used. Useful if you suspect\n"); -- printf(" Triangle is buggy.\n"); -- printf( --" -Q Quiet: Suppresses all explanation of what Triangle is doing,\n"); -- printf(" unless an error occurs.\n"); -- printf( --" -V Verbose: Gives detailed information about what Triangle is doing.\n" --); -- printf( --" Add more `V's for increasing amount of detail. `-V' is most\n"); -- printf( --" useful; itgives information on algorithmic progress and much more\n"); -- printf( --" detailed statistics. `-VV' gives vertex-by-vertex details, and\n"); -- printf( --" prints so much that Triangle runs much more slowly. `-VVVV' gives\n" --); -- printf(" information only a debugger could love.\n"); -- printf(" -h Help: Displays these instructions.\n"); -- printf("\n"); -- printf("Definitions:\n"); -- printf("\n"); -- printf( --" A Delaunay triangulation of a vertex set is a triangulation whose\n"); -- printf( --" vertices are the vertex set, that covers the convex hull of the vertex\n"); -- printf( --" set. A Delaunay triangulation has the property that no vertex lies\n"); -- printf( --" inside the circumscribing circle (circle that passes through all three\n"); -- printf(" vertices) of any triangle in the triangulation.\n\n"); -- printf( --" A Voronoi diagram of a vertex set is a subdivision of the plane into\n"); -- printf( --" polygonal cells (some of which may be unbounded, meaning infinitely\n"); -- printf( --" large), where each cell is the set of points in the plane that are closer\n" --); -- printf( --" to some input vertex than to any other input vertex. The Voronoi diagram\n" --); -- printf(" is a geometric dual of the Delaunay triangulation.\n\n"); -- printf( --" A Planar Straight Line Graph (PSLG) is a set of vertices and segments.\n"); -- printf( --" Segments are simply edges, whose endpoints are all vertices in the PSLG.\n" --); -- printf( --" Segments may intersect each other only at their endpoints. The file\n"); -- printf(" format for PSLGs (.poly files) is described below.\n\n"); -- printf( --" A constrained Delaunay triangulation (CDT) of a PSLG is similar to a\n"); -- printf( --" Delaunay triangulation, but each PSLG segment is present as a single edge\n" --); -- printf( --" of the CDT. (A constrained Delaunay triangulation is not truly a\n"); -- printf( --" Delaunay triangulation, because some of its triangles might not be\n"); -- printf( --" Delaunay.) By definition, a CDT does not have any vertices other than\n"); -- printf( --" those specified in the input PSLG. Depending on context, a CDT might\n"); -- printf( --" cover the convex hull of the PSLG, or it might cover only a segment-\n"); -- printf(" bounded region (e.g. a polygon).\n\n"); -- printf( --" A conforming Delaunay triangulation of a PSLG is a triangulation in which\n" --); -- printf( --" each triangle is truly Delaunay, and each PSLG segment is represented by\n" --); -- printf( --" a linear contiguous sequence of edges of the triangulation. New vertices\n" --); -- printf( --" (not part of the PSLG) may appear, and each input segment may have been\n"); -- printf( --" subdivided into shorter edges (subsegments) by these additional vertices.\n" --); -- printf( --" The new vertices are frequently necessary to maintain the Delaunay\n"); -- printf(" property while ensuring that every segment is represented.\n\n"); -- printf( --" A conforming constrained Delaunay triangulation (CCDT) of a PSLG is a\n"); -- printf( --" triangulation of a PSLG whose triangles are constrained Delaunay. New\n"); -- printf(" vertices may appear, and input segments may be subdivided into\n"); -- printf( --" subsegments, but not to guarantee that segments are respected; rather, to\n" --); -- printf( --" improve the quality of the triangles. The high-quality meshes produced\n"); -- printf( --" by the -q switch are usually CCDTs, but can be made conforming Delaunay\n"); -- printf(" with the -D switch.\n\n"); -- printf("File Formats:\n\n"); -- printf( --" All files may contain comments prefixed by the character '#'. Vertices,\n" --); -- printf( --" triangles, edges, holes, and maximum area constraints must be numbered\n"); -- printf( --" consecutively, starting from either 1 or 0. Whichever you choose, all\n"); -- printf( --" input files must be consistent; if the vertices are numbered from 1, so\n"); -- printf( --" must be all other objects. Triangle automatically detects your choice\n"); -- printf( --" while reading the .node (or .poly) file. (When calling Triangle from\n"); -- printf( --" another program, use the -z switch if you wish to number objects from\n"); -- printf(" zero.) Examples of these file formats are given below.\n\n"); -- printf(" .node files:\n"); -- printf( --" First line: <# of vertices> <# of attributes>\n" --); -- printf( --" <# of boundary markers (0 or 1)>\n" --); -- printf( --" Remaining lines: [attributes] [boundary marker]\n"); -- printf("\n"); -- printf( --" The attributes, which are typically floating-point values of physical\n"); -- printf( --" quantities (such as mass or conductivity) associated with the nodes of\n" --); -- printf( --" a finite element mesh, are copied unchanged to the output mesh. If -q,\n" --); -- printf( --" -a, -u, -D, or -s is selected, each new Steiner point added to the mesh\n" --); -- printf(" has attributes assigned to it by linear interpolation.\n\n"); -- printf( --" If the fourth entry of the first line is `1', the last column of the\n"); -- printf( --" remainder of the file is assumed to contain boundary markers. Boundary\n" --); -- printf( --" markers are used to identify boundary vertices and vertices resting on\n" --); -- printf( --" PSLG segments; a complete description appears in a section below. The\n" --); -- printf( --" .node file produced by Triangle contains boundary markers in the last\n"); -- printf(" column unless they are suppressed by the -B switch.\n\n"); -- printf(" .ele files:\n"); -- printf( --" First line: <# of triangles> <# of attributes>\n"); -- printf( --" Remaining lines: ... [attributes]\n"); -- printf("\n"); -- printf( --" Nodes are indices into the corresponding .node file. The first three\n"); -- printf( --" nodes are the corner vertices, and are listed in counterclockwise order\n" --); -- printf( --" around each triangle. (The remaining nodes, if any, depend on the type\n" --); -- printf(" of finite element used.)\n\n"); -- printf( --" The attributes are just like those of .node files. Because there is no\n" --); -- printf( --" simple mapping from input to output triangles, Triangle attempts to\n"); -- printf( --" interpolate attributes, and may cause a lot of diffusion of attributes\n" --); -- printf( --" among nearby triangles as the triangulation is refined. Attributes do\n" --); -- printf(" not diffuse across segments, so attributes used to identify\n"); -- printf(" segment-bounded regions remain intact.\n\n"); -- printf( --" In .ele files produced by Triangle, each triangular element has three\n"); -- printf( --" nodes (vertices) unless the -o2 switch is used, in which case\n"); -- printf( --" subparametric quadratic elements with six nodes each are generated.\n"); -- printf( --" The first three nodes are the corners in counterclockwise order, and\n"); -- printf( --" the fourth, fifth, and sixth nodes lie on the midpoints of the edges\n"); -- printf( --" opposite the first, second, and third vertices, respectively.\n"); -- printf("\n"); -- printf(" .poly files:\n"); -- printf( --" First line: <# of vertices> <# of attributes>\n" --); -- printf( --" <# of boundary markers (0 or 1)>\n" --); -- printf( --" Following lines: [attributes] [boundary marker]\n"); -- printf(" One line: <# of segments> <# of boundary markers (0 or 1)>\n"); -- printf( --" Following lines: [boundary marker]\n"); -- printf(" One line: <# of holes>\n"); -- printf(" Following lines: \n"); -- printf( --" Optional line: <# of regional attributes and/or area constraints>\n"); -- printf( --" Optional following lines: \n"); -- printf("\n"); -- printf( --" A .poly file represents a PSLG, as well as some additional information.\n" --); -- printf( --" The first section lists all the vertices, and is identical to the\n"); -- printf( --" format of .node files. <# of vertices> may be set to zero to indicate\n" --); -- printf( --" that the vertices are listed in a separate .node file; .poly files\n"); -- printf( --" produced by Triangle always have this format. A vertex set represented\n" --); -- printf( --" this way has the advantage that it may easily be triangulated with or\n"); -- printf( --" without segments (depending on whether the -p switch is invoked).\n"); -- printf("\n"); -- printf( --" The second section lists the segments. Segments are edges whose\n"); -- printf( --" presence in the triangulation is enforced. (Depending on the choice of\n" --); -- printf( --" switches, segment might be subdivided into smaller edges). Each\n"); -- printf( --" segment is specified by listing the indices of its two endpoints. This\n" --); -- printf( --" means that you must include its endpoints in the vertex list. Each\n"); -- printf(" segment, like each point, may have a boundary marker.\n\n"); -- printf( --" If -q, -a, -u, and -s are not selected, Triangle produces a constrained\n" --); -- printf( --" Delaunay triangulation (CDT), in which each segment appears as a single\n" --); -- printf( --" edge in the triangulation. If -q, -a, -u, or -s is selected, Triangle\n" --); -- printf( --" produces a conforming constrained Delaunay triangulation (CCDT), in\n"); -- printf( --" which segments may be subdivided into smaller edges. If -D is\n"); -- printf( --" selected, Triangle produces a conforming Delaunay triangulation, so\n"); -- printf( --" that every triangle is Delaunay, and not just constrained Delaunay.\n"); -- printf("\n"); -- printf( --" The third section lists holes (and concavities, if -c is selected) in\n"); -- printf( --" the triangulation. Holes are specified by identifying a point inside\n"); -- printf( --" each hole. After the triangulation is formed, Triangle creates holes\n"); -- printf( --" by eating triangles, spreading out from each hole point until its\n"); -- printf( --" progress is blocked by segments in the PSLG. You must be careful to\n"); -- printf( --" enclose each hole in segments, or your whole triangulation might be\n"); -- printf( --" eaten away. If the two triangles abutting a segment are eaten, the\n"); -- printf( --" segment itself is also eaten. Do not place a hole directly on a\n"); -- printf(" segment; if you do, Triangle chooses one side of the segment\n"); -- printf(" arbitrarily.\n\n"); -- printf( --" The optional fourth section lists regional attributes (to be assigned\n"); -- printf( --" to all triangles in a region) and regional constraints on the maximum\n"); -- printf( --" triangle area. Triangle reads this section only if the -A switch is\n"); -- printf( --" used or the -a switch is used without a number following it, and the -r\n" --); -- printf( --" switch is not used. Regional attributes and area constraints are\n"); -- printf( --" propagated in the same manner as holes: you specify a point for each\n"); -- printf( --" attribute and/or constraint, and the attribute and/or constraint\n"); -- printf( --" affects the whole region (bounded by segments) containing the point.\n"); -- printf( --" If two values are written on a line after the x and y coordinate, the\n"); -- printf( --" first such value is assumed to be a regional attribute (but is only\n"); -- printf( --" applied if the -A switch is selected), and the second value is assumed\n" --); -- printf( --" to be a regional area constraint (but is only applied if the -a switch\n" --); -- printf( --" is selected). You may specify just one value after the coordinates,\n"); -- printf( --" which can serve as both an attribute and an area constraint, depending\n" --); -- printf( --" on the choice of switches. If you are using the -A and -a switches\n"); -- printf( --" simultaneously and wish to assign an attribute to some region without\n"); -- printf(" imposing an area constraint, use a negative maximum area.\n\n"); -- printf( --" When a triangulation is created from a .poly file, you must either\n"); -- printf( --" enclose the entire region to be triangulated in PSLG segments, or\n"); -- printf( --" use the -c switch, which automatically creates extra segments that\n"); -- printf( --" enclose the convex hull of the PSLG. If you do not use the -c switch,\n" --); -- printf( --" Triangle eats all triangles that are not enclosed by segments; if you\n"); -- printf( --" are not careful, your whole triangulation may be eaten away. If you do\n" --); -- printf( --" use the -c switch, you can still produce concavities by the appropriate\n" --); -- printf( --" placement of holes just inside the boundary of the convex hull.\n"); -- printf("\n"); -- printf( --" An ideal PSLG has no intersecting segments, nor any vertices that lie\n"); -- printf( --" upon segments (except, of course, the endpoints of each segment). You\n" --); -- printf( --" aren't required to make your .poly files ideal, but you should be aware\n" --); -- printf( --" of what can go wrong. Segment intersections are relatively safe--\n"); -- printf( --" Triangle calculates the intersection points for you and adds them to\n"); -- printf( --" the triangulation--as long as your machine's floating-point precision\n"); -- printf( --" doesn't become a problem. You are tempting the fates if you have three\n" --); -- printf( --" segments that cross at the same location, and expect Triangle to figure\n" --); -- printf( --" out where the intersection point is. Thanks to floating-point roundoff\n" --); -- printf( --" error, Triangle will probably decide that the three segments intersect\n" --); -- printf( --" at three different points, and you will find a minuscule triangle in\n"); -- printf( --" your output--unless Triangle tries to refine the tiny triangle, uses\n"); -- printf( --" up the last bit of machine precision, and fails to terminate at all.\n"); -- printf( --" You're better off putting the intersection point in the input files,\n"); -- printf( --" and manually breaking up each segment into two. Similarly, if you\n"); -- printf( --" place a vertex at the middle of a segment, and hope that Triangle will\n" --); -- printf( --" break up the segment at that vertex, you might get lucky. On the other\n" --); -- printf( --" hand, Triangle might decide that the vertex doesn't lie precisely on\n"); -- printf( --" the segment, and you'll have a needle-sharp triangle in your output--or\n" --); -- printf(" a lot of tiny triangles if you're generating a quality mesh.\n"); -- printf("\n"); -- printf( --" When Triangle reads a .poly file, it also writes a .poly file, which\n"); -- printf( --" includes all the subsegments--the edges that are parts of input\n"); -- printf( --" segments. If the -c switch is used, the output .poly file also\n"); -- printf( --" includes all of the edges on the convex hull. Hence, the output .poly\n" --); -- printf( --" file is useful for finding edges associated with input segments and for\n" --); -- printf( --" setting boundary conditions in finite element simulations. Moreover,\n"); -- printf( --" you will need the output .poly file if you plan to refine the output\n"); -- printf( --" mesh, and don't want segments to be missing in later triangulations.\n"); -- printf("\n"); -- printf(" .area files:\n"); -- printf(" First line: <# of triangles>\n"); -- printf(" Following lines: \n"); -- printf("\n"); -- printf( --" An .area file associates with each triangle a maximum area that is used\n" --); -- printf( --" for mesh refinement. As with other file formats, every triangle must\n"); -- printf( --" be represented, and the triangles must be numbered consecutively. A\n"); -- printf( --" triangle may be left unconstrained by assigning it a negative maximum\n"); -- printf(" area.\n\n"); -- printf(" .edge files:\n"); -- printf(" First line: <# of edges> <# of boundary markers (0 or 1)>\n"); -- printf( --" Following lines: [boundary marker]\n"); -- printf("\n"); -- printf( --" Endpoints are indices into the corresponding .node file. Triangle can\n" --); -- printf( --" produce .edge files (use the -e switch), but cannot read them. The\n"); -- printf( --" optional column of boundary markers is suppressed by the -B switch.\n"); -- printf("\n"); -- printf( --" In Voronoi diagrams, one also finds a special kind of edge that is an\n"); -- printf( --" infinite ray with only one endpoint. For these edges, a different\n"); -- printf(" format is used:\n\n"); -- printf(" -1 \n\n"); -- printf( --" The `direction' is a floating-point vector that indicates the direction\n" --); -- printf(" of the infinite ray.\n\n"); -- printf(" .neigh files:\n"); -- printf( --" First line: <# of triangles> <# of neighbors per triangle (always 3)>\n" --); -- printf( --" Following lines: \n"); -- printf("\n"); -- printf( --" Neighbors are indices into the corresponding .ele file. An index of -1\n" --); -- printf( --" indicates no neighbor (because the triangle is on an exterior\n"); -- printf( --" boundary). The first neighbor of triangle i is opposite the first\n"); -- printf(" corner of triangle i, and so on.\n\n"); -- printf( --" Triangle can produce .neigh files (use the -n switch), but cannot read\n" --); -- printf(" them.\n\n"); -- printf("Boundary Markers:\n\n"); -- printf( --" Boundary markers are tags used mainly to identify which output vertices\n"); -- printf( --" and edges are associated with which PSLG segment, and to identify which\n"); -- printf( --" vertices and edges occur on a boundary of the triangulation. A common\n"); -- printf( --" use is to determine where boundary conditions should be applied to a\n"); -- printf( --" finite element mesh. You can prevent boundary markers from being written\n" --); -- printf(" into files produced by Triangle by using the -B switch.\n\n"); -- printf( --" The boundary marker associated with each segment in an output .poly file\n" --); -- printf(" and each edge in an output .edge file is chosen as follows:\n"); -- printf( --" - If an output edge is part or all of a PSLG segment with a nonzero\n"); -- printf( --" boundary marker, then the edge is assigned the same marker.\n"); -- printf( --" - Otherwise, if the edge lies on a boundary of the triangulation\n"); -- printf( --" (even the boundary of a hole), then the edge is assigned the marker\n"); -- printf(" one (1).\n"); -- printf(" - Otherwise, the edge is assigned the marker zero (0).\n"); -- printf( --" The boundary marker associated with each vertex in an output .node file\n"); -- printf(" is chosen as follows:\n"); -- printf( --" - If a vertex is assigned a nonzero boundary marker in the input file,\n" --); -- printf( --" then it is assigned the same marker in the output .node file.\n"); -- printf( --" - Otherwise, if the vertex lies on a PSLG segment (even if it is an\n"); -- printf( --" endpoint of the segment) with a nonzero boundary marker, then the\n"); -- printf( --" vertex is assigned the same marker. If the vertex lies on several\n"); -- printf(" such segments, one of the markers is chosen arbitrarily.\n"); -- printf( --" - Otherwise, if the vertex occurs on a boundary of the triangulation,\n"); -- printf(" then the vertex is assigned the marker one (1).\n"); -- printf(" - Otherwise, the vertex is assigned the marker zero (0).\n"); -- printf("\n"); -- printf( --" If you want Triangle to determine for you which vertices and edges are on\n" --); -- printf( --" the boundary, assign them the boundary marker zero (or use no markers at\n" --); -- printf( --" all) in your input files. In the output files, all boundary vertices,\n"); -- printf(" edges, and segments will be assigned the value one.\n\n"); -- printf("Triangulation Iteration Numbers:\n\n"); -- printf( --" Because Triangle can read and refine its own triangulations, input\n"); -- printf( --" and output files have iteration numbers. For instance, Triangle might\n"); -- printf( --" read the files mesh.3.node, mesh.3.ele, and mesh.3.poly, refine the\n"); -- printf( --" triangulation, and output the files mesh.4.node, mesh.4.ele, and\n"); -- printf(" mesh.4.poly. Files with no iteration number are treated as if\n"); -- printf( --" their iteration number is zero; hence, Triangle might read the file\n"); -- printf( --" points.node, triangulate it, and produce the files points.1.node and\n"); -- printf(" points.1.ele.\n\n"); -- printf( --" Iteration numbers allow you to create a sequence of successively finer\n"); -- printf( --" meshes suitable for multigrid methods. They also allow you to produce a\n" --); -- printf( --" sequence of meshes using error estimate-driven mesh refinement.\n"); -- printf("\n"); -- printf( --" If you're not using refinement or quality meshing, and you don't like\n"); -- printf( --" iteration numbers, use the -I switch to disable them. This switch also\n"); -- printf( --" disables output of .node and .poly files to prevent your input files from\n" --); -- printf( --" being overwritten. (If the input is a .poly file that contains its own\n"); -- printf( --" points, a .node file is written. This can be quite convenient for\n"); -- printf(" computing CDTs or quality meshes.)\n\n"); -- printf("Examples of How to Use Triangle:\n\n"); -- printf( --" `triangle dots' reads vertices from dots.node, and writes their Delaunay\n" --); -- printf( --" triangulation to dots.1.node and dots.1.ele. (dots.1.node is identical\n"); -- printf( --" to dots.node.) `triangle -I dots' writes the triangulation to dots.ele\n"); -- printf( --" instead. (No additional .node file is needed, so none is written.)\n"); -- printf("\n"); -- printf( --" `triangle -pe object.1' reads a PSLG from object.1.poly (and possibly\n"); -- printf( --" object.1.node, if the vertices are omitted from object.1.poly) and writes\n" --); -- printf( --" its constrained Delaunay triangulation to object.2.node and object.2.ele.\n" --); -- printf( --" The segments are copied to object.2.poly, and all edges are written to\n"); -- printf(" object.2.edge.\n\n"); -- printf( --" `triangle -pq31.5a.1 object' reads a PSLG from object.poly (and possibly\n" --); -- printf( --" object.node), generates a mesh whose angles are all between 31.5 and 117\n" --); -- printf( --" degrees and whose triangles all have areas of 0.1 or less, and writes the\n" --); -- printf( --" mesh to object.1.node and object.1.ele. Each segment may be broken up\n"); -- printf(" into multiple subsegments; these are written to object.1.poly.\n"); -- printf("\n"); -- printf( --" Here is a sample file `box.poly' describing a square with a square hole:\n" --); -- printf("\n"); -- printf( --" # A box with eight vertices in 2D, no attributes, one boundary marker.\n" --); -- printf(" 8 2 0 1\n"); -- printf(" # Outer box has these vertices:\n"); -- printf(" 1 0 0 0\n"); -- printf(" 2 0 3 0\n"); -- printf(" 3 3 0 0\n"); -- printf(" 4 3 3 33 # A special marker for this vertex.\n"); -- printf(" # Inner square has these vertices:\n"); -- printf(" 5 1 1 0\n"); -- printf(" 6 1 2 0\n"); -- printf(" 7 2 1 0\n"); -- printf(" 8 2 2 0\n"); -- printf(" # Five segments with boundary markers.\n"); -- printf(" 5 1\n"); -- printf(" 1 1 2 5 # Left side of outer box.\n"); -- printf(" # Square hole has these segments:\n"); -- printf(" 2 5 7 0\n"); -- printf(" 3 7 8 0\n"); -- printf(" 4 8 6 10\n"); -- printf(" 5 6 5 0\n"); -- printf(" # One hole in the middle of the inner square.\n"); -- printf(" 1\n"); -- printf(" 1 1.5 1.5\n"); -- printf("\n"); -- printf( --" Note that some segments are missing from the outer square, so you must\n"); -- printf( --" use the `-c' switch. After `triangle -pqc box.poly', here is the output\n" --); -- printf( --" file `box.1.node', with twelve vertices. The last four vertices were\n"); -- printf( --" added to meet the angle constraint. Vertices 1, 2, and 9 have markers\n"); -- printf( --" from segment 1. Vertices 6 and 8 have markers from segment 4. All the\n"); -- printf( --" other vertices but 4 have been marked to indicate that they lie on a\n"); -- printf(" boundary.\n\n"); -- printf(" 12 2 0 1\n"); -- printf(" 1 0 0 5\n"); -- printf(" 2 0 3 5\n"); -- printf(" 3 3 0 1\n"); -- printf(" 4 3 3 33\n"); -- printf(" 5 1 1 1\n"); -- printf(" 6 1 2 10\n"); -- printf(" 7 2 1 1\n"); -- printf(" 8 2 2 10\n"); -- printf(" 9 0 1.5 5\n"); -- printf(" 10 1.5 0 1\n"); -- printf(" 11 3 1.5 1\n"); -- printf(" 12 1.5 3 1\n"); -- printf(" # Generated by triangle -pqc box.poly\n"); -- printf("\n"); -- printf(" Here is the output file `box.1.ele', with twelve triangles.\n"); -- printf("\n"); -- printf(" 12 3 0\n"); -- printf(" 1 5 6 9\n"); -- printf(" 2 10 3 7\n"); -- printf(" 3 6 8 12\n"); -- printf(" 4 9 1 5\n"); -- printf(" 5 6 2 9\n"); -- printf(" 6 7 3 11\n"); -- printf(" 7 11 4 8\n"); -- printf(" 8 7 5 10\n"); -- printf(" 9 12 2 6\n"); -- printf(" 10 8 7 11\n"); -- printf(" 11 5 1 10\n"); -- printf(" 12 8 4 12\n"); -- printf(" # Generated by triangle -pqc box.poly\n\n"); -- printf( --" Here is the output file `box.1.poly'. Note that segments have been added\n" --); -- printf( --" to represent the convex hull, and some segments have been subdivided by\n"); -- printf( --" newly added vertices. Note also that <# of vertices> is set to zero to\n"); -- printf(" indicate that the vertices should be read from the .node file.\n"); -- printf("\n"); -- printf(" 0 2 0 1\n"); -- printf(" 12 1\n"); -- printf(" 1 1 9 5\n"); -- printf(" 2 5 7 1\n"); -- printf(" 3 8 7 1\n"); -- printf(" 4 6 8 10\n"); -- printf(" 5 5 6 1\n"); -- printf(" 6 3 10 1\n"); -- printf(" 7 4 11 1\n"); -- printf(" 8 2 12 1\n"); -- printf(" 9 9 2 5\n"); -- printf(" 10 10 1 1\n"); -- printf(" 11 11 3 1\n"); -- printf(" 12 12 4 1\n"); -- printf(" 1\n"); -- printf(" 1 1.5 1.5\n"); -- printf(" # Generated by triangle -pqc box.poly\n"); -- printf("\n"); -- printf("Refinement and Area Constraints:\n"); -- printf("\n"); -- printf( --" The -r switch causes a mesh (.node and .ele files) to be read and\n"); -- printf( --" refined. If the -p switch is also used, a .poly file is read and used to\n" --); -- printf( --" specify edges that are constrained and cannot be eliminated (although\n"); -- printf( --" they can be subdivided into smaller edges) by the refinement process.\n"); -- printf("\n"); -- printf( --" When you refine a mesh, you generally want to impose tighter constraints.\n" --); -- printf( --" One way to accomplish this is to use -q with a larger angle, or -a\n"); -- printf( --" followed by a smaller area than you used to generate the mesh you are\n"); -- printf( --" refining. Another way to do this is to create an .area file, which\n"); -- printf( --" specifies a maximum area for each triangle, and use the -a switch\n"); -- printf( --" (without a number following). Each triangle's area constraint is applied\n" --); -- printf( --" to that triangle. Area constraints tend to diffuse as the mesh is\n"); -- printf( --" refined, so if there are large variations in area constraint between\n"); -- printf( --" adjacent triangles, you may not get the results you want. In that case,\n" --); -- printf( --" consider instead using the -u switch and writing a C procedure that\n"); -- printf(" determines which triangles are too large.\n\n"); -- printf( --" If you are refining a mesh composed of linear (three-node) elements, the\n" --); -- printf( --" output mesh contains all the nodes present in the input mesh, in the same\n" --); -- printf( --" order, with new nodes added at the end of the .node file. However, the\n"); -- printf( --" refinement is not hierarchical: there is no guarantee that each output\n"); -- printf( --" element is contained in a single input element. Often, an output element\n" --); -- printf( --" can overlap two or three input elements, and some input edges are not\n"); -- printf( --" present in the output mesh. Hence, a sequence of refined meshes forms a\n" --); -- printf( --" hierarchy of nodes, but not a hierarchy of elements. If you refine a\n"); -- printf( --" mesh of higher-order elements, the hierarchical property applies only to\n" --); -- printf( --" the nodes at the corners of an element; the midpoint nodes on each edge\n"); -- printf(" are discarded before the mesh is refined.\n\n"); -- printf( --" Maximum area constraints in .poly files operate differently from those in\n" --); -- printf( --" .area files. A maximum area in a .poly file applies to the whole\n"); -- printf( --" (segment-bounded) region in which a point falls, whereas a maximum area\n"); -- printf( --" in an .area file applies to only one triangle. Area constraints in .poly\n" --); -- printf( --" files are used only when a mesh is first generated, whereas area\n"); -- printf( --" constraints in .area files are used only to refine an existing mesh, and\n" --); -- printf( --" are typically based on a posteriori error estimates resulting from a\n"); -- printf(" finite element simulation on that mesh.\n\n"); -- printf( --" `triangle -rq25 object.1' reads object.1.node and object.1.ele, then\n"); -- printf( --" refines the triangulation to enforce a 25 degree minimum angle, and then\n" --); -- printf( --" writes the refined triangulation to object.2.node and object.2.ele.\n"); -- printf("\n"); -- printf( --" `triangle -rpaa6.2 z.3' reads z.3.node, z.3.ele, z.3.poly, and z.3.area.\n" --); -- printf( --" After reconstructing the mesh and its subsegments, Triangle refines the\n"); -- printf( --" mesh so that no triangle has area greater than 6.2, and furthermore the\n"); -- printf( --" triangles satisfy the maximum area constraints in z.3.area. No angle\n"); -- printf( --" bound is imposed at all. The output is written to z.4.node, z.4.ele, and\n" --); -- printf(" z.4.poly.\n\n"); -- printf( --" The sequence `triangle -qa1 x', `triangle -rqa.3 x.1', `triangle -rqa.1\n"); -- printf( --" x.2' creates a sequence of successively finer meshes x.1, x.2, and x.3,\n"); -- printf(" suitable for multigrid.\n\n"); -- printf("Convex Hulls and Mesh Boundaries:\n\n"); -- printf( --" If the input is a vertex set (not a PSLG), Triangle produces its convex\n"); -- printf( --" hull as a by-product in the output .poly file if you use the -c switch.\n"); -- printf( --" There are faster algorithms for finding a two-dimensional convex hull\n"); -- printf(" than triangulation, of course, but this one comes for free.\n\n"); -- printf( --" If the input is an unconstrained mesh (you are using the -r switch but\n"); -- printf( --" not the -p switch), Triangle produces a list of its boundary edges\n"); -- printf( --" (including hole boundaries) as a by-product when you use the -c switch.\n"); -- printf( --" If you also use the -p switch, the output .poly file contains all the\n"); -- printf(" segments from the input .poly file as well.\n\n"); -- printf("Voronoi Diagrams:\n\n"); -- printf( --" The -v switch produces a Voronoi diagram, in files suffixed .v.node and\n"); -- printf( --" .v.edge. For example, `triangle -v points' reads points.node, produces\n"); -- printf( --" its Delaunay triangulation in points.1.node and points.1.ele, and\n"); -- printf( --" produces its Voronoi diagram in points.1.v.node and points.1.v.edge. The\n" --); -- printf( --" .v.node file contains a list of all Voronoi vertices, and the .v.edge\n"); -- printf( --" file contains a list of all Voronoi edges, some of which may be infinite\n" --); -- printf( --" rays. (The choice of filenames makes it easy to run the set of Voronoi\n"); -- printf(" vertices through Triangle, if so desired.)\n\n"); -- printf( --" This implementation does not use exact arithmetic to compute the Voronoi\n" --); -- printf( --" vertices, and does not check whether neighboring vertices are identical.\n" --); -- printf( --" Be forewarned that if the Delaunay triangulation is degenerate or\n"); -- printf( --" near-degenerate, the Voronoi diagram may have duplicate vertices or\n"); -- printf(" crossing edges.\n\n"); -- printf( --" The result is a valid Voronoi diagram only if Triangle's output is a true\n" --); -- printf( --" Delaunay triangulation. The Voronoi output is usually meaningless (and\n"); -- printf( --" may contain crossing edges and other pathology) if the output is a CDT or\n" --); -- printf( --" CCDT, or if it has holes or concavities. If the triangulated domain is\n"); -- printf( --" convex and has no holes, you can use -D switch to force Triangle to\n"); -- printf( --" construct a conforming Delaunay triangulation instead of a CCDT, so the\n"); -- printf(" Voronoi diagram will be valid.\n\n"); -- printf("Mesh Topology:\n\n"); -- printf( --" You may wish to know which triangles are adjacent to a certain Delaunay\n"); -- printf( --" edge in an .edge file, which Voronoi cells are adjacent to a certain\n"); -- printf( --" Voronoi edge in a .v.edge file, or which Voronoi cells are adjacent to\n"); -- printf( --" each other. All of this information can be found by cross-referencing\n"); -- printf( --" output files with the recollection that the Delaunay triangulation and\n"); -- printf(" the Voronoi diagram are planar duals.\n\n"); -- printf( --" Specifically, edge i of an .edge file is the dual of Voronoi edge i of\n"); -- printf( --" the corresponding .v.edge file, and is rotated 90 degrees counterclock-\n"); -- printf( --" wise from the Voronoi edge. Triangle j of an .ele file is the dual of\n"); -- printf( --" vertex j of the corresponding .v.node file. Voronoi cell k is the dual\n"); -- printf(" of vertex k of the corresponding .node file.\n\n"); -- printf( --" Hence, to find the triangles adjacent to a Delaunay edge, look at the\n"); -- printf( --" vertices of the corresponding Voronoi edge. If the endpoints of a\n"); -- printf( --" Voronoi edge are Voronoi vertices 2 and 6 respectively, then triangles 2\n" --); -- printf( --" and 6 adjoin the left and right sides of the corresponding Delaunay edge,\n" --); -- printf( --" respectively. To find the Voronoi cells adjacent to a Voronoi edge, look\n" --); -- printf( --" at the endpoints of the corresponding Delaunay edge. If the endpoints of\n" --); -- printf( --" a Delaunay edge are input vertices 7 and 12, then Voronoi cells 7 and 12\n" --); -- printf( --" adjoin the right and left sides of the corresponding Voronoi edge,\n"); -- printf( --" respectively. To find which Voronoi cells are adjacent to each other,\n"); -- printf(" just read the list of Delaunay edges.\n\n"); -- printf( --" Triangle does not write a list of the edges adjoining each Voronoi cell,\n" --); -- printf( --" but you can reconstructed it straightforwardly. For instance, to find\n"); -- printf( --" all the edges of Voronoi cell 1, search the output .edge file for every\n"); -- printf( --" edge that has input vertex 1 as an endpoint. The corresponding dual\n"); -- printf( --" edges in the output .v.edge file form the boundary of Voronoi cell 1.\n"); -- printf("\n"); -- printf( --" For each Voronoi vertex, the .neigh file gives a list of the three\n"); -- printf( --" Voronoi vertices attached to it. You might find this more convenient\n"); -- printf(" than the .v.edge file.\n\n"); -- printf("Quadratic Elements:\n\n"); -- printf( --" Triangle generates meshes with subparametric quadratic elements if the\n"); -- printf( --" -o2 switch is specified. Quadratic elements have six nodes per element,\n" --); -- printf( --" rather than three. `Subparametric' means that the edges of the triangles\n" --); -- printf( --" are always straight, so that subparametric quadratic elements are\n"); -- printf( --" geometrically identical to linear elements, even though they can be used\n" --); -- printf( --" with quadratic interpolating functions. The three extra nodes of an\n"); -- printf( --" element fall at the midpoints of the three edges, with the fourth, fifth,\n" --); -- printf( --" and sixth nodes appearing opposite the first, second, and third corners\n"); -- printf(" respectively.\n\n"); -- printf("Domains with Small Angles:\n\n"); -- printf( --" If two input segments adjoin each other at a small angle, clearly the -q\n" --); -- printf( --" switch cannot remove the small angle. Moreover, Triangle may have no\n"); -- printf( --" choice but to generate additional triangles whose smallest angles are\n"); -- printf( --" smaller than the specified bound. However, these triangles only appear\n"); -- printf( --" between input segments separated by small angles. Moreover, if you\n"); -- printf( --" request a minimum angle of theta degrees, Triangle will generally produce\n" --); -- printf( --" no angle larger than 180 - 2 theta, even if it is forced to compromise on\n" --); -- printf(" the minimum angle.\n\n"); -- printf("Statistics:\n\n"); -- printf( --" After generating a mesh, Triangle prints a count of entities in the\n"); -- printf( --" output mesh, including the number of vertices, triangles, edges, exterior\n" --); -- printf( --" boundary edges (i.e. subsegments on the boundary of the triangulation,\n"); -- printf( --" including hole boundaries), interior boundary edges (i.e. subsegments of\n" --); -- printf( --" input segments not on the boundary), and total subsegments. If you've\n"); -- printf( --" forgotten the statistics for an existing mesh, run Triangle on that mesh\n" --); -- printf( --" with the -rNEP switches to read the mesh and print the statistics without\n" --); -- printf( --" writing any files. Use -rpNEP if you've got a .poly file for the mesh.\n"); -- printf("\n"); -- printf( --" The -V switch produces extended statistics, including a rough estimate\n"); -- printf( --" of memory use, the number of calls to geometric predicates, and\n"); -- printf( --" histograms of the angles and the aspect ratios of the triangles in the\n"); -- printf(" mesh.\n\n"); -- printf("Exact Arithmetic:\n\n"); -- printf( --" Triangle uses adaptive exact arithmetic to perform what computational\n"); -- printf( --" geometers call the `orientation' and `incircle' tests. If the floating-\n" --); -- printf( --" point arithmetic of your machine conforms to the IEEE 754 standard (as\n"); -- printf( --" most workstations do), and does not use extended precision internal\n"); -- printf( --" floating-point registers, then your output is guaranteed to be an\n"); -- printf( --" absolutely true Delaunay or constrained Delaunay triangulation, roundoff\n" --); -- printf( --" error notwithstanding. The word `adaptive' implies that these arithmetic\n" --); -- printf( --" routines compute the result only to the precision necessary to guarantee\n" --); -- printf( --" correctness, so they are usually nearly as fast as their approximate\n"); -- printf(" counterparts.\n\n"); -- printf( --" May CPUs, including Intel x86 processors, have extended precision\n"); -- printf( --" floating-point registers. These must be reconfigured so their precision\n" --); -- printf( --" is reduced to memory precision. Triangle does this if it is compiled\n"); -- printf(" correctly. See the makefile for details.\n\n"); -- printf( --" The exact tests can be disabled with the -X switch. On most inputs, this\n" --); -- printf( --" switch reduces the computation time by about eight percent--it's not\n"); -- printf( --" worth the risk. There are rare difficult inputs (having many collinear\n"); -- printf( --" and cocircular vertices), however, for which the difference in speed\n"); -- printf( --" could be a factor of two. Be forewarned that these are precisely the\n"); -- printf( --" inputs most likely to cause errors if you use the -X switch. Hence, the\n" --); -- printf(" -X switch is not recommended.\n\n"); -- printf( --" Unfortunately, the exact tests don't solve every numerical problem.\n"); -- printf( --" Exact arithmetic is not used to compute the positions of new vertices,\n"); -- printf( --" because the bit complexity of vertex coordinates would grow without\n"); -- printf( --" bound. Hence, segment intersections aren't computed exactly; in very\n"); -- printf( --" unusual cases, roundoff error in computing an intersection point might\n"); -- printf( --" actually lead to an inverted triangle and an invalid triangulation.\n"); -- printf( --" (This is one reason to specify your own intersection points in your .poly\n" --); -- printf( --" files.) Similarly, exact arithmetic is not used to compute the vertices\n" --); -- printf(" of the Voronoi diagram.\n\n"); -- printf( --" Another pair of problems not solved by the exact arithmetic routines is\n"); -- printf( --" underflow and overflow. If Triangle is compiled for double precision\n"); -- printf( --" arithmetic, I believe that Triangle's geometric predicates work correctly\n" --); -- printf( --" if the exponent of every input coordinate falls in the range [-148, 201].\n" --); -- printf( --" Underflow can silently prevent the orientation and incircle tests from\n"); -- printf( --" being performed exactly, while overflow typically causes a floating\n"); -- printf(" exception.\n\n"); -- printf("Calling Triangle from Another Program:\n\n"); -- printf(" Read the file triangle.h for details.\n\n"); -- printf("Troubleshooting:\n\n"); -- printf(" Please read this section before mailing me bugs.\n\n"); -- printf(" `My output mesh has no triangles!'\n\n"); -- printf( --" If you're using a PSLG, you've probably failed to specify a proper set\n" --); -- printf( --" of bounding segments, or forgotten to use the -c switch. Or you may\n"); -- printf( --" have placed a hole badly, thereby eating all your triangles. To test\n"); -- printf(" these possibilities, try again with the -c and -O switches.\n"); -- printf( --" Alternatively, all your input vertices may be collinear, in which case\n" --); -- printf(" you can hardly expect to triangulate them.\n\n"); -- printf(" `Triangle doesn't terminate, or just crashes.'\n\n"); -- printf( --" Bad things can happen when triangles get so small that the distance\n"); -- printf( --" between their vertices isn't much larger than the precision of your\n"); -- printf( --" machine's arithmetic. If you've compiled Triangle for single-precision\n" --); -- printf( --" arithmetic, you might do better by recompiling it for double-precision.\n" --); -- printf( --" Then again, you might just have to settle for more lenient constraints\n" --); -- printf( --" on the minimum angle and the maximum area than you had planned.\n"); -- printf("\n"); -- printf( --" You can minimize precision problems by ensuring that the origin lies\n"); -- printf( --" inside your vertex set, or even inside the densest part of your\n"); -- printf( --" mesh. If you're triangulating an object whose x-coordinates all fall\n"); -- printf( --" between 6247133 and 6247134, you're not leaving much floating-point\n"); -- printf(" precision for Triangle to work with.\n\n"); -- printf( --" Precision problems can occur covertly if the input PSLG contains two\n"); -- printf( --" segments that meet (or intersect) at an extremely small angle, or if\n"); -- printf( --" such an angle is introduced by the -c switch. If you don't realize\n"); -- printf( --" that a tiny angle is being formed, you might never discover why\n"); -- printf( --" Triangle is crashing. To check for this possibility, use the -S switch\n" --); -- printf( --" (with an appropriate limit on the number of Steiner points, found by\n"); -- printf( --" trial-and-error) to stop Triangle early, and view the output .poly file\n" --); -- printf( --" with Show Me (described below). Look carefully for regions where dense\n" --); -- printf( --" clusters of vertices are forming and for small angles between segments.\n" --); -- printf( --" Zoom in closely, as such segments might look like a single segment from\n" --); -- printf(" a distance.\n\n"); -- printf( --" If some of the input values are too large, Triangle may suffer a\n"); -- printf( --" floating exception due to overflow when attempting to perform an\n"); -- printf( --" orientation or incircle test. (Read the section on exact arithmetic\n"); -- printf( --" above.) Again, I recommend compiling Triangle for double (rather\n"); -- printf(" than single) precision arithmetic.\n\n"); -- printf( --" Unexpected problems can arise if you use quality meshing (-q, -a, or\n"); -- printf( --" -u) with an input that is not segment-bounded--that is, if your input\n"); -- printf( --" is a vertex set, or you're using the -c switch. If the convex hull of\n" --); -- printf( --" your input vertices has collinear vertices on its boundary, an input\n"); -- printf( --" vertex that you think lies on the convex hull might actually lie just\n"); -- printf( --" inside the convex hull. If so, the vertex and the nearby convex hull\n"); -- printf( --" edge form an extremely thin triangle. When Triangle tries to refine\n"); -- printf( --" the mesh to enforce angle and area constraints, Triangle might generate\n" --); -- printf( --" extremely tiny triangles, or it might fail because of insufficient\n"); -- printf(" floating-point precision.\n\n"); -- printf( --" `The numbering of the output vertices doesn't match the input vertices.'\n" --); -- printf("\n"); -- printf( --" You may have had duplicate input vertices, or you may have eaten some\n"); -- printf( --" of your input vertices with a hole, or by placing them outside the area\n" --); -- printf( --" enclosed by segments. In any case, you can solve the problem by not\n"); -- printf(" using the -j switch.\n\n"); -- printf( --" `Triangle executes without incident, but when I look at the resulting\n"); -- printf( --" mesh, it has overlapping triangles or other geometric inconsistencies.'\n"); -- printf("\n"); -- printf( --" If you select the -X switch, Triangle occasionally makes mistakes due\n"); -- printf( --" to floating-point roundoff error. Although these errors are rare,\n"); -- printf( --" don't use the -X switch. If you still have problems, please report the\n" --); -- printf(" bug.\n\n"); -- printf( --" `Triangle executes without incident, but when I look at the resulting\n"); -- printf(" Voronoi diagram, it has overlapping edges or other geometric\n"); -- printf(" inconsistencies.'\n"); -- printf("\n"); -- printf( --" If your input is a PSLG (-p), you can only expect a meaningful Voronoi\n" --); -- printf( --" diagram if the domain you are triangulating is convex and free of\n"); -- printf( --" holes, and you use the -D switch to construct a conforming Delaunay\n"); -- printf(" triangulation (instead of a CDT or CCDT).\n\n"); -- printf( --" Strange things can happen if you've taken liberties with your PSLG. Do\n"); -- printf( --" you have a vertex lying in the middle of a segment? Triangle sometimes\n"); -- printf( --" copes poorly with that sort of thing. Do you want to lay out a collinear\n" --); -- printf( --" row of evenly spaced, segment-connected vertices? Have you simply\n"); -- printf( --" defined one long segment connecting the leftmost vertex to the rightmost\n" --); -- printf( --" vertex, and a bunch of vertices lying along it? This method occasionally\n" --); -- printf( --" works, especially with horizontal and vertical lines, but often it\n"); -- printf( --" doesn't, and you'll have to connect each adjacent pair of vertices with a\n" --); -- printf(" separate segment. If you don't like it, tough.\n\n"); -- printf( --" Furthermore, if you have segments that intersect other than at their\n"); -- printf( --" endpoints, try not to let the intersections fall extremely close to PSLG\n" --); -- printf(" vertices or each other.\n\n"); -- printf( --" If you have problems refining a triangulation not produced by Triangle:\n"); -- printf( --" Are you sure the triangulation is geometrically valid? Is it formatted\n"); -- printf( --" correctly for Triangle? Are the triangles all listed so the first three\n" --); -- printf( --" vertices are their corners in counterclockwise order? Are all of the\n"); -- printf( --" triangles constrained Delaunay? Triangle's Delaunay refinement algorithm\n" --); -- printf(" assumes that it starts with a CDT.\n\n"); -- printf("Show Me:\n\n"); -- printf( --" Triangle comes with a separate program named `Show Me', whose primary\n"); -- printf( --" purpose is to draw meshes on your screen or in PostScript. Its secondary\n" --); -- printf( --" purpose is to check the validity of your input files, and do so more\n"); -- printf( --" thoroughly than Triangle does. Unlike Triangle, Show Me requires that\n"); -- printf( --" you have the X Windows system. Sorry, Microsoft Windows users.\n"); -- printf("\n"); -- printf("Triangle on the Web:\n"); -- printf("\n"); -- printf(" To see an illustrated version of these instructions, check out\n"); -- printf("\n"); -- printf(" http://www.cs.cmu.edu/~quake/triangle.html\n"); -- printf("\n"); -- printf("A Brief Plea:\n"); -- printf("\n"); -- printf( --" If you use Triangle, and especially if you use it to accomplish real\n"); -- printf( --" work, I would like very much to hear from you. A short letter or email\n"); -- printf( --" (to jrs@cs.berkeley.edu) describing how you use Triangle will mean a lot\n" --); -- printf( --" to me. The more people I know are using this program, the more easily I\n" --); -- printf( --" can justify spending time on improvements, which in turn will benefit\n"); -- printf( --" you. Also, I can put you on a list to receive email whenever a new\n"); -- printf(" version of Triangle is available.\n\n"); -- printf( --" If you use a mesh generated by Triangle in a publication, please include\n" --); -- printf( --" an acknowledgment as well. And please spell Triangle with a capital `T'!\n" --); -- printf( --" If you want to include a citation, use `Jonathan Richard Shewchuk,\n"); -- printf( --" ``Triangle: Engineering a 2D Quality Mesh Generator and Delaunay\n"); -- printf( --" Triangulator,'' in Applied Computational Geometry: Towards Geometric\n"); -- printf( --" Engineering (Ming C. Lin and Dinesh Manocha, editors), volume 1148 of\n"); -- printf( --" Lecture Notes in Computer Science, pages 203-222, Springer-Verlag,\n"); -- printf( --" Berlin, May 1996. (From the First ACM Workshop on Applied Computational\n" --); -- printf(" Geometry.)'\n\n"); -- printf("Research credit:\n\n"); -- printf( --" Of course, I can take credit for only a fraction of the ideas that made\n"); -- printf( --" this mesh generator possible. Triangle owes its existence to the efforts\n" --); -- printf( --" of many fine computational geometers and other researchers, including\n"); -- printf( --" Marshall Bern, L. Paul Chew, Kenneth L. Clarkson, Boris Delaunay, Rex A.\n" --); -- printf( --" Dwyer, David Eppstein, Steven Fortune, Leonidas J. Guibas, Donald E.\n"); -- printf( --" Knuth, Charles L. Lawson, Der-Tsai Lee, Gary L. Miller, Ernst P. Mucke,\n"); -- printf( --" Steven E. Pav, Douglas M. Priest, Jim Ruppert, Isaac Saias, Bruce J.\n"); -- printf( --" Schachter, Micha Sharir, Peter W. Shor, Daniel D. Sleator, Jorge Stolfi,\n" --); -- printf(" Robert E. Tarjan, Alper Ungor, Christopher J. Van Wyk, Noel J.\n"); -- printf( --" Walkington, and Binhai Zhu. See the comments at the beginning of the\n"); -- printf(" source code for references.\n\n"); -- triexit(0); --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* internalerror() Ask the user to send me the defective product. Exit. */ --/* */ --/*****************************************************************************/ -- --void internalerror() --{ -- printf(" Please report this bug to jrs@cs.berkeley.edu\n"); -- printf(" Include the message above, your input data set, and the exact\n"); -- printf(" command line you used to run Triangle.\n"); -- triexit(1); --} -- --/*****************************************************************************/ --/* */ --/* parsecommandline() Read the command line, identify switches, and set */ --/* up options and file names. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void parsecommandline(int argc, const char * const * const argv, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void parsecommandline(argc, argv, b) --int argc; --const char * const * const argv; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ --#ifdef TRILIBRARY --#define STARTINDEX 0 --#else /* not TRILIBRARY */ --#define STARTINDEX 1 -- int increment; -- int meshnumber; --#endif /* not TRILIBRARY */ -- int i, j, k; -- char workstring[FILENAMESIZE]; -- -- b->poly = b->refine = b->quality = 0; -- b->vararea = b->fixedarea = b->usertest = 0; -- b->regionattrib = b->convex = b->weighted = b->jettison = 0; -- b->firstnumber = 1; -- b->edgesout = b->voronoi = b->neighbors = b->geomview = 0; -- b->nobound = b->nopolywritten = b->nonodewritten = b->noelewritten = 0; -- b->noiterationnum = 0; -- b->noholes = b->noexact = 0; -- b->incremental = b->sweepline = 0; -- b->dwyer = 1; -- b->splitseg = 0; -- b->docheck = 0; -- b->nobisect = 0; -- b->conformdel = 0; -- b->steiner = -1; -- b->order = 1; -- b->minangle = 0.0; -- b->maxarea = -1.0; -- b->quiet = b->verbose = 0; --#ifndef TRILIBRARY -- b->innodefilename[0] = '\0'; --#endif /* not TRILIBRARY */ -- -- for (i = STARTINDEX; i < argc; i++) { --#ifndef TRILIBRARY -- if (argv[i][0] == '-') { --#endif /* not TRILIBRARY */ -- for (j = STARTINDEX; argv[i][j] != '\0'; j++) { -- if (argv[i][j] == 'p') { -- b->poly = 1; -- } --#ifndef CDT_ONLY -- if (argv[i][j] == 'r') { -- b->refine = 1; -- } -- if (argv[i][j] == 'q') { -- b->quality = 1; -- if (((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) || -- (argv[i][j + 1] == '.')) { -- k = 0; -- while (((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) || -- (argv[i][j + 1] == '.')) { -- j++; -- workstring[k] = argv[i][j]; -- k++; -- } -- workstring[k] = '\0'; -- b->minangle = (REAL) strtod(workstring, (char **) NULL); -- } else { -- b->minangle = 20.0; -- } -- } -- if (argv[i][j] == 'a') { -- b->quality = 1; -- if (((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) || -- (argv[i][j + 1] == '.')) { -- b->fixedarea = 1; -- k = 0; -- while (((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) || -- (argv[i][j + 1] == '.')) { -- j++; -- workstring[k] = argv[i][j]; -- k++; -- } -- workstring[k] = '\0'; -- b->maxarea = (REAL) strtod(workstring, (char **) NULL); -- if (b->maxarea <= 0.0) { -- printf("Error: Maximum area must be greater than zero.\n"); -- triexit(1); -- } -- } else { -- b->vararea = 1; -- } -- } -- if (argv[i][j] == 'u') { -- b->quality = 1; -- b->usertest = 1; -- } --#endif /* not CDT_ONLY */ -- if (argv[i][j] == 'A') { -- b->regionattrib = 1; -- } -- if (argv[i][j] == 'c') { -- b->convex = 1; -- } -- if (argv[i][j] == 'w') { -- b->weighted = 1; -- } -- if (argv[i][j] == 'W') { -- b->weighted = 2; -- } -- if (argv[i][j] == 'j') { -- b->jettison = 1; -- } -- if (argv[i][j] == 'z') { -- b->firstnumber = 0; -- } -- if (argv[i][j] == 'e') { -- b->edgesout = 1; -- } -- if (argv[i][j] == 'v') { -- b->voronoi = 1; -- } -- if (argv[i][j] == 'n') { -- b->neighbors = 1; -- } -- if (argv[i][j] == 'g') { -- b->geomview = 1; -- } -- if (argv[i][j] == 'B') { -- b->nobound = 1; -- } -- if (argv[i][j] == 'P') { -- b->nopolywritten = 1; -- } -- if (argv[i][j] == 'N') { -- b->nonodewritten = 1; -- } -- if (argv[i][j] == 'E') { -- b->noelewritten = 1; -- } --#ifndef TRILIBRARY -- if (argv[i][j] == 'I') { -- b->noiterationnum = 1; -- } --#endif /* not TRILIBRARY */ -- if (argv[i][j] == 'O') { -- b->noholes = 1; -- } -- if (argv[i][j] == 'X') { -- b->noexact = 1; -- } -- if (argv[i][j] == 'o') { -- if (argv[i][j + 1] == '2') { -- j++; -- b->order = 2; -- } -- } --#ifndef CDT_ONLY -- if (argv[i][j] == 'Y') { -- b->nobisect++; -- } -- if (argv[i][j] == 'S') { -- b->steiner = 0; -- while ((argv[i][j + 1] >= '0') && (argv[i][j + 1] <= '9')) { -- j++; -- b->steiner = b->steiner * 10 + (int) (argv[i][j] - '0'); -- } -- } --#endif /* not CDT_ONLY */ --#ifndef REDUCED -- if (argv[i][j] == 'i') { -- b->incremental = 1; -- } -- if (argv[i][j] == 'F') { -- b->sweepline = 1; -- } --#endif /* not REDUCED */ -- if (argv[i][j] == 'l') { -- b->dwyer = 0; -- } --#ifndef REDUCED --#ifndef CDT_ONLY -- if (argv[i][j] == 's') { -- b->splitseg = 1; -- } -- if ((argv[i][j] == 'D') || (argv[i][j] == 'L')) { -- b->quality = 1; -- b->conformdel = 1; -- } --#endif /* not CDT_ONLY */ -- if (argv[i][j] == 'C') { -- b->docheck = 1; -- } --#endif /* not REDUCED */ -- if (argv[i][j] == 'Q') { -- b->quiet = 1; -- } -- if (argv[i][j] == 'V') { -- b->verbose++; -- } --#ifndef TRILIBRARY -- if ((argv[i][j] == 'h') || (argv[i][j] == 'H') || -- (argv[i][j] == '?')) { -- info(); -- } --#endif /* not TRILIBRARY */ -- } --#ifndef TRILIBRARY -- } else { -- strncpy(b->innodefilename, argv[i], FILENAMESIZE - 1); -- b->innodefilename[FILENAMESIZE - 1] = '\0'; -- } --#endif /* not TRILIBRARY */ -- } --#ifndef TRILIBRARY -- if (b->innodefilename[0] == '\0') { -- syntax(); -- } -- if (!strcmp(&b->innodefilename[strlen(b->innodefilename) - 5], ".node")) { -- b->innodefilename[strlen(b->innodefilename) - 5] = '\0'; -- } -- if (!strcmp(&b->innodefilename[strlen(b->innodefilename) - 5], ".poly")) { -- b->innodefilename[strlen(b->innodefilename) - 5] = '\0'; -- b->poly = 1; -- } --#ifndef CDT_ONLY -- if (!strcmp(&b->innodefilename[strlen(b->innodefilename) - 4], ".ele")) { -- b->innodefilename[strlen(b->innodefilename) - 4] = '\0'; -- b->refine = 1; -- } -- if (!strcmp(&b->innodefilename[strlen(b->innodefilename) - 5], ".area")) { -- b->innodefilename[strlen(b->innodefilename) - 5] = '\0'; -- b->refine = 1; -- b->quality = 1; -- b->vararea = 1; -- } --#endif /* not CDT_ONLY */ --#endif /* not TRILIBRARY */ -- b->usesegments = b->poly || b->refine || b->quality || b->convex; -- b->goodangle = cos(b->minangle * PI / 180.0); -- if (b->goodangle == 1.0) { -- b->offconstant = 0.0; -- } else { -- b->offconstant = 0.475 * sqrt((1.0 + b->goodangle) / (1.0 - b->goodangle)); -- } -- b->goodangle *= b->goodangle; -- if (b->refine && b->noiterationnum) { -- printf( -- "Error: You cannot use the -I switch when refining a triangulation.\n"); -- triexit(1); -- } -- /* Be careful not to allocate space for element area constraints that */ -- /* will never be assigned any value (other than the default -1.0). */ -- if (!b->refine && !b->poly) { -- b->vararea = 0; -- } -- /* Be careful not to add an extra attribute to each element unless the */ -- /* input supports it (PSLG in, but not refining a preexisting mesh). */ -- if (b->refine || !b->poly) { -- b->regionattrib = 0; -- } -- /* Regular/weighted triangulations are incompatible with PSLGs */ -- /* and meshing. */ -- if (b->weighted && (b->poly || b->quality)) { -- b->weighted = 0; -- if (!b->quiet) { -- printf("Warning: weighted triangulations (-w, -W) are incompatible\n"); -- printf(" with PSLGs (-p) and meshing (-q, -a, -u). Weights ignored.\n" -- ); -- } -- } -- if (b->jettison && b->nonodewritten && !b->quiet) { -- printf("Warning: -j and -N switches are somewhat incompatible.\n"); -- printf(" If any vertices are jettisoned, you will need the output\n"); -- printf(" .node file to reconstruct the new node indices."); -- } -- --#ifndef TRILIBRARY -- strcpy(b->inpolyfilename, b->innodefilename); -- strcpy(b->inelefilename, b->innodefilename); -- strcpy(b->areafilename, b->innodefilename); -- increment = 0; -- strcpy(workstring, b->innodefilename); -- j = 1; -- while (workstring[j] != '\0') { -- if ((workstring[j] == '.') && (workstring[j + 1] != '\0')) { -- increment = j + 1; -- } -- j++; -- } -- meshnumber = 0; -- if (increment > 0) { -- j = increment; -- do { -- if ((workstring[j] >= '0') && (workstring[j] <= '9')) { -- meshnumber = meshnumber * 10 + (int) (workstring[j] - '0'); -- } else { -- increment = 0; -- } -- j++; -- } while (workstring[j] != '\0'); -- } -- if (b->noiterationnum) { -- strcpy(b->outnodefilename, b->innodefilename); -- strcpy(b->outelefilename, b->innodefilename); -- strcpy(b->edgefilename, b->innodefilename); -- strcpy(b->vnodefilename, b->innodefilename); -- strcpy(b->vedgefilename, b->innodefilename); -- strcpy(b->neighborfilename, b->innodefilename); -- strcpy(b->offfilename, b->innodefilename); -- strcat(b->outnodefilename, ".node"); -- strcat(b->outelefilename, ".ele"); -- strcat(b->edgefilename, ".edge"); -- strcat(b->vnodefilename, ".v.node"); -- strcat(b->vedgefilename, ".v.edge"); -- strcat(b->neighborfilename, ".neigh"); -- strcat(b->offfilename, ".off"); -- } else if (increment == 0) { -- strcpy(b->outnodefilename, b->innodefilename); -- strcpy(b->outpolyfilename, b->innodefilename); -- strcpy(b->outelefilename, b->innodefilename); -- strcpy(b->edgefilename, b->innodefilename); -- strcpy(b->vnodefilename, b->innodefilename); -- strcpy(b->vedgefilename, b->innodefilename); -- strcpy(b->neighborfilename, b->innodefilename); -- strcpy(b->offfilename, b->innodefilename); -- strcat(b->outnodefilename, ".1.node"); -- strcat(b->outpolyfilename, ".1.poly"); -- strcat(b->outelefilename, ".1.ele"); -- strcat(b->edgefilename, ".1.edge"); -- strcat(b->vnodefilename, ".1.v.node"); -- strcat(b->vedgefilename, ".1.v.edge"); -- strcat(b->neighborfilename, ".1.neigh"); -- strcat(b->offfilename, ".1.off"); -- } else { -- workstring[increment] = '%'; -- workstring[increment + 1] = 'd'; -- workstring[increment + 2] = '\0'; -- sprintf(b->outnodefilename, workstring, meshnumber + 1); -- strcpy(b->outpolyfilename, b->outnodefilename); -- strcpy(b->outelefilename, b->outnodefilename); -- strcpy(b->edgefilename, b->outnodefilename); -- strcpy(b->vnodefilename, b->outnodefilename); -- strcpy(b->vedgefilename, b->outnodefilename); -- strcpy(b->neighborfilename, b->outnodefilename); -- strcpy(b->offfilename, b->outnodefilename); -- strcat(b->outnodefilename, ".node"); -- strcat(b->outpolyfilename, ".poly"); -- strcat(b->outelefilename, ".ele"); -- strcat(b->edgefilename, ".edge"); -- strcat(b->vnodefilename, ".v.node"); -- strcat(b->vedgefilename, ".v.edge"); -- strcat(b->neighborfilename, ".neigh"); -- strcat(b->offfilename, ".off"); -- } -- strcat(b->innodefilename, ".node"); -- strcat(b->inpolyfilename, ".poly"); -- strcat(b->inelefilename, ".ele"); -- strcat(b->areafilename, ".area"); --#endif /* not TRILIBRARY */ --} -- --/** **/ --/** **/ --/********* User interaction routines begin here *********/ -- --/********* Debugging routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* printtriangle() Print out the details of an oriented triangle. */ --/* */ --/* I originally wrote this procedure to simplify debugging; it can be */ --/* called directly from the debugger, and presents information about an */ --/* oriented triangle in digestible form. It's also used when the */ --/* highest level of verbosity (`-VVV') is specified. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void printtriangle(struct mesh *m, struct behavior *b, struct otri *t) --#else /* not ANSI_DECLARATORS */ --void printtriangle(m, b, t) --struct mesh *m; --struct behavior *b; --struct otri *t; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri printtri; -- struct osub printsh; -- vertex printvertex; -- -- printf("triangle x%lx with orientation %d:\n", (TRIANGLE_PTRINT) t->tri, -- t->orient); -- decode(t->tri[0], printtri); -- if (printtri.tri == m->dummytri) { -- printf(" [0] = Outer space\n"); -- } else { -- printf(" [0] = x%lx %d\n", (TRIANGLE_PTRINT) printtri.tri, -- printtri.orient); -- } -- decode(t->tri[1], printtri); -- if (printtri.tri == m->dummytri) { -- printf(" [1] = Outer space\n"); -- } else { -- printf(" [1] = x%lx %d\n", (TRIANGLE_PTRINT) printtri.tri, -- printtri.orient); -- } -- decode(t->tri[2], printtri); -- if (printtri.tri == m->dummytri) { -- printf(" [2] = Outer space\n"); -- } else { -- printf(" [2] = x%lx %d\n", (TRIANGLE_PTRINT) printtri.tri, -- printtri.orient); -- } -- -- org(*t, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Origin[%d] = NULL\n", (t->orient + 1) % 3 + 3); -- else -- printf(" Origin[%d] = x%lx (%.12g, %.12g)\n", -- (t->orient + 1) % 3 + 3, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- dest(*t, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Dest [%d] = NULL\n", (t->orient + 2) % 3 + 3); -- else -- printf(" Dest [%d] = x%lx (%.12g, %.12g)\n", -- (t->orient + 2) % 3 + 3, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- apex(*t, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Apex [%d] = NULL\n", t->orient + 3); -- else -- printf(" Apex [%d] = x%lx (%.12g, %.12g)\n", -- t->orient + 3, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- -- if (b->usesegments) { -- sdecode(t->tri[6], printsh); -- if (printsh.ss != m->dummysub) { -- printf(" [6] = x%lx %d\n", (TRIANGLE_PTRINT) printsh.ss, -- printsh.ssorient); -- } -- sdecode(t->tri[7], printsh); -- if (printsh.ss != m->dummysub) { -- printf(" [7] = x%lx %d\n", (TRIANGLE_PTRINT) printsh.ss, -- printsh.ssorient); -- } -- sdecode(t->tri[8], printsh); -- if (printsh.ss != m->dummysub) { -- printf(" [8] = x%lx %d\n", (TRIANGLE_PTRINT) printsh.ss, -- printsh.ssorient); -- } -- } -- -- if (b->vararea) { -- printf(" Area constraint: %.4g\n", areabound(*t)); -- } --} -- --/*****************************************************************************/ --/* */ --/* printsubseg() Print out the details of an oriented subsegment. */ --/* */ --/* I originally wrote this procedure to simplify debugging; it can be */ --/* called directly from the debugger, and presents information about an */ --/* oriented subsegment in digestible form. It's also used when the highest */ --/* level of verbosity (`-VVV') is specified. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void printsubseg(struct mesh *m, struct behavior *b, struct osub *s) --#else /* not ANSI_DECLARATORS */ --void printsubseg(m, b, s) --struct mesh *m; --struct behavior *b; --struct osub *s; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct osub printsh; -- struct otri printtri; -- vertex printvertex; -- -- printf("subsegment x%lx with orientation %d and mark %d:\n", -- (TRIANGLE_PTRINT) s->ss, s->ssorient, mark(*s)); -- sdecode(s->ss[0], printsh); -- if (printsh.ss == m->dummysub) { -- printf(" [0] = No subsegment\n"); -- } else { -- printf(" [0] = x%lx %d\n", (TRIANGLE_PTRINT) printsh.ss, -- printsh.ssorient); -- } -- sdecode(s->ss[1], printsh); -- if (printsh.ss == m->dummysub) { -- printf(" [1] = No subsegment\n"); -- } else { -- printf(" [1] = x%lx %d\n", (TRIANGLE_PTRINT) printsh.ss, -- printsh.ssorient); -- } -- -- sorg(*s, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Origin[%d] = NULL\n", 2 + s->ssorient); -- else -- printf(" Origin[%d] = x%lx (%.12g, %.12g)\n", -- 2 + s->ssorient, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- sdest(*s, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Dest [%d] = NULL\n", 3 - s->ssorient); -- else -- printf(" Dest [%d] = x%lx (%.12g, %.12g)\n", -- 3 - s->ssorient, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- -- decode(s->ss[6], printtri); -- if (printtri.tri == m->dummytri) { -- printf(" [6] = Outer space\n"); -- } else { -- printf(" [6] = x%lx %d\n", (TRIANGLE_PTRINT) printtri.tri, -- printtri.orient); -- } -- decode(s->ss[7], printtri); -- if (printtri.tri == m->dummytri) { -- printf(" [7] = Outer space\n"); -- } else { -- printf(" [7] = x%lx %d\n", (TRIANGLE_PTRINT) printtri.tri, -- printtri.orient); -- } -- -- segorg(*s, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Segment origin[%d] = NULL\n", 4 + s->ssorient); -- else -- printf(" Segment origin[%d] = x%lx (%.12g, %.12g)\n", -- 4 + s->ssorient, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); -- segdest(*s, printvertex); -- if (printvertex == (vertex) NULL) -- printf(" Segment dest [%d] = NULL\n", 5 - s->ssorient); -- else -- printf(" Segment dest [%d] = x%lx (%.12g, %.12g)\n", -- 5 - s->ssorient, (TRIANGLE_PTRINT) printvertex, -- printvertex[0], printvertex[1]); --} -- --/** **/ --/** **/ --/********* Debugging routines end here *********/ -- --/********* Memory management routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* poolzero() Set all of a pool's fields to zero. */ --/* */ --/* This procedure should never be called on a pool that has any memory */ --/* allocated to it, as that memory would leak. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void poolzero(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void poolzero(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- pool->firstblock = (void **) NULL; -- pool->nowblock = (void **) NULL; -- pool->nextitem = (void *) NULL; -- pool->deaditemstack = (void *) NULL; -- pool->pathblock = (void **) NULL; -- pool->pathitem = (void *) NULL; -- pool->alignbytes = 0; -- pool->itembytes = 0; -- pool->itemsperblock = 0; -- pool->itemsfirstblock = 0; -- pool->items = 0; -- pool->maxitems = 0; -- pool->unallocateditems = 0; -- pool->pathitemsleft = 0; --} -- --/*****************************************************************************/ --/* */ --/* poolrestart() Deallocate all items in a pool. */ --/* */ --/* The pool is returned to its starting state, except that no memory is */ --/* freed to the operating system. Rather, the previously allocated blocks */ --/* are ready to be reused. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void poolrestart(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void poolrestart(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- TRIANGLE_PTRINT alignptr; -- -- pool->items = 0; -- pool->maxitems = 0; -- -- /* Set the currently active block. */ -- pool->nowblock = pool->firstblock; -- /* Find the first item in the pool. Increment by the size of (void *). */ -- alignptr = (TRIANGLE_PTRINT) (pool->nowblock + 1); -- /* Align the item on an `alignbytes'-byte boundary. */ -- pool->nextitem = (void *) -- (alignptr + (TRIANGLE_PTRINT) pool->alignbytes - -- (alignptr % (TRIANGLE_PTRINT) pool->alignbytes)); -- /* There are lots of unallocated items left in this block. */ -- pool->unallocateditems = pool->itemsfirstblock; -- /* The stack of deallocated items is empty. */ -- pool->deaditemstack = (void *) NULL; --} -- --/*****************************************************************************/ --/* */ --/* poolinit() Initialize a pool of memory for allocation of items. */ --/* */ --/* This routine initializes the machinery for allocating items. A `pool' */ --/* is created whose records have size at least `bytecount'. Items will be */ --/* allocated in `itemcount'-item blocks. Each item is assumed to be a */ --/* collection of words, and either pointers or floating-point values are */ --/* assumed to be the "primary" word type. (The "primary" word type is used */ --/* to determine alignment of items.) If `alignment' isn't zero, all items */ --/* will be `alignment'-byte aligned in memory. `alignment' must be either */ --/* a multiple or a factor of the primary word size; powers of two are safe. */ --/* `alignment' is normally used to create a few unused bits at the bottom */ --/* of each item's pointer, in which information may be stored. */ --/* */ --/* Don't change this routine unless you understand it. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void poolinit(struct memorypool *pool, int bytecount, int itemcount, -- int firstitemcount, int alignment) --#else /* not ANSI_DECLARATORS */ --void poolinit(pool, bytecount, itemcount, firstitemcount, alignment) --struct memorypool *pool; --int bytecount; --int itemcount; --int firstitemcount; --int alignment; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Find the proper alignment, which must be at least as large as: */ -- /* - The parameter `alignment'. */ -- /* - sizeof(void *), so the stack of dead items can be maintained */ -- /* without unaligned accesses. */ -- if (alignment > sizeof(void *)) { -- pool->alignbytes = alignment; -- } else { -- pool->alignbytes = sizeof(void *); -- } -- pool->itembytes = ((bytecount - 1) / pool->alignbytes + 1) * -- pool->alignbytes; -- pool->itemsperblock = itemcount; -- if (firstitemcount == 0) { -- pool->itemsfirstblock = itemcount; -- } else { -- pool->itemsfirstblock = firstitemcount; -- } -- -- /* Allocate a block of items. Space for `itemsfirstblock' items and one */ -- /* pointer (to point to the next block) are allocated, as well as space */ -- /* to ensure alignment of the items. */ -- pool->firstblock = (void **) -- trimalloc(pool->itemsfirstblock * pool->itembytes + (int) sizeof(void *) + -- pool->alignbytes); -- /* Set the next block pointer to NULL. */ -- *(pool->firstblock) = (void *) NULL; -- poolrestart(pool); --} -- --/*****************************************************************************/ --/* */ --/* pooldeinit() Free to the operating system all memory taken by a pool. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void pooldeinit(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void pooldeinit(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- while (pool->firstblock != (void **) NULL) { -- pool->nowblock = (void **) *(pool->firstblock); -- trifree((void *) pool->firstblock); -- pool->firstblock = pool->nowblock; -- } --} -- --/*****************************************************************************/ --/* */ --/* poolalloc() Allocate space for an item. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void *poolalloc(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void *poolalloc(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- void *newitem; -- void **newblock; -- TRIANGLE_PTRINT alignptr; -- -- /* First check the linked list of dead items. If the list is not */ -- /* empty, allocate an item from the list rather than a fresh one. */ -- if (pool->deaditemstack != (void *) NULL) { -- newitem = pool->deaditemstack; /* Take first item in list. */ -- pool->deaditemstack = * (void **) pool->deaditemstack; -- } else { -- /* Check if there are any free items left in the current block. */ -- if (pool->unallocateditems == 0) { -- /* Check if another block must be allocated. */ -- if (*(pool->nowblock) == (void *) NULL) { -- /* Allocate a new block of items, pointed to by the previous block. */ -- newblock = (void **) trimalloc(pool->itemsperblock * pool->itembytes + -- (int) sizeof(void *) + -- pool->alignbytes); -- *(pool->nowblock) = (void *) newblock; -- /* The next block pointer is NULL. */ -- *newblock = (void *) NULL; -- } -- -- /* Move to the new block. */ -- pool->nowblock = (void **) *(pool->nowblock); -- /* Find the first item in the block. */ -- /* Increment by the size of (void *). */ -- alignptr = (TRIANGLE_PTRINT) (pool->nowblock + 1); -- /* Align the item on an `alignbytes'-byte boundary. */ -- pool->nextitem = (void *) -- (alignptr + (TRIANGLE_PTRINT) pool->alignbytes - -- (alignptr % (TRIANGLE_PTRINT) pool->alignbytes)); -- /* There are lots of unallocated items left in this block. */ -- pool->unallocateditems = pool->itemsperblock; -- } -- -- /* Allocate a new item. */ -- newitem = pool->nextitem; -- /* Advance `nextitem' pointer to next free item in block. */ -- pool->nextitem = (void *) ((char *) pool->nextitem + pool->itembytes); -- pool->unallocateditems--; -- pool->maxitems++; -- } -- pool->items++; -- return newitem; --} -- --/*****************************************************************************/ --/* */ --/* pooldealloc() Deallocate space for an item. */ --/* */ --/* The deallocated space is stored in a queue for later reuse. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void pooldealloc(struct memorypool *pool, void *dyingitem) --#else /* not ANSI_DECLARATORS */ --void pooldealloc(pool, dyingitem) --struct memorypool *pool; --void *dyingitem; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Push freshly killed item onto stack. */ -- *((void **) dyingitem) = pool->deaditemstack; -- pool->deaditemstack = dyingitem; -- pool->items--; --} -- --/*****************************************************************************/ --/* */ --/* traversalinit() Prepare to traverse the entire list of items. */ --/* */ --/* This routine is used in conjunction with traverse(). */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void traversalinit(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void traversalinit(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- TRIANGLE_PTRINT alignptr; -- -- /* Begin the traversal in the first block. */ -- pool->pathblock = pool->firstblock; -- /* Find the first item in the block. Increment by the size of (void *). */ -- alignptr = (TRIANGLE_PTRINT) (pool->pathblock + 1); -- /* Align with item on an `alignbytes'-byte boundary. */ -- pool->pathitem = (void *) -- (alignptr + (TRIANGLE_PTRINT) pool->alignbytes - -- (alignptr % (TRIANGLE_PTRINT) pool->alignbytes)); -- /* Set the number of items left in the current block. */ -- pool->pathitemsleft = pool->itemsfirstblock; --} -- --/*****************************************************************************/ --/* */ --/* traverse() Find the next item in the list. */ --/* */ --/* This routine is used in conjunction with traversalinit(). Be forewarned */ --/* that this routine successively returns all items in the list, including */ --/* deallocated ones on the deaditemqueue. It's up to you to figure out */ --/* which ones are actually dead. Why? I don't want to allocate extra */ --/* space just to demarcate dead items. It can usually be done more */ --/* space-efficiently by a routine that knows something about the structure */ --/* of the item. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void *traverse(struct memorypool *pool) --#else /* not ANSI_DECLARATORS */ --void *traverse(pool) --struct memorypool *pool; --#endif /* not ANSI_DECLARATORS */ -- --{ -- void *newitem; -- TRIANGLE_PTRINT alignptr; -- -- /* Stop upon exhausting the list of items. */ -- if (pool->pathitem == pool->nextitem) { -- return (void *) NULL; -- } -- -- /* Check whether any untraversed items remain in the current block. */ -- if (pool->pathitemsleft == 0) { -- /* Find the next block. */ -- pool->pathblock = (void **) *(pool->pathblock); -- /* Find the first item in the block. Increment by the size of (void *). */ -- alignptr = (TRIANGLE_PTRINT) (pool->pathblock + 1); -- /* Align with item on an `alignbytes'-byte boundary. */ -- pool->pathitem = (void *) -- (alignptr + (TRIANGLE_PTRINT) pool->alignbytes - -- (alignptr % (TRIANGLE_PTRINT) pool->alignbytes)); -- /* Set the number of items left in the current block. */ -- pool->pathitemsleft = pool->itemsperblock; -- } -- -- newitem = pool->pathitem; -- /* Find the next item in the block. */ -- pool->pathitem = (void *) ((char *) pool->pathitem + pool->itembytes); -- pool->pathitemsleft--; -- return newitem; --} -- --/*****************************************************************************/ --/* */ --/* dummyinit() Initialize the triangle that fills "outer space" and the */ --/* omnipresent subsegment. */ --/* */ --/* The triangle that fills "outer space," called `dummytri', is pointed to */ --/* by every triangle and subsegment on a boundary (be it outer or inner) of */ --/* the triangulation. Also, `dummytri' points to one of the triangles on */ --/* the convex hull (until the holes and concavities are carved), making it */ --/* possible to find a starting triangle for point location. */ --/* */ --/* The omnipresent subsegment, `dummysub', is pointed to by every triangle */ --/* or subsegment that doesn't have a full complement of real subsegments */ --/* to point to. */ --/* */ --/* `dummytri' and `dummysub' are generally required to fulfill only a few */ --/* invariants: their vertices must remain NULL and `dummytri' must always */ --/* be bonded (at offset zero) to some triangle on the convex hull of the */ --/* mesh, via a boundary edge. Otherwise, the connections of `dummytri' and */ --/* `dummysub' may change willy-nilly. This makes it possible to avoid */ --/* writing a good deal of special-case code (in the edge flip, for example) */ --/* for dealing with the boundary of the mesh, places where no subsegment is */ --/* present, and so forth. Other entities are frequently bonded to */ --/* `dummytri' and `dummysub' as if they were real mesh entities, with no */ --/* harm done. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void dummyinit(struct mesh *m, struct behavior *b, int trianglebytes, -- int subsegbytes) --#else /* not ANSI_DECLARATORS */ --void dummyinit(m, b, trianglebytes, subsegbytes) --struct mesh *m; --struct behavior *b; --int trianglebytes; --int subsegbytes; --#endif /* not ANSI_DECLARATORS */ -- --{ -- TRIANGLE_PTRINT alignptr; -- -- /* Set up `dummytri', the `triangle' that occupies "outer space." */ -- m->dummytribase = (triangle *) trimalloc(trianglebytes + -- m->triangles.alignbytes); -- /* Align `dummytri' on a `triangles.alignbytes'-byte boundary. */ -- alignptr = (TRIANGLE_PTRINT) m->dummytribase; -- m->dummytri = (triangle *) -- (alignptr + (TRIANGLE_PTRINT) m->triangles.alignbytes - -- (alignptr % (TRIANGLE_PTRINT) m->triangles.alignbytes)); -- /* Initialize the three adjoining triangles to be "outer space." These */ -- /* will eventually be changed by various bonding operations, but their */ -- /* values don't really matter, as long as they can legally be */ -- /* dereferenced. */ -- m->dummytri[0] = (triangle) m->dummytri; -- m->dummytri[1] = (triangle) m->dummytri; -- m->dummytri[2] = (triangle) m->dummytri; -- /* Three NULL vertices. */ -- m->dummytri[3] = (triangle) NULL; -- m->dummytri[4] = (triangle) NULL; -- m->dummytri[5] = (triangle) NULL; -- -- if (b->usesegments) { -- /* Set up `dummysub', the omnipresent subsegment pointed to by any */ -- /* triangle side or subsegment end that isn't attached to a real */ -- /* subsegment. */ -- m->dummysubbase = (subseg *) trimalloc(subsegbytes + -- m->subsegs.alignbytes); -- /* Align `dummysub' on a `subsegs.alignbytes'-byte boundary. */ -- alignptr = (TRIANGLE_PTRINT) m->dummysubbase; -- m->dummysub = (subseg *) -- (alignptr + (TRIANGLE_PTRINT) m->subsegs.alignbytes - -- (alignptr % (TRIANGLE_PTRINT) m->subsegs.alignbytes)); -- /* Initialize the two adjoining subsegments to be the omnipresent */ -- /* subsegment. These will eventually be changed by various bonding */ -- /* operations, but their values don't really matter, as long as they */ -- /* can legally be dereferenced. */ -- m->dummysub[0] = (subseg) m->dummysub; -- m->dummysub[1] = (subseg) m->dummysub; -- /* Four NULL vertices. */ -- m->dummysub[2] = (subseg) NULL; -- m->dummysub[3] = (subseg) NULL; -- m->dummysub[4] = (subseg) NULL; -- m->dummysub[5] = (subseg) NULL; -- /* Initialize the two adjoining triangles to be "outer space." */ -- m->dummysub[6] = (subseg) m->dummytri; -- m->dummysub[7] = (subseg) m->dummytri; -- /* Set the boundary marker to zero. */ -- * (int *) (m->dummysub + 8) = 0; -- -- /* Initialize the three adjoining subsegments of `dummytri' to be */ -- /* the omnipresent subsegment. */ -- m->dummytri[6] = (triangle) m->dummysub; -- m->dummytri[7] = (triangle) m->dummysub; -- m->dummytri[8] = (triangle) m->dummysub; -- } --} -- --/*****************************************************************************/ --/* */ --/* initializevertexpool() Calculate the size of the vertex data structure */ --/* and initialize its memory pool. */ --/* */ --/* This routine also computes the `vertexmarkindex' and `vertex2triindex' */ --/* indices used to find values within each vertex. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void initializevertexpool(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void initializevertexpool(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int vertexsize; -- -- /* The index within each vertex at which the boundary marker is found, */ -- /* followed by the vertex type. Ensure the vertex marker is aligned to */ -- /* a sizeof(int)-byte address. */ -- m->vertexmarkindex = ((m->mesh_dim + m->nextras) * sizeof(REAL) + -- sizeof(int) - 1) / -- sizeof(int); -- vertexsize = (m->vertexmarkindex + 2) * sizeof(int); -- if (b->poly) { -- /* The index within each vertex at which a triangle pointer is found. */ -- /* Ensure the pointer is aligned to a sizeof(triangle)-byte address. */ -- m->vertex2triindex = (vertexsize + sizeof(triangle) - 1) / -- sizeof(triangle); -- vertexsize = (m->vertex2triindex + 1) * sizeof(triangle); -- } -- -- /* Initialize the pool of vertices. */ -- poolinit(&m->vertices, vertexsize, VERTEXPERBLOCK, -- m->invertices > VERTEXPERBLOCK ? m->invertices : VERTEXPERBLOCK, -- sizeof(REAL)); --} -- --/*****************************************************************************/ --/* */ --/* initializetrisubpools() Calculate the sizes of the triangle and */ --/* subsegment data structures and initialize */ --/* their memory pools. */ --/* */ --/* This routine also computes the `highorderindex', `elemattribindex', and */ --/* `areaboundindex' indices used to find values within each triangle. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void initializetrisubpools(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void initializetrisubpools(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int trisize; -- -- /* The index within each triangle at which the extra nodes (above three) */ -- /* associated with high order elements are found. There are three */ -- /* pointers to other triangles, three pointers to corners, and possibly */ -- /* three pointers to subsegments before the extra nodes. */ -- m->highorderindex = 6 + (b->usesegments * 3); -- /* The number of bytes occupied by a triangle. */ -- trisize = ((b->order + 1) * (b->order + 2) / 2 + (m->highorderindex - 3)) * -- sizeof(triangle); -- /* The index within each triangle at which its attributes are found, */ -- /* where the index is measured in REALs. */ -- m->elemattribindex = (trisize + sizeof(REAL) - 1) / sizeof(REAL); -- /* The index within each triangle at which the maximum area constraint */ -- /* is found, where the index is measured in REALs. Note that if the */ -- /* `regionattrib' flag is set, an additional attribute will be added. */ -- m->areaboundindex = m->elemattribindex + m->eextras + b->regionattrib; -- /* If triangle attributes or an area bound are needed, increase the number */ -- /* of bytes occupied by a triangle. */ -- if (b->vararea) { -- trisize = (m->areaboundindex + 1) * sizeof(REAL); -- } else if (m->eextras + b->regionattrib > 0) { -- trisize = m->areaboundindex * sizeof(REAL); -- } -- /* If a Voronoi diagram or triangle neighbor graph is requested, make */ -- /* sure there's room to store an integer index in each triangle. This */ -- /* integer index can occupy the same space as the subsegment pointers */ -- /* or attributes or area constraint or extra nodes. */ -- if ((b->voronoi || b->neighbors) && -- (trisize < 6 * sizeof(triangle) + sizeof(int))) { -- trisize = 6 * sizeof(triangle) + sizeof(int); -- } -- -- /* Having determined the memory size of a triangle, initialize the pool. */ -- poolinit(&m->triangles, trisize, TRIPERBLOCK, -- (2 * m->invertices - 2) > TRIPERBLOCK ? (2 * m->invertices - 2) : -- TRIPERBLOCK, 4); -- -- if (b->usesegments) { -- /* Initialize the pool of subsegments. Take into account all eight */ -- /* pointers and one boundary marker. */ -- poolinit(&m->subsegs, 8 * sizeof(triangle) + sizeof(int), -- SUBSEGPERBLOCK, SUBSEGPERBLOCK, 4); -- -- /* Initialize the "outer space" triangle and omnipresent subsegment. */ -- dummyinit(m, b, m->triangles.itembytes, m->subsegs.itembytes); -- } else { -- /* Initialize the "outer space" triangle. */ -- dummyinit(m, b, m->triangles.itembytes, 0); -- } --} -- --/*****************************************************************************/ --/* */ --/* triangledealloc() Deallocate space for a triangle, marking it dead. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void triangledealloc(struct mesh *m, triangle *dyingtriangle) --#else /* not ANSI_DECLARATORS */ --void triangledealloc(m, dyingtriangle) --struct mesh *m; --triangle *dyingtriangle; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Mark the triangle as dead. This makes it possible to detect dead */ -- /* triangles when traversing the list of all triangles. */ -- killtri(dyingtriangle); -- pooldealloc(&m->triangles, (void *) dyingtriangle); --} -- --/*****************************************************************************/ --/* */ --/* triangletraverse() Traverse the triangles, skipping dead ones. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --triangle *triangletraverse(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --triangle *triangletraverse(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- triangle *newtriangle; -- -- do { -- newtriangle = (triangle *) traverse(&m->triangles); -- if (newtriangle == (triangle *) NULL) { -- return (triangle *) NULL; -- } -- } while (deadtri(newtriangle)); /* Skip dead ones. */ -- return newtriangle; --} -- --/*****************************************************************************/ --/* */ --/* subsegdealloc() Deallocate space for a subsegment, marking it dead. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void subsegdealloc(struct mesh *m, subseg *dyingsubseg) --#else /* not ANSI_DECLARATORS */ --void subsegdealloc(m, dyingsubseg) --struct mesh *m; --subseg *dyingsubseg; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Mark the subsegment as dead. This makes it possible to detect dead */ -- /* subsegments when traversing the list of all subsegments. */ -- killsubseg(dyingsubseg); -- pooldealloc(&m->subsegs, (void *) dyingsubseg); --} -- --/*****************************************************************************/ --/* */ --/* subsegtraverse() Traverse the subsegments, skipping dead ones. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --subseg *subsegtraverse(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --subseg *subsegtraverse(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- subseg *newsubseg; -- -- do { -- newsubseg = (subseg *) traverse(&m->subsegs); -- if (newsubseg == (subseg *) NULL) { -- return (subseg *) NULL; -- } -- } while (deadsubseg(newsubseg)); /* Skip dead ones. */ -- return newsubseg; --} -- --/*****************************************************************************/ --/* */ --/* vertexdealloc() Deallocate space for a vertex, marking it dead. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void vertexdealloc(struct mesh *m, vertex dyingvertex) --#else /* not ANSI_DECLARATORS */ --void vertexdealloc(m, dyingvertex) --struct mesh *m; --vertex dyingvertex; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Mark the vertex as dead. This makes it possible to detect dead */ -- /* vertices when traversing the list of all vertices. */ -- setvertextype(dyingvertex, DEADVERTEX); -- pooldealloc(&m->vertices, (void *) dyingvertex); --} -- --/*****************************************************************************/ --/* */ --/* vertextraverse() Traverse the vertices, skipping dead ones. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --vertex vertextraverse(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --vertex vertextraverse(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex newvertex; -- -- do { -- newvertex = (vertex) traverse(&m->vertices); -- if (newvertex == (vertex) NULL) { -- return (vertex) NULL; -- } -- } while (vertextype(newvertex) == DEADVERTEX); /* Skip dead ones. */ -- return newvertex; --} -- --/*****************************************************************************/ --/* */ --/* badsubsegdealloc() Deallocate space for a bad subsegment, marking it */ --/* dead. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void badsubsegdealloc(struct mesh *m, struct badsubseg *dyingseg) --#else /* not ANSI_DECLARATORS */ --void badsubsegdealloc(m, dyingseg) --struct mesh *m; --struct badsubseg *dyingseg; --#endif /* not ANSI_DECLARATORS */ -- --{ -- /* Set subsegment's origin to NULL. This makes it possible to detect dead */ -- /* badsubsegs when traversing the list of all badsubsegs . */ -- dyingseg->subsegorg = (vertex) NULL; -- pooldealloc(&m->badsubsegs, (void *) dyingseg); --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* badsubsegtraverse() Traverse the bad subsegments, skipping dead ones. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --struct badsubseg *badsubsegtraverse(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --struct badsubseg *badsubsegtraverse(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct badsubseg *newseg; -- -- do { -- newseg = (struct badsubseg *) traverse(&m->badsubsegs); -- if (newseg == (struct badsubseg *) NULL) { -- return (struct badsubseg *) NULL; -- } -- } while (newseg->subsegorg == (vertex) NULL); /* Skip dead ones. */ -- return newseg; --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* getvertex() Get a specific vertex, by number, from the list. */ --/* */ --/* The first vertex is number 'firstnumber'. */ --/* */ --/* Note that this takes O(n) time (with a small constant, if VERTEXPERBLOCK */ --/* is large). I don't care to take the trouble to make it work in constant */ --/* time. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --vertex getvertex(struct mesh *m, struct behavior *b, int number) --#else /* not ANSI_DECLARATORS */ --vertex getvertex(m, b, number) --struct mesh *m; --struct behavior *b; --int number; --#endif /* not ANSI_DECLARATORS */ -- --{ -- void **getblock; -- char *foundvertex; -- TRIANGLE_PTRINT alignptr; -- int current; -- -- getblock = m->vertices.firstblock; -- current = b->firstnumber; -- -- /* Find the right block. */ -- if (current + m->vertices.itemsfirstblock <= number) { -- getblock = (void **) *getblock; -- current += m->vertices.itemsfirstblock; -- while (current + m->vertices.itemsperblock <= number) { -- getblock = (void **) *getblock; -- current += m->vertices.itemsperblock; -- } -- } -- -- /* Now find the right vertex. */ -- alignptr = (TRIANGLE_PTRINT) (getblock + 1); -- foundvertex = (char *) (alignptr + (TRIANGLE_PTRINT) m->vertices.alignbytes - -- (alignptr % (TRIANGLE_PTRINT) m->vertices.alignbytes)); -- return (vertex) (foundvertex + m->vertices.itembytes * (number - current)); --} -- --/*****************************************************************************/ --/* */ --/* triangledeinit() Free all remaining allocated memory. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void triangledeinit(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void triangledeinit(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- pooldeinit(&m->triangles); -- trifree((void *) m->dummytribase); -- if (b->usesegments) { -- pooldeinit(&m->subsegs); -- trifree((void *) m->dummysubbase); -- } -- pooldeinit(&m->vertices); --#ifndef CDT_ONLY -- if (b->quality) { -- pooldeinit(&m->badsubsegs); -- if ((b->minangle > 0.0) || b->vararea || b->fixedarea || b->usertest) { -- pooldeinit(&m->badtriangles); -- pooldeinit(&m->flipstackers); -- } -- } --#endif /* not CDT_ONLY */ --} -- --/** **/ --/** **/ --/********* Memory management routines end here *********/ -- --/********* Constructors begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* maketriangle() Create a new triangle with orientation zero. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void maketriangle(struct mesh *m, struct behavior *b, struct otri *newotri) --#else /* not ANSI_DECLARATORS */ --void maketriangle(m, b, newotri) --struct mesh *m; --struct behavior *b; --struct otri *newotri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int i; -- -- newotri->tri = (triangle *) poolalloc(&m->triangles); -- /* Initialize the three adjoining triangles to be "outer space". */ -- newotri->tri[0] = (triangle) m->dummytri; -- newotri->tri[1] = (triangle) m->dummytri; -- newotri->tri[2] = (triangle) m->dummytri; -- /* Three NULL vertices. */ -- newotri->tri[3] = (triangle) NULL; -- newotri->tri[4] = (triangle) NULL; -- newotri->tri[5] = (triangle) NULL; -- if (b->usesegments) { -- /* Initialize the three adjoining subsegments to be the omnipresent */ -- /* subsegment. */ -- newotri->tri[6] = (triangle) m->dummysub; -- newotri->tri[7] = (triangle) m->dummysub; -- newotri->tri[8] = (triangle) m->dummysub; -- } -- for (i = 0; i < m->eextras; i++) { -- setelemattribute(*newotri, i, 0.0); -- } -- if (b->vararea) { -- setareabound(*newotri, -1.0); -- } -- -- newotri->orient = 0; --} -- --/*****************************************************************************/ --/* */ --/* makesubseg() Create a new subsegment with orientation zero. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void makesubseg(struct mesh *m, struct osub *newsubseg) --#else /* not ANSI_DECLARATORS */ --void makesubseg(m, newsubseg) --struct mesh *m; --struct osub *newsubseg; --#endif /* not ANSI_DECLARATORS */ -- --{ -- newsubseg->ss = (subseg *) poolalloc(&m->subsegs); -- /* Initialize the two adjoining subsegments to be the omnipresent */ -- /* subsegment. */ -- newsubseg->ss[0] = (subseg) m->dummysub; -- newsubseg->ss[1] = (subseg) m->dummysub; -- /* Four NULL vertices. */ -- newsubseg->ss[2] = (subseg) NULL; -- newsubseg->ss[3] = (subseg) NULL; -- newsubseg->ss[4] = (subseg) NULL; -- newsubseg->ss[5] = (subseg) NULL; -- /* Initialize the two adjoining triangles to be "outer space." */ -- newsubseg->ss[6] = (subseg) m->dummytri; -- newsubseg->ss[7] = (subseg) m->dummytri; -- /* Set the boundary marker to zero. */ -- setmark(*newsubseg, 0); -- -- newsubseg->ssorient = 0; --} -- --/** **/ --/** **/ --/********* Constructors end here *********/ -- --/********* Geometric primitives begin here *********/ --/** **/ --/** **/ -- --/* The adaptive exact arithmetic geometric predicates implemented herein are */ --/* described in detail in my paper, "Adaptive Precision Floating-Point */ --/* Arithmetic and Fast Robust Geometric Predicates." See the header for a */ --/* full citation. */ -- --/* Which of the following two methods of finding the absolute values is */ --/* fastest is compiler-dependent. A few compilers can inline and optimize */ --/* the fabs() call; but most will incur the overhead of a function call, */ --/* which is disastrously slow. A faster way on IEEE machines might be to */ --/* mask the appropriate bit, but that's difficult to do in C without */ --/* forcing the value to be stored to memory (rather than be kept in the */ --/* register to which the optimizer assigned it). */ -- --#define Absolute(a) ((a) >= 0.0 ? (a) : -(a)) --/* #define Absolute(a) fabs(a) */ -- --/* Many of the operations are broken up into two pieces, a main part that */ --/* performs an approximate operation, and a "tail" that computes the */ --/* roundoff error of that operation. */ --/* */ --/* The operations Fast_Two_Sum(), Fast_Two_Diff(), Two_Sum(), Two_Diff(), */ --/* Split(), and Two_Product() are all implemented as described in the */ --/* reference. Each of these macros requires certain variables to be */ --/* defined in the calling routine. The variables `bvirt', `c', `abig', */ --/* `_i', `_j', `_k', `_l', `_m', and `_n' are declared `INEXACT' because */ --/* they store the result of an operation that may incur roundoff error. */ --/* The input parameter `x' (or the highest numbered `x_' parameter) must */ --/* also be declared `INEXACT'. */ -- --#define Fast_Two_Sum_Tail(a, b, x, y) \ -- bvirt = x - a; \ -- y = b - bvirt -- --#define Fast_Two_Sum(a, b, x, y) \ -- x = (REAL) (a + b); \ -- Fast_Two_Sum_Tail(a, b, x, y) -- --#define Two_Sum_Tail(a, b, x, y) \ -- bvirt = (REAL) (x - a); \ -- avirt = x - bvirt; \ -- bround = b - bvirt; \ -- around = a - avirt; \ -- y = around + bround -- --#define Two_Sum(a, b, x, y) \ -- x = (REAL) (a + b); \ -- Two_Sum_Tail(a, b, x, y) -- --#define Two_Diff_Tail(a, b, x, y) \ -- bvirt = (REAL) (a - x); \ -- avirt = x + bvirt; \ -- bround = bvirt - b; \ -- around = a - avirt; \ -- y = around + bround -- --#define Two_Diff(a, b, x, y) \ -- x = (REAL) (a - b); \ -- Two_Diff_Tail(a, b, x, y) -- --#define Split(a, ahi, alo) \ -- c = (REAL) (splitter * a); \ -- abig = (REAL) (c - a); \ -- ahi = c - abig; \ -- alo = a - ahi -- --#define Two_Product_Tail(a, b, x, y) \ -- Split(a, ahi, alo); \ -- Split(b, bhi, blo); \ -- err1 = x - (ahi * bhi); \ -- err2 = err1 - (alo * bhi); \ -- err3 = err2 - (ahi * blo); \ -- y = (alo * blo) - err3 -- --#define Two_Product(a, b, x, y) \ -- x = (REAL) (a * b); \ -- Two_Product_Tail(a, b, x, y) -- --/* Two_Product_Presplit() is Two_Product() where one of the inputs has */ --/* already been split. Avoids redundant splitting. */ -- --#define Two_Product_Presplit(a, b, bhi, blo, x, y) \ -- x = (REAL) (a * b); \ -- Split(a, ahi, alo); \ -- err1 = x - (ahi * bhi); \ -- err2 = err1 - (alo * bhi); \ -- err3 = err2 - (ahi * blo); \ -- y = (alo * blo) - err3 -- --/* Square() can be done more quickly than Two_Product(). */ -- --#define Square_Tail(a, x, y) \ -- Split(a, ahi, alo); \ -- err1 = x - (ahi * ahi); \ -- err3 = err1 - ((ahi + ahi) * alo); \ -- y = (alo * alo) - err3 -- --#define Square(a, x, y) \ -- x = (REAL) (a * a); \ -- Square_Tail(a, x, y) -- --/* Macros for summing expansions of various fixed lengths. These are all */ --/* unrolled versions of Expansion_Sum(). */ -- --#define Two_One_Sum(a1, a0, b, x2, x1, x0) \ -- Two_Sum(a0, b , _i, x0); \ -- Two_Sum(a1, _i, x2, x1) -- --#define Two_One_Diff(a1, a0, b, x2, x1, x0) \ -- Two_Diff(a0, b , _i, x0); \ -- Two_Sum( a1, _i, x2, x1) -- --#define Two_Two_Sum(a1, a0, b1, b0, x3, x2, x1, x0) \ -- Two_One_Sum(a1, a0, b0, _j, _0, x0); \ -- Two_One_Sum(_j, _0, b1, x3, x2, x1) -- --#define Two_Two_Diff(a1, a0, b1, b0, x3, x2, x1, x0) \ -- Two_One_Diff(a1, a0, b0, _j, _0, x0); \ -- Two_One_Diff(_j, _0, b1, x3, x2, x1) -- --/* Macro for multiplying a two-component expansion by a single component. */ -- --#define Two_One_Product(a1, a0, b, x3, x2, x1, x0) \ -- Split(b, bhi, blo); \ -- Two_Product_Presplit(a0, b, bhi, blo, _i, x0); \ -- Two_Product_Presplit(a1, b, bhi, blo, _j, _0); \ -- Two_Sum(_i, _0, _k, x1); \ -- Fast_Two_Sum(_j, _k, x3, x2) -- --/*****************************************************************************/ --/* */ --/* exactinit() Initialize the variables used for exact arithmetic. */ --/* */ --/* `epsilon' is the largest power of two such that 1.0 + epsilon = 1.0 in */ --/* floating-point arithmetic. `epsilon' bounds the relative roundoff */ --/* error. It is used for floating-point error analysis. */ --/* */ --/* `splitter' is used to split floating-point numbers into two half- */ --/* length significands for exact multiplication. */ --/* */ --/* I imagine that a highly optimizing compiler might be too smart for its */ --/* own good, and somehow cause this routine to fail, if it pretends that */ --/* floating-point arithmetic is too much like real arithmetic. */ --/* */ --/* Don't change this routine unless you fully understand it. */ --/* */ --/*****************************************************************************/ -- --void exactinit() --{ -- REAL half; -- REAL check, lastcheck; -- int every_other; --#ifdef LINUX -- int cword; --#endif /* LINUX */ -- --#ifdef CPU86 --#ifdef SINGLE -- _control87(_PC_24, _MCW_PC); /* Set FPU control word for single precision. */ --#else /* not SINGLE */ -- _control87(_PC_53, _MCW_PC); /* Set FPU control word for double precision. */ --#endif /* not SINGLE */ --#endif /* CPU86 */ --#ifdef LINUX --#ifdef SINGLE -- /* cword = 4223; */ -- cword = 4210; /* set FPU control word for single precision */ --#else /* not SINGLE */ -- /* cword = 4735; */ -- cword = 4722; /* set FPU control word for double precision */ --#endif /* not SINGLE */ -- _FPU_SETCW(cword); --#endif /* LINUX */ -- -- every_other = 1; -- half = 0.5; -- epsilon = 1.0; -- splitter = 1.0; -- check = 1.0; -- /* Repeatedly divide `epsilon' by two until it is too small to add to */ -- /* one without causing roundoff. (Also check if the sum is equal to */ -- /* the previous sum, for machines that round up instead of using exact */ -- /* rounding. Not that these routines will work on such machines.) */ -- do { -- lastcheck = check; -- epsilon *= half; -- if (every_other) { -- splitter *= 2.0; -- } -- every_other = !every_other; -- check = 1.0 + epsilon; -- } while ((check != 1.0) && (check != lastcheck)); -- splitter += 1.0; -- /* Error bounds for orientation and incircle tests. */ -- resulterrbound = (3.0 + 8.0 * epsilon) * epsilon; -- ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon; -- ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon; -- ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon; -- iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon; -- iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon; -- iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon; -- o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon; -- o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon; -- o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon; --} -- --/*****************************************************************************/ --/* */ --/* fast_expansion_sum_zeroelim() Sum two expansions, eliminating zero */ --/* components from the output expansion. */ --/* */ --/* Sets h = e + f. See my Robust Predicates paper for details. */ --/* */ --/* If round-to-even is used (as with IEEE 754), maintains the strongly */ --/* nonoverlapping property. (That is, if e is strongly nonoverlapping, h */ --/* will be also.) Does NOT maintain the nonoverlapping or nonadjacent */ --/* properties. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --static int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h) --#else /* not ANSI_DECLARATORS */ --int fast_expansion_sum_zeroelim(elen, e, flen, f, h) /* h cannot be e or f. */ --int elen; --REAL *e; --int flen; --REAL *f; --REAL *h; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL Q; -- INEXACT REAL Qnew; -- INEXACT REAL hh; -- INEXACT REAL bvirt; -- REAL avirt, bround, around; -- int eindex, findex, hindex; -- REAL enow, fnow; -- -- enow = e[0]; -- fnow = f[0]; -- eindex = findex = 0; -- if ( (fnow > enow) == (fnow > -enow) ) { -- Q = enow; -- enow = e[++eindex]; -- } else { -- Q = fnow; -- fnow = f[++findex]; -- } -- hindex = 0; -- if ((eindex < elen) && (findex < flen)) { -- if ((fnow > enow) == (fnow > -enow)) { -- Fast_Two_Sum(enow, Q, Qnew, hh); -- enow = e[++eindex]; -- } else { -- Fast_Two_Sum(fnow, Q, Qnew, hh); -- fnow = f[++findex]; -- } -- Q = Qnew; -- if (hh != 0.0) { -- h[hindex++] = hh; -- } -- while ((eindex < elen) && (findex < flen)) { -- if ((fnow > enow) == (fnow > -enow)) { -- Two_Sum(Q, enow, Qnew, hh); -- enow = e[++eindex]; -- } else { -- Two_Sum(Q, fnow, Qnew, hh); -- fnow = f[++findex]; -- } -- Q = Qnew; -- if (hh != 0.0) { -- h[hindex++] = hh; -- } -- } -- } -- while (eindex < elen) { -- Two_Sum(Q, enow, Qnew, hh); -- enow = e[++eindex]; -- Q = Qnew; -- if (hh != 0.0) { -- h[hindex++] = hh; -- } -- } -- while (findex < flen) { -- Two_Sum(Q, fnow, Qnew, hh); -- fnow = f[++findex]; -- Q = Qnew; -- if (hh != 0.0) { -- h[hindex++] = hh; -- } -- } -- if ((Q != 0.0) || (hindex == 0)) { -- h[hindex++] = Q; -- } -- return hindex; --} -- --/*****************************************************************************/ --/* */ --/* scale_expansion_zeroelim() Multiply an expansion by a scalar, */ --/* eliminating zero components from the */ --/* output expansion. */ --/* */ --/* Sets h = be. See my Robust Predicates paper for details. */ --/* */ --/* Maintains the nonoverlapping property. If round-to-even is used (as */ --/* with IEEE 754), maintains the strongly nonoverlapping and nonadjacent */ --/* properties as well. (That is, if e has one of these properties, so */ --/* will h.) */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h) --#else /* not ANSI_DECLARATORS */ --int scale_expansion_zeroelim(elen, e, b, h) /* e and h cannot be the same. */ --int elen; --REAL *e; --REAL b; --REAL *h; --#endif /* not ANSI_DECLARATORS */ -- --{ -- INEXACT REAL Q, sum; -- REAL hh; -- INEXACT REAL product1; -- REAL product0; -- int eindex, hindex; -- REAL enow; -- INEXACT REAL bvirt; -- REAL avirt, bround, around; -- INEXACT REAL c; -- INEXACT REAL abig; -- REAL ahi, alo, bhi, blo; -- REAL err1, err2, err3; -- -- Split(b, bhi, blo); -- Two_Product_Presplit(e[0], b, bhi, blo, Q, hh); -- hindex = 0; -- if (hh != 0) { -- h[hindex++] = hh; -- } -- for (eindex = 1; eindex < elen; eindex++) { -- enow = e[eindex]; -- Two_Product_Presplit(enow, b, bhi, blo, product1, product0); -- Two_Sum(Q, product0, sum, hh); -- if (hh != 0) { -- h[hindex++] = hh; -- } -- Fast_Two_Sum(product1, sum, Q, hh); -- if (hh != 0) { -- h[hindex++] = hh; -- } -- } -- if ((Q != 0.0) || (hindex == 0)) { -- h[hindex++] = Q; -- } -- return hindex; --} -- --/*****************************************************************************/ --/* */ --/* estimate() Produce a one-word estimate of an expansion's value. */ --/* */ --/* See my Robust Predicates paper for details. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --REAL estimate(int elen, REAL *e) --#else /* not ANSI_DECLARATORS */ --REAL estimate(elen, e) --int elen; --REAL *e; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL Q; -- int eindex; -- -- Q = e[0]; -- for (eindex = 1; eindex < elen; eindex++) { -- Q += e[eindex]; -- } -- return Q; --} -- --/*****************************************************************************/ --/* */ --/* counterclockwise() Return a positive value if the points pa, pb, and */ --/* pc occur in counterclockwise order; a negative */ --/* value if they occur in clockwise order; and zero */ --/* if they are collinear. The result is also a rough */ --/* approximation of twice the signed area of the */ --/* triangle defined by the three points. */ --/* */ --/* Uses exact arithmetic if necessary to ensure a correct answer. The */ --/* result returned is the determinant of a matrix. This determinant is */ --/* computed adaptively, in the sense that exact arithmetic is used only to */ --/* the degree it is needed to ensure that the returned value has the */ --/* correct sign. Hence, this function is usually quite fast, but will run */ --/* more slowly when the input points are collinear or nearly so. */ --/* */ --/* See my Robust Predicates paper for details. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --REAL counterclockwiseadapt(vertex pa, vertex pb, vertex pc, REAL detsum) --#else /* not ANSI_DECLARATORS */ --REAL counterclockwiseadapt(pa, pb, pc, detsum) --vertex pa; --vertex pb; --vertex pc; --REAL detsum; --#endif /* not ANSI_DECLARATORS */ -- --{ -- INEXACT REAL acx, acy, bcx, bcy; -- REAL acxtail, acytail, bcxtail, bcytail; -- INEXACT REAL detleft, detright; -- REAL detlefttail, detrighttail; -- REAL det, errbound; -- REAL B[4] = {0.}, C1[8] = {0.}, C2[12] = {0.}, D[16] = {0.}; -- INEXACT REAL B3; -- int C1length, C2length, Dlength; -- REAL u[4] = {0.}; -- INEXACT REAL u3; -- INEXACT REAL s1, t1; -- REAL s0, t0; -- -- INEXACT REAL bvirt; -- REAL avirt, bround, around; -- INEXACT REAL c; -- INEXACT REAL abig; -- REAL ahi, alo, bhi, blo; -- REAL err1, err2, err3; -- INEXACT REAL _i, _j; -- REAL _0; -- -- acx = (REAL) (pa[0] - pc[0]); -- bcx = (REAL) (pb[0] - pc[0]); -- acy = (REAL) (pa[1] - pc[1]); -- bcy = (REAL) (pb[1] - pc[1]); -- -- Two_Product(acx, bcy, detleft, detlefttail); -- Two_Product(acy, bcx, detright, detrighttail); -- -- Two_Two_Diff(detleft, detlefttail, detright, detrighttail, -- B3, B[2], B[1], B[0]); -- B[3] = B3; -- -- det = estimate(4, B); -- errbound = ccwerrboundB * detsum; -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- Two_Diff_Tail(pa[0], pc[0], acx, acxtail); -- Two_Diff_Tail(pb[0], pc[0], bcx, bcxtail); -- Two_Diff_Tail(pa[1], pc[1], acy, acytail); -- Two_Diff_Tail(pb[1], pc[1], bcy, bcytail); -- -- if ((acxtail == 0.0) && (acytail == 0.0) -- && (bcxtail == 0.0) && (bcytail == 0.0)) { -- return det; -- } -- -- errbound = ccwerrboundC * detsum + resulterrbound * Absolute(det); -- det += (acx * bcytail + bcy * acxtail) -- - (acy * bcxtail + bcx * acytail); -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- Two_Product(acxtail, bcy, s1, s0); -- Two_Product(acytail, bcx, t1, t0); -- Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- C1length = fast_expansion_sum_zeroelim(4, B, 4, u, C1); -- -- Two_Product(acx, bcytail, s1, s0); -- Two_Product(acy, bcxtail, t1, t0); -- Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- C2length = fast_expansion_sum_zeroelim(C1length, C1, 4, u, C2); -- -- Two_Product(acxtail, bcytail, s1, s0); -- Two_Product(acytail, bcxtail, t1, t0); -- Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- Dlength = fast_expansion_sum_zeroelim(C2length, C2, 4, u, D); -- -- return(D[Dlength - 1]); --} -- --#ifdef ANSI_DECLARATORS --REAL counterclockwise(struct mesh *m, struct behavior *b, -- vertex pa, vertex pb, vertex pc) --#else /* not ANSI_DECLARATORS */ --REAL counterclockwise(m, b, pa, pb, pc) --struct mesh *m; --struct behavior *b; --vertex pa; --vertex pb; --vertex pc; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL detleft, detright, det; -- REAL detsum, errbound; -- -- m->counterclockcount++; -- -- detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]); -- detright = (pa[1] - pc[1]) * (pb[0] - pc[0]); -- det = detleft - detright; -- -- if (b->noexact) { -- return det; -- } -- -- if (detleft > 0.0) { -- if (detright <= 0.0) { -- return det; -- } else { -- detsum = detleft + detright; -- } -- } else if (detleft < 0.0) { -- if (detright >= 0.0) { -- return det; -- } else { -- detsum = -detleft - detright; -- } -- } else { -- return det; -- } -- -- errbound = ccwerrboundA * detsum; -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- return counterclockwiseadapt(pa, pb, pc, detsum); --} -- --/*****************************************************************************/ --/* */ --/* incircle() Return a positive value if the point pd lies inside the */ --/* circle passing through pa, pb, and pc; a negative value if */ --/* it lies outside; and zero if the four points are cocircular.*/ --/* The points pa, pb, and pc must be in counterclockwise */ --/* order, or the sign of the result will be reversed. */ --/* */ --/* Uses exact arithmetic if necessary to ensure a correct answer. The */ --/* result returned is the determinant of a matrix. This determinant is */ --/* computed adaptively, in the sense that exact arithmetic is used only to */ --/* the degree it is needed to ensure that the returned value has the */ --/* correct sign. Hence, this function is usually quite fast, but will run */ --/* more slowly when the input points are cocircular or nearly so. */ --/* */ --/* See my Robust Predicates paper for details. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --REAL incircleadapt(vertex pa, vertex pb, vertex pc, vertex pd, REAL permanent) --#else /* not ANSI_DECLARATORS */ --REAL incircleadapt(pa, pb, pc, pd, permanent) --vertex pa; --vertex pb; --vertex pc; --vertex pd; --REAL permanent; --#endif /* not ANSI_DECLARATORS */ -- --{ -- INEXACT REAL adx, bdx, cdx, ady, bdy, cdy; -- REAL det, errbound; -- -- INEXACT REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1; -- REAL bdxcdy0, cdxbdy0, cdxady0, adxcdy0, adxbdy0, bdxady0; -- REAL bc[4], ca[4], ab[4]; -- INEXACT REAL bc3, ca3, ab3; -- REAL axbc[8], axxbc[16] ={0.}, aybc[8], ayybc[16] = {0.}, adet[32] = {0.}; -- int axbclen, axxbclen, aybclen, ayybclen, alen; -- REAL bxca[8], bxxca[16] = {0.}, byca[8], byyca[16] = {0.}, bdet[32] = {0.}; -- int bxcalen, bxxcalen, bycalen, byycalen, blen; -- REAL cxab[8], cxxab[16] = {0.}, cyab[8], cyyab[16] = {0.}, cdet[32] = {0.}; -- int cxablen, cxxablen, cyablen, cyyablen, clen; -- REAL abdet[64] = {0,}; -- int ablen; -- REAL fin1[1152] = {0.}, fin2[1152] = {0.}; -- REAL *finnow, *finother, *finswap; -- int finlength; -- -- REAL adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; -- INEXACT REAL adxadx1, adyady1, bdxbdx1, bdybdy1, cdxcdx1, cdycdy1; -- REAL adxadx0, adyady0, bdxbdx0, bdybdy0, cdxcdx0, cdycdy0; -- REAL aa[4], bb[4], cc[4]; -- INEXACT REAL aa3, bb3, cc3; -- INEXACT REAL ti1, tj1; -- REAL ti0, tj0; -- REAL u[4] = {0.}, v[4] = {0.}; -- INEXACT REAL u3, v3; -- REAL temp8[8], temp16a[16] = {0.}, temp16b[16] = {0.}, temp16c[16] = {0.}; -- REAL temp32a[32] = {0.}, temp32b[32] = {0.}, temp48[48] = {0.}, temp64[64] = {0.}; -- int temp8len, temp16alen, temp16blen, temp16clen; -- int temp32alen, temp32blen, temp48len, temp64len; -- REAL axtbb[8], axtcc[8], aytbb[8], aytcc[8]; -- int axtbblen, axtcclen, aytbblen, aytcclen; -- REAL bxtaa[8], bxtcc[8], bytaa[8], bytcc[8]; -- int bxtaalen, bxtcclen, bytaalen, bytcclen; -- REAL cxtaa[8], cxtbb[8], cytaa[8], cytbb[8]; -- int cxtaalen, cxtbblen, cytaalen, cytbblen; -- REAL axtbc[8], aytbc[8], bxtca[8], bytca[8], cxtab[8], cytab[8]; -- int axtbclen = 8, aytbclen = 8, bxtcalen = 8, bytcalen = 8, cxtablen = 8, cytablen = 8; -- REAL axtbct[16], aytbct[16], bxtcat[16], bytcat[16], cxtabt[16], cytabt[16]; -- int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen; -- REAL axtbctt[8], aytbctt[8], bxtcatt[8]; -- REAL bytcatt[8], cxtabtt[8], cytabtt[8]; -- int axtbcttlen, aytbcttlen, bxtcattlen, bytcattlen, cxtabttlen, cytabttlen; -- REAL abt[8], bct[8], cat[8]; -- int abtlen, bctlen, catlen; -- REAL abtt[4], bctt[4], catt[4]; -- int abttlen, bcttlen, cattlen; -- INEXACT REAL abtt3, bctt3, catt3; -- REAL negate; -- -- INEXACT REAL bvirt; -- REAL avirt, bround, around; -- INEXACT REAL c; -- INEXACT REAL abig; -- REAL ahi, alo, bhi, blo; -- REAL err1, err2, err3; -- INEXACT REAL _i, _j; -- REAL _0; -- -- adx = (REAL) (pa[0] - pd[0]); -- bdx = (REAL) (pb[0] - pd[0]); -- cdx = (REAL) (pc[0] - pd[0]); -- ady = (REAL) (pa[1] - pd[1]); -- bdy = (REAL) (pb[1] - pd[1]); -- cdy = (REAL) (pc[1] - pd[1]); -- -- Two_Product(bdx, cdy, bdxcdy1, bdxcdy0); -- Two_Product(cdx, bdy, cdxbdy1, cdxbdy0); -- Two_Two_Diff(bdxcdy1, bdxcdy0, cdxbdy1, cdxbdy0, bc3, bc[2], bc[1], bc[0]); -- bc[3] = bc3; -- axbclen = scale_expansion_zeroelim(4, bc, adx, axbc); -- axxbclen = scale_expansion_zeroelim(axbclen, axbc, adx, axxbc); -- aybclen = scale_expansion_zeroelim(4, bc, ady, aybc); -- ayybclen = scale_expansion_zeroelim(aybclen, aybc, ady, ayybc); -- alen = fast_expansion_sum_zeroelim(axxbclen, axxbc, ayybclen, ayybc, adet); -- -- Two_Product(cdx, ady, cdxady1, cdxady0); -- Two_Product(adx, cdy, adxcdy1, adxcdy0); -- Two_Two_Diff(cdxady1, cdxady0, adxcdy1, adxcdy0, ca3, ca[2], ca[1], ca[0]); -- ca[3] = ca3; -- bxcalen = scale_expansion_zeroelim(4, ca, bdx, bxca); -- bxxcalen = scale_expansion_zeroelim(bxcalen, bxca, bdx, bxxca); -- bycalen = scale_expansion_zeroelim(4, ca, bdy, byca); -- byycalen = scale_expansion_zeroelim(bycalen, byca, bdy, byyca); -- blen = fast_expansion_sum_zeroelim(bxxcalen, bxxca, byycalen, byyca, bdet); -- -- Two_Product(adx, bdy, adxbdy1, adxbdy0); -- Two_Product(bdx, ady, bdxady1, bdxady0); -- Two_Two_Diff(adxbdy1, adxbdy0, bdxady1, bdxady0, ab3, ab[2], ab[1], ab[0]); -- ab[3] = ab3; -- cxablen = scale_expansion_zeroelim(4, ab, cdx, cxab); -- cxxablen = scale_expansion_zeroelim(cxablen, cxab, cdx, cxxab); -- cyablen = scale_expansion_zeroelim(4, ab, cdy, cyab); -- cyyablen = scale_expansion_zeroelim(cyablen, cyab, cdy, cyyab); -- clen = fast_expansion_sum_zeroelim(cxxablen, cxxab, cyyablen, cyyab, cdet); -- -- ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet); -- finlength = fast_expansion_sum_zeroelim(ablen, abdet, clen, cdet, fin1); -- -- det = estimate(finlength, fin1); -- errbound = iccerrboundB * permanent; -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- Two_Diff_Tail(pa[0], pd[0], adx, adxtail); -- Two_Diff_Tail(pa[1], pd[1], ady, adytail); -- Two_Diff_Tail(pb[0], pd[0], bdx, bdxtail); -- Two_Diff_Tail(pb[1], pd[1], bdy, bdytail); -- Two_Diff_Tail(pc[0], pd[0], cdx, cdxtail); -- Two_Diff_Tail(pc[1], pd[1], cdy, cdytail); -- if ((adxtail == 0.0) && (bdxtail == 0.0) && (cdxtail == 0.0) -- && (adytail == 0.0) && (bdytail == 0.0) && (cdytail == 0.0)) { -- return det; -- } -- -- errbound = iccerrboundC * permanent + resulterrbound * Absolute(det); -- det += ((adx * adx + ady * ady) * ((bdx * cdytail + cdy * bdxtail) -- - (bdy * cdxtail + cdx * bdytail)) -- + 2.0 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx)) -- + ((bdx * bdx + bdy * bdy) * ((cdx * adytail + ady * cdxtail) -- - (cdy * adxtail + adx * cdytail)) -- + 2.0 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) -- + ((cdx * cdx + cdy * cdy) * ((adx * bdytail + bdy * adxtail) -- - (ady * bdxtail + bdx * adytail)) -- + 2.0 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- finnow = fin1; -- finother = fin2; -- -- if ((bdxtail != 0.0) || (bdytail != 0.0) -- || (cdxtail != 0.0) || (cdytail != 0.0)) { -- Square(adx, adxadx1, adxadx0); -- Square(ady, adyady1, adyady0); -- Two_Two_Sum(adxadx1, adxadx0, adyady1, adyady0, aa3, aa[2], aa[1], aa[0]); -- aa[3] = aa3; -- } -- if ((cdxtail != 0.0) || (cdytail != 0.0) -- || (adxtail != 0.0) || (adytail != 0.0)) { -- Square(bdx, bdxbdx1, bdxbdx0); -- Square(bdy, bdybdy1, bdybdy0); -- Two_Two_Sum(bdxbdx1, bdxbdx0, bdybdy1, bdybdy0, bb3, bb[2], bb[1], bb[0]); -- bb[3] = bb3; -- } -- if ((adxtail != 0.0) || (adytail != 0.0) -- || (bdxtail != 0.0) || (bdytail != 0.0)) { -- Square(cdx, cdxcdx1, cdxcdx0); -- Square(cdy, cdycdy1, cdycdy0); -- Two_Two_Sum(cdxcdx1, cdxcdx0, cdycdy1, cdycdy0, cc3, cc[2], cc[1], cc[0]); -- cc[3] = cc3; -- } -- -- if (adxtail != 0.0) { -- axtbclen = scale_expansion_zeroelim(4, bc, adxtail, axtbc); -- temp16alen = scale_expansion_zeroelim(axtbclen, axtbc, 2.0 * adx, -- temp16a); -- -- axtcclen = scale_expansion_zeroelim(4, cc, adxtail, axtcc); -- temp16blen = scale_expansion_zeroelim(axtcclen, axtcc, bdy, temp16b); -- -- axtbblen = scale_expansion_zeroelim(4, bb, adxtail, axtbb); -- temp16clen = scale_expansion_zeroelim(axtbblen, axtbb, -cdy, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (adytail != 0.0) { -- aytbclen = scale_expansion_zeroelim(4, bc, adytail, aytbc); -- temp16alen = scale_expansion_zeroelim(aytbclen, aytbc, 2.0 * ady, -- temp16a); -- -- aytbblen = scale_expansion_zeroelim(4, bb, adytail, aytbb); -- temp16blen = scale_expansion_zeroelim(aytbblen, aytbb, cdx, temp16b); -- -- aytcclen = scale_expansion_zeroelim(4, cc, adytail, aytcc); -- temp16clen = scale_expansion_zeroelim(aytcclen, aytcc, -bdx, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdxtail != 0.0) { -- bxtcalen = scale_expansion_zeroelim(4, ca, bdxtail, bxtca); -- temp16alen = scale_expansion_zeroelim(bxtcalen, bxtca, 2.0 * bdx, -- temp16a); -- -- bxtaalen = scale_expansion_zeroelim(4, aa, bdxtail, bxtaa); -- temp16blen = scale_expansion_zeroelim(bxtaalen, bxtaa, cdy, temp16b); -- -- bxtcclen = scale_expansion_zeroelim(4, cc, bdxtail, bxtcc); -- temp16clen = scale_expansion_zeroelim(bxtcclen, bxtcc, -ady, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdytail != 0.0) { -- bytcalen = scale_expansion_zeroelim(4, ca, bdytail, bytca); -- temp16alen = scale_expansion_zeroelim(bytcalen, bytca, 2.0 * bdy, -- temp16a); -- -- bytcclen = scale_expansion_zeroelim(4, cc, bdytail, bytcc); -- temp16blen = scale_expansion_zeroelim(bytcclen, bytcc, adx, temp16b); -- -- bytaalen = scale_expansion_zeroelim(4, aa, bdytail, bytaa); -- temp16clen = scale_expansion_zeroelim(bytaalen, bytaa, -cdx, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdxtail != 0.0) { -- cxtablen = scale_expansion_zeroelim(4, ab, cdxtail, cxtab); -- temp16alen = scale_expansion_zeroelim(cxtablen, cxtab, 2.0 * cdx, -- temp16a); -- -- cxtbblen = scale_expansion_zeroelim(4, bb, cdxtail, cxtbb); -- temp16blen = scale_expansion_zeroelim(cxtbblen, cxtbb, ady, temp16b); -- -- cxtaalen = scale_expansion_zeroelim(4, aa, cdxtail, cxtaa); -- temp16clen = scale_expansion_zeroelim(cxtaalen, cxtaa, -bdy, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdytail != 0.0) { -- cytablen = scale_expansion_zeroelim(4, ab, cdytail, cytab); -- temp16alen = scale_expansion_zeroelim(cytablen, cytab, 2.0 * cdy, -- temp16a); -- -- cytaalen = scale_expansion_zeroelim(4, aa, cdytail, cytaa); -- temp16blen = scale_expansion_zeroelim(cytaalen, cytaa, bdx, temp16b); -- -- cytbblen = scale_expansion_zeroelim(4, bb, cdytail, cytbb); -- temp16clen = scale_expansion_zeroelim(cytbblen, cytbb, -adx, temp16c); -- -- temp32alen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16clen, temp16c, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- -- if ((adxtail != 0.0) || (adytail != 0.0)) { -- if ((bdxtail != 0.0) || (bdytail != 0.0) -- || (cdxtail != 0.0) || (cdytail != 0.0)) { -- Two_Product(bdxtail, cdy, ti1, ti0); -- Two_Product(bdx, cdytail, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- negate = -bdy; -- Two_Product(cdxtail, negate, ti1, ti0); -- negate = -bdytail; -- Two_Product(cdx, negate, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, v3, v[2], v[1], v[0]); -- v[3] = v3; -- bctlen = fast_expansion_sum_zeroelim(4, u, 4, v, bct); -- -- Two_Product(bdxtail, cdytail, ti1, ti0); -- Two_Product(cdxtail, bdytail, tj1, tj0); -- Two_Two_Diff(ti1, ti0, tj1, tj0, bctt3, bctt[2], bctt[1], bctt[0]); -- bctt[3] = bctt3; -- bcttlen = 4; -- } else { -- bct[0] = 0.0; -- bctlen = 1; -- bctt[0] = 0.0; -- bcttlen = 1; -- } -- -- if (adxtail != 0.0) { -- temp16alen = scale_expansion_zeroelim(axtbclen, axtbc, adxtail, temp16a); -- axtbctlen = scale_expansion_zeroelim(bctlen, bct, adxtail, axtbct); -- temp32alen = scale_expansion_zeroelim(axtbctlen, axtbct, 2.0 * adx, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (bdytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, cc, adxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, bdytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, bb, -adxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, cdytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- -- temp32alen = scale_expansion_zeroelim(axtbctlen, axtbct, adxtail, -- temp32a); -- axtbcttlen = scale_expansion_zeroelim(bcttlen, bctt, adxtail, axtbctt); -- temp16alen = scale_expansion_zeroelim(axtbcttlen, axtbctt, 2.0 * adx, -- temp16a); -- temp16blen = scale_expansion_zeroelim(axtbcttlen, axtbctt, adxtail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (adytail != 0.0) { -- temp16alen = scale_expansion_zeroelim(aytbclen, aytbc, adytail, temp16a); -- aytbctlen = scale_expansion_zeroelim(bctlen, bct, adytail, aytbct); -- temp32alen = scale_expansion_zeroelim(aytbctlen, aytbct, 2.0 * ady, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- -- temp32alen = scale_expansion_zeroelim(aytbctlen, aytbct, adytail, -- temp32a); -- aytbcttlen = scale_expansion_zeroelim(bcttlen, bctt, adytail, aytbctt); -- temp16alen = scale_expansion_zeroelim(aytbcttlen, aytbctt, 2.0 * ady, -- temp16a); -- temp16blen = scale_expansion_zeroelim(aytbcttlen, aytbctt, adytail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- if ((bdxtail != 0.0) || (bdytail != 0.0)) { -- if ((cdxtail != 0.0) || (cdytail != 0.0) -- || (adxtail != 0.0) || (adytail != 0.0)) { -- Two_Product(cdxtail, ady, ti1, ti0); -- Two_Product(cdx, adytail, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- negate = -cdy; -- Two_Product(adxtail, negate, ti1, ti0); -- negate = -cdytail; -- Two_Product(adx, negate, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, v3, v[2], v[1], v[0]); -- v[3] = v3; -- catlen = fast_expansion_sum_zeroelim(4, u, 4, v, cat); -- -- Two_Product(cdxtail, adytail, ti1, ti0); -- Two_Product(adxtail, cdytail, tj1, tj0); -- Two_Two_Diff(ti1, ti0, tj1, tj0, catt3, catt[2], catt[1], catt[0]); -- catt[3] = catt3; -- cattlen = 4; -- } else { -- cat[0] = 0.0; -- catlen = 1; -- catt[0] = 0.0; -- cattlen = 1; -- } -- -- if (bdxtail != 0.0) { -- temp16alen = scale_expansion_zeroelim(bxtcalen, bxtca, bdxtail, temp16a); -- bxtcatlen = scale_expansion_zeroelim(catlen, cat, bdxtail, bxtcat); -- temp32alen = scale_expansion_zeroelim(bxtcatlen, bxtcat, 2.0 * bdx, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (cdytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, aa, bdxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, cdytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (adytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, cc, -bdxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, adytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- -- temp32alen = scale_expansion_zeroelim(bxtcatlen, bxtcat, bdxtail, -- temp32a); -- bxtcattlen = scale_expansion_zeroelim(cattlen, catt, bdxtail, bxtcatt); -- temp16alen = scale_expansion_zeroelim(bxtcattlen, bxtcatt, 2.0 * bdx, -- temp16a); -- temp16blen = scale_expansion_zeroelim(bxtcattlen, bxtcatt, bdxtail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdytail != 0.0) { -- temp16alen = scale_expansion_zeroelim(bytcalen, bytca, bdytail, temp16a); -- bytcatlen = scale_expansion_zeroelim(catlen, cat, bdytail, bytcat); -- temp32alen = scale_expansion_zeroelim(bytcatlen, bytcat, 2.0 * bdy, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- -- temp32alen = scale_expansion_zeroelim(bytcatlen, bytcat, bdytail, -- temp32a); -- bytcattlen = scale_expansion_zeroelim(cattlen, catt, bdytail, bytcatt); -- temp16alen = scale_expansion_zeroelim(bytcattlen, bytcatt, 2.0 * bdy, -- temp16a); -- temp16blen = scale_expansion_zeroelim(bytcattlen, bytcatt, bdytail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- if ((cdxtail != 0.0) || (cdytail != 0.0)) { -- if ((adxtail != 0.0) || (adytail != 0.0) -- || (bdxtail != 0.0) || (bdytail != 0.0)) { -- Two_Product(adxtail, bdy, ti1, ti0); -- Two_Product(adx, bdytail, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, u3, u[2], u[1], u[0]); -- u[3] = u3; -- negate = -ady; -- Two_Product(bdxtail, negate, ti1, ti0); -- negate = -adytail; -- Two_Product(bdx, negate, tj1, tj0); -- Two_Two_Sum(ti1, ti0, tj1, tj0, v3, v[2], v[1], v[0]); -- v[3] = v3; -- abtlen = fast_expansion_sum_zeroelim(4, u, 4, v, abt); -- -- Two_Product(adxtail, bdytail, ti1, ti0); -- Two_Product(bdxtail, adytail, tj1, tj0); -- Two_Two_Diff(ti1, ti0, tj1, tj0, abtt3, abtt[2], abtt[1], abtt[0]); -- abtt[3] = abtt3; -- abttlen = 4; -- } else { -- abt[0] = 0.0; -- abtlen = 1; -- abtt[0] = 0.0; -- abttlen = 1; -- } -- -- if (cdxtail != 0.0) { -- temp16alen = scale_expansion_zeroelim(cxtablen, cxtab, cdxtail, temp16a); -- cxtabtlen = scale_expansion_zeroelim(abtlen, abt, cdxtail, cxtabt); -- temp32alen = scale_expansion_zeroelim(cxtabtlen, cxtabt, 2.0 * cdx, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (adytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, bb, cdxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, adytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdytail != 0.0) { -- temp8len = scale_expansion_zeroelim(4, aa, -cdxtail, temp8); -- temp16alen = scale_expansion_zeroelim(temp8len, temp8, bdytail, -- temp16a); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp16alen, -- temp16a, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- -- temp32alen = scale_expansion_zeroelim(cxtabtlen, cxtabt, cdxtail, -- temp32a); -- cxtabttlen = scale_expansion_zeroelim(abttlen, abtt, cdxtail, cxtabtt); -- temp16alen = scale_expansion_zeroelim(cxtabttlen, cxtabtt, 2.0 * cdx, -- temp16a); -- temp16blen = scale_expansion_zeroelim(cxtabttlen, cxtabtt, cdxtail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdytail != 0.0) { -- temp16alen = scale_expansion_zeroelim(cytablen, cytab, cdytail, temp16a); -- cytabtlen = scale_expansion_zeroelim(abtlen, abt, cdytail, cytabt); -- temp32alen = scale_expansion_zeroelim(cytabtlen, cytabt, 2.0 * cdy, -- temp32a); -- temp48len = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp32alen, temp32a, temp48); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp48len, -- temp48, finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- -- temp32alen = scale_expansion_zeroelim(cytabtlen, cytabt, cdytail, -- temp32a); -- cytabttlen = scale_expansion_zeroelim(abttlen, abtt, cdytail, cytabtt); -- temp16alen = scale_expansion_zeroelim(cytabttlen, cytabtt, 2.0 * cdy, -- temp16a); -- temp16blen = scale_expansion_zeroelim(cytabttlen, cytabtt, cdytail, -- temp16b); -- temp32blen = fast_expansion_sum_zeroelim(temp16alen, temp16a, -- temp16blen, temp16b, temp32b); -- temp64len = fast_expansion_sum_zeroelim(temp32alen, temp32a, -- temp32blen, temp32b, temp64); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, temp64len, -- temp64, finother); -- finnow = finother; -- } -- } -- -- return finnow[finlength - 1]; --} -- --#ifdef ANSI_DECLARATORS --REAL incircle(struct mesh *m, struct behavior *b, -- vertex pa, vertex pb, vertex pc, vertex pd) --#else /* not ANSI_DECLARATORS */ --REAL incircle(m, b, pa, pb, pc, pd) --struct mesh *m; --struct behavior *b; --vertex pa; --vertex pb; --vertex pc; --vertex pd; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL adx, bdx, cdx, ady, bdy, cdy; -- REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady; -- REAL alift, blift, clift; -- REAL det; -- REAL permanent, errbound; -- -- m->incirclecount++; -- -- adx = pa[0] - pd[0]; -- bdx = pb[0] - pd[0]; -- cdx = pc[0] - pd[0]; -- ady = pa[1] - pd[1]; -- bdy = pb[1] - pd[1]; -- cdy = pc[1] - pd[1]; -- -- bdxcdy = bdx * cdy; -- cdxbdy = cdx * bdy; -- alift = adx * adx + ady * ady; -- -- cdxady = cdx * ady; -- adxcdy = adx * cdy; -- blift = bdx * bdx + bdy * bdy; -- -- adxbdy = adx * bdy; -- bdxady = bdx * ady; -- clift = cdx * cdx + cdy * cdy; -- -- det = alift * (bdxcdy - cdxbdy) -- + blift * (cdxady - adxcdy) -- + clift * (adxbdy - bdxady); -- -- if (b->noexact) { -- return det; -- } -- -- permanent = (Absolute(bdxcdy) + Absolute(cdxbdy)) * alift -- + (Absolute(cdxady) + Absolute(adxcdy)) * blift -- + (Absolute(adxbdy) + Absolute(bdxady)) * clift; -- errbound = iccerrboundA * permanent; -- if ((det > errbound) || (-det > errbound)) { -- return det; -- } -- -- return incircleadapt(pa, pb, pc, pd, permanent); --} -- --/*****************************************************************************/ --/* */ --/* orient3d() Return a positive value if the point pd lies below the */ --/* plane passing through pa, pb, and pc; "below" is defined so */ --/* that pa, pb, and pc appear in counterclockwise order when */ --/* viewed from above the plane. Returns a negative value if */ --/* pd lies above the plane. Returns zero if the points are */ --/* coplanar. The result is also a rough approximation of six */ --/* times the signed volume of the tetrahedron defined by the */ --/* four points. */ --/* */ --/* Uses exact arithmetic if necessary to ensure a correct answer. The */ --/* result returned is the determinant of a matrix. This determinant is */ --/* computed adaptively, in the sense that exact arithmetic is used only to */ --/* the degree it is needed to ensure that the returned value has the */ --/* correct sign. Hence, this function is usually quite fast, but will run */ --/* more slowly when the input points are coplanar or nearly so. */ --/* */ --/* See my Robust Predicates paper for details. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --REAL orient3dadapt(vertex pa, vertex pb, vertex pc, vertex pd, -- REAL aheight, REAL bheight, REAL cheight, REAL dheight, -- REAL permanent) --#else /* not ANSI_DECLARATORS */ --REAL orient3dadapt(pa, pb, pc, pd, -- aheight, bheight, cheight, dheight, permanent) --vertex pa; --vertex pb; --vertex pc; --vertex pd; --REAL aheight; --REAL bheight; --REAL cheight; --REAL dheight; --REAL permanent; --#endif /* not ANSI_DECLARATORS */ -- --{ -- INEXACT REAL adx, bdx, cdx, ady, bdy, cdy, adheight, bdheight, cdheight; -- REAL det, errbound; -- -- INEXACT REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1; -- REAL bdxcdy0, cdxbdy0, cdxady0, adxcdy0, adxbdy0, bdxady0; -- REAL bc[4], ca[4], ab[4]; -- INEXACT REAL bc3, ca3, ab3; -- REAL adet[8]={0.}, bdet[8]={0.}, cdet[8]={0.}; -- int alen, blen, clen; -- REAL abdet[16]={0.}; -- int ablen; -- REAL *finnow, *finother, *finswap; -- REAL fin1[192], fin2[192]; -- int finlength; -- -- REAL adxtail, bdxtail, cdxtail; -- REAL adytail, bdytail, cdytail; -- REAL adheighttail, bdheighttail, cdheighttail; -- INEXACT REAL at_blarge, at_clarge; -- INEXACT REAL bt_clarge, bt_alarge; -- INEXACT REAL ct_alarge, ct_blarge; -- REAL at_b[4]={0.}, at_c[4]={0.}, bt_c[4]={0.}, bt_a[4]={0.}, ct_a[4]={0.}, ct_b[4]={0.}; -- int at_blen, at_clen, bt_clen, bt_alen, ct_alen, ct_blen; -- INEXACT REAL bdxt_cdy1, cdxt_bdy1, cdxt_ady1; -- INEXACT REAL adxt_cdy1, adxt_bdy1, bdxt_ady1; -- REAL bdxt_cdy0, cdxt_bdy0, cdxt_ady0; -- REAL adxt_cdy0, adxt_bdy0, bdxt_ady0; -- INEXACT REAL bdyt_cdx1, cdyt_bdx1, cdyt_adx1; -- INEXACT REAL adyt_cdx1, adyt_bdx1, bdyt_adx1; -- REAL bdyt_cdx0, cdyt_bdx0, cdyt_adx0; -- REAL adyt_cdx0, adyt_bdx0, bdyt_adx0; -- REAL bct[8], cat[8], abt[8]; -- int bctlen, catlen, abtlen; -- INEXACT REAL bdxt_cdyt1, cdxt_bdyt1, cdxt_adyt1; -- INEXACT REAL adxt_cdyt1, adxt_bdyt1, bdxt_adyt1; -- REAL bdxt_cdyt0, cdxt_bdyt0, cdxt_adyt0; -- REAL adxt_cdyt0, adxt_bdyt0, bdxt_adyt0; -- REAL u[4]={0.}, v[12]={0.}, w[16]={0.}; -- INEXACT REAL u3; -- int vlength, wlength; -- REAL negate; -- -- INEXACT REAL bvirt; -- REAL avirt, bround, around; -- INEXACT REAL c; -- INEXACT REAL abig; -- REAL ahi, alo, bhi, blo; -- REAL err1, err2, err3; -- INEXACT REAL _i, _j, _k; -- REAL _0; -- -- adx = (REAL) (pa[0] - pd[0]); -- bdx = (REAL) (pb[0] - pd[0]); -- cdx = (REAL) (pc[0] - pd[0]); -- ady = (REAL) (pa[1] - pd[1]); -- bdy = (REAL) (pb[1] - pd[1]); -- cdy = (REAL) (pc[1] - pd[1]); -- adheight = (REAL) (aheight - dheight); -- bdheight = (REAL) (bheight - dheight); -- cdheight = (REAL) (cheight - dheight); -- -- Two_Product(bdx, cdy, bdxcdy1, bdxcdy0); -- Two_Product(cdx, bdy, cdxbdy1, cdxbdy0); -- Two_Two_Diff(bdxcdy1, bdxcdy0, cdxbdy1, cdxbdy0, bc3, bc[2], bc[1], bc[0]); -- bc[3] = bc3; -- alen = scale_expansion_zeroelim(4, bc, adheight, adet); -- -- Two_Product(cdx, ady, cdxady1, cdxady0); -- Two_Product(adx, cdy, adxcdy1, adxcdy0); -- Two_Two_Diff(cdxady1, cdxady0, adxcdy1, adxcdy0, ca3, ca[2], ca[1], ca[0]); -- ca[3] = ca3; -- blen = scale_expansion_zeroelim(4, ca, bdheight, bdet); -- -- Two_Product(adx, bdy, adxbdy1, adxbdy0); -- Two_Product(bdx, ady, bdxady1, bdxady0); -- Two_Two_Diff(adxbdy1, adxbdy0, bdxady1, bdxady0, ab3, ab[2], ab[1], ab[0]); -- ab[3] = ab3; -- clen = scale_expansion_zeroelim(4, ab, cdheight, cdet); -- -- ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet); -- finlength = fast_expansion_sum_zeroelim(ablen, abdet, clen, cdet, fin1); -- -- det = estimate(finlength, fin1); -- errbound = o3derrboundB * permanent; -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- Two_Diff_Tail(pa[0], pd[0], adx, adxtail); -- Two_Diff_Tail(pb[0], pd[0], bdx, bdxtail); -- Two_Diff_Tail(pc[0], pd[0], cdx, cdxtail); -- Two_Diff_Tail(pa[1], pd[1], ady, adytail); -- Two_Diff_Tail(pb[1], pd[1], bdy, bdytail); -- Two_Diff_Tail(pc[1], pd[1], cdy, cdytail); -- Two_Diff_Tail(aheight, dheight, adheight, adheighttail); -- Two_Diff_Tail(bheight, dheight, bdheight, bdheighttail); -- Two_Diff_Tail(cheight, dheight, cdheight, cdheighttail); -- -- if ((adxtail == 0.0) && (bdxtail == 0.0) && (cdxtail == 0.0) && -- (adytail == 0.0) && (bdytail == 0.0) && (cdytail == 0.0) && -- (adheighttail == 0.0) && -- (bdheighttail == 0.0) && -- (cdheighttail == 0.0)) { -- return det; -- } -- -- errbound = o3derrboundC * permanent + resulterrbound * Absolute(det); -- det += (adheight * ((bdx * cdytail + cdy * bdxtail) - -- (bdy * cdxtail + cdx * bdytail)) + -- adheighttail * (bdx * cdy - bdy * cdx)) + -- (bdheight * ((cdx * adytail + ady * cdxtail) - -- (cdy * adxtail + adx * cdytail)) + -- bdheighttail * (cdx * ady - cdy * adx)) + -- (cdheight * ((adx * bdytail + bdy * adxtail) - -- (ady * bdxtail + bdx * adytail)) + -- cdheighttail * (adx * bdy - ady * bdx)); -- if ((det >= errbound) || (-det >= errbound)) { -- return det; -- } -- -- finnow = fin1; -- finother = fin2; -- -- if (adxtail == 0.0) { -- if (adytail == 0.0) { -- at_b[0] = 0.0; -- at_blen = 1; -- at_c[0] = 0.0; -- at_clen = 1; -- } else { -- negate = -adytail; -- Two_Product(negate, bdx, at_blarge, at_b[0]); -- at_b[1] = at_blarge; -- at_blen = 2; -- Two_Product(adytail, cdx, at_clarge, at_c[0]); -- at_c[1] = at_clarge; -- at_clen = 2; -- } -- } else { -- if (adytail == 0.0) { -- Two_Product(adxtail, bdy, at_blarge, at_b[0]); -- at_b[1] = at_blarge; -- at_blen = 2; -- negate = -adxtail; -- Two_Product(negate, cdy, at_clarge, at_c[0]); -- at_c[1] = at_clarge; -- at_clen = 2; -- } else { -- Two_Product(adxtail, bdy, adxt_bdy1, adxt_bdy0); -- Two_Product(adytail, bdx, adyt_bdx1, adyt_bdx0); -- Two_Two_Diff(adxt_bdy1, adxt_bdy0, adyt_bdx1, adyt_bdx0, -- at_blarge, at_b[2], at_b[1], at_b[0]); -- at_b[3] = at_blarge; -- at_blen = 4; -- Two_Product(adytail, cdx, adyt_cdx1, adyt_cdx0); -- Two_Product(adxtail, cdy, adxt_cdy1, adxt_cdy0); -- Two_Two_Diff(adyt_cdx1, adyt_cdx0, adxt_cdy1, adxt_cdy0, -- at_clarge, at_c[2], at_c[1], at_c[0]); -- at_c[3] = at_clarge; -- at_clen = 4; -- } -- } -- if (bdxtail == 0.0) { -- if (bdytail == 0.0) { -- bt_c[0] = 0.0; -- bt_clen = 1; -- bt_a[0] = 0.0; -- bt_alen = 1; -- } else { -- negate = -bdytail; -- Two_Product(negate, cdx, bt_clarge, bt_c[0]); -- bt_c[1] = bt_clarge; -- bt_clen = 2; -- Two_Product(bdytail, adx, bt_alarge, bt_a[0]); -- bt_a[1] = bt_alarge; -- bt_alen = 2; -- } -- } else { -- if (bdytail == 0.0) { -- Two_Product(bdxtail, cdy, bt_clarge, bt_c[0]); -- bt_c[1] = bt_clarge; -- bt_clen = 2; -- negate = -bdxtail; -- Two_Product(negate, ady, bt_alarge, bt_a[0]); -- bt_a[1] = bt_alarge; -- bt_alen = 2; -- } else { -- Two_Product(bdxtail, cdy, bdxt_cdy1, bdxt_cdy0); -- Two_Product(bdytail, cdx, bdyt_cdx1, bdyt_cdx0); -- Two_Two_Diff(bdxt_cdy1, bdxt_cdy0, bdyt_cdx1, bdyt_cdx0, -- bt_clarge, bt_c[2], bt_c[1], bt_c[0]); -- bt_c[3] = bt_clarge; -- bt_clen = 4; -- Two_Product(bdytail, adx, bdyt_adx1, bdyt_adx0); -- Two_Product(bdxtail, ady, bdxt_ady1, bdxt_ady0); -- Two_Two_Diff(bdyt_adx1, bdyt_adx0, bdxt_ady1, bdxt_ady0, -- bt_alarge, bt_a[2], bt_a[1], bt_a[0]); -- bt_a[3] = bt_alarge; -- bt_alen = 4; -- } -- } -- if (cdxtail == 0.0) { -- if (cdytail == 0.0) { -- ct_a[0] = 0.0; -- ct_alen = 1; -- ct_b[0] = 0.0; -- ct_blen = 1; -- } else { -- negate = -cdytail; -- Two_Product(negate, adx, ct_alarge, ct_a[0]); -- ct_a[1] = ct_alarge; -- ct_alen = 2; -- Two_Product(cdytail, bdx, ct_blarge, ct_b[0]); -- ct_b[1] = ct_blarge; -- ct_blen = 2; -- } -- } else { -- if (cdytail == 0.0) { -- Two_Product(cdxtail, ady, ct_alarge, ct_a[0]); -- ct_a[1] = ct_alarge; -- ct_alen = 2; -- negate = -cdxtail; -- Two_Product(negate, bdy, ct_blarge, ct_b[0]); -- ct_b[1] = ct_blarge; -- ct_blen = 2; -- } else { -- Two_Product(cdxtail, ady, cdxt_ady1, cdxt_ady0); -- Two_Product(cdytail, adx, cdyt_adx1, cdyt_adx0); -- Two_Two_Diff(cdxt_ady1, cdxt_ady0, cdyt_adx1, cdyt_adx0, -- ct_alarge, ct_a[2], ct_a[1], ct_a[0]); -- ct_a[3] = ct_alarge; -- ct_alen = 4; -- Two_Product(cdytail, bdx, cdyt_bdx1, cdyt_bdx0); -- Two_Product(cdxtail, bdy, cdxt_bdy1, cdxt_bdy0); -- Two_Two_Diff(cdyt_bdx1, cdyt_bdx0, cdxt_bdy1, cdxt_bdy0, -- ct_blarge, ct_b[2], ct_b[1], ct_b[0]); -- ct_b[3] = ct_blarge; -- ct_blen = 4; -- } -- } -- -- bctlen = fast_expansion_sum_zeroelim(bt_clen, bt_c, ct_blen, ct_b, bct); -- wlength = scale_expansion_zeroelim(bctlen, bct, adheight, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- catlen = fast_expansion_sum_zeroelim(ct_alen, ct_a, at_clen, at_c, cat); -- wlength = scale_expansion_zeroelim(catlen, cat, bdheight, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- abtlen = fast_expansion_sum_zeroelim(at_blen, at_b, bt_alen, bt_a, abt); -- wlength = scale_expansion_zeroelim(abtlen, abt, cdheight, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- -- if (adheighttail != 0.0) { -- vlength = scale_expansion_zeroelim(4, bc, adheighttail, v); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, vlength, v, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdheighttail != 0.0) { -- vlength = scale_expansion_zeroelim(4, ca, bdheighttail, v); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, vlength, v, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdheighttail != 0.0) { -- vlength = scale_expansion_zeroelim(4, ab, cdheighttail, v); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, vlength, v, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- -- if (adxtail != 0.0) { -- if (bdytail != 0.0) { -- Two_Product(adxtail, bdytail, adxt_bdyt1, adxt_bdyt0); -- Two_One_Product(adxt_bdyt1, adxt_bdyt0, cdheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (cdheighttail != 0.0) { -- Two_One_Product(adxt_bdyt1, adxt_bdyt0, cdheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- if (cdytail != 0.0) { -- negate = -adxtail; -- Two_Product(negate, cdytail, adxt_cdyt1, adxt_cdyt0); -- Two_One_Product(adxt_cdyt1, adxt_cdyt0, bdheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (bdheighttail != 0.0) { -- Two_One_Product(adxt_cdyt1, adxt_cdyt0, bdheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- } -- if (bdxtail != 0.0) { -- if (cdytail != 0.0) { -- Two_Product(bdxtail, cdytail, bdxt_cdyt1, bdxt_cdyt0); -- Two_One_Product(bdxt_cdyt1, bdxt_cdyt0, adheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (adheighttail != 0.0) { -- Two_One_Product(bdxt_cdyt1, bdxt_cdyt0, adheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- if (adytail != 0.0) { -- negate = -bdxtail; -- Two_Product(negate, adytail, bdxt_adyt1, bdxt_adyt0); -- Two_One_Product(bdxt_adyt1, bdxt_adyt0, cdheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (cdheighttail != 0.0) { -- Two_One_Product(bdxt_adyt1, bdxt_adyt0, cdheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- } -- if (cdxtail != 0.0) { -- if (adytail != 0.0) { -- Two_Product(cdxtail, adytail, cdxt_adyt1, cdxt_adyt0); -- Two_One_Product(cdxt_adyt1, cdxt_adyt0, bdheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (bdheighttail != 0.0) { -- Two_One_Product(cdxt_adyt1, cdxt_adyt0, bdheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- if (bdytail != 0.0) { -- negate = -cdxtail; -- Two_Product(negate, bdytail, cdxt_bdyt1, cdxt_bdyt0); -- Two_One_Product(cdxt_bdyt1, cdxt_bdyt0, adheight, u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- if (adheighttail != 0.0) { -- Two_One_Product(cdxt_bdyt1, cdxt_bdyt0, adheighttail, -- u3, u[2], u[1], u[0]); -- u[3] = u3; -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, 4, u, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- } -- } -- -- if (adheighttail != 0.0) { -- wlength = scale_expansion_zeroelim(bctlen, bct, adheighttail, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (bdheighttail != 0.0) { -- wlength = scale_expansion_zeroelim(catlen, cat, bdheighttail, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finswap = finnow; finnow = finother; finother = finswap; -- } -- if (cdheighttail != 0.0) { -- wlength = scale_expansion_zeroelim(abtlen, abt, cdheighttail, w); -- finlength = fast_expansion_sum_zeroelim(finlength, finnow, wlength, w, -- finother); -- finnow = finother; -- } -- -- return finnow[finlength - 1]; --} -- --#ifdef ANSI_DECLARATORS --REAL orient3d(struct mesh *m, struct behavior *b, -- vertex pa, vertex pb, vertex pc, vertex pd, -- REAL aheight, REAL bheight, REAL cheight, REAL dheight) --#else /* not ANSI_DECLARATORS */ --REAL orient3d(m, b, pa, pb, pc, pd, aheight, bheight, cheight, dheight) --struct mesh *m; --struct behavior *b; --vertex pa; --vertex pb; --vertex pc; --vertex pd; --REAL aheight; --REAL bheight; --REAL cheight; --REAL dheight; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL adx, bdx, cdx, ady, bdy, cdy, adheight, bdheight, cdheight; -- REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady; -- REAL det; -- REAL permanent, errbound; -- -- m->orient3dcount++; -- -- adx = pa[0] - pd[0]; -- bdx = pb[0] - pd[0]; -- cdx = pc[0] - pd[0]; -- ady = pa[1] - pd[1]; -- bdy = pb[1] - pd[1]; -- cdy = pc[1] - pd[1]; -- adheight = aheight - dheight; -- bdheight = bheight - dheight; -- cdheight = cheight - dheight; -- -- bdxcdy = bdx * cdy; -- cdxbdy = cdx * bdy; -- -- cdxady = cdx * ady; -- adxcdy = adx * cdy; -- -- adxbdy = adx * bdy; -- bdxady = bdx * ady; -- -- det = adheight * (bdxcdy - cdxbdy) -- + bdheight * (cdxady - adxcdy) -- + cdheight * (adxbdy - bdxady); -- -- if (b->noexact) { -- return det; -- } -- -- permanent = (Absolute(bdxcdy) + Absolute(cdxbdy)) * Absolute(adheight) -- + (Absolute(cdxady) + Absolute(adxcdy)) * Absolute(bdheight) -- + (Absolute(adxbdy) + Absolute(bdxady)) * Absolute(cdheight); -- errbound = o3derrboundA * permanent; -- if ((det > errbound) || (-det > errbound)) { -- return det; -- } -- -- return orient3dadapt(pa, pb, pc, pd, aheight, bheight, cheight, dheight, -- permanent); --} -- --/*****************************************************************************/ --/* */ --/* nonregular() Return a positive value if the point pd is incompatible */ --/* with the circle or plane passing through pa, pb, and pc */ --/* (meaning that pd is inside the circle or below the */ --/* plane); a negative value if it is compatible; and zero if */ --/* the four points are cocircular/coplanar. The points pa, */ --/* pb, and pc must be in counterclockwise order, or the sign */ --/* of the result will be reversed. */ --/* */ --/* If the -w switch is used, the points are lifted onto the parabolic */ --/* lifting map, then they are dropped according to their weights, then the */ --/* 3D orientation test is applied. If the -W switch is used, the points' */ --/* heights are already provided, so the 3D orientation test is applied */ --/* directly. If neither switch is used, the incircle test is applied. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --REAL nonregular(struct mesh *m, struct behavior *b, -- vertex pa, vertex pb, vertex pc, vertex pd) --#else /* not ANSI_DECLARATORS */ --REAL nonregular(m, b, pa, pb, pc, pd) --struct mesh *m; --struct behavior *b; --vertex pa; --vertex pb; --vertex pc; --vertex pd; --#endif /* not ANSI_DECLARATORS */ -- --{ -- if (b->weighted == 0) { -- return incircle(m, b, pa, pb, pc, pd); -- } else if (b->weighted == 1) { -- return orient3d(m, b, pa, pb, pc, pd, -- pa[0] * pa[0] + pa[1] * pa[1] - pa[2], -- pb[0] * pb[0] + pb[1] * pb[1] - pb[2], -- pc[0] * pc[0] + pc[1] * pc[1] - pc[2], -- pd[0] * pd[0] + pd[1] * pd[1] - pd[2]); -- } else { -- return orient3d(m, b, pa, pb, pc, pd, pa[2], pb[2], pc[2], pd[2]); -- } --} -- --/*****************************************************************************/ --/* */ --/* findcircumcenter() Find the circumcenter of a triangle. */ --/* */ --/* The result is returned both in terms of x-y coordinates and xi-eta */ --/* (barycentric) coordinates. The xi-eta coordinate system is defined in */ --/* terms of the triangle: the origin of the triangle is the origin of the */ --/* coordinate system; the destination of the triangle is one unit along the */ --/* xi axis; and the apex of the triangle is one unit along the eta axis. */ --/* This procedure also returns the square of the length of the triangle's */ --/* shortest edge. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void findcircumcenter(struct mesh *m, struct behavior *b, -- vertex torg, vertex tdest, vertex tapex, -- vertex circumcenter, REAL *xi, REAL *eta, int offcenter) --#else /* not ANSI_DECLARATORS */ --void findcircumcenter(m, b, torg, tdest, tapex, circumcenter, xi, eta, -- offcenter) --struct mesh *m; --struct behavior *b; --vertex torg; --vertex tdest; --vertex tapex; --vertex circumcenter; --REAL *xi; --REAL *eta; --int offcenter; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL xdo, ydo, xao, yao; -- REAL dodist, aodist, dadist; -- REAL denominator; -- REAL dx, dy, dxoff, dyoff; -- -- m->circumcentercount++; -- -- /* Compute the circumcenter of the triangle. */ -- xdo = tdest[0] - torg[0]; -- ydo = tdest[1] - torg[1]; -- xao = tapex[0] - torg[0]; -- yao = tapex[1] - torg[1]; -- dodist = xdo * xdo + ydo * ydo; -- aodist = xao * xao + yao * yao; -- dadist = (tdest[0] - tapex[0]) * (tdest[0] - tapex[0]) + -- (tdest[1] - tapex[1]) * (tdest[1] - tapex[1]); -- if (b->noexact) { -- denominator = 0.5 / (xdo * yao - xao * ydo); -- } else { -- /* Use the counterclockwise() routine to ensure a positive (and */ -- /* reasonably accurate) result, avoiding any possibility of */ -- /* division by zero. */ -- denominator = 0.5 / counterclockwise(m, b, tdest, tapex, torg); -- /* Don't count the above as an orientation test. */ -- m->counterclockcount--; -- } -- dx = (yao * dodist - ydo * aodist) * denominator; -- dy = (xdo * aodist - xao * dodist) * denominator; -- -- /* Find the (squared) length of the triangle's shortest edge. This */ -- /* serves as a conservative estimate of the insertion radius of the */ -- /* circumcenter's parent. The estimate is used to ensure that */ -- /* the algorithm terminates even if very small angles appear in */ -- /* the input PSLG. */ -- if ((dodist < aodist) && (dodist < dadist)) { -- if (offcenter && (b->offconstant > 0.0)) { -- /* Find the position of the off-center, as described by Alper Ungor. */ -- dxoff = 0.5 * xdo - b->offconstant * ydo; -- dyoff = 0.5 * ydo + b->offconstant * xdo; -- /* If the off-center is closer to the origin than the */ -- /* circumcenter, use the off-center instead. */ -- if (dxoff * dxoff + dyoff * dyoff < dx * dx + dy * dy) { -- dx = dxoff; -- dy = dyoff; -- } -- } -- } else if (aodist < dadist) { -- if (offcenter && (b->offconstant > 0.0)) { -- dxoff = 0.5 * xao + b->offconstant * yao; -- dyoff = 0.5 * yao - b->offconstant * xao; -- /* If the off-center is closer to the origin than the */ -- /* circumcenter, use the off-center instead. */ -- if (dxoff * dxoff + dyoff * dyoff < dx * dx + dy * dy) { -- dx = dxoff; -- dy = dyoff; -- } -- } -- } else { -- if (offcenter && (b->offconstant > 0.0)) { -- dxoff = 0.5 * (tapex[0] - tdest[0]) - -- b->offconstant * (tapex[1] - tdest[1]); -- dyoff = 0.5 * (tapex[1] - tdest[1]) + -- b->offconstant * (tapex[0] - tdest[0]); -- /* If the off-center is closer to the destination than the */ -- /* circumcenter, use the off-center instead. */ -- if (dxoff * dxoff + dyoff * dyoff < -- (dx - xdo) * (dx - xdo) + (dy - ydo) * (dy - ydo)) { -- dx = xdo + dxoff; -- dy = ydo + dyoff; -- } -- } -- } -- -- circumcenter[0] = torg[0] + dx; -- circumcenter[1] = torg[1] + dy; -- -- /* To interpolate vertex attributes for the new vertex inserted at */ -- /* the circumcenter, define a coordinate system with a xi-axis, */ -- /* directed from the triangle's origin to its destination, and */ -- /* an eta-axis, directed from its origin to its apex. */ -- /* Calculate the xi and eta coordinates of the circumcenter. */ -- *xi = (yao * dx - xao * dy) * (2.0 * denominator); -- *eta = (xdo * dy - ydo * dx) * (2.0 * denominator); --} -- --/** **/ --/** **/ --/********* Geometric primitives end here *********/ -- --/*****************************************************************************/ --/* */ --/* triangleinit() Initialize some variables. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void triangleinit(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --void triangleinit(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- poolzero(&m->vertices); -- poolzero(&m->triangles); -- poolzero(&m->subsegs); -- poolzero(&m->viri); -- poolzero(&m->badsubsegs); -- poolzero(&m->badtriangles); -- poolzero(&m->flipstackers); -- poolzero(&m->splaynodes); -- -- m->recenttri.tri = (triangle *) NULL; /* No triangle has been visited yet. */ -- m->undeads = 0; /* No eliminated input vertices yet. */ -- m->samples = 1; /* Point location should take at least one sample. */ -- m->checksegments = 0; /* There are no segments in the triangulation yet. */ -- m->checkquality = 0; /* The quality triangulation stage has not begun. */ -- m->incirclecount = m->counterclockcount = m->orient3dcount = 0; -- m->hyperbolacount = m->circletopcount = m->circumcentercount = 0; -- randomseed = 1; -- -- exactinit(); /* Initialize exact arithmetic constants. */ --} -- --/*****************************************************************************/ --/* */ --/* randomnation() Generate a random number between 0 and `choices' - 1. */ --/* */ --/* This is a simple linear congruential random number generator. Hence, it */ --/* is a bad random number generator, but good enough for most randomized */ --/* geometric algorithms. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --TRIANGLE_PTRINT randomnation(unsigned int choices) --#else /* not ANSI_DECLARATORS */ --TRIANGLE_PTRINT randomnation(choices) --unsigned int choices; --#endif /* not ANSI_DECLARATORS */ -- --{ -- randomseed = (randomseed * 1366l + 150889l) % 714025l; -- return ( randomseed * (choices + 1 ) )/ 714025l; --} -- --/********* Mesh quality testing routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* checkmesh() Test the mesh for topological consistency. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void checkmesh(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void checkmesh(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop; -- struct otri oppotri, oppooppotri; -- vertex triorg, tridest, triapex; -- vertex oppoorg, oppodest; -- int horrors; -- int saveexact; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- /* Temporarily turn on exact arithmetic if it's off. */ -- saveexact = b->noexact; -- b->noexact = 0; -- if (!b->quiet) { -- printf(" Checking consistency of mesh...\n"); -- } -- horrors = 0; -- /* Run through the list of triangles, checking each one. */ -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- while (triangleloop.tri != (triangle *) NULL) { -- /* Check all three edges of the triangle. */ -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- org(triangleloop, triorg); -- dest(triangleloop, tridest); -- if (triangleloop.orient == 0) { /* Only test for inversion once. */ -- /* Test if the triangle is flat or inverted. */ -- apex(triangleloop, triapex); -- if (counterclockwise(m, b, triorg, tridest, triapex) <= 0.0) { -- printf(" !! !! Inverted "); -- printtriangle(m, b, &triangleloop); -- horrors++; -- } -- } -- /* Find the neighboring triangle on this edge. */ -- sym(triangleloop, oppotri); -- if (oppotri.tri != m->dummytri) { -- /* Check that the triangle's neighbor knows it's a neighbor. */ -- sym(oppotri, oppooppotri); -- if ((triangleloop.tri != oppooppotri.tri) -- || (triangleloop.orient != oppooppotri.orient)) { -- printf(" !! !! Asymmetric triangle-triangle bond:\n"); -- if (triangleloop.tri == oppooppotri.tri) { -- printf(" (Right triangle, wrong orientation)\n"); -- } -- printf(" First "); -- printtriangle(m, b, &triangleloop); -- printf(" Second (nonreciprocating) "); -- printtriangle(m, b, &oppotri); -- horrors++; -- } -- /* Check that both triangles agree on the identities */ -- /* of their shared vertices. */ -- org(oppotri, oppoorg); -- dest(oppotri, oppodest); -- if ((triorg != oppodest) || (tridest != oppoorg)) { -- printf(" !! !! Mismatched edge coordinates between two triangles:\n" -- ); -- printf(" First mismatched "); -- printtriangle(m, b, &triangleloop); -- printf(" Second mismatched "); -- printtriangle(m, b, &oppotri); -- horrors++; -- } -- } -- } -- triangleloop.tri = triangletraverse(m); -- } -- if (horrors == 0) { -- if (!b->quiet) { -- printf(" In my studied opinion, the mesh appears to be consistent.\n"); -- } -- } else if (horrors == 1) { -- printf(" !! !! !! !! Precisely one festering wound discovered.\n"); -- } else { -- printf(" !! !! !! !! %d abominations witnessed.\n", horrors); -- } -- /* Restore the status of exact arithmetic. */ -- b->noexact = saveexact; --} -- --#endif /* not REDUCED */ -- --/*****************************************************************************/ --/* */ --/* checkdelaunay() Ensure that the mesh is (constrained) Delaunay. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void checkdelaunay(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void checkdelaunay(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop; -- struct otri oppotri; -- struct osub opposubseg; -- vertex triorg, tridest, triapex; -- vertex oppoapex; -- int shouldbedelaunay; -- int horrors; -- int saveexact; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- /* Temporarily turn on exact arithmetic if it's off. */ -- saveexact = b->noexact; -- b->noexact = 0; -- if (!b->quiet) { -- printf(" Checking Delaunay property of mesh...\n"); -- } -- horrors = 0; -- /* Run through the list of triangles, checking each one. */ -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- while (triangleloop.tri != (triangle *) NULL) { -- /* Check all three edges of the triangle. */ -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- org(triangleloop, triorg); -- dest(triangleloop, tridest); -- apex(triangleloop, triapex); -- sym(triangleloop, oppotri); -- apex(oppotri, oppoapex); -- /* Only test that the edge is locally Delaunay if there is an */ -- /* adjoining triangle whose pointer is larger (to ensure that */ -- /* each pair isn't tested twice). */ -- shouldbedelaunay = (oppotri.tri != m->dummytri) && -- !deadtri(oppotri.tri) && (triangleloop.tri < oppotri.tri) && -- (triorg != m->infvertex1) && (triorg != m->infvertex2) && -- (triorg != m->infvertex3) && -- (tridest != m->infvertex1) && (tridest != m->infvertex2) && -- (tridest != m->infvertex3) && -- (triapex != m->infvertex1) && (triapex != m->infvertex2) && -- (triapex != m->infvertex3) && -- (oppoapex != m->infvertex1) && (oppoapex != m->infvertex2) && -- (oppoapex != m->infvertex3); -- if (m->checksegments && shouldbedelaunay) { -- /* If a subsegment separates the triangles, then the edge is */ -- /* constrained, so no local Delaunay test should be done. */ -- tspivot(triangleloop, opposubseg); -- if (opposubseg.ss != m->dummysub){ -- shouldbedelaunay = 0; -- } -- } -- if (shouldbedelaunay) { -- if (nonregular(m, b, triorg, tridest, triapex, oppoapex) > 0.0) { -- if (!b->weighted) { -- printf(" !! !! Non-Delaunay pair of triangles:\n"); -- printf(" First non-Delaunay "); -- printtriangle(m, b, &triangleloop); -- printf(" Second non-Delaunay "); -- } else { -- printf(" !! !! Non-regular pair of triangles:\n"); -- printf(" First non-regular "); -- printtriangle(m, b, &triangleloop); -- printf(" Second non-regular "); -- } -- printtriangle(m, b, &oppotri); -- horrors++; -- } -- } -- } -- triangleloop.tri = triangletraverse(m); -- } -- if (horrors == 0) { -- if (!b->quiet) { -- printf( -- " By virtue of my perceptive intelligence, I declare the mesh Delaunay.\n"); -- } -- } else if (horrors == 1) { -- printf( -- " !! !! !! !! Precisely one terrifying transgression identified.\n"); -- } else { -- printf(" !! !! !! !! %d obscenities viewed with horror.\n", horrors); -- } -- /* Restore the status of exact arithmetic. */ -- b->noexact = saveexact; --} -- --#endif /* not REDUCED */ -- --/*****************************************************************************/ --/* */ --/* enqueuebadtriang() Add a bad triangle data structure to the end of a */ --/* queue. */ --/* */ --/* The queue is actually a set of 4096 queues. I use multiple queues to */ --/* give priority to smaller angles. I originally implemented a heap, but */ --/* the queues are faster by a larger margin than I'd suspected. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void enqueuebadtriang(struct mesh *m, struct behavior *b, -- struct badtriang *badtri) --#else /* not ANSI_DECLARATORS */ --void enqueuebadtriang(m, b, badtri) --struct mesh *m; --struct behavior *b; --struct badtriang *badtri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL length, multiplier; -- int exponent, expincrement; -- int queuenumber; -- int posexponent; -- int i; -- -- if (b->verbose > 2) { -- printf(" Queueing bad triangle:\n"); -- printf(" (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- badtri->triangorg[0], badtri->triangorg[1], -- badtri->triangdest[0], badtri->triangdest[1], -- badtri->triangapex[0], badtri->triangapex[1]); -- } -- -- /* Determine the appropriate queue to put the bad triangle into. */ -- /* Recall that the key is the square of its shortest edge length. */ -- if (badtri->key >= 1.0) { -- length = badtri->key; -- posexponent = 1; -- } else { -- /* `badtri->key' is 2.0 to a negative exponent, so we'll record that */ -- /* fact and use the reciprocal of `badtri->key', which is > 1.0. */ -- length = 1.0 / badtri->key; -- posexponent = 0; -- } -- /* `length' is approximately 2.0 to what exponent? The following code */ -- /* determines the answer in time logarithmic in the exponent. */ -- exponent = 0; -- while (length > 2.0) { -- /* Find an approximation by repeated squaring of two. */ -- expincrement = 1; -- multiplier = 0.5; -- while (length * multiplier * multiplier > 1.0) { -- expincrement *= 2; -- multiplier *= multiplier; -- } -- /* Reduce the value of `length', then iterate if necessary. */ -- exponent += expincrement; -- length *= multiplier; -- } -- /* `length' is approximately squareroot(2.0) to what exponent? */ -- exponent = (int) ( 2.0 * exponent + (length > SQUAREROOTTWO) ); -- /* `exponent' is now in the range 0...2047 for IEEE double precision. */ -- /* Choose a queue in the range 0...4095. The shortest edges have the */ -- /* highest priority (queue 4095). */ -- if (posexponent) { -- queuenumber = 2047 - exponent; -- } else { -- queuenumber = 2048 + exponent; -- } -- -- /* Are we inserting into an empty queue? */ -- if (m->queuefront[queuenumber] == (struct badtriang *) NULL) { -- /* Yes, we are inserting into an empty queue. */ -- /* Will this become the highest-priority queue? */ -- if (queuenumber > m->firstnonemptyq) { -- /* Yes, this is the highest-priority queue. */ -- m->nextnonemptyq[queuenumber] = m->firstnonemptyq; -- m->firstnonemptyq = queuenumber; -- } else { -- /* No, this is not the highest-priority queue. */ -- /* Find the queue with next higher priority. */ -- i = queuenumber + 1; -- while (m->queuefront[i] == (struct badtriang *) NULL) { -- i++; -- } -- /* Mark the newly nonempty queue as following a higher-priority queue. */ -- m->nextnonemptyq[queuenumber] = m->nextnonemptyq[i]; -- m->nextnonemptyq[i] = queuenumber; -- } -- /* Put the bad triangle at the beginning of the (empty) queue. */ -- m->queuefront[queuenumber] = badtri; -- } else { -- /* Add the bad triangle to the end of an already nonempty queue. */ -- m->queuetail[queuenumber]->nexttriang = badtri; -- } -- /* Maintain a pointer to the last triangle of the queue. */ -- m->queuetail[queuenumber] = badtri; -- /* Newly enqueued bad triangle has no successor in the queue. */ -- badtri->nexttriang = (struct badtriang *) NULL; --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* enqueuebadtri() Add a bad triangle to the end of a queue. */ --/* */ --/* Allocates a badtriang data structure for the triangle, then passes it to */ --/* enqueuebadtriang(). */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void enqueuebadtri(struct mesh *m, struct behavior *b, struct otri *enqtri, -- REAL minedge, vertex enqapex, vertex enqorg, vertex enqdest) --#else /* not ANSI_DECLARATORS */ --void enqueuebadtri(m, b, enqtri, minedge, enqapex, enqorg, enqdest) --struct mesh *m; --struct behavior *b; --struct otri *enqtri; --REAL minedge; --vertex enqapex; --vertex enqorg; --vertex enqdest; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct badtriang *newbad; -- -- /* Allocate space for the bad triangle. */ -- newbad = (struct badtriang *) poolalloc(&m->badtriangles); -- newbad->poortri = encode(*enqtri); -- newbad->key = minedge; -- newbad->triangapex = enqapex; -- newbad->triangorg = enqorg; -- newbad->triangdest = enqdest; -- enqueuebadtriang(m, b, newbad); --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* dequeuebadtriang() Remove a triangle from the front of the queue. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --struct badtriang *dequeuebadtriang(struct mesh *m) --#else /* not ANSI_DECLARATORS */ --struct badtriang *dequeuebadtriang(m) --struct mesh *m; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct badtriang *result; -- -- /* If no queues are nonempty, return NULL. */ -- if (m->firstnonemptyq < 0) { -- return (struct badtriang *) NULL; -- } -- /* Find the first triangle of the highest-priority queue. */ -- result = m->queuefront[m->firstnonemptyq]; -- /* Remove the triangle from the queue. */ -- m->queuefront[m->firstnonemptyq] = result->nexttriang; -- /* If this queue is now empty, note the new highest-priority */ -- /* nonempty queue. */ -- if (result == m->queuetail[m->firstnonemptyq]) { -- m->firstnonemptyq = m->nextnonemptyq[m->firstnonemptyq]; -- } -- return result; --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* checkseg4encroach() Check a subsegment to see if it is encroached; add */ --/* it to the list if it is. */ --/* */ --/* A subsegment is encroached if there is a vertex in its diametral lens. */ --/* For Ruppert's algorithm (-D switch), the "diametral lens" is the */ --/* diametral circle. For Chew's algorithm (default), the diametral lens is */ --/* just big enough to enclose two isosceles triangles whose bases are the */ --/* subsegment. Each of the two isosceles triangles has two angles equal */ --/* to `b->minangle'. */ --/* */ --/* Chew's algorithm does not require diametral lenses at all--but they save */ --/* time. Any vertex inside a subsegment's diametral lens implies that the */ --/* triangle adjoining the subsegment will be too skinny, so it's only a */ --/* matter of time before the encroaching vertex is deleted by Chew's */ --/* algorithm. It's faster to simply not insert the doomed vertex in the */ --/* first place, which is why I use diametral lenses with Chew's algorithm. */ --/* */ --/* Returns a nonzero value if the subsegment is encroached. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --int checkseg4encroach(struct mesh *m, struct behavior *b, -- struct osub *testsubseg) --#else /* not ANSI_DECLARATORS */ --int checkseg4encroach(m, b, testsubseg) --struct mesh *m; --struct behavior *b; --struct osub *testsubseg; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri neighbortri; -- struct osub testsym; -- struct badsubseg *encroachedseg; -- REAL dotproduct; -- int encroached; -- int sides; -- vertex eorg, edest, eapex; -- triangle ptr; /* Temporary variable used by stpivot(). */ -- -- encroached = 0; -- sides = 0; -- -- sorg(*testsubseg, eorg); -- sdest(*testsubseg, edest); -- /* Check one neighbor of the subsegment. */ -- stpivot(*testsubseg, neighbortri); -- /* Does the neighbor exist, or is this a boundary edge? */ -- if (neighbortri.tri != m->dummytri) { -- sides++; -- /* Find a vertex opposite this subsegment. */ -- apex(neighbortri, eapex); -- /* Check whether the apex is in the diametral lens of the subsegment */ -- /* (the diametral circle if `conformdel' is set). A dot product */ -- /* of two sides of the triangle is used to check whether the angle */ -- /* at the apex is greater than (180 - 2 `minangle') degrees (for */ -- /* lenses; 90 degrees for diametral circles). */ -- dotproduct = (eorg[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (edest[1] - eapex[1]); -- if (dotproduct < 0.0) { -- if (b->conformdel || -- (dotproduct * dotproduct >= -- (2.0 * b->goodangle - 1.0) * (2.0 * b->goodangle - 1.0) * -- ((eorg[0] - eapex[0]) * (eorg[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (eorg[1] - eapex[1])) * -- ((edest[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (edest[1] - eapex[1]) * (edest[1] - eapex[1])))) { -- encroached = 1; -- } -- } -- } -- /* Check the other neighbor of the subsegment. */ -- ssym(*testsubseg, testsym); -- stpivot(testsym, neighbortri); -- /* Does the neighbor exist, or is this a boundary edge? */ -- if (neighbortri.tri != m->dummytri) { -- sides++; -- /* Find the other vertex opposite this subsegment. */ -- apex(neighbortri, eapex); -- /* Check whether the apex is in the diametral lens of the subsegment */ -- /* (or the diametral circle, if `conformdel' is set). */ -- dotproduct = (eorg[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (edest[1] - eapex[1]); -- if (dotproduct < 0.0) { -- if (b->conformdel || -- (dotproduct * dotproduct >= -- (2.0 * b->goodangle - 1.0) * (2.0 * b->goodangle - 1.0) * -- ((eorg[0] - eapex[0]) * (eorg[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (eorg[1] - eapex[1])) * -- ((edest[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (edest[1] - eapex[1]) * (edest[1] - eapex[1])))) { -- encroached += 2; -- } -- } -- } -- -- if (encroached && (!b->nobisect || ((b->nobisect == 1) && (sides == 2)))) { -- if (b->verbose > 2) { -- printf( -- " Queueing encroached subsegment (%.12g, %.12g) (%.12g, %.12g).\n", -- eorg[0], eorg[1], edest[0], edest[1]); -- } -- /* Add the subsegment to the list of encroached subsegments. */ -- /* Be sure to get the orientation right. */ -- encroachedseg = (struct badsubseg *) poolalloc(&m->badsubsegs); -- if (encroached == 1) { -- encroachedseg->encsubseg = sencode(*testsubseg); -- encroachedseg->subsegorg = eorg; -- encroachedseg->subsegdest = edest; -- } else { -- encroachedseg->encsubseg = sencode(testsym); -- encroachedseg->subsegorg = edest; -- encroachedseg->subsegdest = eorg; -- } -- } -- -- return encroached; --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* testtriangle() Test a triangle for quality and size. */ --/* */ --/* Tests a triangle to see if it satisfies the minimum angle condition and */ --/* the maximum area condition. Triangles that aren't up to spec are added */ --/* to the bad triangle queue. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void testtriangle(struct mesh *m, struct behavior *b, struct otri *testtri) --#else /* not ANSI_DECLARATORS */ --void testtriangle(m, b, testtri) --struct mesh *m; --struct behavior *b; --struct otri *testtri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri tri1, tri2; -- struct osub testsub; -- vertex torg, tdest, tapex; -- vertex base1, base2; -- vertex org1, dest1, org2, dest2; -- vertex joinvertex; -- REAL dxod, dyod, dxda, dyda, dxao, dyao; -- REAL dxod2, dyod2, dxda2, dyda2, dxao2, dyao2; -- REAL apexlen, orglen, destlen, minedge; -- REAL angle; -- REAL area; -- REAL dist1, dist2; -- subseg sptr; /* Temporary variable used by tspivot(). */ -- triangle ptr; /* Temporary variable used by oprev() and dnext(). */ -- -- org(*testtri, torg); -- dest(*testtri, tdest); -- apex(*testtri, tapex); -- dxod = torg[0] - tdest[0]; -- dyod = torg[1] - tdest[1]; -- dxda = tdest[0] - tapex[0]; -- dyda = tdest[1] - tapex[1]; -- dxao = tapex[0] - torg[0]; -- dyao = tapex[1] - torg[1]; -- dxod2 = dxod * dxod; -- dyod2 = dyod * dyod; -- dxda2 = dxda * dxda; -- dyda2 = dyda * dyda; -- dxao2 = dxao * dxao; -- dyao2 = dyao * dyao; -- /* Find the lengths of the triangle's three edges. */ -- apexlen = dxod2 + dyod2; -- orglen = dxda2 + dyda2; -- destlen = dxao2 + dyao2; -- -- if ((apexlen < orglen) && (apexlen < destlen)) { -- /* The edge opposite the apex is shortest. */ -- minedge = apexlen; -- /* Find the square of the cosine of the angle at the apex. */ -- angle = dxda * dxao + dyda * dyao; -- angle = angle * angle / (orglen * destlen); -- base1 = torg; -- base2 = tdest; -- otricopy(*testtri, tri1); -- } else if (orglen < destlen) { -- /* The edge opposite the origin is shortest. */ -- minedge = orglen; -- /* Find the square of the cosine of the angle at the origin. */ -- angle = dxod * dxao + dyod * dyao; -- angle = angle * angle / (apexlen * destlen); -- base1 = tdest; -- base2 = tapex; -- lnext(*testtri, tri1); -- } else { -- /* The edge opposite the destination is shortest. */ -- minedge = destlen; -- /* Find the square of the cosine of the angle at the destination. */ -- angle = dxod * dxda + dyod * dyda; -- angle = angle * angle / (apexlen * orglen); -- base1 = tapex; -- base2 = torg; -- lprev(*testtri, tri1); -- } -- -- if (b->vararea || b->fixedarea || b->usertest) { -- /* Check whether the area is larger than permitted. */ -- area = 0.5 * (dxod * dyda - dyod * dxda); -- if (b->fixedarea && (area > b->maxarea)) { -- /* Add this triangle to the list of bad triangles. */ -- enqueuebadtri(m, b, testtri, minedge, tapex, torg, tdest); -- return; -- } -- -- /* Nonpositive area constraints are treated as unconstrained. */ -- if ((b->vararea) && (area > areabound(*testtri)) && -- (areabound(*testtri) > 0.0)) { -- /* Add this triangle to the list of bad triangles. */ -- enqueuebadtri(m, b, testtri, minedge, tapex, torg, tdest); -- return; -- } -- -- if (b->usertest) { -- /* Check whether the user thinks this triangle is too large. */ -- if (triunsuitable(torg, tdest, tapex, area)) { -- enqueuebadtri(m, b, testtri, minedge, tapex, torg, tdest); -- return; -- } -- } -- } -- -- /* Check whether the angle is smaller than permitted. */ -- if (angle > b->goodangle) { -- /* Use the rules of Miller, Pav, and Walkington to decide that certain */ -- /* triangles should not be split, even if they have bad angles. */ -- /* A skinny triangle is not split if its shortest edge subtends a */ -- /* small input angle, and both endpoints of the edge lie on a */ -- /* concentric circular shell. For convenience, I make a small */ -- /* adjustment to that rule: I check if the endpoints of the edge */ -- /* both lie in segment interiors, equidistant from the apex where */ -- /* the two segments meet. */ -- /* First, check if both points lie in segment interiors. */ -- if ((vertextype(base1) == SEGMENTVERTEX) && -- (vertextype(base2) == SEGMENTVERTEX)) { -- /* Check if both points lie in a common segment. If they do, the */ -- /* skinny triangle is enqueued to be split as usual. */ -- tspivot(tri1, testsub); -- if (testsub.ss == m->dummysub) { -- /* No common segment. Find a subsegment that contains `torg'. */ -- otricopy(tri1, tri2); -- do { -- oprevself(tri1); -- tspivot(tri1, testsub); -- } while (testsub.ss == m->dummysub); -- /* Find the endpoints of the containing segment. */ -- segorg(testsub, org1); -- segdest(testsub, dest1); -- /* Find a subsegment that contains `tdest'. */ -- do { -- dnextself(tri2); -- tspivot(tri2, testsub); -- } while (testsub.ss == m->dummysub); -- /* Find the endpoints of the containing segment. */ -- segorg(testsub, org2); -- segdest(testsub, dest2); -- /* Check if the two containing segments have an endpoint in common. */ -- joinvertex = (vertex) NULL; -- if ((dest1[0] == org2[0]) && (dest1[1] == org2[1])) { -- joinvertex = dest1; -- } else if ((org1[0] == dest2[0]) && (org1[1] == dest2[1])) { -- joinvertex = org1; -- } -- if (joinvertex != (vertex) NULL) { -- /* Compute the distance from the common endpoint (of the two */ -- /* segments) to each of the endpoints of the shortest edge. */ -- dist1 = ((base1[0] - joinvertex[0]) * (base1[0] - joinvertex[0]) + -- (base1[1] - joinvertex[1]) * (base1[1] - joinvertex[1])); -- dist2 = ((base2[0] - joinvertex[0]) * (base2[0] - joinvertex[0]) + -- (base2[1] - joinvertex[1]) * (base2[1] - joinvertex[1])); -- /* If the two distances are equal, don't split the triangle. */ -- if ((dist1 < 1.001 * dist2) && (dist1 > 0.999 * dist2)) { -- /* Return now to avoid enqueueing the bad triangle. */ -- return; -- } -- } -- } -- } -- -- /* Add this triangle to the list of bad triangles. */ -- enqueuebadtri(m, b, testtri, minedge, tapex, torg, tdest); -- } --} -- --#endif /* not CDT_ONLY */ -- --/** **/ --/** **/ --/********* Mesh quality testing routines end here *********/ -- --/********* Point location routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* makevertexmap() Construct a mapping from vertices to triangles to */ --/* improve the speed of point location for segment */ --/* insertion. */ --/* */ --/* Traverses all the triangles, and provides each corner of each triangle */ --/* with a pointer to that triangle. Of course, pointers will be */ --/* overwritten by other pointers because (almost) each vertex is a corner */ --/* of several triangles, but in the end every vertex will point to some */ --/* triangle that contains it. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void makevertexmap(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void makevertexmap(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop; -- vertex triorg; -- -- if (b->verbose) { -- printf(" Constructing mapping from vertices to triangles.\n"); -- } -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- while (triangleloop.tri != (triangle *) NULL) { -- /* Check all three vertices of the triangle. */ -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- org(triangleloop, triorg); -- setvertex2tri(triorg, encode(triangleloop)); -- } -- triangleloop.tri = triangletraverse(m); -- } --} -- --/*****************************************************************************/ --/* */ --/* preciselocate() Find a triangle or edge containing a given point. */ --/* */ --/* Begins its search from `searchtri'. It is important that `searchtri' */ --/* be a handle with the property that `searchpoint' is strictly to the left */ --/* of the edge denoted by `searchtri', or is collinear with that edge and */ --/* does not intersect that edge. (In particular, `searchpoint' should not */ --/* be the origin or destination of that edge.) */ --/* */ --/* These conditions are imposed because preciselocate() is normally used in */ --/* one of two situations: */ --/* */ --/* (1) To try to find the location to insert a new point. Normally, we */ --/* know an edge that the point is strictly to the left of. In the */ --/* incremental Delaunay algorithm, that edge is a bounding box edge. */ --/* In Ruppert's Delaunay refinement algorithm for quality meshing, */ --/* that edge is the shortest edge of the triangle whose circumcenter */ --/* is being inserted. */ --/* */ --/* (2) To try to find an existing point. In this case, any edge on the */ --/* convex hull is a good starting edge. You must screen out the */ --/* possibility that the vertex sought is an endpoint of the starting */ --/* edge before you call preciselocate(). */ --/* */ --/* On completion, `searchtri' is a triangle that contains `searchpoint'. */ --/* */ --/* This implementation differs from that given by Guibas and Stolfi. It */ --/* walks from triangle to triangle, crossing an edge only if `searchpoint' */ --/* is on the other side of the line containing that edge. After entering */ --/* a triangle, there are two edges by which one can leave that triangle. */ --/* If both edges are valid (`searchpoint' is on the other side of both */ --/* edges), one of the two is chosen by drawing a line perpendicular to */ --/* the entry edge (whose endpoints are `forg' and `fdest') passing through */ --/* `fapex'. Depending on which side of this perpendicular `searchpoint' */ --/* falls on, an exit edge is chosen. */ --/* */ --/* This implementation is empirically faster than the Guibas and Stolfi */ --/* point location routine (which I originally used), which tends to spiral */ --/* in toward its target. */ --/* */ --/* Returns ONVERTEX if the point lies on an existing vertex. `searchtri' */ --/* is a handle whose origin is the existing vertex. */ --/* */ --/* Returns ONEDGE if the point lies on a mesh edge. `searchtri' is a */ --/* handle whose primary edge is the edge on which the point lies. */ --/* */ --/* Returns INTRIANGLE if the point lies strictly within a triangle. */ --/* `searchtri' is a handle on the triangle that contains the point. */ --/* */ --/* Returns OUTSIDE if the point lies outside the mesh. `searchtri' is a */ --/* handle whose primary edge the point is to the right of. This might */ --/* occur when the circumcenter of a triangle falls just slightly outside */ --/* the mesh due to floating-point roundoff error. It also occurs when */ --/* seeking a hole or region point that a foolish user has placed outside */ --/* the mesh. */ --/* */ --/* If `stopatsubsegment' is nonzero, the search will stop if it tries to */ --/* walk through a subsegment, and will return OUTSIDE. */ --/* */ --/* WARNING: This routine is designed for convex triangulations, and will */ --/* not generally work after the holes and concavities have been carved. */ --/* However, it can still be used to find the circumcenter of a triangle, as */ --/* long as the search is begun from the triangle in question. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --enum locateresult preciselocate(struct mesh *m, struct behavior *b, -- vertex searchpoint, struct otri *searchtri, -- int stopatsubsegment) --#else /* not ANSI_DECLARATORS */ --enum locateresult preciselocate(m, b, searchpoint, searchtri, stopatsubsegment) --struct mesh *m; --struct behavior *b; --vertex searchpoint; --struct otri *searchtri; --int stopatsubsegment; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri backtracktri; -- struct osub checkedge; -- vertex forg, fdest, fapex; -- REAL orgorient, destorient; -- int moveleft; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (b->verbose > 2) { -- printf(" Searching for point (%.12g, %.12g).\n", -- searchpoint[0], searchpoint[1]); -- } -- /* Where are we? */ -- org(*searchtri, forg); -- dest(*searchtri, fdest); -- apex(*searchtri, fapex); -- while (1) { -- if (b->verbose > 2) { -- printf(" At (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- forg[0], forg[1], fdest[0], fdest[1], fapex[0], fapex[1]); -- } -- /* Check whether the apex is the point we seek. */ -- if ((fapex[0] == searchpoint[0]) && (fapex[1] == searchpoint[1])) { -- lprevself(*searchtri); -- return ONVERTEX; -- } -- /* Does the point lie on the other side of the line defined by the */ -- /* triangle edge opposite the triangle's destination? */ -- destorient = counterclockwise(m, b, forg, fapex, searchpoint); -- /* Does the point lie on the other side of the line defined by the */ -- /* triangle edge opposite the triangle's origin? */ -- orgorient = counterclockwise(m, b, fapex, fdest, searchpoint); -- if (destorient > 0.0) { -- if (orgorient > 0.0) { -- /* Move left if the inner product of (fapex - searchpoint) and */ -- /* (fdest - forg) is positive. This is equivalent to drawing */ -- /* a line perpendicular to the line (forg, fdest) and passing */ -- /* through `fapex', and determining which side of this line */ -- /* `searchpoint' falls on. */ -- moveleft = (fapex[0] - searchpoint[0]) * (fdest[0] - forg[0]) + -- (fapex[1] - searchpoint[1]) * (fdest[1] - forg[1]) > 0.0; -- } else { -- moveleft = 1; -- } -- } else { -- if (orgorient > 0.0) { -- moveleft = 0; -- } else { -- /* The point we seek must be on the boundary of or inside this */ -- /* triangle. */ -- if (destorient == 0.0) { -- lprevself(*searchtri); -- return ONEDGE; -- } -- if (orgorient == 0.0) { -- lnextself(*searchtri); -- return ONEDGE; -- } -- return INTRIANGLE; -- } -- } -- -- /* Move to another triangle. Leave a trace `backtracktri' in case */ -- /* floating-point roundoff or some such bogey causes us to walk */ -- /* off a boundary of the triangulation. */ -- if (moveleft) { -- lprev(*searchtri, backtracktri); -- fdest = fapex; -- } else { -- lnext(*searchtri, backtracktri); -- forg = fapex; -- } -- sym(backtracktri, *searchtri); -- -- if (m->checksegments && stopatsubsegment) { -- /* Check for walking through a subsegment. */ -- tspivot(backtracktri, checkedge); -- if (checkedge.ss != m->dummysub) { -- /* Go back to the last triangle. */ -- otricopy(backtracktri, *searchtri); -- return OUTSIDE; -- } -- } -- /* Check for walking right out of the triangulation. */ -- if (searchtri->tri == m->dummytri) { -- /* Go back to the last triangle. */ -- otricopy(backtracktri, *searchtri); -- return OUTSIDE; -- } -- -- apex(*searchtri, fapex); -- } --} -- --/*****************************************************************************/ --/* */ --/* locate() Find a triangle or edge containing a given point. */ --/* */ --/* Searching begins from one of: the input `searchtri', a recently */ --/* encountered triangle `recenttri', or from a triangle chosen from a */ --/* random sample. The choice is made by determining which triangle's */ --/* origin is closest to the point we are searching for. Normally, */ --/* `searchtri' should be a handle on the convex hull of the triangulation. */ --/* */ --/* Details on the random sampling method can be found in the Mucke, Saias, */ --/* and Zhu paper cited in the header of this code. */ --/* */ --/* On completion, `searchtri' is a triangle that contains `searchpoint'. */ --/* */ --/* Returns ONVERTEX if the point lies on an existing vertex. `searchtri' */ --/* is a handle whose origin is the existing vertex. */ --/* */ --/* Returns ONEDGE if the point lies on a mesh edge. `searchtri' is a */ --/* handle whose primary edge is the edge on which the point lies. */ --/* */ --/* Returns INTRIANGLE if the point lies strictly within a triangle. */ --/* `searchtri' is a handle on the triangle that contains the point. */ --/* */ --/* Returns OUTSIDE if the point lies outside the mesh. `searchtri' is a */ --/* handle whose primary edge the point is to the right of. This might */ --/* occur when the circumcenter of a triangle falls just slightly outside */ --/* the mesh due to floating-point roundoff error. It also occurs when */ --/* seeking a hole or region point that a foolish user has placed outside */ --/* the mesh. */ --/* */ --/* WARNING: This routine is designed for convex triangulations, and will */ --/* not generally work after the holes and concavities have been carved. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --enum locateresult locate(struct mesh *m, struct behavior *b, -- vertex searchpoint, struct otri *searchtri) --#else /* not ANSI_DECLARATORS */ --enum locateresult locate(m, b, searchpoint, searchtri) --struct mesh *m; --struct behavior *b; --vertex searchpoint; --struct otri *searchtri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- void **sampleblock; -- char *firsttri; -- struct otri sampletri; -- vertex torg, tdest; -- TRIANGLE_PTRINT alignptr; -- REAL searchdist, dist; -- REAL ahead; -- long samplesperblock, totalsamplesleft, samplesleft; -- long population, totalpopulation; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- if (b->verbose > 2) { -- printf(" Randomly sampling for a triangle near point (%.12g, %.12g).\n", -- searchpoint[0], searchpoint[1]); -- } -- /* Record the distance from the suggested starting triangle to the */ -- /* point we seek. */ -- org(*searchtri, torg); -- searchdist = (searchpoint[0] - torg[0]) * (searchpoint[0] - torg[0]) + -- (searchpoint[1] - torg[1]) * (searchpoint[1] - torg[1]); -- if (b->verbose > 2) { -- printf(" Boundary triangle has origin (%.12g, %.12g).\n", -- torg[0], torg[1]); -- } -- -- /* If a recently encountered triangle has been recorded and has not been */ -- /* deallocated, test it as a good starting point. */ -- if (m->recenttri.tri != (triangle *) NULL) { -- if (!deadtri(m->recenttri.tri)) { -- org(m->recenttri, torg); -- if ((torg[0] == searchpoint[0]) && (torg[1] == searchpoint[1])) { -- otricopy(m->recenttri, *searchtri); -- return ONVERTEX; -- } -- dist = (searchpoint[0] - torg[0]) * (searchpoint[0] - torg[0]) + -- (searchpoint[1] - torg[1]) * (searchpoint[1] - torg[1]); -- if (dist < searchdist) { -- otricopy(m->recenttri, *searchtri); -- searchdist = dist; -- if (b->verbose > 2) { -- printf(" Choosing recent triangle with origin (%.12g, %.12g).\n", -- torg[0], torg[1]); -- } -- } -- } -- } -- -- /* The number of random samples taken is proportional to the cube root of */ -- /* the number of triangles in the mesh. The next bit of code assumes */ -- /* that the number of triangles increases monotonically (or at least */ -- /* doesn't decrease enough to matter). */ -- while (SAMPLEFACTOR * m->samples * m->samples * m->samples < -- m->triangles.items) { -- m->samples++; -- } -- -- /* We'll draw ceiling(samples * TRIPERBLOCK / maxitems) random samples */ -- /* from each block of triangles (except the first)--until we meet the */ -- /* sample quota. The ceiling means that blocks at the end might be */ -- /* neglected, but I don't care. */ -- samplesperblock = (m->samples * TRIPERBLOCK - 1) / m->triangles.maxitems + 1; -- /* We'll draw ceiling(samples * itemsfirstblock / maxitems) random samples */ -- /* from the first block of triangles. */ -- samplesleft = (m->samples * m->triangles.itemsfirstblock - 1) / -- m->triangles.maxitems + 1; -- totalsamplesleft = m->samples; -- population = m->triangles.itemsfirstblock; -- totalpopulation = m->triangles.maxitems; -- sampleblock = m->triangles.firstblock; -- sampletri.orient = 0; -- while (totalsamplesleft > 0) { -- /* If we're in the last block, `population' needs to be corrected. */ -- if (population > totalpopulation) { -- population = totalpopulation; -- } -- /* Find a pointer to the first triangle in the block. */ -- alignptr = (TRIANGLE_PTRINT) (sampleblock + 1); -- firsttri = (char *) (alignptr + -- (TRIANGLE_PTRINT) m->triangles.alignbytes - -- (alignptr % -- (TRIANGLE_PTRINT) m->triangles.alignbytes)); -- -- /* Choose `samplesleft' randomly sampled triangles in this block. */ -- do { -- sampletri.tri = (triangle *) (firsttri + -- (randomnation((unsigned int) population) * -- m->triangles.itembytes)); -- if (!deadtri(sampletri.tri)) { -- org(sampletri, torg); -- dist = (searchpoint[0] - torg[0]) * (searchpoint[0] - torg[0]) + -- (searchpoint[1] - torg[1]) * (searchpoint[1] - torg[1]); -- if (dist < searchdist) { -- otricopy(sampletri, *searchtri); -- searchdist = dist; -- if (b->verbose > 2) { -- printf(" Choosing triangle with origin (%.12g, %.12g).\n", -- torg[0], torg[1]); -- } -- } -- } -- -- samplesleft--; -- totalsamplesleft--; -- } while ((samplesleft > 0) && (totalsamplesleft > 0)); -- -- if (totalsamplesleft > 0) { -- sampleblock = (void **) *sampleblock; -- samplesleft = samplesperblock; -- totalpopulation -= population; -- population = TRIPERBLOCK; -- } -- } -- -- /* Where are we? */ -- org(*searchtri, torg); -- dest(*searchtri, tdest); -- /* Check the starting triangle's vertices. */ -- if ((torg[0] == searchpoint[0]) && (torg[1] == searchpoint[1])) { -- return ONVERTEX; -- } -- if ((tdest[0] == searchpoint[0]) && (tdest[1] == searchpoint[1])) { -- lnextself(*searchtri); -- return ONVERTEX; -- } -- /* Orient `searchtri' to fit the preconditions of calling preciselocate(). */ -- ahead = counterclockwise(m, b, torg, tdest, searchpoint); -- if (ahead < 0.0) { -- /* Turn around so that `searchpoint' is to the left of the */ -- /* edge specified by `searchtri'. */ -- symself(*searchtri); -- } else if (ahead == 0.0) { -- /* Check if `searchpoint' is between `torg' and `tdest'. */ -- if (((torg[0] < searchpoint[0]) == (searchpoint[0] < tdest[0])) && -- ((torg[1] < searchpoint[1]) == (searchpoint[1] < tdest[1]))) { -- return ONEDGE; -- } -- } -- return preciselocate(m, b, searchpoint, searchtri, 0); --} -- --/** **/ --/** **/ --/********* Point location routines end here *********/ -- --/********* Mesh transformation routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* insertsubseg() Create a new subsegment and insert it between two */ --/* triangles. */ --/* */ --/* The new subsegment is inserted at the edge described by the handle */ --/* `tri'. Its vertices are properly initialized. The marker `subsegmark' */ --/* is applied to the subsegment and, if appropriate, its vertices. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void insertsubseg(struct mesh *m, struct behavior *b, struct otri *tri, -- int subsegmark) --#else /* not ANSI_DECLARATORS */ --void insertsubseg(m, b, tri, subsegmark) --struct mesh *m; --struct behavior *b; --struct otri *tri; /* Edge at which to insert the new subsegment. */ --int subsegmark; /* Marker for the new subsegment. */ --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri oppotri; -- struct osub newsubseg; -- vertex triorg, tridest; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- org(*tri, triorg); -- dest(*tri, tridest); -- /* Mark vertices if possible. */ -- if (vertexmark(triorg) == 0) { -- setvertexmark(triorg, subsegmark); -- } -- if (vertexmark(tridest) == 0) { -- setvertexmark(tridest, subsegmark); -- } -- /* Check if there's already a subsegment here. */ -- tspivot(*tri, newsubseg); -- if (newsubseg.ss == m->dummysub) { -- /* Make new subsegment and initialize its vertices. */ -- makesubseg(m, &newsubseg); -- setsorg(newsubseg, tridest); -- setsdest(newsubseg, triorg); -- setsegorg(newsubseg, tridest); -- setsegdest(newsubseg, triorg); -- /* Bond new subsegment to the two triangles it is sandwiched between. */ -- /* Note that the facing triangle `oppotri' might be equal to */ -- /* `dummytri' (outer space), but the new subsegment is bonded to it */ -- /* all the same. */ -- tsbond(*tri, newsubseg); -- sym(*tri, oppotri); -- ssymself(newsubseg); -- tsbond(oppotri, newsubseg); -- setmark(newsubseg, subsegmark); -- if (b->verbose > 2) { -- printf(" Inserting new "); -- printsubseg(m, b, &newsubseg); -- } -- } else { -- if (mark(newsubseg) == 0) { -- setmark(newsubseg, subsegmark); -- } -- } --} -- --/*****************************************************************************/ --/* */ --/* Terminology */ --/* */ --/* A "local transformation" replaces a small set of triangles with another */ --/* set of triangles. This may or may not involve inserting or deleting a */ --/* vertex. */ --/* */ --/* The term "casing" is used to describe the set of triangles that are */ --/* attached to the triangles being transformed, but are not transformed */ --/* themselves. Think of the casing as a fixed hollow structure inside */ --/* which all the action happens. A "casing" is only defined relative to */ --/* a single transformation; each occurrence of a transformation will */ --/* involve a different casing. */ --/* */ --/*****************************************************************************/ -- --/*****************************************************************************/ --/* */ --/* flip() Transform two triangles to two different triangles by flipping */ --/* an edge counterclockwise within a quadrilateral. */ --/* */ --/* Imagine the original triangles, abc and bad, oriented so that the */ --/* shared edge ab lies in a horizontal plane, with the vertex b on the left */ --/* and the vertex a on the right. The vertex c lies below the edge, and */ --/* the vertex d lies above the edge. The `flipedge' handle holds the edge */ --/* ab of triangle abc, and is directed left, from vertex a to vertex b. */ --/* */ --/* The triangles abc and bad are deleted and replaced by the triangles cdb */ --/* and dca. The triangles that represent abc and bad are NOT deallocated; */ --/* they are reused for dca and cdb, respectively. Hence, any handles that */ --/* may have held the original triangles are still valid, although not */ --/* directed as they were before. */ --/* */ --/* Upon completion of this routine, the `flipedge' handle holds the edge */ --/* dc of triangle dca, and is directed down, from vertex d to vertex c. */ --/* (Hence, the two triangles have rotated counterclockwise.) */ --/* */ --/* WARNING: This transformation is geometrically valid only if the */ --/* quadrilateral adbc is convex. Furthermore, this transformation is */ --/* valid only if there is not a subsegment between the triangles abc and */ --/* bad. This routine does not check either of these preconditions, and */ --/* it is the responsibility of the calling routine to ensure that they are */ --/* met. If they are not, the streets shall be filled with wailing and */ --/* gnashing of teeth. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void flip(struct mesh *m, struct behavior *b, struct otri *flipedge) --#else /* not ANSI_DECLARATORS */ --void flip(m, b, flipedge) --struct mesh *m; --struct behavior *b; --struct otri *flipedge; /* Handle for the triangle abc. */ --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri botleft, botright; -- struct otri topleft, topright; -- struct otri top; -- struct otri botlcasing, botrcasing; -- struct otri toplcasing, toprcasing; -- struct osub botlsubseg, botrsubseg; -- struct osub toplsubseg, toprsubseg; -- vertex leftvertex, rightvertex, botvertex; -- vertex farvertex; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- /* Identify the vertices of the quadrilateral. */ -- org(*flipedge, rightvertex); -- dest(*flipedge, leftvertex); -- apex(*flipedge, botvertex); -- sym(*flipedge, top); --#ifdef SELF_CHECK -- if (top.tri == m->dummytri) { -- printf("Internal error in flip(): Attempt to flip on boundary.\n"); -- lnextself(*flipedge); -- return; -- } -- if (m->checksegments) { -- tspivot(*flipedge, toplsubseg); -- if (toplsubseg.ss != m->dummysub) { -- printf("Internal error in flip(): Attempt to flip a segment.\n"); -- lnextself(*flipedge); -- return; -- } -- } --#endif /* SELF_CHECK */ -- apex(top, farvertex); -- -- /* Identify the casing of the quadrilateral. */ -- lprev(top, topleft); -- sym(topleft, toplcasing); -- lnext(top, topright); -- sym(topright, toprcasing); -- lnext(*flipedge, botleft); -- sym(botleft, botlcasing); -- lprev(*flipedge, botright); -- sym(botright, botrcasing); -- /* Rotate the quadrilateral one-quarter turn counterclockwise. */ -- bond(topleft, botlcasing); -- bond(botleft, botrcasing); -- bond(botright, toprcasing); -- bond(topright, toplcasing); -- -- if (m->checksegments) { -- /* Check for subsegments and rebond them to the quadrilateral. */ -- tspivot(topleft, toplsubseg); -- tspivot(botleft, botlsubseg); -- tspivot(botright, botrsubseg); -- tspivot(topright, toprsubseg); -- if (toplsubseg.ss == m->dummysub) { -- tsdissolve(topright); -- } else { -- tsbond(topright, toplsubseg); -- } -- if (botlsubseg.ss == m->dummysub) { -- tsdissolve(topleft); -- } else { -- tsbond(topleft, botlsubseg); -- } -- if (botrsubseg.ss == m->dummysub) { -- tsdissolve(botleft); -- } else { -- tsbond(botleft, botrsubseg); -- } -- if (toprsubseg.ss == m->dummysub) { -- tsdissolve(botright); -- } else { -- tsbond(botright, toprsubseg); -- } -- } -- -- /* New vertex assignments for the rotated quadrilateral. */ -- setorg(*flipedge, farvertex); -- setdest(*flipedge, botvertex); -- setapex(*flipedge, rightvertex); -- setorg(top, botvertex); -- setdest(top, farvertex); -- setapex(top, leftvertex); -- if (b->verbose > 2) { -- printf(" Edge flip results in left "); -- printtriangle(m, b, &top); -- printf(" and right "); -- printtriangle(m, b, flipedge); -- } --} -- --/*****************************************************************************/ --/* */ --/* unflip() Transform two triangles to two different triangles by */ --/* flipping an edge clockwise within a quadrilateral. Reverses */ --/* the flip() operation so that the data structures representing */ --/* the triangles are back where they were before the flip(). */ --/* */ --/* Imagine the original triangles, abc and bad, oriented so that the */ --/* shared edge ab lies in a horizontal plane, with the vertex b on the left */ --/* and the vertex a on the right. The vertex c lies below the edge, and */ --/* the vertex d lies above the edge. The `flipedge' handle holds the edge */ --/* ab of triangle abc, and is directed left, from vertex a to vertex b. */ --/* */ --/* The triangles abc and bad are deleted and replaced by the triangles cdb */ --/* and dca. The triangles that represent abc and bad are NOT deallocated; */ --/* they are reused for cdb and dca, respectively. Hence, any handles that */ --/* may have held the original triangles are still valid, although not */ --/* directed as they were before. */ --/* */ --/* Upon completion of this routine, the `flipedge' handle holds the edge */ --/* cd of triangle cdb, and is directed up, from vertex c to vertex d. */ --/* (Hence, the two triangles have rotated clockwise.) */ --/* */ --/* WARNING: This transformation is geometrically valid only if the */ --/* quadrilateral adbc is convex. Furthermore, this transformation is */ --/* valid only if there is not a subsegment between the triangles abc and */ --/* bad. This routine does not check either of these preconditions, and */ --/* it is the responsibility of the calling routine to ensure that they are */ --/* met. If they are not, the streets shall be filled with wailing and */ --/* gnashing of teeth. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void unflip(struct mesh *m, struct behavior *b, struct otri *flipedge) --#else /* not ANSI_DECLARATORS */ --void unflip(m, b, flipedge) --struct mesh *m; --struct behavior *b; --struct otri *flipedge; /* Handle for the triangle abc. */ --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri botleft, botright; -- struct otri topleft, topright; -- struct otri top; -- struct otri botlcasing, botrcasing; -- struct otri toplcasing, toprcasing; -- struct osub botlsubseg, botrsubseg; -- struct osub toplsubseg, toprsubseg; -- vertex leftvertex, rightvertex, botvertex; -- vertex farvertex; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- /* Identify the vertices of the quadrilateral. */ -- org(*flipedge, rightvertex); -- dest(*flipedge, leftvertex); -- apex(*flipedge, botvertex); -- sym(*flipedge, top); --#ifdef SELF_CHECK -- if (top.tri == m->dummytri) { -- printf("Internal error in unflip(): Attempt to flip on boundary.\n"); -- lnextself(*flipedge); -- return; -- } -- if (m->checksegments) { -- tspivot(*flipedge, toplsubseg); -- if (toplsubseg.ss != m->dummysub) { -- printf("Internal error in unflip(): Attempt to flip a subsegment.\n"); -- lnextself(*flipedge); -- return; -- } -- } --#endif /* SELF_CHECK */ -- apex(top, farvertex); -- -- /* Identify the casing of the quadrilateral. */ -- lprev(top, topleft); -- sym(topleft, toplcasing); -- lnext(top, topright); -- sym(topright, toprcasing); -- lnext(*flipedge, botleft); -- sym(botleft, botlcasing); -- lprev(*flipedge, botright); -- sym(botright, botrcasing); -- /* Rotate the quadrilateral one-quarter turn clockwise. */ -- bond(topleft, toprcasing); -- bond(botleft, toplcasing); -- bond(botright, botlcasing); -- bond(topright, botrcasing); -- -- if (m->checksegments) { -- /* Check for subsegments and rebond them to the quadrilateral. */ -- tspivot(topleft, toplsubseg); -- tspivot(botleft, botlsubseg); -- tspivot(botright, botrsubseg); -- tspivot(topright, toprsubseg); -- if (toplsubseg.ss == m->dummysub) { -- tsdissolve(botleft); -- } else { -- tsbond(botleft, toplsubseg); -- } -- if (botlsubseg.ss == m->dummysub) { -- tsdissolve(botright); -- } else { -- tsbond(botright, botlsubseg); -- } -- if (botrsubseg.ss == m->dummysub) { -- tsdissolve(topright); -- } else { -- tsbond(topright, botrsubseg); -- } -- if (toprsubseg.ss == m->dummysub) { -- tsdissolve(topleft); -- } else { -- tsbond(topleft, toprsubseg); -- } -- } -- -- /* New vertex assignments for the rotated quadrilateral. */ -- setorg(*flipedge, botvertex); -- setdest(*flipedge, farvertex); -- setapex(*flipedge, leftvertex); -- setorg(top, farvertex); -- setdest(top, botvertex); -- setapex(top, rightvertex); -- if (b->verbose > 2) { -- printf(" Edge unflip results in left "); -- printtriangle(m, b, flipedge); -- printf(" and right "); -- printtriangle(m, b, &top); -- } --} -- --/*****************************************************************************/ --/* */ --/* insertvertex() Insert a vertex into a Delaunay triangulation, */ --/* performing flips as necessary to maintain the Delaunay */ --/* property. */ --/* */ --/* The point `insertvertex' is located. If `searchtri.tri' is not NULL, */ --/* the search for the containing triangle begins from `searchtri'. If */ --/* `searchtri.tri' is NULL, a full point location procedure is called. */ --/* If `insertvertex' is found inside a triangle, the triangle is split into */ --/* three; if `insertvertex' lies on an edge, the edge is split in two, */ --/* thereby splitting the two adjacent triangles into four. Edge flips are */ --/* used to restore the Delaunay property. If `insertvertex' lies on an */ --/* existing vertex, no action is taken, and the value DUPLICATEVERTEX is */ --/* returned. On return, `searchtri' is set to a handle whose origin is the */ --/* existing vertex. */ --/* */ --/* Normally, the parameter `splitseg' is set to NULL, implying that no */ --/* subsegment should be split. In this case, if `insertvertex' is found to */ --/* lie on a segment, no action is taken, and the value VIOLATINGVERTEX is */ --/* returned. On return, `searchtri' is set to a handle whose primary edge */ --/* is the violated subsegment. */ --/* */ --/* If the calling routine wishes to split a subsegment by inserting a */ --/* vertex in it, the parameter `splitseg' should be that subsegment. In */ --/* this case, `searchtri' MUST be the triangle handle reached by pivoting */ --/* from that subsegment; no point location is done. */ --/* */ --/* `segmentflaws' and `triflaws' are flags that indicate whether or not */ --/* there should be checks for the creation of encroached subsegments or bad */ --/* quality triangles. If a newly inserted vertex encroaches upon */ --/* subsegments, these subsegments are added to the list of subsegments to */ --/* be split if `segmentflaws' is set. If bad triangles are created, these */ --/* are added to the queue if `triflaws' is set. */ --/* */ --/* If a duplicate vertex or violated segment does not prevent the vertex */ --/* from being inserted, the return value will be ENCROACHINGVERTEX if the */ --/* vertex encroaches upon a subsegment (and checking is enabled), or */ --/* SUCCESSFULVERTEX otherwise. In either case, `searchtri' is set to a */ --/* handle whose origin is the newly inserted vertex. */ --/* */ --/* insertvertex() does not use flip() for reasons of speed; some */ --/* information can be reused from edge flip to edge flip, like the */ --/* locations of subsegments. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --enum insertvertexresult insertvertex(struct mesh *m, struct behavior *b, -- vertex newvertex, struct otri *searchtri, -- struct osub *splitseg, -- int segmentflaws, int triflaws) --#else /* not ANSI_DECLARATORS */ --enum insertvertexresult insertvertex(m, b, newvertex, searchtri, splitseg, -- segmentflaws, triflaws) --struct mesh *m; --struct behavior *b; --vertex newvertex; --struct otri *searchtri; --struct osub *splitseg; --int segmentflaws; --int triflaws; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri horiz; -- struct otri top; -- struct otri botleft, botright; -- struct otri topleft, topright; -- struct otri newbotleft, newbotright; -- struct otri newtopright; -- struct otri botlcasing, botrcasing; -- struct otri toplcasing, toprcasing; -- struct otri testtri; -- struct osub botlsubseg, botrsubseg; -- struct osub toplsubseg, toprsubseg; -- struct osub brokensubseg; -- struct osub checksubseg; -- struct osub rightsubseg; -- struct osub newsubseg; -- struct badsubseg *encroached; -- struct flipstacker *newflip; -- vertex first; -- vertex leftvertex, rightvertex, botvertex, topvertex, farvertex; -- vertex segmentorg, segmentdest; -- REAL attrib; -- REAL area; -- enum insertvertexresult success; -- enum locateresult intersect; -- int doflip; -- int mirrorflag; -- int enq; -- int i; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by spivot() and tspivot(). */ -- -- if (b->verbose > 1) { -- printf(" Inserting (%.12g, %.12g).\n", newvertex[0], newvertex[1]); -- } -- -- if (splitseg == (struct osub *) NULL) { -- /* Find the location of the vertex to be inserted. Check if a good */ -- /* starting triangle has already been provided by the caller. */ -- if (searchtri->tri == m->dummytri) { -- /* Find a boundary triangle. */ -- horiz.tri = m->dummytri; -- horiz.orient = 0; -- symself(horiz); -- /* Search for a triangle containing `newvertex'. */ -- intersect = locate(m, b, newvertex, &horiz); -- } else { -- /* Start searching from the triangle provided by the caller. */ -- otricopy(*searchtri, horiz); -- intersect = preciselocate(m, b, newvertex, &horiz, 1); -- } -- } else { -- /* The calling routine provides the subsegment in which */ -- /* the vertex is inserted. */ -- otricopy(*searchtri, horiz); -- intersect = ONEDGE; -- } -- -- if (intersect == ONVERTEX) { -- /* There's already a vertex there. Return in `searchtri' a triangle */ -- /* whose origin is the existing vertex. */ -- otricopy(horiz, *searchtri); -- otricopy(horiz, m->recenttri); -- return DUPLICATEVERTEX; -- } -- if ((intersect == ONEDGE) || (intersect == OUTSIDE)) { -- /* The vertex falls on an edge or boundary. */ -- if (m->checksegments && (splitseg == (struct osub *) NULL)) { -- /* Check whether the vertex falls on a subsegment. */ -- tspivot(horiz, brokensubseg); -- if (brokensubseg.ss != m->dummysub) { -- /* The vertex falls on a subsegment, and hence will not be inserted. */ -- if (segmentflaws) { -- enq = b->nobisect != 2; -- if (enq && (b->nobisect == 1)) { -- /* This subsegment may be split only if it is an */ -- /* internal boundary. */ -- sym(horiz, testtri); -- enq = testtri.tri != m->dummytri; -- } -- if (enq) { -- /* Add the subsegment to the list of encroached subsegments. */ -- encroached = (struct badsubseg *) poolalloc(&m->badsubsegs); -- encroached->encsubseg = sencode(brokensubseg); -- sorg(brokensubseg, encroached->subsegorg); -- sdest(brokensubseg, encroached->subsegdest); -- if (b->verbose > 2) { -- printf( -- " Queueing encroached subsegment (%.12g, %.12g) (%.12g, %.12g).\n", -- encroached->subsegorg[0], encroached->subsegorg[1], -- encroached->subsegdest[0], encroached->subsegdest[1]); -- } -- } -- } -- /* Return a handle whose primary edge contains the vertex, */ -- /* which has not been inserted. */ -- otricopy(horiz, *searchtri); -- otricopy(horiz, m->recenttri); -- return VIOLATINGVERTEX; -- } -- } -- -- /* Insert the vertex on an edge, dividing one triangle into two (if */ -- /* the edge lies on a boundary) or two triangles into four. */ -- lprev(horiz, botright); -- sym(botright, botrcasing); -- sym(horiz, topright); -- /* Is there a second triangle? (Or does this edge lie on a boundary?) */ -- mirrorflag = topright.tri != m->dummytri; -- if (mirrorflag) { -- lnextself(topright); -- sym(topright, toprcasing); -- maketriangle(m, b, &newtopright); -- } else { -- /* Splitting a boundary edge increases the number of boundary edges. */ -- m->hullsize++; -- } -- maketriangle(m, b, &newbotright); -- -- /* Set the vertices of changed and new triangles. */ -- org(horiz, rightvertex); -- dest(horiz, leftvertex); -- apex(horiz, botvertex); -- setorg(newbotright, botvertex); -- setdest(newbotright, rightvertex); -- setapex(newbotright, newvertex); -- setorg(horiz, newvertex); -- for (i = 0; i < m->eextras; i++) { -- /* Set the element attributes of a new triangle. */ -- setelemattribute(newbotright, i, elemattribute(botright, i)); -- } -- if (b->vararea) { -- /* Set the area constraint of a new triangle. */ -- setareabound(newbotright, areabound(botright)); -- } -- if (mirrorflag) { -- dest(topright, topvertex); -- setorg(newtopright, rightvertex); -- setdest(newtopright, topvertex); -- setapex(newtopright, newvertex); -- setorg(topright, newvertex); -- for (i = 0; i < m->eextras; i++) { -- /* Set the element attributes of another new triangle. */ -- setelemattribute(newtopright, i, elemattribute(topright, i)); -- } -- if (b->vararea) { -- /* Set the area constraint of another new triangle. */ -- setareabound(newtopright, areabound(topright)); -- } -- } -- -- /* There may be subsegments that need to be bonded */ -- /* to the new triangle(s). */ -- if (m->checksegments) { -- tspivot(botright, botrsubseg); -- if (botrsubseg.ss != m->dummysub) { -- tsdissolve(botright); -- tsbond(newbotright, botrsubseg); -- } -- if (mirrorflag) { -- tspivot(topright, toprsubseg); -- if (toprsubseg.ss != m->dummysub) { -- tsdissolve(topright); -- tsbond(newtopright, toprsubseg); -- } -- } -- } -- -- /* Bond the new triangle(s) to the surrounding triangles. */ -- bond(newbotright, botrcasing); -- lprevself(newbotright); -- bond(newbotright, botright); -- lprevself(newbotright); -- if (mirrorflag) { -- bond(newtopright, toprcasing); -- lnextself(newtopright); -- bond(newtopright, topright); -- lnextself(newtopright); -- bond(newtopright, newbotright); -- } -- -- if (splitseg != (struct osub *) NULL) { -- /* Split the subsegment into two. */ -- setsdest(*splitseg, newvertex); -- segorg(*splitseg, segmentorg); -- segdest(*splitseg, segmentdest); -- ssymself(*splitseg); -- spivot(*splitseg, rightsubseg); -- insertsubseg(m, b, &newbotright, mark(*splitseg)); -- tspivot(newbotright, newsubseg); -- setsegorg(newsubseg, segmentorg); -- setsegdest(newsubseg, segmentdest); -- sbond(*splitseg, newsubseg); -- ssymself(newsubseg); -- sbond(newsubseg, rightsubseg); -- ssymself(*splitseg); -- /* Transfer the subsegment's boundary marker to the vertex */ -- /* if required. */ -- if (vertexmark(newvertex) == 0) { -- setvertexmark(newvertex, mark(*splitseg)); -- } -- } -- -- if (m->checkquality) { -- poolrestart(&m->flipstackers); -- m->lastflip = (struct flipstacker *) poolalloc(&m->flipstackers); -- m->lastflip->flippedtri = encode(horiz); -- m->lastflip->prevflip = (struct flipstacker *) &insertvertex; -- } -- --#ifdef SELF_CHECK -- if (counterclockwise(m, b, rightvertex, leftvertex, botvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf( -- " Clockwise triangle prior to edge vertex insertion (bottom).\n"); -- } -- if (mirrorflag) { -- if (counterclockwise(m, b, leftvertex, rightvertex, topvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle prior to edge vertex insertion (top).\n"); -- } -- if (counterclockwise(m, b, rightvertex, topvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf( -- " Clockwise triangle after edge vertex insertion (top right).\n"); -- } -- if (counterclockwise(m, b, topvertex, leftvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf( -- " Clockwise triangle after edge vertex insertion (top left).\n"); -- } -- } -- if (counterclockwise(m, b, leftvertex, botvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf( -- " Clockwise triangle after edge vertex insertion (bottom left).\n"); -- } -- if (counterclockwise(m, b, botvertex, rightvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf( -- " Clockwise triangle after edge vertex insertion (bottom right).\n"); -- } --#endif /* SELF_CHECK */ -- if (b->verbose > 2) { -- printf(" Updating bottom left "); -- printtriangle(m, b, &botright); -- if (mirrorflag) { -- printf(" Updating top left "); -- printtriangle(m, b, &topright); -- printf(" Creating top right "); -- printtriangle(m, b, &newtopright); -- } -- printf(" Creating bottom right "); -- printtriangle(m, b, &newbotright); -- } -- -- /* Position `horiz' on the first edge to check for */ -- /* the Delaunay property. */ -- lnextself(horiz); -- } else { -- /* Insert the vertex in a triangle, splitting it into three. */ -- lnext(horiz, botleft); -- lprev(horiz, botright); -- sym(botleft, botlcasing); -- sym(botright, botrcasing); -- maketriangle(m, b, &newbotleft); -- maketriangle(m, b, &newbotright); -- -- /* Set the vertices of changed and new triangles. */ -- org(horiz, rightvertex); -- dest(horiz, leftvertex); -- apex(horiz, botvertex); -- setorg(newbotleft, leftvertex); -- setdest(newbotleft, botvertex); -- setapex(newbotleft, newvertex); -- setorg(newbotright, botvertex); -- setdest(newbotright, rightvertex); -- setapex(newbotright, newvertex); -- setapex(horiz, newvertex); -- for (i = 0; i < m->eextras; i++) { -- /* Set the element attributes of the new triangles. */ -- attrib = elemattribute(horiz, i); -- setelemattribute(newbotleft, i, attrib); -- setelemattribute(newbotright, i, attrib); -- } -- if (b->vararea) { -- /* Set the area constraint of the new triangles. */ -- area = areabound(horiz); -- setareabound(newbotleft, area); -- setareabound(newbotright, area); -- } -- -- /* There may be subsegments that need to be bonded */ -- /* to the new triangles. */ -- if (m->checksegments) { -- tspivot(botleft, botlsubseg); -- if (botlsubseg.ss != m->dummysub) { -- tsdissolve(botleft); -- tsbond(newbotleft, botlsubseg); -- } -- tspivot(botright, botrsubseg); -- if (botrsubseg.ss != m->dummysub) { -- tsdissolve(botright); -- tsbond(newbotright, botrsubseg); -- } -- } -- -- /* Bond the new triangles to the surrounding triangles. */ -- bond(newbotleft, botlcasing); -- bond(newbotright, botrcasing); -- lnextself(newbotleft); -- lprevself(newbotright); -- bond(newbotleft, newbotright); -- lnextself(newbotleft); -- bond(botleft, newbotleft); -- lprevself(newbotright); -- bond(botright, newbotright); -- -- if (m->checkquality) { -- poolrestart(&m->flipstackers); -- m->lastflip = (struct flipstacker *) poolalloc(&m->flipstackers); -- m->lastflip->flippedtri = encode(horiz); -- m->lastflip->prevflip = (struct flipstacker *) NULL; -- } -- --#ifdef SELF_CHECK -- if (counterclockwise(m, b, rightvertex, leftvertex, botvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle prior to vertex insertion.\n"); -- } -- if (counterclockwise(m, b, rightvertex, leftvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle after vertex insertion (top).\n"); -- } -- if (counterclockwise(m, b, leftvertex, botvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle after vertex insertion (left).\n"); -- } -- if (counterclockwise(m, b, botvertex, rightvertex, newvertex) < 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle after vertex insertion (right).\n"); -- } --#endif /* SELF_CHECK */ -- if (b->verbose > 2) { -- printf(" Updating top "); -- printtriangle(m, b, &horiz); -- printf(" Creating left "); -- printtriangle(m, b, &newbotleft); -- printf(" Creating right "); -- printtriangle(m, b, &newbotright); -- } -- } -- -- /* The insertion is successful by default, unless an encroached */ -- /* subsegment is found. */ -- success = SUCCESSFULVERTEX; -- /* Circle around the newly inserted vertex, checking each edge opposite */ -- /* it for the Delaunay property. Non-Delaunay edges are flipped. */ -- /* `horiz' is always the edge being checked. `first' marks where to */ -- /* stop circling. */ -- org(horiz, first); -- rightvertex = first; -- dest(horiz, leftvertex); -- /* Circle until finished. */ -- while (1) { -- /* By default, the edge will be flipped. */ -- doflip = 1; -- -- if (m->checksegments) { -- /* Check for a subsegment, which cannot be flipped. */ -- tspivot(horiz, checksubseg); -- if (checksubseg.ss != m->dummysub) { -- /* The edge is a subsegment and cannot be flipped. */ -- doflip = 0; --#ifndef CDT_ONLY -- if (segmentflaws) { -- /* Does the new vertex encroach upon this subsegment? */ -- if (checkseg4encroach(m, b, &checksubseg)) { -- success = ENCROACHINGVERTEX; -- } -- } --#endif /* not CDT_ONLY */ -- } -- } -- -- if (doflip) { -- /* Check if the edge is a boundary edge. */ -- sym(horiz, top); -- if (top.tri == m->dummytri) { -- /* The edge is a boundary edge and cannot be flipped. */ -- doflip = 0; -- } else { -- /* Find the vertex on the other side of the edge. */ -- apex(top, farvertex); -- /* In the incremental Delaunay triangulation algorithm, any of */ -- /* `leftvertex', `rightvertex', and `farvertex' could be vertices */ -- /* of the triangular bounding box. These vertices must be */ -- /* treated as if they are infinitely distant, even though their */ -- /* "coordinates" are not. */ -- if ((leftvertex == m->infvertex1) || (leftvertex == m->infvertex2) || -- (leftvertex == m->infvertex3)) { -- /* `leftvertex' is infinitely distant. Check the convexity of */ -- /* the boundary of the triangulation. 'farvertex' might be */ -- /* infinite as well, but trust me, this same condition should */ -- /* be applied. */ -- doflip = counterclockwise(m, b, newvertex, rightvertex, farvertex) -- > 0.0; -- } else if ((rightvertex == m->infvertex1) || -- (rightvertex == m->infvertex2) || -- (rightvertex == m->infvertex3)) { -- /* `rightvertex' is infinitely distant. Check the convexity of */ -- /* the boundary of the triangulation. 'farvertex' might be */ -- /* infinite as well, but trust me, this same condition should */ -- /* be applied. */ -- doflip = counterclockwise(m, b, farvertex, leftvertex, newvertex) -- > 0.0; -- } else if ((farvertex == m->infvertex1) || -- (farvertex == m->infvertex2) || -- (farvertex == m->infvertex3)) { -- /* `farvertex' is infinitely distant and cannot be inside */ -- /* the circumcircle of the triangle `horiz'. */ -- doflip = 0; -- } else { -- /* Test whether the edge is locally Delaunay. */ -- doflip = incircle(m, b, leftvertex, newvertex, rightvertex, -- farvertex) > 0.0; -- } -- if (doflip) { -- /* We made it! Flip the edge `horiz' by rotating its containing */ -- /* quadrilateral (the two triangles adjacent to `horiz'). */ -- /* Identify the casing of the quadrilateral. */ -- lprev(top, topleft); -- sym(topleft, toplcasing); -- lnext(top, topright); -- sym(topright, toprcasing); -- lnext(horiz, botleft); -- sym(botleft, botlcasing); -- lprev(horiz, botright); -- sym(botright, botrcasing); -- /* Rotate the quadrilateral one-quarter turn counterclockwise. */ -- bond(topleft, botlcasing); -- bond(botleft, botrcasing); -- bond(botright, toprcasing); -- bond(topright, toplcasing); -- if (m->checksegments) { -- /* Check for subsegments and rebond them to the quadrilateral. */ -- tspivot(topleft, toplsubseg); -- tspivot(botleft, botlsubseg); -- tspivot(botright, botrsubseg); -- tspivot(topright, toprsubseg); -- if (toplsubseg.ss == m->dummysub) { -- tsdissolve(topright); -- } else { -- tsbond(topright, toplsubseg); -- } -- if (botlsubseg.ss == m->dummysub) { -- tsdissolve(topleft); -- } else { -- tsbond(topleft, botlsubseg); -- } -- if (botrsubseg.ss == m->dummysub) { -- tsdissolve(botleft); -- } else { -- tsbond(botleft, botrsubseg); -- } -- if (toprsubseg.ss == m->dummysub) { -- tsdissolve(botright); -- } else { -- tsbond(botright, toprsubseg); -- } -- } -- /* New vertex assignments for the rotated quadrilateral. */ -- setorg(horiz, farvertex); -- setdest(horiz, newvertex); -- setapex(horiz, rightvertex); -- setorg(top, newvertex); -- setdest(top, farvertex); -- setapex(top, leftvertex); -- for (i = 0; i < m->eextras; i++) { -- /* Take the average of the two triangles' attributes. */ -- attrib = 0.5 * (elemattribute(top, i) + elemattribute(horiz, i)); -- setelemattribute(top, i, attrib); -- setelemattribute(horiz, i, attrib); -- } -- if (b->vararea) { -- if ((areabound(top) <= 0.0) || (areabound(horiz) <= 0.0)) { -- area = -1.0; -- } else { -- /* Take the average of the two triangles' area constraints. */ -- /* This prevents small area constraints from migrating a */ -- /* long, long way from their original location due to flips. */ -- area = 0.5 * (areabound(top) + areabound(horiz)); -- } -- setareabound(top, area); -- setareabound(horiz, area); -- } -- -- if (m->checkquality) { -- newflip = (struct flipstacker *) poolalloc(&m->flipstackers); -- newflip->flippedtri = encode(horiz); -- newflip->prevflip = m->lastflip; -- m->lastflip = newflip; -- } -- --#ifdef SELF_CHECK -- if (newvertex != (vertex) NULL) { -- if (counterclockwise(m, b, leftvertex, newvertex, rightvertex) < -- 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle prior to edge flip (bottom).\n"); -- } -- /* The following test has been removed because constrainededge() */ -- /* sometimes generates inverted triangles that insertvertex() */ -- /* removes. */ --/* -- if (counterclockwise(m, b, rightvertex, farvertex, leftvertex) < -- 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle prior to edge flip (top).\n"); -- } --*/ -- if (counterclockwise(m, b, farvertex, leftvertex, newvertex) < -- 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle after edge flip (left).\n"); -- } -- if (counterclockwise(m, b, newvertex, rightvertex, farvertex) < -- 0.0) { -- printf("Internal error in insertvertex():\n"); -- printf(" Clockwise triangle after edge flip (right).\n"); -- } -- } --#endif /* SELF_CHECK */ -- if (b->verbose > 2) { -- printf(" Edge flip results in left "); -- lnextself(topleft); -- printtriangle(m, b, &topleft); -- printf(" and right "); -- printtriangle(m, b, &horiz); -- } -- /* On the next iterations, consider the two edges that were */ -- /* exposed (this is, are now visible to the newly inserted */ -- /* vertex) by the edge flip. */ -- lprevself(horiz); -- leftvertex = farvertex; -- } -- } -- } -- if (!doflip) { -- /* The handle `horiz' is accepted as locally Delaunay. */ --#ifndef CDT_ONLY -- if (triflaws) { -- /* Check the triangle `horiz' for quality. */ -- testtriangle(m, b, &horiz); -- } --#endif /* not CDT_ONLY */ -- /* Look for the next edge around the newly inserted vertex. */ -- lnextself(horiz); -- sym(horiz, testtri); -- /* Check for finishing a complete revolution about the new vertex, or */ -- /* falling outside of the triangulation. The latter will happen */ -- /* when a vertex is inserted at a boundary. */ -- if ((leftvertex == first) || (testtri.tri == m->dummytri)) { -- /* We're done. Return a triangle whose origin is the new vertex. */ -- lnext(horiz, *searchtri); -- lnext(horiz, m->recenttri); -- return success; -- } -- /* Finish finding the next edge around the newly inserted vertex. */ -- lnext(testtri, horiz); -- rightvertex = leftvertex; -- dest(horiz, leftvertex); -- } -- } --} -- --/*****************************************************************************/ --/* */ --/* triangulatepolygon() Find the Delaunay triangulation of a polygon that */ --/* has a certain "nice" shape. This includes the */ --/* polygons that result from deletion of a vertex or */ --/* insertion of a segment. */ --/* */ --/* This is a conceptually difficult routine. The starting assumption is */ --/* that we have a polygon with n sides. n - 1 of these sides are currently */ --/* represented as edges in the mesh. One side, called the "base", need not */ --/* be. */ --/* */ --/* Inside the polygon is a structure I call a "fan", consisting of n - 1 */ --/* triangles that share a common origin. For each of these triangles, the */ --/* edge opposite the origin is one of the sides of the polygon. The */ --/* primary edge of each triangle is the edge directed from the origin to */ --/* the destination; note that this is not the same edge that is a side of */ --/* the polygon. `firstedge' is the primary edge of the first triangle. */ --/* From there, the triangles follow in counterclockwise order about the */ --/* polygon, until `lastedge', the primary edge of the last triangle. */ --/* `firstedge' and `lastedge' are probably connected to other triangles */ --/* beyond the extremes of the fan, but their identity is not important, as */ --/* long as the fan remains connected to them. */ --/* */ --/* Imagine the polygon oriented so that its base is at the bottom. This */ --/* puts `firstedge' on the far right, and `lastedge' on the far left. */ --/* The right vertex of the base is the destination of `firstedge', and the */ --/* left vertex of the base is the apex of `lastedge'. */ --/* */ --/* The challenge now is to find the right sequence of edge flips to */ --/* transform the fan into a Delaunay triangulation of the polygon. Each */ --/* edge flip effectively removes one triangle from the fan, committing it */ --/* to the polygon. The resulting polygon has one fewer edge. If `doflip' */ --/* is set, the final flip will be performed, resulting in a fan of one */ --/* (useless?) triangle. If `doflip' is not set, the final flip is not */ --/* performed, resulting in a fan of two triangles, and an unfinished */ --/* triangular polygon that is not yet filled out with a single triangle. */ --/* On completion of the routine, `lastedge' is the last remaining triangle, */ --/* or the leftmost of the last two. */ --/* */ --/* Although the flips are performed in the order described above, the */ --/* decisions about what flips to perform are made in precisely the reverse */ --/* order. The recursive triangulatepolygon() procedure makes a decision, */ --/* uses up to two recursive calls to triangulate the "subproblems" */ --/* (polygons with fewer edges), and then performs an edge flip. */ --/* */ --/* The "decision" it makes is which vertex of the polygon should be */ --/* connected to the base. This decision is made by testing every possible */ --/* vertex. Once the best vertex is found, the two edges that connect this */ --/* vertex to the base become the bases for two smaller polygons. These */ --/* are triangulated recursively. Unfortunately, this approach can take */ --/* O(n^2) time not only in the worst case, but in many common cases. It's */ --/* rarely a big deal for vertex deletion, where n is rarely larger than */ --/* ten, but it could be a big deal for segment insertion, especially if */ --/* there's a lot of long segments that each cut many triangles. I ought to */ --/* code a faster algorithm some day. */ --/* */ --/* The `edgecount' parameter is the number of sides of the polygon, */ --/* including its base. `triflaws' is a flag that determines whether the */ --/* new triangles should be tested for quality, and enqueued if they are */ --/* bad. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void triangulatepolygon(struct mesh *m, struct behavior *b, -- struct otri *firstedge, struct otri *lastedge, -- int edgecount, int doflip, int triflaws) --#else /* not ANSI_DECLARATORS */ --void triangulatepolygon(m, b, firstedge, lastedge, edgecount, doflip, triflaws) --struct mesh *m; --struct behavior *b; --struct otri *firstedge; --struct otri *lastedge; --int edgecount; --int doflip; --int triflaws; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri testtri; -- struct otri besttri; -- struct otri tempedge; -- vertex leftbasevertex, rightbasevertex; -- vertex testvertex; -- vertex bestvertex; -- int bestnumber; -- int i; -- triangle ptr; /* Temporary variable used by sym(), onext(), and oprev(). */ -- -- /* Identify the base vertices. */ -- apex(*lastedge, leftbasevertex); -- dest(*firstedge, rightbasevertex); -- if (b->verbose > 2) { -- printf(" Triangulating interior polygon at edge\n"); -- printf(" (%.12g, %.12g) (%.12g, %.12g)\n", leftbasevertex[0], -- leftbasevertex[1], rightbasevertex[0], rightbasevertex[1]); -- } -- /* Find the best vertex to connect the base to. */ -- onext(*firstedge, besttri); -- dest(besttri, bestvertex); -- otricopy(besttri, testtri); -- bestnumber = 1; -- for (i = 2; i <= edgecount - 2; i++) { -- onextself(testtri); -- dest(testtri, testvertex); -- /* Is this a better vertex? */ -- if (incircle(m, b, leftbasevertex, rightbasevertex, bestvertex, -- testvertex) > 0.0) { -- otricopy(testtri, besttri); -- bestvertex = testvertex; -- bestnumber = i; -- } -- } -- if (b->verbose > 2) { -- printf(" Connecting edge to (%.12g, %.12g)\n", bestvertex[0], -- bestvertex[1]); -- } -- if (bestnumber > 1) { -- /* Recursively triangulate the smaller polygon on the right. */ -- oprev(besttri, tempedge); -- triangulatepolygon(m, b, firstedge, &tempedge, bestnumber + 1, 1, -- triflaws); -- } -- if (bestnumber < edgecount - 2) { -- /* Recursively triangulate the smaller polygon on the left. */ -- sym(besttri, tempedge); -- triangulatepolygon(m, b, &besttri, lastedge, edgecount - bestnumber, 1, -- triflaws); -- /* Find `besttri' again; it may have been lost to edge flips. */ -- sym(tempedge, besttri); -- } -- if (doflip) { -- /* Do one final edge flip. */ -- flip(m, b, &besttri); --#ifndef CDT_ONLY -- if (triflaws) { -- /* Check the quality of the newly committed triangle. */ -- sym(besttri, testtri); -- testtriangle(m, b, &testtri); -- } --#endif /* not CDT_ONLY */ -- } -- /* Return the base triangle. */ -- otricopy(besttri, *lastedge); --} -- --/*****************************************************************************/ --/* */ --/* deletevertex() Delete a vertex from a Delaunay triangulation, ensuring */ --/* that the triangulation remains Delaunay. */ --/* */ --/* The origin of `deltri' is deleted. The union of the triangles adjacent */ --/* to this vertex is a polygon, for which the Delaunay triangulation is */ --/* found. Two triangles are removed from the mesh. */ --/* */ --/* Only interior vertices that do not lie on segments or boundaries may be */ --/* deleted. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void deletevertex(struct mesh *m, struct behavior *b, struct otri *deltri) --#else /* not ANSI_DECLARATORS */ --void deletevertex(m, b, deltri) --struct mesh *m; --struct behavior *b; --struct otri *deltri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri countingtri; -- struct otri firstedge, lastedge; -- struct otri deltriright; -- struct otri lefttri, righttri; -- struct otri leftcasing, rightcasing; -- struct osub leftsubseg, rightsubseg; -- vertex delvertex; -- vertex neworg; -- int edgecount; -- triangle ptr; /* Temporary variable used by sym(), onext(), and oprev(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- org(*deltri, delvertex); -- if (b->verbose > 1) { -- printf(" Deleting (%.12g, %.12g).\n", delvertex[0], delvertex[1]); -- } -- vertexdealloc(m, delvertex); -- -- /* Count the degree of the vertex being deleted. */ -- onext(*deltri, countingtri); -- edgecount = 1; -- while (!otriequal(*deltri, countingtri)) { --#ifdef SELF_CHECK -- if (countingtri.tri == m->dummytri) { -- printf("Internal error in deletevertex():\n"); -- printf(" Attempt to delete boundary vertex.\n"); -- internalerror(); -- } --#endif /* SELF_CHECK */ -- edgecount++; -- onextself(countingtri); -- } -- --#ifdef SELF_CHECK -- if (edgecount < 3) { -- printf("Internal error in deletevertex():\n Vertex has degree %d.\n", -- edgecount); -- internalerror(); -- } --#endif /* SELF_CHECK */ -- if (edgecount > 3) { -- /* Triangulate the polygon defined by the union of all triangles */ -- /* adjacent to the vertex being deleted. Check the quality of */ -- /* the resulting triangles. */ -- onext(*deltri, firstedge); -- oprev(*deltri, lastedge); -- triangulatepolygon(m, b, &firstedge, &lastedge, edgecount, 0, -- !b->nobisect); -- } -- /* Splice out two triangles. */ -- lprev(*deltri, deltriright); -- dnext(*deltri, lefttri); -- sym(lefttri, leftcasing); -- oprev(deltriright, righttri); -- sym(righttri, rightcasing); -- bond(*deltri, leftcasing); -- bond(deltriright, rightcasing); -- tspivot(lefttri, leftsubseg); -- if (leftsubseg.ss != m->dummysub) { -- tsbond(*deltri, leftsubseg); -- } -- tspivot(righttri, rightsubseg); -- if (rightsubseg.ss != m->dummysub) { -- tsbond(deltriright, rightsubseg); -- } -- -- /* Set the new origin of `deltri' and check its quality. */ -- org(lefttri, neworg); -- setorg(*deltri, neworg); -- if (!b->nobisect) { -- testtriangle(m, b, deltri); -- } -- -- /* Delete the two spliced-out triangles. */ -- triangledealloc(m, lefttri.tri); -- triangledealloc(m, righttri.tri); --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* undovertex() Undo the most recent vertex insertion. */ --/* */ --/* Walks through the list of transformations (flips and a vertex insertion) */ --/* in the reverse of the order in which they were done, and undoes them. */ --/* The inserted vertex is removed from the triangulation and deallocated. */ --/* Two triangles (possibly just one) are also deallocated. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void undovertex(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void undovertex(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri fliptri; -- struct otri botleft, botright, topright; -- struct otri botlcasing, botrcasing, toprcasing; -- struct otri gluetri; -- struct osub botlsubseg, botrsubseg, toprsubseg; -- vertex botvertex, rightvertex; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- /* Walk through the list of transformations (flips and a vertex insertion) */ -- /* in the reverse of the order in which they were done, and undo them. */ -- while (m->lastflip != (struct flipstacker *) NULL) { -- /* Find a triangle involved in the last unreversed transformation. */ -- decode(m->lastflip->flippedtri, fliptri); -- -- /* We are reversing one of three transformations: a trisection of one */ -- /* triangle into three (by inserting a vertex in the triangle), a */ -- /* bisection of two triangles into four (by inserting a vertex in an */ -- /* edge), or an edge flip. */ -- if (m->lastflip->prevflip == (struct flipstacker *) NULL) { -- /* Restore a triangle that was split into three triangles, */ -- /* so it is again one triangle. */ -- dprev(fliptri, botleft); -- lnextself(botleft); -- onext(fliptri, botright); -- lprevself(botright); -- sym(botleft, botlcasing); -- sym(botright, botrcasing); -- dest(botleft, botvertex); -- -- setapex(fliptri, botvertex); -- lnextself(fliptri); -- bond(fliptri, botlcasing); -- tspivot(botleft, botlsubseg); -- tsbond(fliptri, botlsubseg); -- lnextself(fliptri); -- bond(fliptri, botrcasing); -- tspivot(botright, botrsubseg); -- tsbond(fliptri, botrsubseg); -- -- /* Delete the two spliced-out triangles. */ -- triangledealloc(m, botleft.tri); -- triangledealloc(m, botright.tri); -- } else if (m->lastflip->prevflip == (struct flipstacker *) &insertvertex) { -- /* Restore two triangles that were split into four triangles, */ -- /* so they are again two triangles. */ -- lprev(fliptri, gluetri); -- sym(gluetri, botright); -- lnextself(botright); -- sym(botright, botrcasing); -- dest(botright, rightvertex); -- -- setorg(fliptri, rightvertex); -- bond(gluetri, botrcasing); -- tspivot(botright, botrsubseg); -- tsbond(gluetri, botrsubseg); -- -- /* Delete the spliced-out triangle. */ -- triangledealloc(m, botright.tri); -- -- sym(fliptri, gluetri); -- if (gluetri.tri != m->dummytri) { -- lnextself(gluetri); -- dnext(gluetri, topright); -- sym(topright, toprcasing); -- -- setorg(gluetri, rightvertex); -- bond(gluetri, toprcasing); -- tspivot(topright, toprsubseg); -- tsbond(gluetri, toprsubseg); -- -- /* Delete the spliced-out triangle. */ -- triangledealloc(m, topright.tri); -- } -- -- /* This is the end of the list, sneakily encoded. */ -- m->lastflip->prevflip = (struct flipstacker *) NULL; -- } else { -- /* Undo an edge flip. */ -- unflip(m, b, &fliptri); -- } -- -- /* Go on and process the next transformation. */ -- m->lastflip = m->lastflip->prevflip; -- } --} -- --#endif /* not CDT_ONLY */ -- --/** **/ --/** **/ --/********* Mesh transformation routines end here *********/ -- --/********* Divide-and-conquer Delaunay triangulation begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* The divide-and-conquer bounding box */ --/* */ --/* I originally implemented the divide-and-conquer and incremental Delaunay */ --/* triangulations using the edge-based data structure presented by Guibas */ --/* and Stolfi. Switching to a triangle-based data structure doubled the */ --/* speed. However, I had to think of a few extra tricks to maintain the */ --/* elegance of the original algorithms. */ --/* */ --/* The "bounding box" used by my variant of the divide-and-conquer */ --/* algorithm uses one triangle for each edge of the convex hull of the */ --/* triangulation. These bounding triangles all share a common apical */ --/* vertex, which is represented by NULL and which represents nothing. */ --/* The bounding triangles are linked in a circular fan about this NULL */ --/* vertex, and the edges on the convex hull of the triangulation appear */ --/* opposite the NULL vertex. You might find it easiest to imagine that */ --/* the NULL vertex is a point in 3D space behind the center of the */ --/* triangulation, and that the bounding triangles form a sort of cone. */ --/* */ --/* This bounding box makes it easy to represent degenerate cases. For */ --/* instance, the triangulation of two vertices is a single edge. This edge */ --/* is represented by two bounding box triangles, one on each "side" of the */ --/* edge. These triangles are also linked together in a fan about the NULL */ --/* vertex. */ --/* */ --/* The bounding box also makes it easy to traverse the convex hull, as the */ --/* divide-and-conquer algorithm needs to do. */ --/* */ --/*****************************************************************************/ -- --/*****************************************************************************/ --/* */ --/* vertexsort() Sort an array of vertices by x-coordinate, using the */ --/* y-coordinate as a secondary key. */ --/* */ --/* Uses quicksort. Randomized O(n log n) time. No, I did not make any of */ --/* the usual quicksort mistakes. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void vertexsort(vertex *sortarray, int arraysize) --#else /* not ANSI_DECLARATORS */ --void vertexsort(sortarray, arraysize) --vertex *sortarray; --int arraysize; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int left, right; -- int pivot; -- REAL pivotx, pivoty; -- vertex temp; -- -- if (arraysize == 2) { -- /* Recursive base case. */ -- if ((sortarray[0][0] > sortarray[1][0]) || -- ((sortarray[0][0] == sortarray[1][0]) && -- (sortarray[0][1] > sortarray[1][1]))) { -- temp = sortarray[1]; -- sortarray[1] = sortarray[0]; -- sortarray[0] = temp; -- } -- return; -- } -- /* Choose a random pivot to split the array. */ -- pivot = (int) randomnation((unsigned int) arraysize); -- if (pivot == arraysize)//JLM without this test, pivot can equal arraysize and segfault -- pivot--; -- pivotx = sortarray[pivot][0]; -- pivoty = sortarray[pivot][1]; -- /* Split the array. */ -- left = -1; -- right = arraysize; -- while (left < right) { -- /* Search for a vertex whose x-coordinate is too large for the left. */ -- do { -- left++; -- } while ((left <= right) && ((sortarray[left][0] < pivotx) || -- ((sortarray[left][0] == pivotx) && -- (sortarray[left][1] < pivoty)))); -- /* Search for a vertex whose x-coordinate is too small for the right. */ -- do { -- right--; -- } while ((left <= right) && ((sortarray[right][0] > pivotx) || -- ((sortarray[right][0] == pivotx) && -- (sortarray[right][1] > pivoty)))); -- if (left < right) { -- /* Swap the left and right vertices. */ -- temp = sortarray[left]; -- sortarray[left] = sortarray[right]; -- sortarray[right] = temp; -- } -- } -- if (left > 1) { -- /* Recursively sort the left subset. */ -- vertexsort(sortarray, left); -- } -- if (right < arraysize - 2) { -- /* Recursively sort the right subset. */ -- vertexsort(&sortarray[right + 1], arraysize - right - 1); -- } --} -- --/*****************************************************************************/ --/* */ --/* vertexmedian() An order statistic algorithm, almost. Shuffles an */ --/* array of vertices so that the first `median' vertices */ --/* occur lexicographically before the remaining vertices. */ --/* */ --/* Uses the x-coordinate as the primary key if axis == 0; the y-coordinate */ --/* if axis == 1. Very similar to the vertexsort() procedure, but runs in */ --/* randomized linear time. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void vertexmedian(vertex *sortarray, int arraysize, int median, int axis) --#else /* not ANSI_DECLARATORS */ --void vertexmedian(sortarray, arraysize, median, axis) --vertex *sortarray; --int arraysize; --int median; --int axis; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int left, right; -- int pivot; -- REAL pivot1, pivot2; -- vertex temp; -- -- if (arraysize == 2) { -- /* Recursive base case. */ -- if ((sortarray[0][axis] > sortarray[1][axis]) || -- ((sortarray[0][axis] == sortarray[1][axis]) && -- (sortarray[0][1 - axis] > sortarray[1][1 - axis]))) { -- temp = sortarray[1]; -- sortarray[1] = sortarray[0]; -- sortarray[0] = temp; -- } -- return; -- } -- /* Choose a random pivot to split the array. */ -- pivot = (int) randomnation((unsigned int) arraysize); -- if (pivot == arraysize)//JLM/SES without this test, pivot can equal arraysize and segfault -- pivot--; -- pivot1 = sortarray[pivot][axis]; -- pivot2 = sortarray[pivot][1 - axis]; -- /* Split the array. */ -- left = -1; -- right = arraysize; -- while (left < right) { -- /* Search for a vertex whose x-coordinate is too large for the left. */ -- do { -- left++; -- } while ((left <= right) && ((sortarray[left][axis] < pivot1) || -- ((sortarray[left][axis] == pivot1) && -- (sortarray[left][1 - axis] < pivot2)))); -- /* Search for a vertex whose x-coordinate is too small for the right. */ -- do { -- right--; -- } while ((left <= right) && ((sortarray[right][axis] > pivot1) || -- ((sortarray[right][axis] == pivot1) && -- (sortarray[right][1 - axis] > pivot2)))); -- if (left < right) { -- /* Swap the left and right vertices. */ -- temp = sortarray[left]; -- sortarray[left] = sortarray[right]; -- sortarray[right] = temp; -- } -- } -- /* Unlike in vertexsort(), at most one of the following */ -- /* conditionals is true. */ -- if (left > median) { -- /* Recursively shuffle the left subset. */ -- vertexmedian(sortarray, left, median, axis); -- } -- if (right < median - 1) { -- /* Recursively shuffle the right subset. */ -- vertexmedian(&sortarray[right + 1], arraysize - right - 1, -- median - right - 1, axis); -- } --} -- --/*****************************************************************************/ --/* */ --/* alternateaxes() Sorts the vertices as appropriate for the divide-and- */ --/* conquer algorithm with alternating cuts. */ --/* */ --/* Partitions by x-coordinate if axis == 0; by y-coordinate if axis == 1. */ --/* For the base case, subsets containing only two or three vertices are */ --/* always sorted by x-coordinate. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void alternateaxes(vertex *sortarray, int arraysize, int axis) --#else /* not ANSI_DECLARATORS */ --void alternateaxes(sortarray, arraysize, axis) --vertex *sortarray; --int arraysize; --int axis; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int divider; -- -- divider = arraysize >> 1; -- if (arraysize <= 3) { -- /* Recursive base case: subsets of two or three vertices will be */ -- /* handled specially, and should always be sorted by x-coordinate. */ -- axis = 0; -- } -- /* Partition with a horizontal or vertical cut. */ -- vertexmedian(sortarray, arraysize, divider, axis); -- /* Recursively partition the subsets with a cross cut. */ -- if (arraysize - divider >= 2) { -- if (divider >= 2) { -- alternateaxes(sortarray, divider, 1 - axis); -- } -- alternateaxes(&sortarray[divider], arraysize - divider, 1 - axis); -- } --} -- --/*****************************************************************************/ --/* */ --/* mergehulls() Merge two adjacent Delaunay triangulations into a */ --/* single Delaunay triangulation. */ --/* */ --/* This is similar to the algorithm given by Guibas and Stolfi, but uses */ --/* a triangle-based, rather than edge-based, data structure. */ --/* */ --/* The algorithm walks up the gap between the two triangulations, knitting */ --/* them together. As they are merged, some of their bounding triangles */ --/* are converted into real triangles of the triangulation. The procedure */ --/* pulls each hull's bounding triangles apart, then knits them together */ --/* like the teeth of two gears. The Delaunay property determines, at each */ --/* step, whether the next "tooth" is a bounding triangle of the left hull */ --/* or the right. When a bounding triangle becomes real, its apex is */ --/* changed from NULL to a real vertex. */ --/* */ --/* Only two new triangles need to be allocated. These become new bounding */ --/* triangles at the top and bottom of the seam. They are used to connect */ --/* the remaining bounding triangles (those that have not been converted */ --/* into real triangles) into a single fan. */ --/* */ --/* On entry, `farleft' and `innerleft' are bounding triangles of the left */ --/* triangulation. The origin of `farleft' is the leftmost vertex, and */ --/* the destination of `innerleft' is the rightmost vertex of the */ --/* triangulation. Similarly, `innerright' and `farright' are bounding */ --/* triangles of the right triangulation. The origin of `innerright' and */ --/* destination of `farright' are the leftmost and rightmost vertices. */ --/* */ --/* On completion, the origin of `farleft' is the leftmost vertex of the */ --/* merged triangulation, and the destination of `farright' is the rightmost */ --/* vertex. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void mergehulls(struct mesh *m, struct behavior *b, struct otri *farleft, -- struct otri *innerleft, struct otri *innerright, -- struct otri *farright, int axis) --#else /* not ANSI_DECLARATORS */ --void mergehulls(m, b, farleft, innerleft, innerright, farright, axis) --struct mesh *m; --struct behavior *b; --struct otri *farleft; --struct otri *innerleft; --struct otri *innerright; --struct otri *farright; --int axis; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri leftcand, rightcand; -- struct otri baseedge; -- struct otri nextedge; -- struct otri sidecasing, topcasing, outercasing; -- struct otri checkedge; -- vertex innerleftdest; -- vertex innerrightorg; -- vertex innerleftapex, innerrightapex; -- vertex farleftpt, farrightpt; -- vertex farleftapex, farrightapex; -- vertex lowerleft, lowerright; -- vertex upperleft, upperright; -- vertex nextapex; -- vertex checkvertex; -- int changemade; -- int badedge; -- int leftfinished, rightfinished; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- dest(*innerleft, innerleftdest); -- apex(*innerleft, innerleftapex); -- org(*innerright, innerrightorg); -- apex(*innerright, innerrightapex); -- /* Special treatment for horizontal cuts. */ -- if (b->dwyer && (axis == 1)) { -- org(*farleft, farleftpt); -- apex(*farleft, farleftapex); -- dest(*farright, farrightpt); -- apex(*farright, farrightapex); -- /* The pointers to the extremal vertices are shifted to point to the */ -- /* topmost and bottommost vertex of each hull, rather than the */ -- /* leftmost and rightmost vertices. */ -- while (farleftapex[1] < farleftpt[1]) { -- lnextself(*farleft); -- symself(*farleft); -- farleftpt = farleftapex; -- apex(*farleft, farleftapex); -- } -- sym(*innerleft, checkedge); -- apex(checkedge, checkvertex); -- while (checkvertex[1] > innerleftdest[1]) { -- lnext(checkedge, *innerleft); -- innerleftapex = innerleftdest; -- innerleftdest = checkvertex; -- sym(*innerleft, checkedge); -- apex(checkedge, checkvertex); -- } -- while (innerrightapex[1] < innerrightorg[1]) { -- lnextself(*innerright); -- symself(*innerright); -- innerrightorg = innerrightapex; -- apex(*innerright, innerrightapex); -- } -- sym(*farright, checkedge); -- apex(checkedge, checkvertex); -- while (checkvertex[1] > farrightpt[1]) { -- lnext(checkedge, *farright); -- farrightpt = checkvertex; -- sym(*farright, checkedge); -- apex(checkedge, checkvertex); -- } -- } -- /* Find a line tangent to and below both hulls. */ -- do { -- changemade = 0; -- /* Make innerleftdest the "bottommost" vertex of the left hull. */ -- if (counterclockwise(m, b, innerleftdest, innerleftapex, innerrightorg) > -- 0.0) { -- lprevself(*innerleft); -- symself(*innerleft); -- innerleftdest = innerleftapex; -- apex(*innerleft, innerleftapex); -- changemade = 1; -- } -- /* Make innerrightorg the "bottommost" vertex of the right hull. */ -- if (counterclockwise(m, b, innerrightapex, innerrightorg, innerleftdest) > -- 0.0) { -- lnextself(*innerright); -- symself(*innerright); -- innerrightorg = innerrightapex; -- apex(*innerright, innerrightapex); -- changemade = 1; -- } -- } while (changemade); -- /* Find the two candidates to be the next "gear tooth." */ -- sym(*innerleft, leftcand); -- sym(*innerright, rightcand); -- /* Create the bottom new bounding triangle. */ -- maketriangle(m, b, &baseedge); -- /* Connect it to the bounding boxes of the left and right triangulations. */ -- bond(baseedge, *innerleft); -- lnextself(baseedge); -- bond(baseedge, *innerright); -- lnextself(baseedge); -- setorg(baseedge, innerrightorg); -- setdest(baseedge, innerleftdest); -- /* Apex is intentionally left NULL. */ -- if (b->verbose > 2) { -- printf(" Creating base bounding "); -- printtriangle(m, b, &baseedge); -- } -- /* Fix the extreme triangles if necessary. */ -- org(*farleft, farleftpt); -- if (innerleftdest == farleftpt) { -- lnext(baseedge, *farleft); -- } -- dest(*farright, farrightpt); -- if (innerrightorg == farrightpt) { -- lprev(baseedge, *farright); -- } -- /* The vertices of the current knitting edge. */ -- lowerleft = innerleftdest; -- lowerright = innerrightorg; -- /* The candidate vertices for knitting. */ -- apex(leftcand, upperleft); -- apex(rightcand, upperright); -- /* Walk up the gap between the two triangulations, knitting them together. */ -- while (1) { -- /* Have we reached the top? (This isn't quite the right question, */ -- /* because even though the left triangulation might seem finished now, */ -- /* moving up on the right triangulation might reveal a new vertex of */ -- /* the left triangulation. And vice-versa.) */ -- leftfinished = counterclockwise(m, b, upperleft, lowerleft, lowerright) <= -- 0.0; -- rightfinished = counterclockwise(m, b, upperright, lowerleft, lowerright) -- <= 0.0; -- if (leftfinished && rightfinished) { -- /* Create the top new bounding triangle. */ -- maketriangle(m, b, &nextedge); -- setorg(nextedge, lowerleft); -- setdest(nextedge, lowerright); -- /* Apex is intentionally left NULL. */ -- /* Connect it to the bounding boxes of the two triangulations. */ -- bond(nextedge, baseedge); -- lnextself(nextedge); -- bond(nextedge, rightcand); -- lnextself(nextedge); -- bond(nextedge, leftcand); -- if (b->verbose > 2) { -- printf(" Creating top bounding "); -- printtriangle(m, b, &nextedge); -- } -- /* Special treatment for horizontal cuts. */ -- if (b->dwyer && (axis == 1)) { -- org(*farleft, farleftpt); -- apex(*farleft, farleftapex); -- dest(*farright, farrightpt); -- apex(*farright, farrightapex); -- sym(*farleft, checkedge); -- apex(checkedge, checkvertex); -- /* The pointers to the extremal vertices are restored to the */ -- /* leftmost and rightmost vertices (rather than topmost and */ -- /* bottommost). */ -- while (checkvertex[0] < farleftpt[0]) { -- lprev(checkedge, *farleft); -- farleftpt = checkvertex; -- sym(*farleft, checkedge); -- apex(checkedge, checkvertex); -- } -- while (farrightapex[0] > farrightpt[0]) { -- lprevself(*farright); -- symself(*farright); -- farrightpt = farrightapex; -- apex(*farright, farrightapex); -- } -- } -- return; -- } -- /* Consider eliminating edges from the left triangulation. */ -- if (!leftfinished) { -- /* What vertex would be exposed if an edge were deleted? */ -- lprev(leftcand, nextedge); -- symself(nextedge); -- apex(nextedge, nextapex); -- /* If nextapex is NULL, then no vertex would be exposed; the */ -- /* triangulation would have been eaten right through. */ -- if (nextapex != (vertex) NULL) { -- /* Check whether the edge is Delaunay. */ -- badedge = incircle(m, b, lowerleft, lowerright, upperleft, nextapex) > -- 0.0; -- while (badedge) { -- /* Eliminate the edge with an edge flip. As a result, the */ -- /* left triangulation will have one more boundary triangle. */ -- lnextself(nextedge); -- sym(nextedge, topcasing); -- lnextself(nextedge); -- sym(nextedge, sidecasing); -- bond(nextedge, topcasing); -- bond(leftcand, sidecasing); -- lnextself(leftcand); -- sym(leftcand, outercasing); -- lprevself(nextedge); -- bond(nextedge, outercasing); -- /* Correct the vertices to reflect the edge flip. */ -- setorg(leftcand, lowerleft); -- setdest(leftcand, NULL); -- setapex(leftcand, nextapex); -- setorg(nextedge, NULL); -- setdest(nextedge, upperleft); -- setapex(nextedge, nextapex); -- /* Consider the newly exposed vertex. */ -- upperleft = nextapex; -- /* What vertex would be exposed if another edge were deleted? */ -- otricopy(sidecasing, nextedge); -- apex(nextedge, nextapex); -- if (nextapex != (vertex) NULL) { -- /* Check whether the edge is Delaunay. */ -- badedge = incircle(m, b, lowerleft, lowerright, upperleft, -- nextapex) > 0.0; -- } else { -- /* Avoid eating right through the triangulation. */ -- badedge = 0; -- } -- } -- } -- } -- /* Consider eliminating edges from the right triangulation. */ -- if (!rightfinished) { -- /* What vertex would be exposed if an edge were deleted? */ -- lnext(rightcand, nextedge); -- symself(nextedge); -- apex(nextedge, nextapex); -- /* If nextapex is NULL, then no vertex would be exposed; the */ -- /* triangulation would have been eaten right through. */ -- if (nextapex != (vertex) NULL) { -- /* Check whether the edge is Delaunay. */ -- badedge = incircle(m, b, lowerleft, lowerright, upperright, nextapex) > -- 0.0; -- while (badedge) { -- /* Eliminate the edge with an edge flip. As a result, the */ -- /* right triangulation will have one more boundary triangle. */ -- lprevself(nextedge); -- sym(nextedge, topcasing); -- lprevself(nextedge); -- sym(nextedge, sidecasing); -- bond(nextedge, topcasing); -- bond(rightcand, sidecasing); -- lprevself(rightcand); -- sym(rightcand, outercasing); -- lnextself(nextedge); -- bond(nextedge, outercasing); -- /* Correct the vertices to reflect the edge flip. */ -- setorg(rightcand, NULL); -- setdest(rightcand, lowerright); -- setapex(rightcand, nextapex); -- setorg(nextedge, upperright); -- setdest(nextedge, NULL); -- setapex(nextedge, nextapex); -- /* Consider the newly exposed vertex. */ -- upperright = nextapex; -- /* What vertex would be exposed if another edge were deleted? */ -- otricopy(sidecasing, nextedge); -- apex(nextedge, nextapex); -- if (nextapex != (vertex) NULL) { -- /* Check whether the edge is Delaunay. */ -- badedge = incircle(m, b, lowerleft, lowerright, upperright, -- nextapex) > 0.0; -- } else { -- /* Avoid eating right through the triangulation. */ -- badedge = 0; -- } -- } -- } -- } -- if (leftfinished || (!rightfinished && -- (incircle(m, b, upperleft, lowerleft, lowerright, upperright) > -- 0.0))) { -- /* Knit the triangulations, adding an edge from `lowerleft' */ -- /* to `upperright'. */ -- bond(baseedge, rightcand); -- lprev(rightcand, baseedge); -- setdest(baseedge, lowerleft); -- lowerright = upperright; -- sym(baseedge, rightcand); -- apex(rightcand, upperright); -- } else { -- /* Knit the triangulations, adding an edge from `upperleft' */ -- /* to `lowerright'. */ -- bond(baseedge, leftcand); -- lnext(leftcand, baseedge); -- setorg(baseedge, lowerright); -- lowerleft = upperleft; -- sym(baseedge, leftcand); -- apex(leftcand, upperleft); -- } -- if (b->verbose > 2) { -- printf(" Connecting "); -- printtriangle(m, b, &baseedge); -- } -- } --} -- --/*****************************************************************************/ --/* */ --/* divconqrecurse() Recursively form a Delaunay triangulation by the */ --/* divide-and-conquer method. */ --/* */ --/* Recursively breaks down the problem into smaller pieces, which are */ --/* knitted together by mergehulls(). The base cases (problems of two or */ --/* three vertices) are handled specially here. */ --/* */ --/* On completion, `farleft' and `farright' are bounding triangles such that */ --/* the origin of `farleft' is the leftmost vertex (breaking ties by */ --/* choosing the highest leftmost vertex), and the destination of */ --/* `farright' is the rightmost vertex (breaking ties by choosing the */ --/* lowest rightmost vertex). */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void divconqrecurse(struct mesh *m, struct behavior *b, vertex *sortarray, -- int vertices, int axis, -- struct otri *farleft, struct otri *farright) --#else /* not ANSI_DECLARATORS */ --void divconqrecurse(m, b, sortarray, vertices, axis, farleft, farright) --struct mesh *m; --struct behavior *b; --vertex *sortarray; --int vertices; --int axis; --struct otri *farleft; --struct otri *farright; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri midtri, tri1, tri2, tri3; -- struct otri innerleft, innerright; -- REAL area; -- int divider; -- -- if (b->verbose > 2) { -- printf(" Triangulating %d vertices.\n", vertices); -- } -- if (vertices == 2) { -- /* The triangulation of two vertices is an edge. An edge is */ -- /* represented by two bounding triangles. */ -- maketriangle(m, b, farleft); -- setorg(*farleft, sortarray[0]); -- setdest(*farleft, sortarray[1]); -- /* The apex is intentionally left NULL. */ -- maketriangle(m, b, farright); -- setorg(*farright, sortarray[1]); -- setdest(*farright, sortarray[0]); -- /* The apex is intentionally left NULL. */ -- bond(*farleft, *farright); -- lprevself(*farleft); -- lnextself(*farright); -- bond(*farleft, *farright); -- lprevself(*farleft); -- lnextself(*farright); -- bond(*farleft, *farright); -- if (b->verbose > 2) { -- printf(" Creating "); -- printtriangle(m, b, farleft); -- printf(" Creating "); -- printtriangle(m, b, farright); -- } -- /* Ensure that the origin of `farleft' is sortarray[0]. */ -- lprev(*farright, *farleft); -- return; -- } else if (vertices == 3) { -- /* The triangulation of three vertices is either a triangle (with */ -- /* three bounding triangles) or two edges (with four bounding */ -- /* triangles). In either case, four triangles are created. */ -- maketriangle(m, b, &midtri); -- maketriangle(m, b, &tri1); -- maketriangle(m, b, &tri2); -- maketriangle(m, b, &tri3); -- area = counterclockwise(m, b, sortarray[0], sortarray[1], sortarray[2]); -- if (area == 0.0) { -- /* Three collinear vertices; the triangulation is two edges. */ -- setorg(midtri, sortarray[0]); -- setdest(midtri, sortarray[1]); -- setorg(tri1, sortarray[1]); -- setdest(tri1, sortarray[0]); -- setorg(tri2, sortarray[2]); -- setdest(tri2, sortarray[1]); -- setorg(tri3, sortarray[1]); -- setdest(tri3, sortarray[2]); -- /* All apices are intentionally left NULL. */ -- bond(midtri, tri1); -- bond(tri2, tri3); -- lnextself(midtri); -- lprevself(tri1); -- lnextself(tri2); -- lprevself(tri3); -- bond(midtri, tri3); -- bond(tri1, tri2); -- lnextself(midtri); -- lprevself(tri1); -- lnextself(tri2); -- lprevself(tri3); -- bond(midtri, tri1); -- bond(tri2, tri3); -- /* Ensure that the origin of `farleft' is sortarray[0]. */ -- otricopy(tri1, *farleft); -- /* Ensure that the destination of `farright' is sortarray[2]. */ -- otricopy(tri2, *farright); -- } else { -- /* The three vertices are not collinear; the triangulation is one */ -- /* triangle, namely `midtri'. */ -- setorg(midtri, sortarray[0]); -- setdest(tri1, sortarray[0]); -- setorg(tri3, sortarray[0]); -- /* Apices of tri1, tri2, and tri3 are left NULL. */ -- if (area > 0.0) { -- /* The vertices are in counterclockwise order. */ -- setdest(midtri, sortarray[1]); -- setorg(tri1, sortarray[1]); -- setdest(tri2, sortarray[1]); -- setapex(midtri, sortarray[2]); -- setorg(tri2, sortarray[2]); -- setdest(tri3, sortarray[2]); -- } else { -- /* The vertices are in clockwise order. */ -- setdest(midtri, sortarray[2]); -- setorg(tri1, sortarray[2]); -- setdest(tri2, sortarray[2]); -- setapex(midtri, sortarray[1]); -- setorg(tri2, sortarray[1]); -- setdest(tri3, sortarray[1]); -- } -- /* The topology does not depend on how the vertices are ordered. */ -- bond(midtri, tri1); -- lnextself(midtri); -- bond(midtri, tri2); -- lnextself(midtri); -- bond(midtri, tri3); -- lprevself(tri1); -- lnextself(tri2); -- bond(tri1, tri2); -- lprevself(tri1); -- lprevself(tri3); -- bond(tri1, tri3); -- lnextself(tri2); -- lprevself(tri3); -- bond(tri2, tri3); -- /* Ensure that the origin of `farleft' is sortarray[0]. */ -- otricopy(tri1, *farleft); -- /* Ensure that the destination of `farright' is sortarray[2]. */ -- if (area > 0.0) { -- otricopy(tri2, *farright); -- } else { -- lnext(*farleft, *farright); -- } -- } -- if (b->verbose > 2) { -- printf(" Creating "); -- printtriangle(m, b, &midtri); -- printf(" Creating "); -- printtriangle(m, b, &tri1); -- printf(" Creating "); -- printtriangle(m, b, &tri2); -- printf(" Creating "); -- printtriangle(m, b, &tri3); -- } -- return; -- } else { -- /* Split the vertices in half. */ -- divider = vertices >> 1; -- /* Recursively triangulate each half. */ -- divconqrecurse(m, b, sortarray, divider, 1 - axis, farleft, &innerleft); -- divconqrecurse(m, b, &sortarray[divider], vertices - divider, 1 - axis, -- &innerright, farright); -- if (b->verbose > 1) { -- printf(" Joining triangulations with %d and %d vertices.\n", divider, -- vertices - divider); -- } -- /* Merge the two triangulations into one. */ -- mergehulls(m, b, farleft, &innerleft, &innerright, farright, axis); -- } --} -- --#ifdef ANSI_DECLARATORS --long removeghosts(struct mesh *m, struct behavior *b, struct otri *startghost) --#else /* not ANSI_DECLARATORS */ --long removeghosts(m, b, startghost) --struct mesh *m; --struct behavior *b; --struct otri *startghost; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri searchedge; -- struct otri dissolveedge; -- struct otri deadtriangle; -- vertex markorg; -- long hullsize; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- if (b->verbose) { -- printf(" Removing ghost triangles.\n"); -- } -- /* Find an edge on the convex hull to start point location from. */ -- lprev(*startghost, searchedge); -- symself(searchedge); -- m->dummytri[0] = encode(searchedge); -- /* Remove the bounding box and count the convex hull edges. */ -- otricopy(*startghost, dissolveedge); -- hullsize = 0; -- do { -- hullsize++; -- lnext(dissolveedge, deadtriangle); -- lprevself(dissolveedge); -- symself(dissolveedge); -- /* If no PSLG is involved, set the boundary markers of all the vertices */ -- /* on the convex hull. If a PSLG is used, this step is done later. */ -- if (!b->poly) { -- /* Watch out for the case where all the input vertices are collinear. */ -- if (dissolveedge.tri != m->dummytri) { -- org(dissolveedge, markorg); -- if (vertexmark(markorg) == 0) { -- setvertexmark(markorg, 1); -- } -- } -- } -- /* Remove a bounding triangle from a convex hull triangle. */ -- dissolve(dissolveedge); -- /* Find the next bounding triangle. */ -- sym(deadtriangle, dissolveedge); -- /* Delete the bounding triangle. */ -- triangledealloc(m, deadtriangle.tri); -- } while (!otriequal(dissolveedge, *startghost)); -- return hullsize; --} -- --/*****************************************************************************/ --/* */ --/* divconqdelaunay() Form a Delaunay triangulation by the divide-and- */ --/* conquer method. */ --/* */ --/* Sorts the vertices, calls a recursive procedure to triangulate them, and */ --/* removes the bounding box, setting boundary markers as appropriate. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --long divconqdelaunay(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --long divconqdelaunay(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex *sortarray; -- struct otri hullleft, hullright; -- int divider; -- int i, j; -- -- if (b->verbose) { -- printf(" Sorting vertices.\n"); -- } -- -- /* Allocate an array of pointers to vertices for sorting. */ -- sortarray = (vertex *) trimalloc(m->invertices * (int) sizeof(vertex)); -- traversalinit(&m->vertices); -- for (i = 0; i < m->invertices; i++) { -- sortarray[i] = vertextraverse(m); -- } -- /* Sort the vertices. */ -- vertexsort(sortarray, m->invertices); -- /* Discard duplicate vertices, which can really mess up the algorithm. */ -- i = 0; -- for (j = 1; j < m->invertices; j++) { -- if ((sortarray[i][0] == sortarray[j][0]) -- && (sortarray[i][1] == sortarray[j][1])) { -- if (!b->quiet) { -- printf( --"Warning: A duplicate vertex at (%.12g, %.12g) appeared and was ignored.\n", -- sortarray[j][0], sortarray[j][1]); -- } -- setvertextype(sortarray[j], UNDEADVERTEX); -- m->undeads++; -- } else { -- i++; -- sortarray[i] = sortarray[j]; -- } -- } -- i++; -- if (b->dwyer) { -- /* Re-sort the array of vertices to accommodate alternating cuts. */ -- divider = i >> 1; -- if (i - divider >= 2) { -- if (divider >= 2) { -- alternateaxes(sortarray, divider, 1); -- } -- alternateaxes(&sortarray[divider], i - divider, 1); -- } -- } -- -- if (b->verbose) { -- printf(" Forming triangulation.\n"); -- } -- -- /* Form the Delaunay triangulation. */ -- divconqrecurse(m, b, sortarray, i, 0, &hullleft, &hullright); -- trifree((void *) sortarray); -- -- return removeghosts(m, b, &hullleft); --} -- --/** **/ --/** **/ --/********* Divide-and-conquer Delaunay triangulation ends here *********/ -- --/********* Incremental Delaunay triangulation begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* boundingbox() Form an "infinite" bounding triangle to insert vertices */ --/* into. */ --/* */ --/* The vertices at "infinity" are assigned finite coordinates, which are */ --/* used by the point location routines, but (mostly) ignored by the */ --/* Delaunay edge flip routines. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void boundingbox(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void boundingbox(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri inftri; /* Handle for the triangular bounding box. */ -- REAL width; -- -- if (b->verbose) { -- printf(" Creating triangular bounding box.\n"); -- } -- /* Find the width (or height, whichever is larger) of the triangulation. */ -- width = m->xmax - m->xmin; -- if (m->ymax - m->ymin > width) { -- width = m->ymax - m->ymin; -- } -- if (width == 0.0) { -- width = 1.0; -- } -- /* Create the vertices of the bounding box. */ -- m->infvertex1 = (vertex) trimalloc(m->vertices.itembytes); -- m->infvertex2 = (vertex) trimalloc(m->vertices.itembytes); -- m->infvertex3 = (vertex) trimalloc(m->vertices.itembytes); -- m->infvertex1[0] = m->xmin - 50.0 * width; -- m->infvertex1[1] = m->ymin - 40.0 * width; -- m->infvertex2[0] = m->xmax + 50.0 * width; -- m->infvertex2[1] = m->ymin - 40.0 * width; -- m->infvertex3[0] = 0.5 * (m->xmin + m->xmax); -- m->infvertex3[1] = m->ymax + 60.0 * width; -- -- /* Create the bounding box. */ -- maketriangle(m, b, &inftri); -- setorg(inftri, m->infvertex1); -- setdest(inftri, m->infvertex2); -- setapex(inftri, m->infvertex3); -- /* Link dummytri to the bounding box so we can always find an */ -- /* edge to begin searching (point location) from. */ -- m->dummytri[0] = (triangle) inftri.tri; -- if (b->verbose > 2) { -- printf(" Creating "); -- printtriangle(m, b, &inftri); -- } --} -- --#endif /* not REDUCED */ -- --/*****************************************************************************/ --/* */ --/* removebox() Remove the "infinite" bounding triangle, setting boundary */ --/* markers as appropriate. */ --/* */ --/* The triangular bounding box has three boundary triangles (one for each */ --/* side of the bounding box), and a bunch of triangles fanning out from */ --/* the three bounding box vertices (one triangle for each edge of the */ --/* convex hull of the inner mesh). This routine removes these triangles. */ --/* */ --/* Returns the number of edges on the convex hull of the triangulation. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --long removebox(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --long removebox(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri deadtriangle; -- struct otri searchedge; -- struct otri checkedge; -- struct otri nextedge, finaledge, dissolveedge; -- vertex markorg; -- long hullsize; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- if (b->verbose) { -- printf(" Removing triangular bounding box.\n"); -- } -- /* Find a boundary triangle. */ -- nextedge.tri = m->dummytri; -- nextedge.orient = 0; -- symself(nextedge); -- /* Mark a place to stop. */ -- lprev(nextedge, finaledge); -- lnextself(nextedge); -- symself(nextedge); -- /* Find a triangle (on the boundary of the vertex set) that isn't */ -- /* a bounding box triangle. */ -- lprev(nextedge, searchedge); -- symself(searchedge); -- /* Check whether nextedge is another boundary triangle */ -- /* adjacent to the first one. */ -- lnext(nextedge, checkedge); -- symself(checkedge); -- if (checkedge.tri == m->dummytri) { -- /* Go on to the next triangle. There are only three boundary */ -- /* triangles, and this next triangle cannot be the third one, */ -- /* so it's safe to stop here. */ -- lprevself(searchedge); -- symself(searchedge); -- } -- /* Find a new boundary edge to search from, as the current search */ -- /* edge lies on a bounding box triangle and will be deleted. */ -- m->dummytri[0] = encode(searchedge); -- hullsize = -2l; -- while (!otriequal(nextedge, finaledge)) { -- hullsize++; -- lprev(nextedge, dissolveedge); -- symself(dissolveedge); -- /* If not using a PSLG, the vertices should be marked now. */ -- /* (If using a PSLG, markhull() will do the job.) */ -- if (!b->poly) { -- /* Be careful! One must check for the case where all the input */ -- /* vertices are collinear, and thus all the triangles are part of */ -- /* the bounding box. Otherwise, the setvertexmark() call below */ -- /* will cause a bad pointer reference. */ -- if (dissolveedge.tri != m->dummytri) { -- org(dissolveedge, markorg); -- if (vertexmark(markorg) == 0) { -- setvertexmark(markorg, 1); -- } -- } -- } -- /* Disconnect the bounding box triangle from the mesh triangle. */ -- dissolve(dissolveedge); -- lnext(nextedge, deadtriangle); -- sym(deadtriangle, nextedge); -- /* Get rid of the bounding box triangle. */ -- triangledealloc(m, deadtriangle.tri); -- /* Do we need to turn the corner? */ -- if (nextedge.tri == m->dummytri) { -- /* Turn the corner. */ -- otricopy(dissolveedge, nextedge); -- } -- } -- triangledealloc(m, finaledge.tri); -- -- trifree((void *) m->infvertex1); /* Deallocate the bounding box vertices. */ -- trifree((void *) m->infvertex2); -- trifree((void *) m->infvertex3); -- -- return hullsize; --} -- --#endif /* not REDUCED */ -- --/*****************************************************************************/ --/* */ --/* incrementaldelaunay() Form a Delaunay triangulation by incrementally */ --/* inserting vertices. */ --/* */ --/* Returns the number of edges on the convex hull of the triangulation. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --long incrementaldelaunay(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --long incrementaldelaunay(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri starttri; -- vertex vertexloop; -- -- /* Create a triangular bounding box. */ -- boundingbox(m, b); -- if (b->verbose) { -- printf(" Incrementally inserting vertices.\n"); -- } -- traversalinit(&m->vertices); -- vertexloop = vertextraverse(m); -- while (vertexloop != (vertex) NULL) { -- starttri.tri = m->dummytri; -- if (insertvertex(m, b, vertexloop, &starttri, (struct osub *) NULL, 0, 0) -- == DUPLICATEVERTEX) { -- if (!b->quiet) { -- printf( --"Warning: A duplicate vertex at (%.12g, %.12g) appeared and was ignored.\n", -- vertexloop[0], vertexloop[1]); -- } -- setvertextype(vertexloop, UNDEADVERTEX); -- m->undeads++; -- } -- vertexloop = vertextraverse(m); -- } -- /* Remove the bounding box. */ -- return removebox(m, b); --} -- --#endif /* not REDUCED */ -- --/** **/ --/** **/ --/********* Incremental Delaunay triangulation ends here *********/ -- --/********* Sweepline Delaunay triangulation begins here *********/ --/** **/ --/** **/ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void eventheapinsert(struct event **heap, int heapsize, struct event *newevent) --#else /* not ANSI_DECLARATORS */ --void eventheapinsert(heap, heapsize, newevent) --struct event **heap; --int heapsize; --struct event *newevent; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL eventx, eventy; -- int eventnum; -- int parent; -- int notdone; -- -- eventx = newevent->xkey; -- eventy = newevent->ykey; -- eventnum = heapsize; -- notdone = eventnum > 0; -- while (notdone) { -- parent = (eventnum - 1) >> 1; -- if ((heap[parent]->ykey < eventy) || -- ((heap[parent]->ykey == eventy) -- && (heap[parent]->xkey <= eventx))) { -- notdone = 0; -- } else { -- heap[eventnum] = heap[parent]; -- heap[eventnum]->heapposition = eventnum; -- -- eventnum = parent; -- notdone = eventnum > 0; -- } -- } -- heap[eventnum] = newevent; -- newevent->heapposition = eventnum; --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void eventheapify(struct event **heap, int heapsize, int eventnum) --#else /* not ANSI_DECLARATORS */ --void eventheapify(heap, heapsize, eventnum) --struct event **heap; --int heapsize; --int eventnum; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct event *thisevent; -- REAL eventx, eventy; -- int leftchild, rightchild; -- int smallest; -- int notdone; -- -- thisevent = heap[eventnum]; -- eventx = thisevent->xkey; -- eventy = thisevent->ykey; -- leftchild = 2 * eventnum + 1; -- notdone = leftchild < heapsize; -- while (notdone) { -- if ((heap[leftchild]->ykey < eventy) || -- ((heap[leftchild]->ykey == eventy) -- && (heap[leftchild]->xkey < eventx))) { -- smallest = leftchild; -- } else { -- smallest = eventnum; -- } -- rightchild = leftchild + 1; -- if (rightchild < heapsize) { -- if ((heap[rightchild]->ykey < heap[smallest]->ykey) || -- ((heap[rightchild]->ykey == heap[smallest]->ykey) -- && (heap[rightchild]->xkey < heap[smallest]->xkey))) { -- smallest = rightchild; -- } -- } -- if (smallest == eventnum) { -- notdone = 0; -- } else { -- heap[eventnum] = heap[smallest]; -- heap[eventnum]->heapposition = eventnum; -- heap[smallest] = thisevent; -- thisevent->heapposition = smallest; -- -- eventnum = smallest; -- leftchild = 2 * eventnum + 1; -- notdone = leftchild < heapsize; -- } -- } --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void eventheapdelete(struct event **heap, int heapsize, int eventnum) --#else /* not ANSI_DECLARATORS */ --void eventheapdelete(heap, heapsize, eventnum) --struct event **heap; --int heapsize; --int eventnum; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct event *moveevent; -- REAL eventx, eventy; -- int parent; -- int notdone; -- -- moveevent = heap[heapsize - 1]; -- if (eventnum > 0) { -- eventx = moveevent->xkey; -- eventy = moveevent->ykey; -- do { -- parent = (eventnum - 1) >> 1; -- if ((heap[parent]->ykey < eventy) || -- ((heap[parent]->ykey == eventy) -- && (heap[parent]->xkey <= eventx))) { -- notdone = 0; -- } else { -- heap[eventnum] = heap[parent]; -- heap[eventnum]->heapposition = eventnum; -- -- eventnum = parent; -- notdone = eventnum > 0; -- } -- } while (notdone); -- } -- heap[eventnum] = moveevent; -- moveevent->heapposition = eventnum; -- eventheapify(heap, heapsize - 1, eventnum); --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void createeventheap(struct mesh *m, struct event ***eventheap, -- struct event **events, struct event **freeevents) --#else /* not ANSI_DECLARATORS */ --void createeventheap(m, eventheap, events, freeevents) --struct mesh *m; --struct event ***eventheap; --struct event **events; --struct event **freeevents; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex thisvertex; -- int maxevents; -- int i; -- -- maxevents = (3 * m->invertices) / 2; -- *eventheap = (struct event **) trimalloc(maxevents * -- (int) sizeof(struct event *)); -- *events = (struct event *) trimalloc(maxevents * (int) sizeof(struct event)); -- traversalinit(&m->vertices); -- for (i = 0; i < m->invertices; i++) { -- thisvertex = vertextraverse(m); -- (*events)[i].eventptr = (void *) thisvertex; -- (*events)[i].xkey = thisvertex[0]; -- (*events)[i].ykey = thisvertex[1]; -- eventheapinsert(*eventheap, i, *events + i); -- } -- *freeevents = (struct event *) NULL; -- for (i = maxevents - 1; i >= m->invertices; i--) { -- (*events)[i].eventptr = (void *) *freeevents; -- *freeevents = *events + i; -- } --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --int rightofhyperbola(struct mesh *m, struct otri *fronttri, vertex newsite) --#else /* not ANSI_DECLARATORS */ --int rightofhyperbola(m, fronttri, newsite) --struct mesh *m; --struct otri *fronttri; --vertex newsite; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex leftvertex, rightvertex; -- REAL dxa, dya, dxb, dyb; -- -- m->hyperbolacount++; -- -- dest(*fronttri, leftvertex); -- apex(*fronttri, rightvertex); -- if ((leftvertex[1] < rightvertex[1]) || -- ((leftvertex[1] == rightvertex[1]) && -- (leftvertex[0] < rightvertex[0]))) { -- if (newsite[0] >= rightvertex[0]) { -- return 1; -- } -- } else { -- if (newsite[0] <= leftvertex[0]) { -- return 0; -- } -- } -- dxa = leftvertex[0] - newsite[0]; -- dya = leftvertex[1] - newsite[1]; -- dxb = rightvertex[0] - newsite[0]; -- dyb = rightvertex[1] - newsite[1]; -- return dya * (dxb * dxb + dyb * dyb) > dyb * (dxa * dxa + dya * dya); --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --REAL circletop(struct mesh *m, vertex pa, vertex pb, vertex pc, REAL ccwabc) --#else /* not ANSI_DECLARATORS */ --REAL circletop(m, pa, pb, pc, ccwabc) --struct mesh *m; --vertex pa; --vertex pb; --vertex pc; --REAL ccwabc; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL xac, yac, xbc, ybc, xab, yab; -- REAL aclen2, bclen2, ablen2; -- -- m->circletopcount++; -- -- xac = pa[0] - pc[0]; -- yac = pa[1] - pc[1]; -- xbc = pb[0] - pc[0]; -- ybc = pb[1] - pc[1]; -- xab = pa[0] - pb[0]; -- yab = pa[1] - pb[1]; -- aclen2 = xac * xac + yac * yac; -- bclen2 = xbc * xbc + ybc * ybc; -- ablen2 = xab * xab + yab * yab; -- return pc[1] + (xac * bclen2 - xbc * aclen2 + sqrt(aclen2 * bclen2 * ablen2)) -- / (2.0 * ccwabc); --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --void check4deadevent(struct otri *checktri, struct event **freeevents, -- struct event **eventheap, int *heapsize) --#else /* not ANSI_DECLARATORS */ --void check4deadevent(checktri, freeevents, eventheap, heapsize) --struct otri *checktri; --struct event **freeevents; --struct event **eventheap; --int *heapsize; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct event *deadevent; -- vertex eventvertex; -- int eventnum; -- -- org(*checktri, eventvertex); -- if (eventvertex != (vertex) NULL) { -- deadevent = (struct event *) eventvertex; -- eventnum = deadevent->heapposition; -- deadevent->eventptr = (void *) *freeevents; -- *freeevents = deadevent; -- eventheapdelete(eventheap, *heapsize, eventnum); -- (*heapsize)--; -- setorg(*checktri, NULL); -- } --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --struct splaynode *splay(struct mesh *m, struct splaynode *splaytree, -- vertex searchpoint, struct otri *searchtri) --#else /* not ANSI_DECLARATORS */ --struct splaynode *splay(m, splaytree, searchpoint, searchtri) --struct mesh *m; --struct splaynode *splaytree; --vertex searchpoint; --struct otri *searchtri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct splaynode *child, *grandchild; -- struct splaynode *lefttree, *righttree; -- struct splaynode *leftright; -- vertex checkvertex; -- int rightofroot, rightofchild; -- -- if (splaytree == (struct splaynode *) NULL) { -- return (struct splaynode *) NULL; -- } -- dest(splaytree->keyedge, checkvertex); -- if (checkvertex == splaytree->keydest) { -- rightofroot = rightofhyperbola(m, &splaytree->keyedge, searchpoint); -- if (rightofroot) { -- otricopy(splaytree->keyedge, *searchtri); -- child = splaytree->rchild; -- } else { -- child = splaytree->lchild; -- } -- if (child == (struct splaynode *) NULL) { -- return splaytree; -- } -- dest(child->keyedge, checkvertex); -- if (checkvertex != child->keydest) { -- child = splay(m, child, searchpoint, searchtri); -- if (child == (struct splaynode *) NULL) { -- if (rightofroot) { -- splaytree->rchild = (struct splaynode *) NULL; -- } else { -- splaytree->lchild = (struct splaynode *) NULL; -- } -- return splaytree; -- } -- } -- rightofchild = rightofhyperbola(m, &child->keyedge, searchpoint); -- if (rightofchild) { -- otricopy(child->keyedge, *searchtri); -- grandchild = splay(m, child->rchild, searchpoint, searchtri); -- child->rchild = grandchild; -- } else { -- grandchild = splay(m, child->lchild, searchpoint, searchtri); -- child->lchild = grandchild; -- } -- if (grandchild == (struct splaynode *) NULL) { -- if (rightofroot) { -- splaytree->rchild = child->lchild; -- child->lchild = splaytree; -- } else { -- splaytree->lchild = child->rchild; -- child->rchild = splaytree; -- } -- return child; -- } -- if (rightofchild) { -- if (rightofroot) { -- splaytree->rchild = child->lchild; -- child->lchild = splaytree; -- } else { -- splaytree->lchild = grandchild->rchild; -- grandchild->rchild = splaytree; -- } -- child->rchild = grandchild->lchild; -- grandchild->lchild = child; -- } else { -- if (rightofroot) { -- splaytree->rchild = grandchild->lchild; -- grandchild->lchild = splaytree; -- } else { -- splaytree->lchild = child->rchild; -- child->rchild = splaytree; -- } -- child->lchild = grandchild->rchild; -- grandchild->rchild = child; -- } -- return grandchild; -- } else { -- lefttree = splay(m, splaytree->lchild, searchpoint, searchtri); -- righttree = splay(m, splaytree->rchild, searchpoint, searchtri); -- -- pooldealloc(&m->splaynodes, (void *) splaytree); -- if (lefttree == (struct splaynode *) NULL) { -- return righttree; -- } else if (righttree == (struct splaynode *) NULL) { -- return lefttree; -- } else if (lefttree->rchild == (struct splaynode *) NULL) { -- lefttree->rchild = righttree->lchild; -- righttree->lchild = lefttree; -- return righttree; -- } else if (righttree->lchild == (struct splaynode *) NULL) { -- righttree->lchild = lefttree->rchild; -- lefttree->rchild = righttree; -- return lefttree; -- } else { --/* printf("Holy Toledo!!!\n"); */ -- leftright = lefttree->rchild; -- while (leftright->rchild != (struct splaynode *) NULL) { -- leftright = leftright->rchild; -- } -- leftright->rchild = righttree; -- return lefttree; -- } -- } --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --struct splaynode *splayinsert(struct mesh *m, struct splaynode *splayroot, -- struct otri *newkey, vertex searchpoint) --#else /* not ANSI_DECLARATORS */ --struct splaynode *splayinsert(m, splayroot, newkey, searchpoint) --struct mesh *m; --struct splaynode *splayroot; --struct otri *newkey; --vertex searchpoint; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct splaynode *newsplaynode; -- -- newsplaynode = (struct splaynode *) poolalloc(&m->splaynodes); -- otricopy(*newkey, newsplaynode->keyedge); -- dest(*newkey, newsplaynode->keydest); -- if (splayroot == (struct splaynode *) NULL) { -- newsplaynode->lchild = (struct splaynode *) NULL; -- newsplaynode->rchild = (struct splaynode *) NULL; -- } else if (rightofhyperbola(m, &splayroot->keyedge, searchpoint)) { -- newsplaynode->lchild = splayroot; -- newsplaynode->rchild = splayroot->rchild; -- splayroot->rchild = (struct splaynode *) NULL; -- } else { -- newsplaynode->lchild = splayroot->lchild; -- newsplaynode->rchild = splayroot; -- splayroot->lchild = (struct splaynode *) NULL; -- } -- return newsplaynode; --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --struct splaynode *circletopinsert(struct mesh *m, struct behavior *b, -- struct splaynode *splayroot, -- struct otri *newkey, -- vertex pa, vertex pb, vertex pc, REAL topy) --#else /* not ANSI_DECLARATORS */ --struct splaynode *circletopinsert(m, b, splayroot, newkey, pa, pb, pc, topy) --struct mesh *m; --struct behavior *b; --struct splaynode *splayroot; --struct otri *newkey; --vertex pa; --vertex pb; --vertex pc; --REAL topy; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL ccwabc; -- REAL xac, yac, xbc, ybc; -- REAL aclen2, bclen2; -- REAL searchpoint[2]; -- struct otri dummytri; -- -- ccwabc = counterclockwise(m, b, pa, pb, pc); -- xac = pa[0] - pc[0]; -- yac = pa[1] - pc[1]; -- xbc = pb[0] - pc[0]; -- ybc = pb[1] - pc[1]; -- aclen2 = xac * xac + yac * yac; -- bclen2 = xbc * xbc + ybc * ybc; -- searchpoint[0] = pc[0] - (yac * bclen2 - ybc * aclen2) / (2.0 * ccwabc); -- searchpoint[1] = topy; -- return splayinsert(m, splay(m, splayroot, (vertex) searchpoint, &dummytri), -- newkey, (vertex) searchpoint); --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --struct splaynode *frontlocate(struct mesh *m, struct splaynode *splayroot, -- struct otri *bottommost, vertex searchvertex, -- struct otri *searchtri, int *farright) --#else /* not ANSI_DECLARATORS */ --struct splaynode *frontlocate(m, splayroot, bottommost, searchvertex, -- searchtri, farright) --struct mesh *m; --struct splaynode *splayroot; --struct otri *bottommost; --vertex searchvertex; --struct otri *searchtri; --int *farright; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int farrightflag; -- triangle ptr; /* Temporary variable used by onext(). */ -- -- otricopy(*bottommost, *searchtri); -- splayroot = splay(m, splayroot, searchvertex, searchtri); -- -- farrightflag = 0; -- while (!farrightflag && rightofhyperbola(m, searchtri, searchvertex)) { -- onextself(*searchtri); -- farrightflag = otriequal(*searchtri, *bottommost); -- } -- *farright = farrightflag; -- return splayroot; --} -- --#endif /* not REDUCED */ -- --#ifndef REDUCED -- --#ifdef ANSI_DECLARATORS --long sweeplinedelaunay(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --long sweeplinedelaunay(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct event **eventheap; -- struct event *events; -- struct event *freeevents; -- struct event *nextevent; -- struct event *newevent; -- struct splaynode *splayroot; -- struct otri bottommost; -- struct otri searchtri; -- struct otri fliptri; -- struct otri lefttri, righttri, farlefttri, farrighttri; -- struct otri inserttri; -- vertex firstvertex, secondvertex; -- vertex nextvertex, lastvertex; -- vertex connectvertex; -- vertex leftvertex, midvertex, rightvertex; -- REAL lefttest, righttest; -- int heapsize; -- int check4events, farrightflag; -- triangle ptr; /* Temporary variable used by sym(), onext(), and oprev(). */ -- -- poolinit(&m->splaynodes, sizeof(struct splaynode), SPLAYNODEPERBLOCK, -- SPLAYNODEPERBLOCK, 0); -- splayroot = (struct splaynode *) NULL; -- -- if (b->verbose) { -- printf(" Placing vertices in event heap.\n"); -- } -- createeventheap(m, &eventheap, &events, &freeevents); -- heapsize = m->invertices; -- -- if (b->verbose) { -- printf(" Forming triangulation.\n"); -- } -- maketriangle(m, b, &lefttri); -- maketriangle(m, b, &righttri); -- bond(lefttri, righttri); -- lnextself(lefttri); -- lprevself(righttri); -- bond(lefttri, righttri); -- lnextself(lefttri); -- lprevself(righttri); -- bond(lefttri, righttri); -- firstvertex = (vertex) eventheap[0]->eventptr; -- eventheap[0]->eventptr = (void *) freeevents; -- freeevents = eventheap[0]; -- eventheapdelete(eventheap, heapsize, 0); -- heapsize--; -- do { -- if (heapsize == 0) { -- printf("Error: Input vertices are all identical.\n"); -- triexit(1); -- } -- secondvertex = (vertex) eventheap[0]->eventptr; -- eventheap[0]->eventptr = (void *) freeevents; -- freeevents = eventheap[0]; -- eventheapdelete(eventheap, heapsize, 0); -- heapsize--; -- if ((firstvertex[0] == secondvertex[0]) && -- (firstvertex[1] == secondvertex[1])) { -- if (!b->quiet) { -- printf( --"Warning: A duplicate vertex at (%.12g, %.12g) appeared and was ignored.\n", -- secondvertex[0], secondvertex[1]); -- } -- setvertextype(secondvertex, UNDEADVERTEX); -- m->undeads++; -- } -- } while ((firstvertex[0] == secondvertex[0]) && -- (firstvertex[1] == secondvertex[1])); -- setorg(lefttri, firstvertex); -- setdest(lefttri, secondvertex); -- setorg(righttri, secondvertex); -- setdest(righttri, firstvertex); -- lprev(lefttri, bottommost); -- lastvertex = secondvertex; -- while (heapsize > 0) { -- nextevent = eventheap[0]; -- eventheapdelete(eventheap, heapsize, 0); -- heapsize--; -- check4events = 1; -- if (nextevent->xkey < m->xmin) { -- decode(nextevent->eventptr, fliptri); -- oprev(fliptri, farlefttri); -- check4deadevent(&farlefttri, &freeevents, eventheap, &heapsize); -- onext(fliptri, farrighttri); -- check4deadevent(&farrighttri, &freeevents, eventheap, &heapsize); -- -- if (otriequal(farlefttri, bottommost)) { -- lprev(fliptri, bottommost); -- } -- flip(m, b, &fliptri); -- setapex(fliptri, NULL); -- lprev(fliptri, lefttri); -- lnext(fliptri, righttri); -- sym(lefttri, farlefttri); -- -- if (randomnation(SAMPLERATE) == 0) { -- symself(fliptri); -- dest(fliptri, leftvertex); -- apex(fliptri, midvertex); -- org(fliptri, rightvertex); -- splayroot = circletopinsert(m, b, splayroot, &lefttri, leftvertex, -- midvertex, rightvertex, nextevent->ykey); -- } -- } else { -- nextvertex = (vertex) nextevent->eventptr; -- if ((nextvertex[0] == lastvertex[0]) && -- (nextvertex[1] == lastvertex[1])) { -- if (!b->quiet) { -- printf( --"Warning: A duplicate vertex at (%.12g, %.12g) appeared and was ignored.\n", -- nextvertex[0], nextvertex[1]); -- } -- setvertextype(nextvertex, UNDEADVERTEX); -- m->undeads++; -- check4events = 0; -- } else { -- lastvertex = nextvertex; -- -- splayroot = frontlocate(m, splayroot, &bottommost, nextvertex, -- &searchtri, &farrightflag); --/* -- otricopy(bottommost, searchtri); -- farrightflag = 0; -- while (!farrightflag && rightofhyperbola(m, &searchtri, nextvertex)) { -- onextself(searchtri); -- farrightflag = otriequal(searchtri, bottommost); -- } --*/ -- -- check4deadevent(&searchtri, &freeevents, eventheap, &heapsize); -- -- otricopy(searchtri, farrighttri); -- sym(searchtri, farlefttri); -- maketriangle(m, b, &lefttri); -- maketriangle(m, b, &righttri); -- dest(farrighttri, connectvertex); -- setorg(lefttri, connectvertex); -- setdest(lefttri, nextvertex); -- setorg(righttri, nextvertex); -- setdest(righttri, connectvertex); -- bond(lefttri, righttri); -- lnextself(lefttri); -- lprevself(righttri); -- bond(lefttri, righttri); -- lnextself(lefttri); -- lprevself(righttri); -- bond(lefttri, farlefttri); -- bond(righttri, farrighttri); -- if (!farrightflag && otriequal(farrighttri, bottommost)) { -- otricopy(lefttri, bottommost); -- } -- -- if (randomnation(SAMPLERATE) == 0) { -- splayroot = splayinsert(m, splayroot, &lefttri, nextvertex); -- } else if (randomnation(SAMPLERATE) == 0) { -- lnext(righttri, inserttri); -- splayroot = splayinsert(m, splayroot, &inserttri, nextvertex); -- } -- } -- } -- nextevent->eventptr = (void *) freeevents; -- freeevents = nextevent; -- -- if (check4events) { -- apex(farlefttri, leftvertex); -- dest(lefttri, midvertex); -- apex(lefttri, rightvertex); -- lefttest = counterclockwise(m, b, leftvertex, midvertex, rightvertex); -- if (lefttest > 0.0) { -- newevent = freeevents; -- freeevents = (struct event *) freeevents->eventptr; -- newevent->xkey = m->xminextreme; -- newevent->ykey = circletop(m, leftvertex, midvertex, rightvertex, -- lefttest); -- newevent->eventptr = (void *) encode(lefttri); -- eventheapinsert(eventheap, heapsize, newevent); -- heapsize++; -- setorg(lefttri, newevent); -- } -- apex(righttri, leftvertex); -- org(righttri, midvertex); -- apex(farrighttri, rightvertex); -- righttest = counterclockwise(m, b, leftvertex, midvertex, rightvertex); -- if (righttest > 0.0) { -- newevent = freeevents; -- freeevents = (struct event *) freeevents->eventptr; -- newevent->xkey = m->xminextreme; -- newevent->ykey = circletop(m, leftvertex, midvertex, rightvertex, -- righttest); -- newevent->eventptr = (void *) encode(farrighttri); -- eventheapinsert(eventheap, heapsize, newevent); -- heapsize++; -- setorg(farrighttri, newevent); -- } -- } -- } -- -- pooldeinit(&m->splaynodes); -- lprevself(bottommost); -- return removeghosts(m, b, &bottommost); --} -- --#endif /* not REDUCED */ -- --/** **/ --/** **/ --/********* Sweepline Delaunay triangulation ends here *********/ -- --/********* General mesh construction routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* delaunay() Form a Delaunay triangulation. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --long delaunay(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --long delaunay(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- long hulledges; -- -- m->eextras = 0; -- initializetrisubpools(m, b); -- --#ifdef REDUCED -- if (!b->quiet) { -- printf( -- "Constructing Delaunay triangulation by divide-and-conquer method.\n"); -- } -- hulledges = divconqdelaunay(m, b); --#else /* not REDUCED */ -- if (!b->quiet) { -- printf("Constructing Delaunay triangulation "); -- if (b->incremental) { -- printf("by incremental method.\n"); -- } else if (b->sweepline) { -- printf("by sweepline method.\n"); -- } else { -- printf("by divide-and-conquer method.\n"); -- } -- } -- if (b->incremental) { -- hulledges = incrementaldelaunay(m, b); -- } else if (b->sweepline) { -- hulledges = sweeplinedelaunay(m, b); -- } else { -- hulledges = divconqdelaunay(m, b); -- } --#endif /* not REDUCED */ -- -- if (m->triangles.items == 0) { -- /* The input vertices were all collinear, so there are no triangles. */ -- return 0l; -- } else { -- return hulledges; -- } --} -- --/*****************************************************************************/ --/* */ --/* reconstruct() Reconstruct a triangulation from its .ele (and possibly */ --/* .poly) file. Used when the -r switch is used. */ --/* */ --/* Reads an .ele file and reconstructs the original mesh. If the -p switch */ --/* is used, this procedure will also read a .poly file and reconstruct the */ --/* subsegments of the original mesh. If the -a switch is used, this */ --/* procedure will also read an .area file and set a maximum area constraint */ --/* on each triangle. */ --/* */ --/* Vertices that are not corners of triangles, such as nodes on edges of */ --/* subparametric elements, are discarded. */ --/* */ --/* This routine finds the adjacencies between triangles (and subsegments) */ --/* by forming one stack of triangles for each vertex. Each triangle is on */ --/* three different stacks simultaneously. Each triangle's subsegment */ --/* pointers are used to link the items in each stack. This memory-saving */ --/* feature makes the code harder to read. The most important thing to keep */ --/* in mind is that each triangle is removed from a stack precisely when */ --/* the corresponding pointer is adjusted to refer to a subsegment rather */ --/* than the next triangle of the stack. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --int reconstruct(struct mesh *m, struct behavior *b, int *trianglelist, -- REAL *triangleattriblist, REAL *trianglearealist, -- int elements, int corners, int attribs, -- int *segmentlist,int *segmentmarkerlist, int numberofsegments) --#else /* not ANSI_DECLARATORS */ --int reconstruct(m, b, trianglelist, triangleattriblist, trianglearealist, -- elements, corners, attribs, segmentlist, segmentmarkerlist, -- numberofsegments) --struct mesh *m; --struct behavior *b; --int *trianglelist; --REAL *triangleattriblist; --REAL *trianglearealist; --int elements; --int corners; --int attribs; --int *segmentlist; --int *segmentmarkerlist; --int numberofsegments; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --long reconstruct(struct mesh *m, struct behavior *b, char *elefilename, -- char *areafilename, char *polyfilename, FILE *polyfile) --#else /* not ANSI_DECLARATORS */ --long reconstruct(m, b, elefilename, areafilename, polyfilename, polyfile) --struct mesh *m; --struct behavior *b; --char *elefilename; --char *areafilename; --char *polyfilename; --FILE *polyfile; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- int vertexindex; -- int attribindex; --#else /* not TRILIBRARY */ -- FILE *elefile; -- FILE *areafile; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int areaelements; --#endif /* not TRILIBRARY */ -- struct otri triangleloop; -- struct otri triangleleft; -- struct otri checktri; -- struct otri checkleft; -- struct otri checkneighbor; -- struct osub subsegloop; -- triangle *vertexarray; -- triangle *prevlink; -- triangle nexttri; -- vertex tdest, tapex; -- vertex checkdest, checkapex; -- vertex shorg; -- vertex killvertex; -- vertex segmentorg, segmentdest; -- REAL area; -- int corner[3]; -- int end[2]; -- int killvertexindex; -- int incorners; -- int segmentmarkers; -- int boundmarker; -- int aroundvertex; -- long hullsize; -- int notfound; -- long elementnumber, segmentnumber; -- int i, j; -- triangle ptr; /* Temporary variable used by sym(). */ -- --#ifdef TRILIBRARY -- m->inelements = elements; -- incorners = corners; -- if (incorners < 3) { -- printf("Error: Triangles must have at least 3 vertices.\n"); -- triexit(1); -- } -- m->eextras = attribs; --#else /* not TRILIBRARY */ -- /* Read the triangles from an .ele file. */ -- if (!b->quiet) { -- printf("Opening %s.\n", elefilename); -- } -- elefile = fopen(elefilename, "r"); -- if (elefile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", elefilename); -- triexit(1); -- } -- /* Read number of triangles, number of vertices per triangle, and */ -- /* number of triangle attributes from .ele file. */ -- stringptr = readline(inputline, elefile, elefilename); -- m->inelements = (int) strtol(stringptr, &stringptr, 0); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- incorners = 3; -- } else { -- incorners = (int) strtol(stringptr, &stringptr, 0); -- if (incorners < 3) { -- printf("Error: Triangles in %s must have at least 3 vertices.\n", -- elefilename); -- triexit(1); -- } -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- m->eextras = 0; -- } else { -- m->eextras = (int) strtol(stringptr, &stringptr, 0); -- } --#endif /* not TRILIBRARY */ -- -- initializetrisubpools(m, b); -- -- /* Create the triangles. */ -- for (elementnumber = 1; elementnumber <= m->inelements; elementnumber++) { -- maketriangle(m, b, &triangleloop); -- /* Mark the triangle as living. */ -- triangleloop.tri[3] = (triangle) triangleloop.tri; -- } -- -- segmentmarkers = 0; -- if (b->poly) { --#ifdef TRILIBRARY -- m->insegments = numberofsegments; -- segmentmarkers = segmentmarkerlist != (int *) NULL; --#else /* not TRILIBRARY */ -- /* Read number of segments and number of segment */ -- /* boundary markers from .poly file. */ -- stringptr = readline(inputline, polyfile, b->inpolyfilename); -- m->insegments = (int) strtol(stringptr, &stringptr, 0); -- stringptr = findfield(stringptr); -- if (*stringptr != '\0') { -- segmentmarkers = (int) strtol(stringptr, &stringptr, 0); -- } --#endif /* not TRILIBRARY */ -- -- /* Create the subsegments. */ -- for (segmentnumber = 1; segmentnumber <= m->insegments; segmentnumber++) { -- makesubseg(m, &subsegloop); -- /* Mark the subsegment as living. */ -- subsegloop.ss[2] = (subseg) subsegloop.ss; -- } -- } -- --#ifdef TRILIBRARY -- vertexindex = 0; -- attribindex = 0; --#else /* not TRILIBRARY */ -- if (b->vararea) { -- /* Open an .area file, check for consistency with the .ele file. */ -- if (!b->quiet) { -- printf("Opening %s.\n", areafilename); -- } -- areafile = fopen(areafilename, "r"); -- if (areafile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", areafilename); -- triexit(1); -- } -- stringptr = readline(inputline, areafile, areafilename); -- areaelements = (int) strtol(stringptr, &stringptr, 0); -- if (areaelements != m->inelements) { -- printf("Error: %s and %s disagree on number of triangles.\n", -- elefilename, areafilename); -- triexit(1); -- } -- } --#endif /* not TRILIBRARY */ -- -- if (!b->quiet) { -- printf("Reconstructing mesh.\n"); -- } -- /* Allocate a temporary array that maps each vertex to some adjacent */ -- /* triangle. I took care to allocate all the permanent memory for */ -- /* triangles and subsegments first. */ -- vertexarray = (triangle *) trimalloc(m->vertices.items * -- (int) sizeof(triangle)); -- /* Each vertex is initially unrepresented. */ -- for (i = 0; i < m->vertices.items; i++) { -- vertexarray[i] = (triangle) m->dummytri; -- } -- -- if (b->verbose) { -- printf(" Assembling triangles.\n"); -- } -- /* Read the triangles from the .ele file, and link */ -- /* together those that share an edge. */ -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- elementnumber = b->firstnumber; -- while (triangleloop.tri != (triangle *) NULL) { --#ifdef TRILIBRARY -- /* Copy the triangle's three corners. */ -- for (j = 0; j < 3; j++) { -- corner[j] = trianglelist[vertexindex++]; -- if ((corner[j] < b->firstnumber) || -- (corner[j] >= b->firstnumber + m->invertices)) { -- printf("Error: Triangle %ld has an invalid vertex index.\n", -- elementnumber); -- triexit(1); -- } -- } --#else /* not TRILIBRARY */ -- /* Read triangle number and the triangle's three corners. */ -- stringptr = readline(inputline, elefile, elefilename); -- for (j = 0; j < 3; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Triangle %ld is missing vertex %d in %s.\n", -- elementnumber, j + 1, elefilename); -- triexit(1); -- } else { -- corner[j] = (int) strtol(stringptr, &stringptr, 0); -- if ((corner[j] < b->firstnumber) || -- (corner[j] >= b->firstnumber + m->invertices)) { -- printf("Error: Triangle %ld has an invalid vertex index.\n", -- elementnumber); -- triexit(1); -- } -- } -- } --#endif /* not TRILIBRARY */ -- -- /* Find out about (and throw away) extra nodes. */ -- for (j = 3; j < incorners; j++) { --#ifdef TRILIBRARY -- killvertexindex = trianglelist[vertexindex++]; --#else /* not TRILIBRARY */ -- stringptr = findfield(stringptr); -- if (*stringptr != '\0') { -- killvertexindex = (int) strtol(stringptr, &stringptr, 0); --#endif /* not TRILIBRARY */ -- if ((killvertexindex >= b->firstnumber) && -- (killvertexindex < b->firstnumber + m->invertices)) { -- /* Delete the non-corner vertex if it's not already deleted. */ -- killvertex = getvertex(m, b, killvertexindex); -- if (vertextype(killvertex) != DEADVERTEX) { -- vertexdealloc(m, killvertex); -- } -- } --#ifndef TRILIBRARY -- } --#endif /* not TRILIBRARY */ -- } -- -- /* Read the triangle's attributes. */ -- for (j = 0; j < m->eextras; j++) { --#ifdef TRILIBRARY -- setelemattribute(triangleloop, j, triangleattriblist[attribindex++]); --#else /* not TRILIBRARY */ -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- setelemattribute(triangleloop, j, 0); -- } else { -- setelemattribute(triangleloop, j, -- (REAL) strtod(stringptr, &stringptr)); -- } --#endif /* not TRILIBRARY */ -- } -- -- if (b->vararea) { --#ifdef TRILIBRARY -- area = trianglearealist[elementnumber - b->firstnumber]; --#else /* not TRILIBRARY */ -- /* Read an area constraint from the .area file. */ -- stringptr = readline(inputline, areafile, areafilename); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- area = -1.0; /* No constraint on this triangle. */ -- } else { -- area = (REAL) strtod(stringptr, &stringptr); -- } --#endif /* not TRILIBRARY */ -- setareabound(triangleloop, area); -- } -- -- /* Set the triangle's vertices. */ -- triangleloop.orient = 0; -- setorg(triangleloop, getvertex(m, b, corner[0])); -- setdest(triangleloop, getvertex(m, b, corner[1])); -- setapex(triangleloop, getvertex(m, b, corner[2])); -- /* Try linking the triangle to others that share these vertices. */ -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- /* Take the number for the origin of triangleloop. */ -- aroundvertex = corner[triangleloop.orient]; -- /* Look for other triangles having this vertex. */ -- nexttri = vertexarray[aroundvertex - b->firstnumber]; -- /* Link the current triangle to the next one in the stack. */ -- triangleloop.tri[6 + triangleloop.orient] = nexttri; -- /* Push the current triangle onto the stack. */ -- vertexarray[aroundvertex - b->firstnumber] = encode(triangleloop); -- decode(nexttri, checktri); -- if (checktri.tri != m->dummytri) { -- dest(triangleloop, tdest); -- apex(triangleloop, tapex); -- /* Look for other triangles that share an edge. */ -- do { -- dest(checktri, checkdest); -- apex(checktri, checkapex); -- if (tapex == checkdest) { -- /* The two triangles share an edge; bond them together. */ -- lprev(triangleloop, triangleleft); -- bond(triangleleft, checktri); -- } -- if (tdest == checkapex) { -- /* The two triangles share an edge; bond them together. */ -- lprev(checktri, checkleft); -- bond(triangleloop, checkleft); -- } -- /* Find the next triangle in the stack. */ -- nexttri = checktri.tri[6 + checktri.orient]; -- decode(nexttri, checktri); -- } while (checktri.tri != m->dummytri); -- } -- } -- triangleloop.tri = triangletraverse(m); -- elementnumber++; -- } -- --#ifdef TRILIBRARY -- vertexindex = 0; --#else /* not TRILIBRARY */ -- fclose(elefile); -- if (b->vararea) { -- fclose(areafile); -- } --#endif /* not TRILIBRARY */ -- -- hullsize = 0; /* Prepare to count the boundary edges. */ -- if (b->poly) { -- if (b->verbose) { -- printf(" Marking segments in triangulation.\n"); -- } -- /* Read the segments from the .poly file, and link them */ -- /* to their neighboring triangles. */ -- boundmarker = 0; -- traversalinit(&m->subsegs); -- subsegloop.ss = subsegtraverse(m); -- segmentnumber = b->firstnumber; -- while (subsegloop.ss != (subseg *) NULL) { --#ifdef TRILIBRARY -- end[0] = segmentlist[vertexindex++]; -- end[1] = segmentlist[vertexindex++]; -- if (segmentmarkers) { -- boundmarker = segmentmarkerlist[segmentnumber - b->firstnumber]; -- } --#else /* not TRILIBRARY */ -- /* Read the endpoints of each segment, and possibly a boundary marker. */ -- stringptr = readline(inputline, polyfile, b->inpolyfilename); -- /* Skip the first (segment number) field. */ -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %ld has no endpoints in %s.\n", segmentnumber, -- polyfilename); -- triexit(1); -- } else { -- end[0] = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %ld is missing its second endpoint in %s.\n", -- segmentnumber, polyfilename); -- triexit(1); -- } else { -- end[1] = (int) strtol(stringptr, &stringptr, 0); -- } -- if (segmentmarkers) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- boundmarker = 0; -- } else { -- boundmarker = (int) strtol(stringptr, &stringptr, 0); -- } -- } --#endif /* not TRILIBRARY */ -- for (j = 0; j < 2; j++) { -- if ((end[j] < b->firstnumber) || -- (end[j] >= b->firstnumber + m->invertices)) { -- printf("Error: Segment %ld has an invalid vertex index.\n", -- segmentnumber); -- triexit(1); -- } -- } -- -- /* set the subsegment's vertices. */ -- subsegloop.ssorient = 0; -- segmentorg = getvertex(m, b, end[0]); -- segmentdest = getvertex(m, b, end[1]); -- setsorg(subsegloop, segmentorg); -- setsdest(subsegloop, segmentdest); -- setsegorg(subsegloop, segmentorg); -- setsegdest(subsegloop, segmentdest); -- setmark(subsegloop, boundmarker); -- /* Try linking the subsegment to triangles that share these vertices. */ -- for (subsegloop.ssorient = 0; subsegloop.ssorient < 2; -- subsegloop.ssorient++) { -- /* Take the number for the destination of subsegloop. */ -- aroundvertex = end[1 - subsegloop.ssorient]; -- /* Look for triangles having this vertex. */ -- prevlink = &vertexarray[aroundvertex - b->firstnumber]; -- nexttri = vertexarray[aroundvertex - b->firstnumber]; -- decode(nexttri, checktri); -- sorg(subsegloop, shorg); -- notfound = 1; -- /* Look for triangles having this edge. Note that I'm only */ -- /* comparing each triangle's destination with the subsegment; */ -- /* each triangle's apex is handled through a different vertex. */ -- /* Because each triangle appears on three vertices' lists, each */ -- /* occurrence of a triangle on a list can (and does) represent */ -- /* an edge. In this way, most edges are represented twice, and */ -- /* every triangle-subsegment bond is represented once. */ -- while (notfound && (checktri.tri != m->dummytri)) { -- dest(checktri, checkdest); -- if (shorg == checkdest) { -- /* We have a match. Remove this triangle from the list. */ -- *prevlink = checktri.tri[6 + checktri.orient]; -- /* Bond the subsegment to the triangle. */ -- tsbond(checktri, subsegloop); -- /* Check if this is a boundary edge. */ -- sym(checktri, checkneighbor); -- if (checkneighbor.tri == m->dummytri) { -- /* The next line doesn't insert a subsegment (because there's */ -- /* already one there), but it sets the boundary markers of */ -- /* the existing subsegment and its vertices. */ -- insertsubseg(m, b, &checktri, 1); -- hullsize++; -- } -- notfound = 0; -- } -- /* Find the next triangle in the stack. */ -- prevlink = &checktri.tri[6 + checktri.orient]; -- nexttri = checktri.tri[6 + checktri.orient]; -- decode(nexttri, checktri); -- } -- } -- subsegloop.ss = subsegtraverse(m); -- segmentnumber++; -- } -- } -- -- /* Mark the remaining edges as not being attached to any subsegment. */ -- /* Also, count the (yet uncounted) boundary edges. */ -- for (i = 0; i < m->vertices.items; i++) { -- /* Search the stack of triangles adjacent to a vertex. */ -- nexttri = vertexarray[i]; -- decode(nexttri, checktri); -- while (checktri.tri != m->dummytri) { -- /* Find the next triangle in the stack before this */ -- /* information gets overwritten. */ -- nexttri = checktri.tri[6 + checktri.orient]; -- /* No adjacent subsegment. (This overwrites the stack info.) */ -- tsdissolve(checktri); -- sym(checktri, checkneighbor); -- if (checkneighbor.tri == m->dummytri) { -- insertsubseg(m, b, &checktri, 1); -- hullsize++; -- } -- decode(nexttri, checktri); -- } -- } -- -- trifree((void *) vertexarray); -- return hullsize; --} -- --#endif /* not CDT_ONLY */ -- --/** **/ --/** **/ --/********* General mesh construction routines end here *********/ -- --/********* Segment insertion begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* finddirection() Find the first triangle on the path from one point */ --/* to another. */ --/* */ --/* Finds the triangle that intersects a line segment drawn from the */ --/* origin of `searchtri' to the point `searchpoint', and returns the result */ --/* in `searchtri'. The origin of `searchtri' does not change, even though */ --/* the triangle returned may differ from the one passed in. This routine */ --/* is used to find the direction to move in to get from one point to */ --/* another. */ --/* */ --/* The return value notes whether the destination or apex of the found */ --/* triangle is collinear with the two points in question. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --enum finddirectionresult finddirection(struct mesh *m, struct behavior *b, -- struct otri *searchtri, -- vertex searchpoint) --#else /* not ANSI_DECLARATORS */ --enum finddirectionresult finddirection(m, b, searchtri, searchpoint) --struct mesh *m; --struct behavior *b; --struct otri *searchtri; --vertex searchpoint; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri checktri; -- vertex startvertex; -- vertex leftvertex, rightvertex; -- REAL leftccw, rightccw; -- int leftflag, rightflag; -- triangle ptr; /* Temporary variable used by onext() and oprev(). */ -- -- org(*searchtri, startvertex); -- dest(*searchtri, rightvertex); -- apex(*searchtri, leftvertex); -- /* Is `searchpoint' to the left? */ -- leftccw = counterclockwise(m, b, searchpoint, startvertex, leftvertex); -- leftflag = leftccw > 0.0; -- /* Is `searchpoint' to the right? */ -- rightccw = counterclockwise(m, b, startvertex, searchpoint, rightvertex); -- rightflag = rightccw > 0.0; -- if (leftflag && rightflag) { -- /* `searchtri' faces directly away from `searchpoint'. We could go left */ -- /* or right. Ask whether it's a triangle or a boundary on the left. */ -- onext(*searchtri, checktri); -- if (checktri.tri == m->dummytri) { -- leftflag = 0; -- } else { -- rightflag = 0; -- } -- } -- while (leftflag) { -- /* Turn left until satisfied. */ -- onextself(*searchtri); -- if (searchtri->tri == m->dummytri) { -- printf("Internal error in finddirection(): Unable to find a\n"); -- printf(" triangle leading from (%.12g, %.12g) to", startvertex[0], -- startvertex[1]); -- printf(" (%.12g, %.12g).\n", searchpoint[0], searchpoint[1]); -- internalerror(); -- } -- apex(*searchtri, leftvertex); -- rightccw = leftccw; -- leftccw = counterclockwise(m, b, searchpoint, startvertex, leftvertex); -- leftflag = leftccw > 0.0; -- } -- while (rightflag) { -- /* Turn right until satisfied. */ -- oprevself(*searchtri); -- if (searchtri->tri == m->dummytri) { -- printf("Internal error in finddirection(): Unable to find a\n"); -- printf(" triangle leading from (%.12g, %.12g) to", startvertex[0], -- startvertex[1]); -- printf(" (%.12g, %.12g).\n", searchpoint[0], searchpoint[1]); -- internalerror(); -- } -- dest(*searchtri, rightvertex); -- leftccw = rightccw; -- rightccw = counterclockwise(m, b, startvertex, searchpoint, rightvertex); -- rightflag = rightccw > 0.0; -- } -- if (leftccw == 0.0) { -- return LEFTCOLLINEAR; -- } else if (rightccw == 0.0) { -- return RIGHTCOLLINEAR; -- } else { -- return WITHIN; -- } --} -- --/*****************************************************************************/ --/* */ --/* segmentintersection() Find the intersection of an existing segment */ --/* and a segment that is being inserted. Insert */ --/* a vertex at the intersection, splitting an */ --/* existing subsegment. */ --/* */ --/* The segment being inserted connects the apex of splittri to endpoint2. */ --/* splitsubseg is the subsegment being split, and MUST adjoin splittri. */ --/* Hence, endpoints of the subsegment being split are the origin and */ --/* destination of splittri. */ --/* */ --/* On completion, splittri is a handle having the newly inserted */ --/* intersection point as its origin, and endpoint1 as its destination. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void segmentintersection(struct mesh *m, struct behavior *b, -- struct otri *splittri, struct osub *splitsubseg, -- vertex endpoint2) --#else /* not ANSI_DECLARATORS */ --void segmentintersection(m, b, splittri, splitsubseg, endpoint2) --struct mesh *m; --struct behavior *b; --struct otri *splittri; --struct osub *splitsubseg; --vertex endpoint2; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct osub opposubseg; -- vertex endpoint1; -- vertex torg, tdest; -- vertex leftvertex, rightvertex; -- vertex newvertex; -- enum insertvertexresult success; -- REAL ex, ey; -- REAL tx, ty; -- REAL etx, ety; -- REAL split, denom; -- int i; -- triangle ptr; /* Temporary variable used by onext(). */ -- subseg sptr; /* Temporary variable used by snext(). */ -- -- /* Find the other three segment endpoints. */ -- apex(*splittri, endpoint1); -- org(*splittri, torg); -- dest(*splittri, tdest); -- /* Segment intersection formulae; see the Antonio reference. */ -- tx = tdest[0] - torg[0]; -- ty = tdest[1] - torg[1]; -- ex = endpoint2[0] - endpoint1[0]; -- ey = endpoint2[1] - endpoint1[1]; -- etx = torg[0] - endpoint2[0]; -- ety = torg[1] - endpoint2[1]; -- denom = ty * ex - tx * ey; -- if (denom == 0.0) { -- printf("Internal error in segmentintersection():"); -- printf(" Attempt to find intersection of parallel segments.\n"); -- internalerror(); -- } -- split = (ey * etx - ex * ety) / denom; -- /* Create the new vertex. */ -- newvertex = (vertex) poolalloc(&m->vertices); -- /* Interpolate its coordinate and attributes. */ -- for (i = 0; i < 2 + m->nextras; i++) { -- newvertex[i] = torg[i] + split * (tdest[i] - torg[i]); -- } -- setvertexmark(newvertex, mark(*splitsubseg)); -- setvertextype(newvertex, INPUTVERTEX); -- if (b->verbose > 1) { -- printf( -- " Splitting subsegment (%.12g, %.12g) (%.12g, %.12g) at (%.12g, %.12g).\n", -- torg[0], torg[1], tdest[0], tdest[1], newvertex[0], newvertex[1]); -- } -- /* Insert the intersection vertex. This should always succeed. */ -- success = insertvertex(m, b, newvertex, splittri, splitsubseg, 0, 0); -- if (success != SUCCESSFULVERTEX) { -- printf("Internal error in segmentintersection():\n"); -- printf(" Failure to split a segment.\n"); -- internalerror(); -- } -- /* Record a triangle whose origin is the new vertex. */ -- setvertex2tri(newvertex, encode(*splittri)); -- if (m->steinerleft > 0) { -- m->steinerleft--; -- } -- -- /* Divide the segment into two, and correct the segment endpoints. */ -- ssymself(*splitsubseg); -- spivot(*splitsubseg, opposubseg); -- sdissolve(*splitsubseg); -- sdissolve(opposubseg); -- do { -- setsegorg(*splitsubseg, newvertex); -- snextself(*splitsubseg); -- } while (splitsubseg->ss != m->dummysub); -- do { -- setsegorg(opposubseg, newvertex); -- snextself(opposubseg); -- } while (opposubseg.ss != m->dummysub); -- -- /* Inserting the vertex may have caused edge flips. We wish to rediscover */ -- /* the edge connecting endpoint1 to the new intersection vertex. */ -- finddirection(m, b, splittri, endpoint1); -- dest(*splittri, rightvertex); -- apex(*splittri, leftvertex); -- if ((leftvertex[0] == endpoint1[0]) && (leftvertex[1] == endpoint1[1])) { -- onextself(*splittri); -- } else if ((rightvertex[0] != endpoint1[0]) || -- (rightvertex[1] != endpoint1[1])) { -- printf("Internal error in segmentintersection():\n"); -- printf(" Topological inconsistency after splitting a segment.\n"); -- internalerror(); -- } -- /* `splittri' should have destination endpoint1. */ --} -- --/*****************************************************************************/ --/* */ --/* scoutsegment() Scout the first triangle on the path from one endpoint */ --/* to another, and check for completion (reaching the */ --/* second endpoint), a collinear vertex, or the */ --/* intersection of two segments. */ --/* */ --/* Returns one if the entire segment is successfully inserted, and zero if */ --/* the job must be finished by conformingedge() or constrainededge(). */ --/* */ --/* If the first triangle on the path has the second endpoint as its */ --/* destination or apex, a subsegment is inserted and the job is done. */ --/* */ --/* If the first triangle on the path has a destination or apex that lies on */ --/* the segment, a subsegment is inserted connecting the first endpoint to */ --/* the collinear vertex, and the search is continued from the collinear */ --/* vertex. */ --/* */ --/* If the first triangle on the path has a subsegment opposite its origin, */ --/* then there is a segment that intersects the segment being inserted. */ --/* Their intersection vertex is inserted, splitting the subsegment. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --int scoutsegment(struct mesh *m, struct behavior *b, struct otri *searchtri, -- vertex endpoint2, int newmark) --#else /* not ANSI_DECLARATORS */ --int scoutsegment(m, b, searchtri, endpoint2, newmark) --struct mesh *m; --struct behavior *b; --struct otri *searchtri; --vertex endpoint2; --int newmark; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri crosstri; -- struct osub crosssubseg; -- vertex leftvertex, rightvertex; -- enum finddirectionresult collinear; -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- collinear = finddirection(m, b, searchtri, endpoint2); -- dest(*searchtri, rightvertex); -- apex(*searchtri, leftvertex); -- if (((leftvertex[0] == endpoint2[0]) && (leftvertex[1] == endpoint2[1])) || -- ((rightvertex[0] == endpoint2[0]) && (rightvertex[1] == endpoint2[1]))) { -- /* The segment is already an edge in the mesh. */ -- if ((leftvertex[0] == endpoint2[0]) && (leftvertex[1] == endpoint2[1])) { -- lprevself(*searchtri); -- } -- /* Insert a subsegment, if there isn't already one there. */ -- insertsubseg(m, b, searchtri, newmark); -- return 1; -- } else if (collinear == LEFTCOLLINEAR) { -- /* We've collided with a vertex between the segment's endpoints. */ -- /* Make the collinear vertex be the triangle's origin. */ -- lprevself(*searchtri); -- insertsubseg(m, b, searchtri, newmark); -- /* Insert the remainder of the segment. */ -- return scoutsegment(m, b, searchtri, endpoint2, newmark); -- } else if (collinear == RIGHTCOLLINEAR) { -- /* We've collided with a vertex between the segment's endpoints. */ -- insertsubseg(m, b, searchtri, newmark); -- /* Make the collinear vertex be the triangle's origin. */ -- lnextself(*searchtri); -- /* Insert the remainder of the segment. */ -- return scoutsegment(m, b, searchtri, endpoint2, newmark); -- } else { -- lnext(*searchtri, crosstri); -- tspivot(crosstri, crosssubseg); -- /* Check for a crossing segment. */ -- if (crosssubseg.ss == m->dummysub) { -- return 0; -- } else { -- /* Insert a vertex at the intersection. */ -- segmentintersection(m, b, &crosstri, &crosssubseg, endpoint2); -- otricopy(crosstri, *searchtri); -- insertsubseg(m, b, searchtri, newmark); -- /* Insert the remainder of the segment. */ -- return scoutsegment(m, b, searchtri, endpoint2, newmark); -- } -- } --} -- --/*****************************************************************************/ --/* */ --/* conformingedge() Force a segment into a conforming Delaunay */ --/* triangulation by inserting a vertex at its midpoint, */ --/* and recursively forcing in the two half-segments if */ --/* necessary. */ --/* */ --/* Generates a sequence of subsegments connecting `endpoint1' to */ --/* `endpoint2'. `newmark' is the boundary marker of the segment, assigned */ --/* to each new splitting vertex and subsegment. */ --/* */ --/* Note that conformingedge() does not always maintain the conforming */ --/* Delaunay property. Once inserted, segments are locked into place; */ --/* vertices inserted later (to force other segments in) may render these */ --/* fixed segments non-Delaunay. The conforming Delaunay property will be */ --/* restored by enforcequality() by splitting encroached subsegments. */ --/* */ --/*****************************************************************************/ -- --#ifndef REDUCED --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void conformingedge(struct mesh *m, struct behavior *b, -- vertex endpoint1, vertex endpoint2, int newmark) --#else /* not ANSI_DECLARATORS */ --void conformingedge(m, b, endpoint1, endpoint2, newmark) --struct mesh *m; --struct behavior *b; --vertex endpoint1; --vertex endpoint2; --int newmark; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri searchtri1, searchtri2; -- struct osub brokensubseg; -- vertex newvertex; -- vertex midvertex1, midvertex2; -- enum insertvertexresult success; -- int i; -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (b->verbose > 2) { -- printf("Forcing segment into triangulation by recursive splitting:\n"); -- printf(" (%.12g, %.12g) (%.12g, %.12g)\n", endpoint1[0], endpoint1[1], -- endpoint2[0], endpoint2[1]); -- } -- /* Create a new vertex to insert in the middle of the segment. */ -- newvertex = (vertex) poolalloc(&m->vertices); -- /* Interpolate coordinates and attributes. */ -- for (i = 0; i < 2 + m->nextras; i++) { -- newvertex[i] = 0.5 * (endpoint1[i] + endpoint2[i]); -- } -- setvertexmark(newvertex, newmark); -- setvertextype(newvertex, SEGMENTVERTEX); -- /* No known triangle to search from. */ -- searchtri1.tri = m->dummytri; -- /* Attempt to insert the new vertex. */ -- success = insertvertex(m, b, newvertex, &searchtri1, (struct osub *) NULL, -- 0, 0); -- if (success == DUPLICATEVERTEX) { -- if (b->verbose > 2) { -- printf(" Segment intersects existing vertex (%.12g, %.12g).\n", -- newvertex[0], newvertex[1]); -- } -- /* Use the vertex that's already there. */ -- vertexdealloc(m, newvertex); -- org(searchtri1, newvertex); -- } else { -- if (success == VIOLATINGVERTEX) { -- if (b->verbose > 2) { -- printf(" Two segments intersect at (%.12g, %.12g).\n", -- newvertex[0], newvertex[1]); -- } -- /* By fluke, we've landed right on another segment. Split it. */ -- tspivot(searchtri1, brokensubseg); -- success = insertvertex(m, b, newvertex, &searchtri1, &brokensubseg, -- 0, 0); -- if (success != SUCCESSFULVERTEX) { -- printf("Internal error in conformingedge():\n"); -- printf(" Failure to split a segment.\n"); -- internalerror(); -- } -- } -- /* The vertex has been inserted successfully. */ -- if (m->steinerleft > 0) { -- m->steinerleft--; -- } -- } -- otricopy(searchtri1, searchtri2); -- /* `searchtri1' and `searchtri2' are fastened at their origins to */ -- /* `newvertex', and will be directed toward `endpoint1' and `endpoint2' */ -- /* respectively. First, we must get `searchtri2' out of the way so it */ -- /* won't be invalidated during the insertion of the first half of the */ -- /* segment. */ -- finddirection(m, b, &searchtri2, endpoint2); -- if (!scoutsegment(m, b, &searchtri1, endpoint1, newmark)) { -- /* The origin of searchtri1 may have changed if a collision with an */ -- /* intervening vertex on the segment occurred. */ -- org(searchtri1, midvertex1); -- conformingedge(m, b, midvertex1, endpoint1, newmark); -- } -- if (!scoutsegment(m, b, &searchtri2, endpoint2, newmark)) { -- /* The origin of searchtri2 may have changed if a collision with an */ -- /* intervening vertex on the segment occurred. */ -- org(searchtri2, midvertex2); -- conformingedge(m, b, midvertex2, endpoint2, newmark); -- } --} -- --#endif /* not CDT_ONLY */ --#endif /* not REDUCED */ -- --/*****************************************************************************/ --/* */ --/* delaunayfixup() Enforce the Delaunay condition at an edge, fanning out */ --/* recursively from an existing vertex. Pay special */ --/* attention to stacking inverted triangles. */ --/* */ --/* This is a support routine for inserting segments into a constrained */ --/* Delaunay triangulation. */ --/* */ --/* The origin of fixuptri is treated as if it has just been inserted, and */ --/* the local Delaunay condition needs to be enforced. It is only enforced */ --/* in one sector, however, that being the angular range defined by */ --/* fixuptri. */ --/* */ --/* This routine also needs to make decisions regarding the "stacking" of */ --/* triangles. (Read the description of constrainededge() below before */ --/* reading on here, so you understand the algorithm.) If the position of */ --/* the new vertex (the origin of fixuptri) indicates that the vertex before */ --/* it on the polygon is a reflex vertex, then "stack" the triangle by */ --/* doing nothing. (fixuptri is an inverted triangle, which is how stacked */ --/* triangles are identified.) */ --/* */ --/* Otherwise, check whether the vertex before that was a reflex vertex. */ --/* If so, perform an edge flip, thereby eliminating an inverted triangle */ --/* (popping it off the stack). The edge flip may result in the creation */ --/* of a new inverted triangle, depending on whether or not the new vertex */ --/* is visible to the vertex three edges behind on the polygon. */ --/* */ --/* If neither of the two vertices behind the new vertex are reflex */ --/* vertices, fixuptri and fartri, the triangle opposite it, are not */ --/* inverted; hence, ensure that the edge between them is locally Delaunay. */ --/* */ --/* `leftside' indicates whether or not fixuptri is to the left of the */ --/* segment being inserted. (Imagine that the segment is pointing up from */ --/* endpoint1 to endpoint2.) */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void delaunayfixup(struct mesh *m, struct behavior *b, -- struct otri *fixuptri, int leftside) --#else /* not ANSI_DECLARATORS */ --void delaunayfixup(m, b, fixuptri, leftside) --struct mesh *m; --struct behavior *b; --struct otri *fixuptri; --int leftside; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri neartri; -- struct otri fartri; -- struct osub faredge; -- vertex nearvertex, leftvertex, rightvertex, farvertex; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- lnext(*fixuptri, neartri); -- sym(neartri, fartri); -- /* Check if the edge opposite the origin of fixuptri can be flipped. */ -- if (fartri.tri == m->dummytri) { -- return; -- } -- tspivot(neartri, faredge); -- if (faredge.ss != m->dummysub) { -- return; -- } -- /* Find all the relevant vertices. */ -- apex(neartri, nearvertex); -- org(neartri, leftvertex); -- dest(neartri, rightvertex); -- apex(fartri, farvertex); -- /* Check whether the previous polygon vertex is a reflex vertex. */ -- if (leftside) { -- if (counterclockwise(m, b, nearvertex, leftvertex, farvertex) <= 0.0) { -- /* leftvertex is a reflex vertex too. Nothing can */ -- /* be done until a convex section is found. */ -- return; -- } -- } else { -- if (counterclockwise(m, b, farvertex, rightvertex, nearvertex) <= 0.0) { -- /* rightvertex is a reflex vertex too. Nothing can */ -- /* be done until a convex section is found. */ -- return; -- } -- } -- if (counterclockwise(m, b, rightvertex, leftvertex, farvertex) > 0.0) { -- /* fartri is not an inverted triangle, and farvertex is not a reflex */ -- /* vertex. As there are no reflex vertices, fixuptri isn't an */ -- /* inverted triangle, either. Hence, test the edge between the */ -- /* triangles to ensure it is locally Delaunay. */ -- if (incircle(m, b, leftvertex, farvertex, rightvertex, nearvertex) <= -- 0.0) { -- return; -- } -- /* Not locally Delaunay; go on to an edge flip. */ -- } /* else fartri is inverted; remove it from the stack by flipping. */ -- flip(m, b, &neartri); -- lprevself(*fixuptri); /* Restore the origin of fixuptri after the flip. */ -- /* Recursively process the two triangles that result from the flip. */ -- delaunayfixup(m, b, fixuptri, leftside); -- delaunayfixup(m, b, &fartri, leftside); --} -- --/*****************************************************************************/ --/* */ --/* constrainededge() Force a segment into a constrained Delaunay */ --/* triangulation by deleting the triangles it */ --/* intersects, and triangulating the polygons that */ --/* form on each side of it. */ --/* */ --/* Generates a single subsegment connecting `endpoint1' to `endpoint2'. */ --/* The triangle `starttri' has `endpoint1' as its origin. `newmark' is the */ --/* boundary marker of the segment. */ --/* */ --/* To insert a segment, every triangle whose interior intersects the */ --/* segment is deleted. The union of these deleted triangles is a polygon */ --/* (which is not necessarily monotone, but is close enough), which is */ --/* divided into two polygons by the new segment. This routine's task is */ --/* to generate the Delaunay triangulation of these two polygons. */ --/* */ --/* You might think of this routine's behavior as a two-step process. The */ --/* first step is to walk from endpoint1 to endpoint2, flipping each edge */ --/* encountered. This step creates a fan of edges connected to endpoint1, */ --/* including the desired edge to endpoint2. The second step enforces the */ --/* Delaunay condition on each side of the segment in an incremental manner: */ --/* proceeding along the polygon from endpoint1 to endpoint2 (this is done */ --/* independently on each side of the segment), each vertex is "enforced" */ --/* as if it had just been inserted, but affecting only the previous */ --/* vertices. The result is the same as if the vertices had been inserted */ --/* in the order they appear on the polygon, so the result is Delaunay. */ --/* */ --/* In truth, constrainededge() interleaves these two steps. The procedure */ --/* walks from endpoint1 to endpoint2, and each time an edge is encountered */ --/* and flipped, the newly exposed vertex (at the far end of the flipped */ --/* edge) is "enforced" upon the previously flipped edges, usually affecting */ --/* only one side of the polygon (depending upon which side of the segment */ --/* the vertex falls on). */ --/* */ --/* The algorithm is complicated by the need to handle polygons that are not */ --/* convex. Although the polygon is not necessarily monotone, it can be */ --/* triangulated in a manner similar to the stack-based algorithms for */ --/* monotone polygons. For each reflex vertex (local concavity) of the */ --/* polygon, there will be an inverted triangle formed by one of the edge */ --/* flips. (An inverted triangle is one with negative area - that is, its */ --/* vertices are arranged in clockwise order - and is best thought of as a */ --/* wrinkle in the fabric of the mesh.) Each inverted triangle can be */ --/* thought of as a reflex vertex pushed on the stack, waiting to be fixed */ --/* later. */ --/* */ --/* A reflex vertex is popped from the stack when a vertex is inserted that */ --/* is visible to the reflex vertex. (However, if the vertex behind the */ --/* reflex vertex is not visible to the reflex vertex, a new inverted */ --/* triangle will take its place on the stack.) These details are handled */ --/* by the delaunayfixup() routine above. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void constrainededge(struct mesh *m, struct behavior *b, -- struct otri *starttri, vertex endpoint2, int newmark) --#else /* not ANSI_DECLARATORS */ --void constrainededge(m, b, starttri, endpoint2, newmark) --struct mesh *m; --struct behavior *b; --struct otri *starttri; --vertex endpoint2; --int newmark; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri fixuptri, fixuptri2; -- struct osub crosssubseg; -- vertex endpoint1; -- vertex farvertex; -- REAL area; -- int collision; -- int done; -- triangle ptr; /* Temporary variable used by sym() and oprev(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- org(*starttri, endpoint1); -- lnext(*starttri, fixuptri); -- flip(m, b, &fixuptri); -- /* `collision' indicates whether we have found a vertex directly */ -- /* between endpoint1 and endpoint2. */ -- collision = 0; -- done = 0; -- do { -- org(fixuptri, farvertex); -- /* `farvertex' is the extreme point of the polygon we are "digging" */ -- /* to get from endpoint1 to endpoint2. */ -- if ((farvertex[0] == endpoint2[0]) && (farvertex[1] == endpoint2[1])) { -- oprev(fixuptri, fixuptri2); -- /* Enforce the Delaunay condition around endpoint2. */ -- delaunayfixup(m, b, &fixuptri, 0); -- delaunayfixup(m, b, &fixuptri2, 1); -- done = 1; -- } else { -- /* Check whether farvertex is to the left or right of the segment */ -- /* being inserted, to decide which edge of fixuptri to dig */ -- /* through next. */ -- area = counterclockwise(m, b, endpoint1, endpoint2, farvertex); -- if (area == 0.0) { -- /* We've collided with a vertex between endpoint1 and endpoint2. */ -- collision = 1; -- oprev(fixuptri, fixuptri2); -- /* Enforce the Delaunay condition around farvertex. */ -- delaunayfixup(m, b, &fixuptri, 0); -- delaunayfixup(m, b, &fixuptri2, 1); -- done = 1; -- } else { -- if (area > 0.0) { /* farvertex is to the left of the segment. */ -- oprev(fixuptri, fixuptri2); -- /* Enforce the Delaunay condition around farvertex, on the */ -- /* left side of the segment only. */ -- delaunayfixup(m, b, &fixuptri2, 1); -- /* Flip the edge that crosses the segment. After the edge is */ -- /* flipped, one of its endpoints is the fan vertex, and the */ -- /* destination of fixuptri is the fan vertex. */ -- lprevself(fixuptri); -- } else { /* farvertex is to the right of the segment. */ -- delaunayfixup(m, b, &fixuptri, 0); -- /* Flip the edge that crosses the segment. After the edge is */ -- /* flipped, one of its endpoints is the fan vertex, and the */ -- /* destination of fixuptri is the fan vertex. */ -- oprevself(fixuptri); -- } -- /* Check for two intersecting segments. */ -- tspivot(fixuptri, crosssubseg); -- if (crosssubseg.ss == m->dummysub) { -- flip(m, b, &fixuptri); /* May create inverted triangle at left. */ -- } else { -- /* We've collided with a segment between endpoint1 and endpoint2. */ -- collision = 1; -- /* Insert a vertex at the intersection. */ -- segmentintersection(m, b, &fixuptri, &crosssubseg, endpoint2); -- done = 1; -- } -- } -- } -- } while (!done); -- /* Insert a subsegment to make the segment permanent. */ -- insertsubseg(m, b, &fixuptri, newmark); -- /* If there was a collision with an interceding vertex, install another */ -- /* segment connecting that vertex with endpoint2. */ -- if (collision) { -- /* Insert the remainder of the segment. */ -- if (!scoutsegment(m, b, &fixuptri, endpoint2, newmark)) { -- constrainededge(m, b, &fixuptri, endpoint2, newmark); -- } -- } --} -- --/*****************************************************************************/ --/* */ --/* insertsegment() Insert a PSLG segment into a triangulation. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void insertsegment(struct mesh *m, struct behavior *b, -- vertex endpoint1, vertex endpoint2, int newmark) --#else /* not ANSI_DECLARATORS */ --void insertsegment(m, b, endpoint1, endpoint2, newmark) --struct mesh *m; --struct behavior *b; --vertex endpoint1; --vertex endpoint2; --int newmark; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri searchtri1, searchtri2; -- triangle encodedtri; -- vertex checkvertex; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- if (b->verbose > 1) { -- printf(" Connecting (%.12g, %.12g) to (%.12g, %.12g).\n", -- endpoint1[0], endpoint1[1], endpoint2[0], endpoint2[1]); -- } -- -- /* Find a triangle whose origin is the segment's first endpoint. */ -- checkvertex = (vertex) NULL; -- encodedtri = vertex2tri(endpoint1); -- if (encodedtri != (triangle) NULL) { -- decode(encodedtri, searchtri1); -- org(searchtri1, checkvertex); -- } -- if (checkvertex != endpoint1) { -- /* Find a boundary triangle to search from. */ -- searchtri1.tri = m->dummytri; -- searchtri1.orient = 0; -- symself(searchtri1); -- /* Search for the segment's first endpoint by point location. */ -- if (locate(m, b, endpoint1, &searchtri1) != ONVERTEX) { -- printf( -- "Internal error in insertsegment(): Unable to locate PSLG vertex\n"); -- printf(" (%.12g, %.12g) in triangulation.\n", -- endpoint1[0], endpoint1[1]); -- internalerror(); -- } -- } -- /* Remember this triangle to improve subsequent point location. */ -- otricopy(searchtri1, m->recenttri); -- /* Scout the beginnings of a path from the first endpoint */ -- /* toward the second. */ -- if (scoutsegment(m, b, &searchtri1, endpoint2, newmark)) { -- /* The segment was easily inserted. */ -- return; -- } -- /* The first endpoint may have changed if a collision with an intervening */ -- /* vertex on the segment occurred. */ -- org(searchtri1, endpoint1); -- -- /* Find a triangle whose origin is the segment's second endpoint. */ -- checkvertex = (vertex) NULL; -- encodedtri = vertex2tri(endpoint2); -- if (encodedtri != (triangle) NULL) { -- decode(encodedtri, searchtri2); -- org(searchtri2, checkvertex); -- } -- if (checkvertex != endpoint2) { -- /* Find a boundary triangle to search from. */ -- searchtri2.tri = m->dummytri; -- searchtri2.orient = 0; -- symself(searchtri2); -- /* Search for the segment's second endpoint by point location. */ -- if (locate(m, b, endpoint2, &searchtri2) != ONVERTEX) { -- printf( -- "Internal error in insertsegment(): Unable to locate PSLG vertex\n"); -- printf(" (%.12g, %.12g) in triangulation.\n", -- endpoint2[0], endpoint2[1]); -- internalerror(); -- } -- } -- /* Remember this triangle to improve subsequent point location. */ -- otricopy(searchtri2, m->recenttri); -- /* Scout the beginnings of a path from the second endpoint */ -- /* toward the first. */ -- if (scoutsegment(m, b, &searchtri2, endpoint1, newmark)) { -- /* The segment was easily inserted. */ -- return; -- } -- /* The second endpoint may have changed if a collision with an intervening */ -- /* vertex on the segment occurred. */ -- org(searchtri2, endpoint2); -- --#ifndef REDUCED --#ifndef CDT_ONLY -- if (b->splitseg) { -- /* Insert vertices to force the segment into the triangulation. */ -- conformingedge(m, b, endpoint1, endpoint2, newmark); -- } else { --#endif /* not CDT_ONLY */ --#endif /* not REDUCED */ -- /* Insert the segment directly into the triangulation. */ -- constrainededge(m, b, &searchtri1, endpoint2, newmark); --#ifndef REDUCED --#ifndef CDT_ONLY -- } --#endif /* not CDT_ONLY */ --#endif /* not REDUCED */ --} -- --/*****************************************************************************/ --/* */ --/* markhull() Cover the convex hull of a triangulation with subsegments. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void markhull(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void markhull(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri hulltri; -- struct otri nexttri; -- struct otri starttri; -- triangle ptr; /* Temporary variable used by sym() and oprev(). */ -- -- /* Find a triangle handle on the hull. */ -- hulltri.tri = m->dummytri; -- hulltri.orient = 0; -- symself(hulltri); -- /* Remember where we started so we know when to stop. */ -- otricopy(hulltri, starttri); -- /* Go once counterclockwise around the convex hull. */ -- do { -- /* Create a subsegment if there isn't already one here. */ -- insertsubseg(m, b, &hulltri, 1); -- /* To find the next hull edge, go clockwise around the next vertex. */ -- lnextself(hulltri); -- oprev(hulltri, nexttri); -- while (nexttri.tri != m->dummytri) { -- otricopy(nexttri, hulltri); -- oprev(hulltri, nexttri); -- } -- } while (!otriequal(hulltri, starttri)); --} -- --/*****************************************************************************/ --/* */ --/* formskeleton() Create the segments of a triangulation, including PSLG */ --/* segments and edges on the convex hull. */ --/* */ --/* The PSLG segments are read from a .poly file. The return value is the */ --/* number of segments in the file. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void formskeleton(struct mesh *m, struct behavior *b, int *segmentlist, -- int *segmentmarkerlist, int numberofsegments) --#else /* not ANSI_DECLARATORS */ --void formskeleton(m, b, segmentlist, segmentmarkerlist, numberofsegments) --struct mesh *m; --struct behavior *b; --int *segmentlist; --int *segmentmarkerlist; --int numberofsegments; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void formskeleton(struct mesh *m, struct behavior *b, -- FILE *polyfile, char *polyfilename) --#else /* not ANSI_DECLARATORS */ --void formskeleton(m, b, polyfile, polyfilename) --struct mesh *m; --struct behavior *b; --FILE *polyfile; --char *polyfilename; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- char polyfilename[6]; -- int index; --#else /* not TRILIBRARY */ -- char inputline[INPUTLINESIZE]; -- char *stringptr; --#endif /* not TRILIBRARY */ -- vertex endpoint1, endpoint2; -- int segmentmarkers; -- int end1, end2; -- int boundmarker; -- int i; -- -- if (b->poly) { -- if (!b->quiet) { -- printf("Recovering segments in Delaunay triangulation.\n"); -- } --#ifdef TRILIBRARY -- strcpy(polyfilename, "input"); -- m->insegments = numberofsegments; -- segmentmarkers = segmentmarkerlist != (int *) NULL; -- index = 0; --#else /* not TRILIBRARY */ -- /* Read the segments from a .poly file. */ -- /* Read number of segments and number of boundary markers. */ -- stringptr = readline(inputline, polyfile, polyfilename); -- m->insegments = (int) strtol(stringptr, &stringptr, 0); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- segmentmarkers = 0; -- } else { -- segmentmarkers = (int) strtol(stringptr, &stringptr, 0); -- } --#endif /* not TRILIBRARY */ -- /* If the input vertices are collinear, there is no triangulation, */ -- /* so don't try to insert segments. */ -- if (m->triangles.items == 0) { -- return; -- } -- -- /* If segments are to be inserted, compute a mapping */ -- /* from vertices to triangles. */ -- if (m->insegments > 0) { -- makevertexmap(m, b); -- if (b->verbose) { -- printf(" Recovering PSLG segments.\n"); -- } -- } -- -- boundmarker = 0; -- /* Read and insert the segments. */ -- for (i = 0; i < m->insegments; i++) { --#ifdef TRILIBRARY -- end1 = segmentlist[index++]; -- end2 = segmentlist[index++]; -- if (segmentmarkers) { -- boundmarker = segmentmarkerlist[i]; -- } --#else /* not TRILIBRARY */ -- stringptr = readline(inputline, polyfile, b->inpolyfilename); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %d has no endpoints in %s.\n", -- b->firstnumber + i, polyfilename); -- triexit(1); -- } else { -- end1 = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Segment %d is missing its second endpoint in %s.\n", -- b->firstnumber + i, polyfilename); -- triexit(1); -- } else { -- end2 = (int) strtol(stringptr, &stringptr, 0); -- } -- if (segmentmarkers) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- boundmarker = 0; -- } else { -- boundmarker = (int) strtol(stringptr, &stringptr, 0); -- } -- } --#endif /* not TRILIBRARY */ -- if ((end1 < b->firstnumber) || -- (end1 >= b->firstnumber + m->invertices)) { -- if (!b->quiet) { -- printf("Warning: Invalid first endpoint of segment %d in %s.\n", -- b->firstnumber + i, polyfilename); -- } -- } else if ((end2 < b->firstnumber) || -- (end2 >= b->firstnumber + m->invertices)) { -- if (!b->quiet) { -- printf("Warning: Invalid second endpoint of segment %d in %s.\n", -- b->firstnumber + i, polyfilename); -- } -- } else { -- /* Find the vertices numbered `end1' and `end2'. */ -- endpoint1 = getvertex(m, b, end1); -- endpoint2 = getvertex(m, b, end2); -- if ((endpoint1[0] == endpoint2[0]) && (endpoint1[1] == endpoint2[1])) { -- if (!b->quiet) { -- printf("Warning: Endpoints of segment %d are coincident in %s.\n", -- b->firstnumber + i, polyfilename); -- } -- } else { -- insertsegment(m, b, endpoint1, endpoint2, boundmarker); -- } -- } -- } -- } else { -- m->insegments = 0; -- } -- if (b->convex || !b->poly) { -- /* Enclose the convex hull with subsegments. */ -- if (b->verbose) { -- printf(" Enclosing convex hull with segments.\n"); -- } -- markhull(m, b); -- } --} -- --/** **/ --/** **/ --/********* Segment insertion ends here *********/ -- --/********* Carving out holes and concavities begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* infecthull() Virally infect all of the triangles of the convex hull */ --/* that are not protected by subsegments. Where there are */ --/* subsegments, set boundary markers as appropriate. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void infecthull(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void infecthull(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri hulltri; -- struct otri nexttri; -- struct otri starttri; -- struct osub hullsubseg; -- triangle **deadtriangle; -- vertex horg, hdest; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (b->verbose) { -- printf(" Marking concavities (external triangles) for elimination.\n"); -- } -- /* Find a triangle handle on the hull. */ -- hulltri.tri = m->dummytri; -- hulltri.orient = 0; -- symself(hulltri); -- /* Remember where we started so we know when to stop. */ -- otricopy(hulltri, starttri); -- /* Go once counterclockwise around the convex hull. */ -- do { -- /* Ignore triangles that are already infected. */ -- if (!infected(hulltri)) { -- /* Is the triangle protected by a subsegment? */ -- tspivot(hulltri, hullsubseg); -- if (hullsubseg.ss == m->dummysub) { -- /* The triangle is not protected; infect it. */ -- if (!infected(hulltri)) { -- infect(hulltri); -- deadtriangle = (triangle **) poolalloc(&m->viri); -- *deadtriangle = hulltri.tri; -- } -- } else { -- /* The triangle is protected; set boundary markers if appropriate. */ -- if (mark(hullsubseg) == 0) { -- setmark(hullsubseg, 1); -- org(hulltri, horg); -- dest(hulltri, hdest); -- if (vertexmark(horg) == 0) { -- setvertexmark(horg, 1); -- } -- if (vertexmark(hdest) == 0) { -- setvertexmark(hdest, 1); -- } -- } -- } -- } -- /* To find the next hull edge, go clockwise around the next vertex. */ -- lnextself(hulltri); -- oprev(hulltri, nexttri); -- while (nexttri.tri != m->dummytri) { -- otricopy(nexttri, hulltri); -- oprev(hulltri, nexttri); -- } -- } while (!otriequal(hulltri, starttri)); --} -- --/*****************************************************************************/ --/* */ --/* plague() Spread the virus from all infected triangles to any neighbors */ --/* not protected by subsegments. Delete all infected triangles. */ --/* */ --/* This is the procedure that actually creates holes and concavities. */ --/* */ --/* This procedure operates in two phases. The first phase identifies all */ --/* the triangles that will die, and marks them as infected. They are */ --/* marked to ensure that each triangle is added to the virus pool only */ --/* once, so the procedure will terminate. */ --/* */ --/* The second phase actually eliminates the infected triangles. It also */ --/* eliminates orphaned vertices. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void plague(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void plague(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri testtri; -- struct otri neighbor; -- triangle **virusloop; -- triangle **deadtriangle; -- struct osub neighborsubseg; -- vertex testvertex; -- vertex norg, ndest; -- vertex deadorg, deaddest, deadapex; -- int killorg; -- triangle ptr; /* Temporary variable used by sym() and onext(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (b->verbose) { -- printf(" Marking neighbors of marked triangles.\n"); -- } -- /* Loop through all the infected triangles, spreading the virus to */ -- /* their neighbors, then to their neighbors' neighbors. */ -- traversalinit(&m->viri); -- virusloop = (triangle **) traverse(&m->viri); -- while (virusloop != (triangle **) NULL) { -- testtri.tri = *virusloop; -- /* A triangle is marked as infected by messing with one of its pointers */ -- /* to subsegments, setting it to an illegal value. Hence, we have to */ -- /* temporarily uninfect this triangle so that we can examine its */ -- /* adjacent subsegments. */ -- uninfect(testtri); -- if (b->verbose > 2) { -- /* Assign the triangle an orientation for convenience in */ -- /* checking its vertices. */ -- testtri.orient = 0; -- org(testtri, deadorg); -- dest(testtri, deaddest); -- apex(testtri, deadapex); -- printf(" Checking (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- deadorg[0], deadorg[1], deaddest[0], deaddest[1], -- deadapex[0], deadapex[1]); -- } -- /* Check each of the triangle's three neighbors. */ -- for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) { -- /* Find the neighbor. */ -- sym(testtri, neighbor); -- /* Check for a subsegment between the triangle and its neighbor. */ -- tspivot(testtri, neighborsubseg); -- /* Check if the neighbor is nonexistent or already infected. */ -- if ((neighbor.tri == m->dummytri) || infected(neighbor)) { -- if (neighborsubseg.ss != m->dummysub) { -- /* There is a subsegment separating the triangle from its */ -- /* neighbor, but both triangles are dying, so the subsegment */ -- /* dies too. */ -- subsegdealloc(m, neighborsubseg.ss); -- if (neighbor.tri != m->dummytri) { -- /* Make sure the subsegment doesn't get deallocated again */ -- /* later when the infected neighbor is visited. */ -- uninfect(neighbor); -- tsdissolve(neighbor); -- infect(neighbor); -- } -- } -- } else { /* The neighbor exists and is not infected. */ -- if (neighborsubseg.ss == m->dummysub) { -- /* There is no subsegment protecting the neighbor, so */ -- /* the neighbor becomes infected. */ -- if (b->verbose > 2) { -- org(neighbor, deadorg); -- dest(neighbor, deaddest); -- apex(neighbor, deadapex); -- printf( -- " Marking (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- deadorg[0], deadorg[1], deaddest[0], deaddest[1], -- deadapex[0], deadapex[1]); -- } -- infect(neighbor); -- /* Ensure that the neighbor's neighbors will be infected. */ -- deadtriangle = (triangle **) poolalloc(&m->viri); -- *deadtriangle = neighbor.tri; -- } else { /* The neighbor is protected by a subsegment. */ -- /* Remove this triangle from the subsegment. */ -- stdissolve(neighborsubseg); -- /* The subsegment becomes a boundary. Set markers accordingly. */ -- if (mark(neighborsubseg) == 0) { -- setmark(neighborsubseg, 1); -- } -- org(neighbor, norg); -- dest(neighbor, ndest); -- if (vertexmark(norg) == 0) { -- setvertexmark(norg, 1); -- } -- if (vertexmark(ndest) == 0) { -- setvertexmark(ndest, 1); -- } -- } -- } -- } -- /* Remark the triangle as infected, so it doesn't get added to the */ -- /* virus pool again. */ -- infect(testtri); -- virusloop = (triangle **) traverse(&m->viri); -- } -- -- if (b->verbose) { -- printf(" Deleting marked triangles.\n"); -- } -- -- traversalinit(&m->viri); -- virusloop = (triangle **) traverse(&m->viri); -- while (virusloop != (triangle **) NULL) { -- testtri.tri = *virusloop; -- -- /* Check each of the three corners of the triangle for elimination. */ -- /* This is done by walking around each vertex, checking if it is */ -- /* still connected to at least one live triangle. */ -- for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) { -- org(testtri, testvertex); -- /* Check if the vertex has already been tested. */ -- if (testvertex != (vertex) NULL) { -- killorg = 1; -- /* Mark the corner of the triangle as having been tested. */ -- setorg(testtri, NULL); -- /* Walk counterclockwise about the vertex. */ -- onext(testtri, neighbor); -- /* Stop upon reaching a boundary or the starting triangle. */ -- while ((neighbor.tri != m->dummytri) && -- (!otriequal(neighbor, testtri))) { -- if (infected(neighbor)) { -- /* Mark the corner of this triangle as having been tested. */ -- setorg(neighbor, NULL); -- } else { -- /* A live triangle. The vertex survives. */ -- killorg = 0; -- } -- /* Walk counterclockwise about the vertex. */ -- onextself(neighbor); -- } -- /* If we reached a boundary, we must walk clockwise as well. */ -- if (neighbor.tri == m->dummytri) { -- /* Walk clockwise about the vertex. */ -- oprev(testtri, neighbor); -- /* Stop upon reaching a boundary. */ -- while (neighbor.tri != m->dummytri) { -- if (infected(neighbor)) { -- /* Mark the corner of this triangle as having been tested. */ -- setorg(neighbor, NULL); -- } else { -- /* A live triangle. The vertex survives. */ -- killorg = 0; -- } -- /* Walk clockwise about the vertex. */ -- oprevself(neighbor); -- } -- } -- if (killorg) { -- if (b->verbose > 1) { -- printf(" Deleting vertex (%.12g, %.12g)\n", -- testvertex[0], testvertex[1]); -- } -- setvertextype(testvertex, UNDEADVERTEX); -- m->undeads++; -- } -- } -- } -- -- /* Record changes in the number of boundary edges, and disconnect */ -- /* dead triangles from their neighbors. */ -- for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) { -- sym(testtri, neighbor); -- if (neighbor.tri == m->dummytri) { -- /* There is no neighboring triangle on this edge, so this edge */ -- /* is a boundary edge. This triangle is being deleted, so this */ -- /* boundary edge is deleted. */ -- m->hullsize--; -- } else { -- /* Disconnect the triangle from its neighbor. */ -- dissolve(neighbor); -- /* There is a neighboring triangle on this edge, so this edge */ -- /* becomes a boundary edge when this triangle is deleted. */ -- m->hullsize++; -- } -- } -- /* Return the dead triangle to the pool of triangles. */ -- triangledealloc(m, testtri.tri); -- virusloop = (triangle **) traverse(&m->viri); -- } -- /* Empty the virus pool. */ -- poolrestart(&m->viri); --} -- --/*****************************************************************************/ --/* */ --/* regionplague() Spread regional attributes and/or area constraints */ --/* (from a .poly file) throughout the mesh. */ --/* */ --/* This procedure operates in two phases. The first phase spreads an */ --/* attribute and/or an area constraint through a (segment-bounded) region. */ --/* The triangles are marked to ensure that each triangle is added to the */ --/* virus pool only once, so the procedure will terminate. */ --/* */ --/* The second phase uninfects all infected triangles, returning them to */ --/* normal. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void regionplague(struct mesh *m, struct behavior *b, -- REAL attribute, REAL area) --#else /* not ANSI_DECLARATORS */ --void regionplague(m, b, attribute, area) --struct mesh *m; --struct behavior *b; --REAL attribute; --REAL area; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri testtri; -- struct otri neighbor; -- triangle **virusloop; -- triangle **regiontri; -- struct osub neighborsubseg; -- vertex regionorg, regiondest, regionapex; -- triangle ptr; /* Temporary variable used by sym() and onext(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (b->verbose > 1) { -- printf(" Marking neighbors of marked triangles.\n"); -- } -- /* Loop through all the infected triangles, spreading the attribute */ -- /* and/or area constraint to their neighbors, then to their neighbors' */ -- /* neighbors. */ -- traversalinit(&m->viri); -- virusloop = (triangle **) traverse(&m->viri); -- while (virusloop != (triangle **) NULL) { -- testtri.tri = *virusloop; -- /* A triangle is marked as infected by messing with one of its pointers */ -- /* to subsegments, setting it to an illegal value. Hence, we have to */ -- /* temporarily uninfect this triangle so that we can examine its */ -- /* adjacent subsegments. */ -- uninfect(testtri); -- if (b->regionattrib) { -- /* Set an attribute. */ -- setelemattribute(testtri, m->eextras, attribute); -- } -- if (b->vararea) { -- /* Set an area constraint. */ -- setareabound(testtri, area); -- } -- if (b->verbose > 2) { -- /* Assign the triangle an orientation for convenience in */ -- /* checking its vertices. */ -- testtri.orient = 0; -- org(testtri, regionorg); -- dest(testtri, regiondest); -- apex(testtri, regionapex); -- printf(" Checking (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- regionorg[0], regionorg[1], regiondest[0], regiondest[1], -- regionapex[0], regionapex[1]); -- } -- /* Check each of the triangle's three neighbors. */ -- for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) { -- /* Find the neighbor. */ -- sym(testtri, neighbor); -- /* Check for a subsegment between the triangle and its neighbor. */ -- tspivot(testtri, neighborsubseg); -- /* Make sure the neighbor exists, is not already infected, and */ -- /* isn't protected by a subsegment. */ -- if ((neighbor.tri != m->dummytri) && !infected(neighbor) -- && (neighborsubseg.ss == m->dummysub)) { -- if (b->verbose > 2) { -- org(neighbor, regionorg); -- dest(neighbor, regiondest); -- apex(neighbor, regionapex); -- printf(" Marking (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- regionorg[0], regionorg[1], regiondest[0], regiondest[1], -- regionapex[0], regionapex[1]); -- } -- /* Infect the neighbor. */ -- infect(neighbor); -- /* Ensure that the neighbor's neighbors will be infected. */ -- regiontri = (triangle **) poolalloc(&m->viri); -- *regiontri = neighbor.tri; -- } -- } -- /* Remark the triangle as infected, so it doesn't get added to the */ -- /* virus pool again. */ -- infect(testtri); -- virusloop = (triangle **) traverse(&m->viri); -- } -- -- /* Uninfect all triangles. */ -- if (b->verbose > 1) { -- printf(" Unmarking marked triangles.\n"); -- } -- traversalinit(&m->viri); -- virusloop = (triangle **) traverse(&m->viri); -- while (virusloop != (triangle **) NULL) { -- testtri.tri = *virusloop; -- uninfect(testtri); -- virusloop = (triangle **) traverse(&m->viri); -- } -- /* Empty the virus pool. */ -- poolrestart(&m->viri); --} -- --/*****************************************************************************/ --/* */ --/* carveholes() Find the holes and infect them. Find the area */ --/* constraints and infect them. Infect the convex hull. */ --/* Spread the infection and kill triangles. Spread the */ --/* area constraints. */ --/* */ --/* This routine mainly calls other routines to carry out all these */ --/* functions. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void carveholes(struct mesh *m, struct behavior *b, REAL *holelist, int holes, -- REAL *regionlist, int regions) --#else /* not ANSI_DECLARATORS */ --void carveholes(m, b, holelist, holes, regionlist, regions) --struct mesh *m; --struct behavior *b; --REAL *holelist; --int holes; --REAL *regionlist; --int regions; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri searchtri; -- struct otri triangleloop; -- struct otri *regiontris; -- triangle **holetri; -- triangle **regiontri; -- vertex searchorg, searchdest; -- enum locateresult intersect; -- int i; -- triangle ptr; /* Temporary variable used by sym(). */ -- -- if (!(b->quiet || (b->noholes && b->convex))) { -- printf("Removing unwanted triangles.\n"); -- if (b->verbose && (holes > 0)) { -- printf(" Marking holes for elimination.\n"); -- } -- } -- -- if (regions > 0) { -- /* Allocate storage for the triangles in which region points fall. */ -- regiontris = (struct otri *) trimalloc(regions * -- (int) sizeof(struct otri)); -- } else { -- regiontris = (struct otri *) NULL; -- } -- -- if (((holes > 0) && !b->noholes) || !b->convex || (regions > 0)) { -- /* Initialize a pool of viri to be used for holes, concavities, */ -- /* regional attributes, and/or regional area constraints. */ -- poolinit(&m->viri, sizeof(triangle *), VIRUSPERBLOCK, VIRUSPERBLOCK, 0); -- } -- -- if (!b->convex) { -- /* Mark as infected any unprotected triangles on the boundary. */ -- /* This is one way by which concavities are created. */ -- infecthull(m, b); -- } -- -- if ((holes > 0) && !b->noholes) { -- /* Infect each triangle in which a hole lies. */ -- for (i = 0; i < 2 * holes; i += 2) { -- /* Ignore holes that aren't within the bounds of the mesh. */ -- if ((holelist[i] >= m->xmin) && (holelist[i] <= m->xmax) -- && (holelist[i + 1] >= m->ymin) && (holelist[i + 1] <= m->ymax)) { -- /* Start searching from some triangle on the outer boundary. */ -- searchtri.tri = m->dummytri; -- searchtri.orient = 0; -- symself(searchtri); -- /* Ensure that the hole is to the left of this boundary edge; */ -- /* otherwise, locate() will falsely report that the hole */ -- /* falls within the starting triangle. */ -- org(searchtri, searchorg); -- dest(searchtri, searchdest); -- if (counterclockwise(m, b, searchorg, searchdest, &holelist[i]) > -- 0.0) { -- /* Find a triangle that contains the hole. */ -- intersect = locate(m, b, &holelist[i], &searchtri); -- if ((intersect != OUTSIDE) && (!infected(searchtri))) { -- /* Infect the triangle. This is done by marking the triangle */ -- /* as infected and including the triangle in the virus pool. */ -- infect(searchtri); -- holetri = (triangle **) poolalloc(&m->viri); -- *holetri = searchtri.tri; -- } -- } -- } -- } -- } -- -- /* Now, we have to find all the regions BEFORE we carve the holes, because */ -- /* locate() won't work when the triangulation is no longer convex. */ -- /* (Incidentally, this is the reason why regional attributes and area */ -- /* constraints can't be used when refining a preexisting mesh, which */ -- /* might not be convex; they can only be used with a freshly */ -- /* triangulated PSLG.) */ -- if (regions > 0) { -- /* Find the starting triangle for each region. */ -- for (i = 0; i < regions; i++) { -- regiontris[i].tri = m->dummytri; -- /* Ignore region points that aren't within the bounds of the mesh. */ -- if ((regionlist[4 * i] >= m->xmin) && (regionlist[4 * i] <= m->xmax) && -- (regionlist[4 * i + 1] >= m->ymin) && -- (regionlist[4 * i + 1] <= m->ymax)) { -- /* Start searching from some triangle on the outer boundary. */ -- searchtri.tri = m->dummytri; -- searchtri.orient = 0; -- symself(searchtri); -- /* Ensure that the region point is to the left of this boundary */ -- /* edge; otherwise, locate() will falsely report that the */ -- /* region point falls within the starting triangle. */ -- org(searchtri, searchorg); -- dest(searchtri, searchdest); -- if (counterclockwise(m, b, searchorg, searchdest, ®ionlist[4 * i]) > -- 0.0) { -- /* Find a triangle that contains the region point. */ -- intersect = locate(m, b, ®ionlist[4 * i], &searchtri); -- if ((intersect != OUTSIDE) && (!infected(searchtri))) { -- /* Record the triangle for processing after the */ -- /* holes have been carved. */ -- otricopy(searchtri, regiontris[i]); -- } -- } -- } -- } -- } -- -- if (m->viri.items > 0) { -- /* Carve the holes and concavities. */ -- plague(m, b); -- } -- /* The virus pool should be empty now. */ -- -- if (regions > 0) { -- if (!b->quiet) { -- if (b->regionattrib) { -- if (b->vararea) { -- printf("Spreading regional attributes and area constraints.\n"); -- } else { -- printf("Spreading regional attributes.\n"); -- } -- } else { -- printf("Spreading regional area constraints.\n"); -- } -- } -- if (b->regionattrib && !b->refine) { -- /* Assign every triangle a regional attribute of zero. */ -- traversalinit(&m->triangles); -- triangleloop.orient = 0; -- triangleloop.tri = triangletraverse(m); -- while (triangleloop.tri != (triangle *) NULL) { -- setelemattribute(triangleloop, m->eextras, 0.0); -- triangleloop.tri = triangletraverse(m); -- } -- } -- for (i = 0; i < regions; i++) { -- if (regiontris[i].tri != m->dummytri) { -- /* Make sure the triangle under consideration still exists. */ -- /* It may have been eaten by the virus. */ -- if (!deadtri(regiontris[i].tri)) { -- /* Put one triangle in the virus pool. */ -- infect(regiontris[i]); -- regiontri = (triangle **) poolalloc(&m->viri); -- *regiontri = regiontris[i].tri; -- /* Apply one region's attribute and/or area constraint. */ -- regionplague(m, b, regionlist[4 * i + 2], regionlist[4 * i + 3]); -- /* The virus pool should be empty now. */ -- } -- } -- } -- if (b->regionattrib && !b->refine) { -- /* Note the fact that each triangle has an additional attribute. */ -- m->eextras++; -- } -- } -- -- /* Free up memory. */ -- if (((holes > 0) && !b->noholes) || !b->convex || (regions > 0)) { -- pooldeinit(&m->viri); -- } -- if (regions > 0) { -- trifree((void *) regiontris); -- } --} -- --/** **/ --/** **/ --/********* Carving out holes and concavities ends here *********/ -- --/********* Mesh quality maintenance begins here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* tallyencs() Traverse the entire list of subsegments, and check each */ --/* to see if it is encroached. If so, add it to the list. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void tallyencs(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void tallyencs(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct osub subsegloop; -- -- traversalinit(&m->subsegs); -- subsegloop.ssorient = 0; -- subsegloop.ss = subsegtraverse(m); -- while (subsegloop.ss != (subseg *) NULL) { -- /* If the segment is encroached, add it to the list. */ -- checkseg4encroach(m, b, &subsegloop); -- subsegloop.ss = subsegtraverse(m); -- } --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* precisionerror() Print an error message for precision problems. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --void precisionerror() --{ -- printf("Try increasing the area criterion and/or reducing the minimum\n"); -- printf(" allowable angle so that tiny triangles are not created.\n"); --#ifdef SINGLE -- printf("Alternatively, try recompiling me with double precision\n"); -- printf(" arithmetic (by removing \"#define SINGLE\" from the\n"); -- printf(" source file or \"-DSINGLE\" from the makefile).\n"); --#endif /* SINGLE */ --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* splitencsegs() Split all the encroached subsegments. */ --/* */ --/* Each encroached subsegment is repaired by splitting it - inserting a */ --/* vertex at or near its midpoint. Newly inserted vertices may encroach */ --/* upon other subsegments; these are also repaired. */ --/* */ --/* `triflaws' is a flag that specifies whether one should take note of new */ --/* bad triangles that result from inserting vertices to repair encroached */ --/* subsegments. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void splitencsegs(struct mesh *m, struct behavior *b, int triflaws) --#else /* not ANSI_DECLARATORS */ --void splitencsegs(m, b, triflaws) --struct mesh *m; --struct behavior *b; --int triflaws; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri enctri; -- struct otri testtri; -- struct osub testsh; -- struct osub currentenc; -- struct badsubseg *encloop; -- vertex eorg, edest, eapex; -- vertex newvertex; -- enum insertvertexresult success; -- REAL segmentlength, nearestpoweroftwo; -- REAL split; -- REAL multiplier, divisor; -- int acuteorg, acuteorg2, acutedest, acutedest2; -- int i; -- triangle ptr; /* Temporary variable used by stpivot(). */ -- subseg sptr; /* Temporary variable used by snext(). */ -- -- /* Note that steinerleft == -1 if an unlimited number */ -- /* of Steiner points is allowed. */ -- while ((m->badsubsegs.items > 0) && (m->steinerleft != 0)) { -- traversalinit(&m->badsubsegs); -- encloop = badsubsegtraverse(m); -- while ((encloop != (struct badsubseg *) NULL) && (m->steinerleft != 0)) { -- sdecode(encloop->encsubseg, currentenc); -- sorg(currentenc, eorg); -- sdest(currentenc, edest); -- /* Make sure that this segment is still the same segment it was */ -- /* when it was determined to be encroached. If the segment was */ -- /* enqueued multiple times (because several newly inserted */ -- /* vertices encroached it), it may have already been split. */ -- if (!deadsubseg(currentenc.ss) && -- (eorg == encloop->subsegorg) && (edest == encloop->subsegdest)) { -- /* To decide where to split a segment, we need to know if the */ -- /* segment shares an endpoint with an adjacent segment. */ -- /* The concern is that, if we simply split every encroached */ -- /* segment in its center, two adjacent segments with a small */ -- /* angle between them might lead to an infinite loop; each */ -- /* vertex added to split one segment will encroach upon the */ -- /* other segment, which must then be split with a vertex that */ -- /* will encroach upon the first segment, and so on forever. */ -- /* To avoid this, imagine a set of concentric circles, whose */ -- /* radii are powers of two, about each segment endpoint. */ -- /* These concentric circles determine where the segment is */ -- /* split. (If both endpoints are shared with adjacent */ -- /* segments, split the segment in the middle, and apply the */ -- /* concentric circles for later splittings.) */ -- -- /* Is the origin shared with another segment? */ -- stpivot(currentenc, enctri); -- lnext(enctri, testtri); -- tspivot(testtri, testsh); -- acuteorg = testsh.ss != m->dummysub; -- /* Is the destination shared with another segment? */ -- lnextself(testtri); -- tspivot(testtri, testsh); -- acutedest = testsh.ss != m->dummysub; -- -- /* If we're using Chew's algorithm (rather than Ruppert's) */ -- /* to define encroachment, delete free vertices from the */ -- /* subsegment's diametral circle. */ -- if (!b->conformdel && !acuteorg && !acutedest) { -- apex(enctri, eapex); -- while ((vertextype(eapex) == FREEVERTEX) && -- ((eorg[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (edest[1] - eapex[1]) < 0.0)) { -- deletevertex(m, b, &testtri); -- stpivot(currentenc, enctri); -- apex(enctri, eapex); -- lprev(enctri, testtri); -- } -- } -- -- /* Now, check the other side of the segment, if there's a triangle */ -- /* there. */ -- sym(enctri, testtri); -- if (testtri.tri != m->dummytri) { -- /* Is the destination shared with another segment? */ -- lnextself(testtri); -- tspivot(testtri, testsh); -- acutedest2 = testsh.ss != m->dummysub; -- acutedest = acutedest || acutedest2; -- /* Is the origin shared with another segment? */ -- lnextself(testtri); -- tspivot(testtri, testsh); -- acuteorg2 = testsh.ss != m->dummysub; -- acuteorg = acuteorg || acuteorg2; -- -- /* Delete free vertices from the subsegment's diametral circle. */ -- if (!b->conformdel && !acuteorg2 && !acutedest2) { -- org(testtri, eapex); -- while ((vertextype(eapex) == FREEVERTEX) && -- ((eorg[0] - eapex[0]) * (edest[0] - eapex[0]) + -- (eorg[1] - eapex[1]) * (edest[1] - eapex[1]) < 0.0)) { -- deletevertex(m, b, &testtri); -- sym(enctri, testtri); -- apex(testtri, eapex); -- lprevself(testtri); -- } -- } -- } -- -- /* Use the concentric circles if exactly one endpoint is shared */ -- /* with another adjacent segment. */ -- if (acuteorg || acutedest) { -- segmentlength = sqrt((edest[0] - eorg[0]) * (edest[0] - eorg[0]) + -- (edest[1] - eorg[1]) * (edest[1] - eorg[1])); -- /* Find the power of two that most evenly splits the segment. */ -- /* The worst case is a 2:1 ratio between subsegment lengths. */ -- nearestpoweroftwo = 1.0; -- while (segmentlength > 3.0 * nearestpoweroftwo) { -- nearestpoweroftwo *= 2.0; -- } -- while (segmentlength < 1.5 * nearestpoweroftwo) { -- nearestpoweroftwo *= 0.5; -- } -- /* Where do we split the segment? */ -- split = nearestpoweroftwo / segmentlength; -- if (acutedest) { -- split = 1.0 - split; -- } -- } else { -- /* If we're not worried about adjacent segments, split */ -- /* this segment in the middle. */ -- split = 0.5; -- } -- -- /* Create the new vertex. */ -- newvertex = (vertex) poolalloc(&m->vertices); -- /* Interpolate its coordinate and attributes. */ -- for (i = 0; i < 2 + m->nextras; i++) { -- newvertex[i] = eorg[i] + split * (edest[i] - eorg[i]); -- } -- -- if (!b->noexact) { -- /* Roundoff in the above calculation may yield a `newvertex' */ -- /* that is not precisely collinear with `eorg' and `edest'. */ -- /* Improve collinearity by one step of iterative refinement. */ -- multiplier = counterclockwise(m, b, eorg, edest, newvertex); -- divisor = ((eorg[0] - edest[0]) * (eorg[0] - edest[0]) + -- (eorg[1] - edest[1]) * (eorg[1] - edest[1])); -- if ((multiplier != 0.0) && (divisor != 0.0)) { -- multiplier = multiplier / divisor; -- /* Watch out for NANs. */ -- if (multiplier == multiplier) { -- newvertex[0] += multiplier * (edest[1] - eorg[1]); -- newvertex[1] += multiplier * (eorg[0] - edest[0]); -- } -- } -- } -- -- setvertexmark(newvertex, mark(currentenc)); -- setvertextype(newvertex, SEGMENTVERTEX); -- if (b->verbose > 1) { -- printf( -- " Splitting subsegment (%.12g, %.12g) (%.12g, %.12g) at (%.12g, %.12g).\n", -- eorg[0], eorg[1], edest[0], edest[1], -- newvertex[0], newvertex[1]); -- } -- /* Check whether the new vertex lies on an endpoint. */ -- if (((newvertex[0] == eorg[0]) && (newvertex[1] == eorg[1])) || -- ((newvertex[0] == edest[0]) && (newvertex[1] == edest[1]))) { -- printf("Error: Ran out of precision at (%.12g, %.12g).\n", -- newvertex[0], newvertex[1]); -- printf("I attempted to split a segment to a smaller size than\n"); -- printf(" can be accommodated by the finite precision of\n"); -- printf(" floating point arithmetic.\n"); -- precisionerror(); -- triexit(1); -- } -- /* Insert the splitting vertex. This should always succeed. */ -- success = insertvertex(m, b, newvertex, &enctri, ¤tenc, -- 1, triflaws); -- if ((success != SUCCESSFULVERTEX) && (success != ENCROACHINGVERTEX)) { -- printf("Internal error in splitencsegs():\n"); -- printf(" Failure to split a segment.\n"); -- internalerror(); -- } -- if (m->steinerleft > 0) { -- m->steinerleft--; -- } -- /* Check the two new subsegments to see if they're encroached. */ -- checkseg4encroach(m, b, ¤tenc); -- snextself(currentenc); -- checkseg4encroach(m, b, ¤tenc); -- } -- -- badsubsegdealloc(m, encloop); -- encloop = badsubsegtraverse(m); -- } -- } --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* tallyfaces() Test every triangle in the mesh for quality measures. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void tallyfaces(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void tallyfaces(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop; -- -- if (b->verbose) { -- printf(" Making a list of bad triangles.\n"); -- } -- traversalinit(&m->triangles); -- triangleloop.orient = 0; -- triangleloop.tri = triangletraverse(m); -- while (triangleloop.tri != (triangle *) NULL) { -- /* If the triangle is bad, enqueue it. */ -- testtriangle(m, b, &triangleloop); -- triangleloop.tri = triangletraverse(m); -- } --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* splittriangle() Inserts a vertex at the circumcenter of a triangle. */ --/* Deletes the newly inserted vertex if it encroaches */ --/* upon a segment. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void splittriangle(struct mesh *m, struct behavior *b, -- struct badtriang *badtri) --#else /* not ANSI_DECLARATORS */ --void splittriangle(m, b, badtri) --struct mesh *m; --struct behavior *b; --struct badtriang *badtri; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri badotri; -- vertex borg, bdest, bapex; -- vertex newvertex; -- REAL xi, eta; -- enum insertvertexresult success; -- int errorflag; -- int i; -- -- decode(badtri->poortri, badotri); -- org(badotri, borg); -- dest(badotri, bdest); -- apex(badotri, bapex); -- /* Make sure that this triangle is still the same triangle it was */ -- /* when it was tested and determined to be of bad quality. */ -- /* Subsequent transformations may have made it a different triangle. */ -- if (!deadtri(badotri.tri) && (borg == badtri->triangorg) && -- (bdest == badtri->triangdest) && (bapex == badtri->triangapex)) { -- if (b->verbose > 1) { -- printf(" Splitting this triangle at its circumcenter:\n"); -- printf(" (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", borg[0], -- borg[1], bdest[0], bdest[1], bapex[0], bapex[1]); -- } -- -- errorflag = 0; -- /* Create a new vertex at the triangle's circumcenter. */ -- newvertex = (vertex) poolalloc(&m->vertices); -- findcircumcenter(m, b, borg, bdest, bapex, newvertex, &xi, &eta, 1); -- -- /* Check whether the new vertex lies on a triangle vertex. */ -- if (((newvertex[0] == borg[0]) && (newvertex[1] == borg[1])) || -- ((newvertex[0] == bdest[0]) && (newvertex[1] == bdest[1])) || -- ((newvertex[0] == bapex[0]) && (newvertex[1] == bapex[1]))) { -- if (!b->quiet) { -- printf( -- "Warning: New vertex (%.12g, %.12g) falls on existing vertex.\n", -- newvertex[0], newvertex[1]); -- errorflag = 1; -- } -- vertexdealloc(m, newvertex); -- } else { -- for (i = 2; i < 2 + m->nextras; i++) { -- /* Interpolate the vertex attributes at the circumcenter. */ -- newvertex[i] = borg[i] + xi * (bdest[i] - borg[i]) -- + eta * (bapex[i] - borg[i]); -- } -- /* The new vertex must be in the interior, and therefore is a */ -- /* free vertex with a marker of zero. */ -- setvertexmark(newvertex, 0); -- setvertextype(newvertex, FREEVERTEX); -- -- /* Ensure that the handle `badotri' does not represent the longest */ -- /* edge of the triangle. This ensures that the circumcenter must */ -- /* fall to the left of this edge, so point location will work. */ -- /* (If the angle org-apex-dest exceeds 90 degrees, then the */ -- /* circumcenter lies outside the org-dest edge, and eta is */ -- /* negative. Roundoff error might prevent eta from being */ -- /* negative when it should be, so I test eta against xi.) */ -- if (eta < xi) { -- lprevself(badotri); -- } -- -- /* Insert the circumcenter, searching from the edge of the triangle, */ -- /* and maintain the Delaunay property of the triangulation. */ -- success = insertvertex(m, b, newvertex, &badotri, (struct osub *) NULL, -- 1, 1); -- if (success == SUCCESSFULVERTEX) { -- if (m->steinerleft > 0) { -- m->steinerleft--; -- } -- } else if (success == ENCROACHINGVERTEX) { -- /* If the newly inserted vertex encroaches upon a subsegment, */ -- /* delete the new vertex. */ -- undovertex(m, b); -- if (b->verbose > 1) { -- printf(" Rejecting (%.12g, %.12g).\n", newvertex[0], newvertex[1]); -- } -- vertexdealloc(m, newvertex); -- } else if (success == VIOLATINGVERTEX) { -- /* Failed to insert the new vertex, but some subsegment was */ -- /* marked as being encroached. */ -- vertexdealloc(m, newvertex); -- } else { /* success == DUPLICATEVERTEX */ -- /* Couldn't insert the new vertex because a vertex is already there. */ -- if (!b->quiet) { -- printf( -- "Warning: New vertex (%.12g, %.12g) falls on existing vertex.\n", -- newvertex[0], newvertex[1]); -- errorflag = 1; -- } -- vertexdealloc(m, newvertex); -- } -- } -- if (errorflag) { -- if (b->verbose) { -- printf(" The new vertex is at the circumcenter of triangle\n"); -- printf(" (%.12g, %.12g) (%.12g, %.12g) (%.12g, %.12g)\n", -- borg[0], borg[1], bdest[0], bdest[1], bapex[0], bapex[1]); -- } -- printf("This probably means that I am trying to refine triangles\n"); -- printf(" to a smaller size than can be accommodated by the finite\n"); -- printf(" precision of floating point arithmetic. (You can be\n"); -- printf(" sure of this if I fail to terminate.)\n"); -- precisionerror(); -- } -- } --} -- --#endif /* not CDT_ONLY */ -- --/*****************************************************************************/ --/* */ --/* enforcequality() Remove all the encroached subsegments and bad */ --/* triangles from the triangulation. */ --/* */ --/*****************************************************************************/ -- --#ifndef CDT_ONLY -- --#ifdef ANSI_DECLARATORS --void enforcequality(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void enforcequality(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct badtriang *badtri; -- int i; -- -- if (!b->quiet) { -- printf("Adding Steiner points to enforce quality.\n"); -- } -- /* Initialize the pool of encroached subsegments. */ -- poolinit(&m->badsubsegs, sizeof(struct badsubseg), BADSUBSEGPERBLOCK, -- BADSUBSEGPERBLOCK, 0); -- if (b->verbose) { -- printf(" Looking for encroached subsegments.\n"); -- } -- /* Test all segments to see if they're encroached. */ -- tallyencs(m, b); -- if (b->verbose && (m->badsubsegs.items > 0)) { -- printf(" Splitting encroached subsegments.\n"); -- } -- /* Fix encroached subsegments without noting bad triangles. */ -- splitencsegs(m, b, 0); -- /* At this point, if we haven't run out of Steiner points, the */ -- /* triangulation should be (conforming) Delaunay. */ -- -- /* Next, we worry about enforcing triangle quality. */ -- if ((b->minangle > 0.0) || b->vararea || b->fixedarea || b->usertest) { -- /* Initialize the pool of bad triangles. */ -- poolinit(&m->badtriangles, sizeof(struct badtriang), BADTRIPERBLOCK, -- BADTRIPERBLOCK, 0); -- /* Initialize the queues of bad triangles. */ -- for (i = 0; i < 4096; i++) { -- m->queuefront[i] = (struct badtriang *) NULL; -- } -- m->firstnonemptyq = -1; -- /* Test all triangles to see if they're bad. */ -- tallyfaces(m, b); -- /* Initialize the pool of recently flipped triangles. */ -- poolinit(&m->flipstackers, sizeof(struct flipstacker), FLIPSTACKERPERBLOCK, -- FLIPSTACKERPERBLOCK, 0); -- m->checkquality = 1; -- if (b->verbose) { -- printf(" Splitting bad triangles.\n"); -- } -- while ((m->badtriangles.items > 0) && (m->steinerleft != 0)) { -- /* Fix one bad triangle by inserting a vertex at its circumcenter. */ -- badtri = dequeuebadtriang(m); -- splittriangle(m, b, badtri); -- if (m->badsubsegs.items > 0) { -- /* Put bad triangle back in queue for another try later. */ -- enqueuebadtriang(m, b, badtri); -- /* Fix any encroached subsegments that resulted. */ -- /* Record any new bad triangles that result. */ -- splitencsegs(m, b, 1); -- } else { -- /* Return the bad triangle to the pool. */ -- pooldealloc(&m->badtriangles, (void *) badtri); -- } -- } -- } -- /* At this point, if the "-D" switch was selected and we haven't run out */ -- /* of Steiner points, the triangulation should be (conforming) Delaunay */ -- /* and have no low-quality triangles. */ -- -- /* Might we have run out of Steiner points too soon? */ -- if (!b->quiet && b->conformdel && (m->badsubsegs.items > 0) && -- (m->steinerleft == 0)) { -- printf("\nWarning: I ran out of Steiner points, but the mesh has\n"); -- if (m->badsubsegs.items == 1) { -- printf(" one encroached subsegment, and therefore might not be truly\n" -- ); -- } else { -- printf(" %ld encroached subsegments, and therefore might not be truly\n" -- , m->badsubsegs.items); -- } -- printf(" Delaunay. If the Delaunay property is important to you,\n"); -- printf(" try increasing the number of Steiner points (controlled by\n"); -- printf(" the -S switch) slightly and try again.\n\n"); -- } --} -- --#endif /* not CDT_ONLY */ -- --/** **/ --/** **/ --/********* Mesh quality maintenance ends here *********/ -- --/*****************************************************************************/ --/* */ --/* highorder() Create extra nodes for quadratic subparametric elements. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void highorder(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void highorder(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop, trisym; -- struct osub checkmark; -- vertex newvertex; -- vertex torg, tdest; -- int i; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- -- if (!b->quiet) { -- printf("Adding vertices for second-order triangles.\n"); -- } -- /* The following line ensures that dead items in the pool of nodes */ -- /* cannot be allocated for the extra nodes associated with high */ -- /* order elements. This ensures that the primary nodes (at the */ -- /* corners of elements) will occur earlier in the output files, and */ -- /* have lower indices, than the extra nodes. */ -- m->vertices.deaditemstack = (void *) NULL; -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- /* To loop over the set of edges, loop over all triangles, and look at */ -- /* the three edges of each triangle. If there isn't another triangle */ -- /* adjacent to the edge, operate on the edge. If there is another */ -- /* adjacent triangle, operate on the edge only if the current triangle */ -- /* has a smaller pointer than its neighbor. This way, each edge is */ -- /* considered only once. */ -- while (triangleloop.tri != (triangle *) NULL) { -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- sym(triangleloop, trisym); -- if ((triangleloop.tri < trisym.tri) || (trisym.tri == m->dummytri)) { -- org(triangleloop, torg); -- dest(triangleloop, tdest); -- /* Create a new node in the middle of the edge. Interpolate */ -- /* its attributes. */ -- newvertex = (vertex) poolalloc(&m->vertices); -- for (i = 0; i < 2 + m->nextras; i++) { -- newvertex[i] = 0.5 * (torg[i] + tdest[i]); -- } -- /* Set the new node's marker to zero or one, depending on */ -- /* whether it lies on a boundary. */ -- setvertexmark(newvertex, trisym.tri == m->dummytri); -- setvertextype(newvertex, -- trisym.tri == m->dummytri ? FREEVERTEX : SEGMENTVERTEX); -- if (b->usesegments) { -- tspivot(triangleloop, checkmark); -- /* If this edge is a segment, transfer the marker to the new node. */ -- if (checkmark.ss != m->dummysub) { -- setvertexmark(newvertex, mark(checkmark)); -- setvertextype(newvertex, SEGMENTVERTEX); -- } -- } -- if (b->verbose > 1) { -- printf(" Creating (%.12g, %.12g).\n", newvertex[0], newvertex[1]); -- } -- /* Record the new node in the (one or two) adjacent elements. */ -- triangleloop.tri[m->highorderindex + triangleloop.orient] = -- (triangle) newvertex; -- if (trisym.tri != m->dummytri) { -- trisym.tri[m->highorderindex + trisym.orient] = (triangle) newvertex; -- } -- } -- } -- triangleloop.tri = triangletraverse(m); -- } --} -- --/********* File I/O routines begin here *********/ --/** **/ --/** **/ -- --/*****************************************************************************/ --/* */ --/* readline() Read a nonempty line from a file. */ --/* */ --/* A line is considered "nonempty" if it contains something that looks like */ --/* a number. Comments (prefaced by `#') are ignored. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --char *readline(char *string, FILE *infile, char *infilename) --#else /* not ANSI_DECLARATORS */ --char *readline(string, infile, infilename) --char *string; --FILE *infile; --char *infilename; --#endif /* not ANSI_DECLARATORS */ -- --{ -- char *result; -- -- /* Search for something that looks like a number. */ -- do { -- result = fgets(string, INPUTLINESIZE, infile); -- if (result == (char *) NULL) { -- printf(" Error: Unexpected end of file in %s.\n", infilename); -- triexit(1); -- } -- /* Skip anything that doesn't look like a number, a comment, */ -- /* or the end of a line. */ -- while ((*result != '\0') && (*result != '#') -- && (*result != '.') && (*result != '+') && (*result != '-') -- && ((*result < '0') || (*result > '9'))) { -- result++; -- } -- /* If it's a comment or end of line, read another line and try again. */ -- } while ((*result == '#') || (*result == '\0')); -- return result; --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* findfield() Find the next field of a string. */ --/* */ --/* Jumps past the current field by searching for whitespace, then jumps */ --/* past the whitespace to find the next field. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --char *findfield(char *string) --#else /* not ANSI_DECLARATORS */ --char *findfield(string) --char *string; --#endif /* not ANSI_DECLARATORS */ -- --{ -- char *result; -- -- result = string; -- /* Skip the current field. Stop upon reaching whitespace. */ -- while ((*result != '\0') && (*result != '#') -- && (*result != ' ') && (*result != '\t')) { -- result++; -- } -- /* Now skip the whitespace and anything else that doesn't look like a */ -- /* number, a comment, or the end of a line. */ -- while ((*result != '\0') && (*result != '#') -- && (*result != '.') && (*result != '+') && (*result != '-') -- && ((*result < '0') || (*result > '9'))) { -- result++; -- } -- /* Check for a comment (prefixed with `#'). */ -- if (*result == '#') { -- *result = '\0'; -- } -- return result; --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* readnodes() Read the vertices from a file, which may be a .node or */ --/* .poly file. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void readnodes(struct mesh *m, struct behavior *b, char *nodefilename, -- char *polyfilename, FILE **polyfile) --#else /* not ANSI_DECLARATORS */ --void readnodes(m, b, nodefilename, polyfilename, polyfile) --struct mesh *m; --struct behavior *b; --char *nodefilename; --char *polyfilename; --FILE **polyfile; --#endif /* not ANSI_DECLARATORS */ -- --{ -- FILE *infile; -- vertex vertexloop; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- char *infilename; -- REAL x, y; -- int firstnode; -- int nodemarkers; -- int currentmarker; -- int i, j; -- -- if (b->poly) { -- /* Read the vertices from a .poly file. */ -- if (!b->quiet) { -- printf("Opening %s.\n", polyfilename); -- } -- *polyfile = fopen(polyfilename, "r"); -- if (*polyfile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", polyfilename); -- triexit(1); -- } -- /* Read number of vertices, number of dimensions, number of vertex */ -- /* attributes, and number of boundary markers. */ -- stringptr = readline(inputline, *polyfile, polyfilename); -- m->invertices = (int) strtol(stringptr, &stringptr, 0); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- m->mesh_dim = 2; -- } else { -- m->mesh_dim = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- m->nextras = 0; -- } else { -- m->nextras = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- nodemarkers = 0; -- } else { -- nodemarkers = (int) strtol(stringptr, &stringptr, 0); -- } -- if (m->invertices > 0) { -- infile = *polyfile; -- infilename = polyfilename; -- m->readnodefile = 0; -- } else { -- /* If the .poly file claims there are zero vertices, that means that */ -- /* the vertices should be read from a separate .node file. */ -- m->readnodefile = 1; -- infilename = nodefilename; -- } -- } else { -- m->readnodefile = 1; -- infilename = nodefilename; -- *polyfile = (FILE *) NULL; -- } -- -- if (m->readnodefile) { -- /* Read the vertices from a .node file. */ -- if (!b->quiet) { -- printf("Opening %s.\n", nodefilename); -- } -- infile = fopen(nodefilename, "r"); -- if (infile == (FILE *) NULL) { -- printf(" Error: Cannot access file %s.\n", nodefilename); -- triexit(1); -- } -- /* Read number of vertices, number of dimensions, number of vertex */ -- /* attributes, and number of boundary markers. */ -- stringptr = readline(inputline, infile, nodefilename); -- m->invertices = (int) strtol(stringptr, &stringptr, 0); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- m->mesh_dim = 2; -- } else { -- m->mesh_dim = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- m->nextras = 0; -- } else { -- m->nextras = (int) strtol(stringptr, &stringptr, 0); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- nodemarkers = 0; -- } else { -- nodemarkers = (int) strtol(stringptr, &stringptr, 0); -- } -- } -- -- if (m->invertices < 3) { -- printf("Error: Input must have at least three input vertices.\n"); -- triexit(1); -- } -- if (m->mesh_dim != 2) { -- printf("Error: Triangle only works with two-dimensional meshes.\n"); -- triexit(1); -- } -- if (m->nextras == 0) { -- b->weighted = 0; -- } -- -- initializevertexpool(m, b); -- -- /* Read the vertices. */ -- for (i = 0; i < m->invertices; i++) { -- vertexloop = (vertex) poolalloc(&m->vertices); -- stringptr = readline(inputline, infile, infilename); -- if (i == 0) { -- firstnode = (int) strtol(stringptr, &stringptr, 0); -- if ((firstnode == 0) || (firstnode == 1)) { -- b->firstnumber = firstnode; -- } -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Vertex %d has no x coordinate.\n", b->firstnumber + i); -- triexit(1); -- } -- x = (REAL) strtod(stringptr, &stringptr); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Vertex %d has no y coordinate.\n", b->firstnumber + i); -- triexit(1); -- } -- y = (REAL) strtod(stringptr, &stringptr); -- vertexloop[0] = x; -- vertexloop[1] = y; -- /* Read the vertex attributes. */ -- for (j = 2; j < 2 + m->nextras; j++) { -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- vertexloop[j] = 0.0; -- } else { -- vertexloop[j] = (REAL) strtod(stringptr, &stringptr); -- } -- } -- if (nodemarkers) { -- /* Read a vertex marker. */ -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- setvertexmark(vertexloop, 0); -- } else { -- currentmarker = (int) strtol(stringptr, &stringptr, 0); -- setvertexmark(vertexloop, currentmarker); -- } -- } else { -- /* If no markers are specified in the file, they default to zero. */ -- setvertexmark(vertexloop, 0); -- } -- setvertextype(vertexloop, INPUTVERTEX); -- /* Determine the smallest and largest x and y coordinates. */ -- if (i == 0) { -- m->xmin = m->xmax = x; -- m->ymin = m->ymax = y; -- } else { -- m->xmin = (x < m->xmin) ? x : m->xmin; -- m->xmax = (x > m->xmax) ? x : m->xmax; -- m->ymin = (y < m->ymin) ? y : m->ymin; -- m->ymax = (y > m->ymax) ? y : m->ymax; -- } -- } -- if (m->readnodefile) { -- fclose(infile); -- } -- -- /* Nonexistent x value used as a flag to mark circle events in sweepline */ -- /* Delaunay algorithm. */ -- m->xminextreme = 10 * m->xmin - 9 * m->xmax; --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* transfernodes() Read the vertices from memory. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void transfernodes(struct mesh *m, struct behavior *b, REAL *pointlist, -- REAL *pointattriblist, int *pointmarkerlist, -- int numberofpoints, int numberofpointattribs) --#else /* not ANSI_DECLARATORS */ --void transfernodes(m, b, pointlist, pointattriblist, pointmarkerlist, -- numberofpoints, numberofpointattribs) --struct mesh *m; --struct behavior *b; --REAL *pointlist; --REAL *pointattriblist; --int *pointmarkerlist; --int numberofpoints; --int numberofpointattribs; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex vertexloop; -- REAL x, y; -- int i, j; -- int coordindex; -- int attribindex; -- -- m->invertices = numberofpoints; -- m->mesh_dim = 2; -- m->nextras = numberofpointattribs; -- m->readnodefile = 0; -- if (m->invertices < 3) { -- printf("Error: Input must have at least three input vertices.\n"); -- triexit(1); -- } -- if (m->nextras == 0) { -- b->weighted = 0; -- } -- -- initializevertexpool(m, b); -- -- /* Read the vertices. */ -- coordindex = 0; -- attribindex = 0; -- for (i = 0; i < m->invertices; i++) { -- vertexloop = (vertex) poolalloc(&m->vertices); -- /* Read the vertex coordinates. */ -- x = vertexloop[0] = pointlist[coordindex++]; -- y = vertexloop[1] = pointlist[coordindex++]; -- /* Read the vertex attributes. */ -- for (j = 0; j < numberofpointattribs; j++) { -- vertexloop[2 + j] = pointattriblist[attribindex++]; -- } -- if (pointmarkerlist != (int *) NULL) { -- /* Read a vertex marker. */ -- setvertexmark(vertexloop, pointmarkerlist[i]); -- } else { -- /* If no markers are specified, they default to zero. */ -- setvertexmark(vertexloop, 0); -- } -- setvertextype(vertexloop, INPUTVERTEX); -- /* Determine the smallest and largest x and y coordinates. */ -- if (i == 0) { -- m->xmin = m->xmax = x; -- m->ymin = m->ymax = y; -- } else { -- m->xmin = (x < m->xmin) ? x : m->xmin; -- m->xmax = (x > m->xmax) ? x : m->xmax; -- m->ymin = (y < m->ymin) ? y : m->ymin; -- m->ymax = (y > m->ymax) ? y : m->ymax; -- } -- } -- -- /* Nonexistent x value used as a flag to mark circle events in sweepline */ -- /* Delaunay algorithm. */ -- m->xminextreme = 10 * m->xmin - 9 * m->xmax; --} -- --#endif /* TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* readholes() Read the holes, and possibly regional attributes and area */ --/* constraints, from a .poly file. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void readholes(struct mesh *m, struct behavior *b, -- FILE *polyfile, char *polyfilename, REAL **hlist, int *holes, -- REAL **rlist, int *regions) --#else /* not ANSI_DECLARATORS */ --void readholes(m, b, polyfile, polyfilename, hlist, holes, rlist, regions) --struct mesh *m; --struct behavior *b; --FILE *polyfile; --char *polyfilename; --REAL **hlist; --int *holes; --REAL **rlist; --int *regions; --#endif /* not ANSI_DECLARATORS */ -- --{ -- REAL *holelist; -- REAL *regionlist; -- char inputline[INPUTLINESIZE]; -- char *stringptr; -- int index; -- int i; -- -- /* Read the holes. */ -- stringptr = readline(inputline, polyfile, polyfilename); -- *holes = (int) strtol(stringptr, &stringptr, 0); -- if (*holes > 0) { -- holelist = (REAL *) trimalloc(2 * *holes * (int) sizeof(REAL)); -- *hlist = holelist; -- for (i = 0; i < 2 * *holes; i += 2) { -- stringptr = readline(inputline, polyfile, polyfilename); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Hole %d has no x coordinate.\n", -- b->firstnumber + (i >> 1)); -- triexit(1); -- } else { -- holelist[i] = (REAL) strtod(stringptr, &stringptr); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Hole %d has no y coordinate.\n", -- b->firstnumber + (i >> 1)); -- triexit(1); -- } else { -- holelist[i + 1] = (REAL) strtod(stringptr, &stringptr); -- } -- } -- } else { -- *hlist = (REAL *) NULL; -- } -- --#ifndef CDT_ONLY -- if ((b->regionattrib || b->vararea) && !b->refine) { -- /* Read the area constraints. */ -- stringptr = readline(inputline, polyfile, polyfilename); -- *regions = (int) strtol(stringptr, &stringptr, 0); -- if (*regions > 0) { -- regionlist = (REAL *) trimalloc(4 * *regions * (int) sizeof(REAL)); -- *rlist = regionlist; -- index = 0; -- for (i = 0; i < *regions; i++) { -- stringptr = readline(inputline, polyfile, polyfilename); -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Region %d has no x coordinate.\n", -- b->firstnumber + i); -- triexit(1); -- } else { -- regionlist[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf("Error: Region %d has no y coordinate.\n", -- b->firstnumber + i); -- triexit(1); -- } else { -- regionlist[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- printf( -- "Error: Region %d has no region attribute or area constraint.\n", -- b->firstnumber + i); -- triexit(1); -- } else { -- regionlist[index++] = (REAL) strtod(stringptr, &stringptr); -- } -- stringptr = findfield(stringptr); -- if (*stringptr == '\0') { -- regionlist[index] = regionlist[index - 1]; -- } else { -- regionlist[index] = (REAL) strtod(stringptr, &stringptr); -- } -- index++; -- } -- } -- } else { -- /* Set `*regions' to zero to avoid an accidental free() later. */ -- *regions = 0; -- *rlist = (REAL *) NULL; -- } --#endif /* not CDT_ONLY */ -- -- fclose(polyfile); --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* finishfile() Write the command line to the output file so the user */ --/* can remember how the file was generated. Close the file. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void finishfile(FILE *outfile, int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void finishfile(outfile, argc, argv) --FILE *outfile; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --{ -- int i; -- -- fprintf(outfile, "# Generated by"); -- for (i = 0; i < argc; i++) { -- fprintf(outfile, " "); -- fputs(argv[i], outfile); -- } -- fprintf(outfile, "\n"); -- fclose(outfile); --} -- --#endif /* not TRILIBRARY */ -- --/*****************************************************************************/ --/* */ --/* writenodes() Number the vertices and write them to a .node file. */ --/* */ --/* To save memory, the vertex numbers are written over the boundary markers */ --/* after the vertices are written to a file. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writenodes(struct mesh *m, struct behavior *b, REAL **pointlist, -- REAL **pointattriblist, int **pointmarkerlist) --#else /* not ANSI_DECLARATORS */ --void writenodes(m, b, pointlist, pointattriblist, pointmarkerlist) --struct mesh *m; --struct behavior *b; --REAL **pointlist; --REAL **pointattriblist; --int **pointmarkerlist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writenodes(struct mesh *m, struct behavior *b, char *nodefilename, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writenodes(m, b, nodefilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *nodefilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- REAL *plist; -- REAL *palist; -- int *pmlist; -- int coordindex; -- int attribindex; --#else /* not TRILIBRARY */ -- FILE *outfile; --#endif /* not TRILIBRARY */ -- vertex vertexloop; -- long outvertices; -- int vertexnumber; -- int i; -- -- if (b->jettison) { -- outvertices = m->vertices.items - m->undeads; -- } else { -- outvertices = m->vertices.items; -- } -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing vertices.\n"); -- } -- /* Allocate memory for output vertices if necessary. */ -- if (*pointlist == (REAL *) NULL) { -- *pointlist = (REAL *) trimalloc((int) (outvertices * 2 * sizeof(REAL))); -- } -- /* Allocate memory for output vertex attributes if necessary. */ -- if ((m->nextras > 0) && (*pointattriblist == (REAL *) NULL)) { -- *pointattriblist = (REAL *) trimalloc((int) (outvertices * m->nextras * -- sizeof(REAL))); -- } -- /* Allocate memory for output vertex markers if necessary. */ -- if (!b->nobound && (*pointmarkerlist == (int *) NULL)) { -- *pointmarkerlist = (int *) trimalloc((int) (outvertices * sizeof(int))); -- } -- plist = *pointlist; -- palist = *pointattriblist; -- pmlist = *pointmarkerlist; -- coordindex = 0; -- attribindex = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", nodefilename); -- } -- outfile = fopen(nodefilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", nodefilename); -- triexit(1); -- } -- /* Number of vertices, number of dimensions, number of vertex attributes, */ -- /* and number of boundary markers (zero or one). */ -- fprintf(outfile, "%ld %d %d %d\n", outvertices, m->mesh_dim, -- m->nextras, 1 - b->nobound); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->vertices); -- vertexnumber = b->firstnumber; -- vertexloop = vertextraverse(m); -- while (vertexloop != (vertex) NULL) { -- if (!b->jettison || (vertextype(vertexloop) != UNDEADVERTEX)) { --#ifdef TRILIBRARY -- /* X and y coordinates. */ -- plist[coordindex++] = vertexloop[0]; -- plist[coordindex++] = vertexloop[1]; -- /* Vertex attributes. */ -- for (i = 0; i < m->nextras; i++) { -- palist[attribindex++] = vertexloop[2 + i]; -- } -- if (!b->nobound) { -- /* Copy the boundary marker. */ -- pmlist[vertexnumber - b->firstnumber] = vertexmark(vertexloop); -- } --#else /* not TRILIBRARY */ -- /* Vertex number, x and y coordinates. */ -- fprintf(outfile, "%4d %.17g %.17g", vertexnumber, vertexloop[0], -- vertexloop[1]); -- for (i = 0; i < m->nextras; i++) { -- /* Write an attribute. */ -- fprintf(outfile, " %.17g", vertexloop[i + 2]); -- } -- if (b->nobound) { -- fprintf(outfile, "\n"); -- } else { -- /* Write the boundary marker. */ -- fprintf(outfile, " %d\n", vertexmark(vertexloop)); -- } --#endif /* not TRILIBRARY */ -- -- setvertexmark(vertexloop, vertexnumber); -- vertexnumber++; -- } -- vertexloop = vertextraverse(m); -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --/*****************************************************************************/ --/* */ --/* numbernodes() Number the vertices. */ --/* */ --/* Each vertex is assigned a marker equal to its number. */ --/* */ --/* Used when writenodes() is not called because no .node file is written. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void numbernodes(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void numbernodes(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- vertex vertexloop; -- int vertexnumber; -- -- traversalinit(&m->vertices); -- vertexnumber = b->firstnumber; -- vertexloop = vertextraverse(m); -- while (vertexloop != (vertex) NULL) { -- setvertexmark(vertexloop, vertexnumber); -- if (!b->jettison || (vertextype(vertexloop) != UNDEADVERTEX)) { -- vertexnumber++; -- } -- vertexloop = vertextraverse(m); -- } --} -- --/*****************************************************************************/ --/* */ --/* writeelements() Write the triangles to an .ele file. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writeelements(struct mesh *m, struct behavior *b, -- int **trianglelist, REAL **triangleattriblist) --#else /* not ANSI_DECLARATORS */ --void writeelements(m, b, trianglelist, triangleattriblist) --struct mesh *m; --struct behavior *b; --int **trianglelist; --REAL **triangleattriblist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writeelements(struct mesh *m, struct behavior *b, char *elefilename, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writeelements(m, b, elefilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *elefilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- int *tlist; -- REAL *talist; -- int vertexindex; -- int attribindex; --#else /* not TRILIBRARY */ -- FILE *outfile; --#endif /* not TRILIBRARY */ -- struct otri triangleloop; -- vertex p1, p2, p3; -- vertex mid1, mid2, mid3; -- long elementnumber; -- int i; -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing triangles.\n"); -- } -- /* Allocate memory for output triangles if necessary. */ -- if (*trianglelist == (int *) NULL) { -- *trianglelist = (int *) trimalloc((int) (m->triangles.items * -- ((b->order + 1) * (b->order + 2) / -- 2) * sizeof(int))); -- } -- /* Allocate memory for output triangle attributes if necessary. */ -- if ((m->eextras > 0) && (*triangleattriblist == (REAL *) NULL)) { -- *triangleattriblist = (REAL *) trimalloc((int) (m->triangles.items * -- m->eextras * -- sizeof(REAL))); -- } -- tlist = *trianglelist; -- talist = *triangleattriblist; -- vertexindex = 0; -- attribindex = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", elefilename); -- } -- outfile = fopen(elefilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", elefilename); -- triexit(1); -- } -- /* Number of triangles, vertices per triangle, attributes per triangle. */ -- fprintf(outfile, "%ld %d %d\n", m->triangles.items, -- (b->order + 1) * (b->order + 2) / 2, m->eextras); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- triangleloop.orient = 0; -- elementnumber = b->firstnumber; -- while (triangleloop.tri != (triangle *) NULL) { -- org(triangleloop, p1); -- dest(triangleloop, p2); -- apex(triangleloop, p3); -- if (b->order == 1) { --#ifdef TRILIBRARY -- tlist[vertexindex++] = vertexmark(p1); -- tlist[vertexindex++] = vertexmark(p2); -- tlist[vertexindex++] = vertexmark(p3); --#else /* not TRILIBRARY */ -- /* Triangle number, indices for three vertices. */ -- fprintf(outfile, "%4ld %4d %4d %4d", elementnumber, -- vertexmark(p1), vertexmark(p2), vertexmark(p3)); --#endif /* not TRILIBRARY */ -- } else { -- mid1 = (vertex) triangleloop.tri[m->highorderindex + 1]; -- mid2 = (vertex) triangleloop.tri[m->highorderindex + 2]; -- mid3 = (vertex) triangleloop.tri[m->highorderindex]; --#ifdef TRILIBRARY -- tlist[vertexindex++] = vertexmark(p1); -- tlist[vertexindex++] = vertexmark(p2); -- tlist[vertexindex++] = vertexmark(p3); -- tlist[vertexindex++] = vertexmark(mid1); -- tlist[vertexindex++] = vertexmark(mid2); -- tlist[vertexindex++] = vertexmark(mid3); --#else /* not TRILIBRARY */ -- /* Triangle number, indices for six vertices. */ -- fprintf(outfile, "%4ld %4d %4d %4d %4d %4d %4d", elementnumber, -- vertexmark(p1), vertexmark(p2), vertexmark(p3), vertexmark(mid1), -- vertexmark(mid2), vertexmark(mid3)); --#endif /* not TRILIBRARY */ -- } -- --#ifdef TRILIBRARY -- for (i = 0; i < m->eextras; i++) { -- talist[attribindex++] = elemattribute(triangleloop, i); -- } --#else /* not TRILIBRARY */ -- for (i = 0; i < m->eextras; i++) { -- fprintf(outfile, " %.17g", elemattribute(triangleloop, i)); -- } -- fprintf(outfile, "\n"); --#endif /* not TRILIBRARY */ -- -- triangleloop.tri = triangletraverse(m); -- elementnumber++; -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --/*****************************************************************************/ --/* */ --/* writepoly() Write the segments and holes to a .poly file. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writepoly(struct mesh *m, struct behavior *b, -- int **segmentlist, int **segmentmarkerlist) --#else /* not ANSI_DECLARATORS */ --void writepoly(m, b, segmentlist, segmentmarkerlist) --struct mesh *m; --struct behavior *b; --int **segmentlist; --int **segmentmarkerlist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writepoly(struct mesh *m, struct behavior *b, char *polyfilename, -- REAL *holelist, int holes, REAL *regionlist, int regions, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writepoly(m, b, polyfilename, holelist, holes, regionlist, regions, -- argc, argv) --struct mesh *m; --struct behavior *b; --char *polyfilename; --REAL *holelist; --int holes; --REAL *regionlist; --int regions; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- int *slist; -- int *smlist; -- int index; --#else /* not TRILIBRARY */ -- FILE *outfile; -- long holenumber, regionnumber; --#endif /* not TRILIBRARY */ -- struct osub subsegloop; -- vertex endpoint1, endpoint2; -- long subsegnumber; -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing segments.\n"); -- } -- /* Allocate memory for output segments if necessary. */ -- if (*segmentlist == (int *) NULL) { -- *segmentlist = (int *) trimalloc((int) (m->subsegs.items * 2 * -- sizeof(int))); -- } -- /* Allocate memory for output segment markers if necessary. */ -- if (!b->nobound && (*segmentmarkerlist == (int *) NULL)) { -- *segmentmarkerlist = (int *) trimalloc((int) (m->subsegs.items * -- sizeof(int))); -- } -- slist = *segmentlist; -- smlist = *segmentmarkerlist; -- index = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", polyfilename); -- } -- outfile = fopen(polyfilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", polyfilename); -- triexit(1); -- } -- /* The zero indicates that the vertices are in a separate .node file. */ -- /* Followed by number of dimensions, number of vertex attributes, */ -- /* and number of boundary markers (zero or one). */ -- fprintf(outfile, "%d %d %d %d\n", 0, m->mesh_dim, m->nextras, -- 1 - b->nobound); -- /* Number of segments, number of boundary markers (zero or one). */ -- fprintf(outfile, "%ld %d\n", m->subsegs.items, 1 - b->nobound); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->subsegs); -- subsegloop.ss = subsegtraverse(m); -- subsegloop.ssorient = 0; -- subsegnumber = b->firstnumber; -- while (subsegloop.ss != (subseg *) NULL) { -- sorg(subsegloop, endpoint1); -- sdest(subsegloop, endpoint2); --#ifdef TRILIBRARY -- /* Copy indices of the segment's two endpoints. */ -- slist[index++] = vertexmark(endpoint1); -- slist[index++] = vertexmark(endpoint2); -- if (!b->nobound) { -- /* Copy the boundary marker. */ -- smlist[subsegnumber - b->firstnumber] = mark(subsegloop); -- } --#else /* not TRILIBRARY */ -- /* Segment number, indices of its two endpoints, and possibly a marker. */ -- if (b->nobound) { -- fprintf(outfile, "%4ld %4d %4d\n", subsegnumber, -- vertexmark(endpoint1), vertexmark(endpoint2)); -- } else { -- fprintf(outfile, "%4ld %4d %4d %4d\n", subsegnumber, -- vertexmark(endpoint1), vertexmark(endpoint2), mark(subsegloop)); -- } --#endif /* not TRILIBRARY */ -- -- subsegloop.ss = subsegtraverse(m); -- subsegnumber++; -- } -- --#ifndef TRILIBRARY --#ifndef CDT_ONLY -- fprintf(outfile, "%d\n", holes); -- if (holes > 0) { -- for (holenumber = 0; holenumber < holes; holenumber++) { -- /* Hole number, x and y coordinates. */ -- fprintf(outfile, "%4ld %.17g %.17g\n", b->firstnumber + holenumber, -- holelist[2 * holenumber], holelist[2 * holenumber + 1]); -- } -- } -- if (regions > 0) { -- fprintf(outfile, "%d\n", regions); -- for (regionnumber = 0; regionnumber < regions; regionnumber++) { -- /* Region number, x and y coordinates, attribute, maximum area. */ -- fprintf(outfile, "%4ld %.17g %.17g %.17g %.17g\n", -- b->firstnumber + regionnumber, -- regionlist[4 * regionnumber], regionlist[4 * regionnumber + 1], -- regionlist[4 * regionnumber + 2], -- regionlist[4 * regionnumber + 3]); -- } -- } --#endif /* not CDT_ONLY */ -- -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --/*****************************************************************************/ --/* */ --/* writeedges() Write the edges to an .edge file. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writeedges(struct mesh *m, struct behavior *b, -- int **edgelist, int **edgemarkerlist) --#else /* not ANSI_DECLARATORS */ --void writeedges(m, b, edgelist, edgemarkerlist) --struct mesh *m; --struct behavior *b; --int **edgelist; --int **edgemarkerlist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writeedges(struct mesh *m, struct behavior *b, char *edgefilename, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writeedges(m, b, edgefilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *edgefilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- int *elist; -- int *emlist; -- int index; --#else /* not TRILIBRARY */ -- FILE *outfile; --#endif /* not TRILIBRARY */ -- struct otri triangleloop, trisym; -- struct osub checkmark; -- vertex p1, p2; -- long edgenumber; -- triangle ptr; /* Temporary variable used by sym(). */ -- subseg sptr; /* Temporary variable used by tspivot(). */ -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing edges.\n"); -- } -- /* Allocate memory for edges if necessary. */ -- if (*edgelist == (int *) NULL) { -- *edgelist = (int *) trimalloc((int) (m->edges * 2 * sizeof(int))); -- } -- /* Allocate memory for edge markers if necessary. */ -- if (!b->nobound && (*edgemarkerlist == (int *) NULL)) { -- *edgemarkerlist = (int *) trimalloc((int) (m->edges * sizeof(int))); -- } -- elist = *edgelist; -- emlist = *edgemarkerlist; -- index = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", edgefilename); -- } -- outfile = fopen(edgefilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", edgefilename); -- triexit(1); -- } -- /* Number of edges, number of boundary markers (zero or one). */ -- fprintf(outfile, "%ld %d\n", m->edges, 1 - b->nobound); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- edgenumber = b->firstnumber; -- /* To loop over the set of edges, loop over all triangles, and look at */ -- /* the three edges of each triangle. If there isn't another triangle */ -- /* adjacent to the edge, operate on the edge. If there is another */ -- /* adjacent triangle, operate on the edge only if the current triangle */ -- /* has a smaller pointer than its neighbor. This way, each edge is */ -- /* considered only once. */ -- while (triangleloop.tri != (triangle *) NULL) { -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- sym(triangleloop, trisym); -- if ((triangleloop.tri < trisym.tri) || (trisym.tri == m->dummytri)) { -- org(triangleloop, p1); -- dest(triangleloop, p2); --#ifdef TRILIBRARY -- elist[index++] = vertexmark(p1); -- elist[index++] = vertexmark(p2); --#endif /* TRILIBRARY */ -- if (b->nobound) { --#ifndef TRILIBRARY -- /* Edge number, indices of two endpoints. */ -- fprintf(outfile, "%4ld %d %d\n", edgenumber, -- vertexmark(p1), vertexmark(p2)); --#endif /* not TRILIBRARY */ -- } else { -- /* Edge number, indices of two endpoints, and a boundary marker. */ -- /* If there's no subsegment, the boundary marker is zero. */ -- if (b->usesegments) { -- tspivot(triangleloop, checkmark); -- if (checkmark.ss == m->dummysub) { --#ifdef TRILIBRARY -- emlist[edgenumber - b->firstnumber] = 0; --#else /* not TRILIBRARY */ -- fprintf(outfile, "%4ld %d %d %d\n", edgenumber, -- vertexmark(p1), vertexmark(p2), 0); --#endif /* not TRILIBRARY */ -- } else { --#ifdef TRILIBRARY -- emlist[edgenumber - b->firstnumber] = mark(checkmark); --#else /* not TRILIBRARY */ -- fprintf(outfile, "%4ld %d %d %d\n", edgenumber, -- vertexmark(p1), vertexmark(p2), mark(checkmark)); --#endif /* not TRILIBRARY */ -- } -- } else { --#ifdef TRILIBRARY -- emlist[edgenumber - b->firstnumber] = trisym.tri == m->dummytri; --#else /* not TRILIBRARY */ -- fprintf(outfile, "%4ld %d %d %d\n", edgenumber, -- vertexmark(p1), vertexmark(p2), trisym.tri == m->dummytri); --#endif /* not TRILIBRARY */ -- } -- } -- edgenumber++; -- } -- } -- triangleloop.tri = triangletraverse(m); -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --/*****************************************************************************/ --/* */ --/* writevoronoi() Write the Voronoi diagram to a .v.node and .v.edge */ --/* file. */ --/* */ --/* The Voronoi diagram is the geometric dual of the Delaunay triangulation. */ --/* Hence, the Voronoi vertices are listed by traversing the Delaunay */ --/* triangles, and the Voronoi edges are listed by traversing the Delaunay */ --/* edges. */ --/* */ --/* WARNING: In order to assign numbers to the Voronoi vertices, this */ --/* procedure messes up the subsegments or the extra nodes of every */ --/* element. Hence, you should call this procedure last. */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writevoronoi(struct mesh *m, struct behavior *b, REAL **vpointlist, -- REAL **vpointattriblist, int **vpointmarkerlist, -- int **vedgelist, int **vedgemarkerlist, REAL **vnormlist) --#else /* not ANSI_DECLARATORS */ --void writevoronoi(m, b, vpointlist, vpointattriblist, vpointmarkerlist, -- vedgelist, vedgemarkerlist, vnormlist) --struct mesh *m; --struct behavior *b; --REAL **vpointlist; --REAL **vpointattriblist; --int **vpointmarkerlist; --int **vedgelist; --int **vedgemarkerlist; --REAL **vnormlist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writevoronoi(struct mesh *m, struct behavior *b, char *vnodefilename, -- char *vedgefilename, int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writevoronoi(m, b, vnodefilename, vedgefilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *vnodefilename; --char *vedgefilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- REAL *plist; -- REAL *palist; -- int *elist; -- REAL *normlist; -- int coordindex; -- int attribindex; --#else /* not TRILIBRARY */ -- FILE *outfile; --#endif /* not TRILIBRARY */ -- struct otri triangleloop, trisym; -- vertex torg, tdest, tapex; -- REAL circumcenter[2]; -- REAL xi, eta; -- long vnodenumber, vedgenumber; -- int p1, p2; -- int i; -- triangle ptr; /* Temporary variable used by sym(). */ -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing Voronoi vertices.\n"); -- } -- /* Allocate memory for Voronoi vertices if necessary. */ -- if (*vpointlist == (REAL *) NULL) { -- *vpointlist = (REAL *) trimalloc((int) (m->triangles.items * 2 * -- sizeof(REAL))); -- } -- /* Allocate memory for Voronoi vertex attributes if necessary. */ -- if (*vpointattriblist == (REAL *) NULL) { -- *vpointattriblist = (REAL *) trimalloc((int) (m->triangles.items * -- m->nextras * sizeof(REAL))); -- } -- *vpointmarkerlist = (int *) NULL; -- plist = *vpointlist; -- palist = *vpointattriblist; -- coordindex = 0; -- attribindex = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", vnodefilename); -- } -- outfile = fopen(vnodefilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", vnodefilename); -- triexit(1); -- } -- /* Number of triangles, two dimensions, number of vertex attributes, */ -- /* no markers. */ -- fprintf(outfile, "%ld %d %d %d\n", m->triangles.items, 2, m->nextras, 0); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- triangleloop.orient = 0; -- vnodenumber = b->firstnumber; -- while (triangleloop.tri != (triangle *) NULL) { -- org(triangleloop, torg); -- dest(triangleloop, tdest); -- apex(triangleloop, tapex); -- findcircumcenter(m, b, torg, tdest, tapex, circumcenter, &xi, &eta, 0); --#ifdef TRILIBRARY -- /* X and y coordinates. */ -- plist[coordindex++] = circumcenter[0]; -- plist[coordindex++] = circumcenter[1]; -- for (i = 2; i < 2 + m->nextras; i++) { -- /* Interpolate the vertex attributes at the circumcenter. */ -- palist[attribindex++] = torg[i] + xi * (tdest[i] - torg[i]) -- + eta * (tapex[i] - torg[i]); -- } --#else /* not TRILIBRARY */ -- /* Voronoi vertex number, x and y coordinates. */ -- fprintf(outfile, "%4ld %.17g %.17g", vnodenumber, circumcenter[0], -- circumcenter[1]); -- for (i = 2; i < 2 + m->nextras; i++) { -- /* Interpolate the vertex attributes at the circumcenter. */ -- fprintf(outfile, " %.17g", torg[i] + xi * (tdest[i] - torg[i]) -- + eta * (tapex[i] - torg[i])); -- } -- fprintf(outfile, "\n"); --#endif /* not TRILIBRARY */ -- -- * (int *) (triangleloop.tri + 6) = (int) vnodenumber; -- triangleloop.tri = triangletraverse(m); -- vnodenumber++; -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing Voronoi edges.\n"); -- } -- /* Allocate memory for output Voronoi edges if necessary. */ -- if (*vedgelist == (int *) NULL) { -- *vedgelist = (int *) trimalloc((int) (m->edges * 2 * sizeof(int))); -- } -- *vedgemarkerlist = (int *) NULL; -- /* Allocate memory for output Voronoi norms if necessary. */ -- if (*vnormlist == (REAL *) NULL) { -- *vnormlist = (REAL *) trimalloc((int) (m->edges * 2 * sizeof(REAL))); -- } -- elist = *vedgelist; -- normlist = *vnormlist; -- coordindex = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", vedgefilename); -- } -- outfile = fopen(vedgefilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", vedgefilename); -- triexit(1); -- } -- /* Number of edges, zero boundary markers. */ -- fprintf(outfile, "%ld %d\n", m->edges, 0); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- vedgenumber = b->firstnumber; -- /* To loop over the set of edges, loop over all triangles, and look at */ -- /* the three edges of each triangle. If there isn't another triangle */ -- /* adjacent to the edge, operate on the edge. If there is another */ -- /* adjacent triangle, operate on the edge only if the current triangle */ -- /* has a smaller pointer than its neighbor. This way, each edge is */ -- /* considered only once. */ -- while (triangleloop.tri != (triangle *) NULL) { -- for (triangleloop.orient = 0; triangleloop.orient < 3; -- triangleloop.orient++) { -- sym(triangleloop, trisym); -- if ((triangleloop.tri < trisym.tri) || (trisym.tri == m->dummytri)) { -- /* Find the number of this triangle (and Voronoi vertex). */ -- p1 = * (int *) (triangleloop.tri + 6); -- if (trisym.tri == m->dummytri) { -- org(triangleloop, torg); -- dest(triangleloop, tdest); --#ifdef TRILIBRARY -- /* Copy an infinite ray. Index of one endpoint, and -1. */ -- elist[coordindex] = p1; -- normlist[coordindex++] = tdest[1] - torg[1]; -- elist[coordindex] = -1; -- normlist[coordindex++] = torg[0] - tdest[0]; --#else /* not TRILIBRARY */ -- /* Write an infinite ray. Edge number, index of one endpoint, -1, */ -- /* and x and y coordinates of a vector representing the */ -- /* direction of the ray. */ -- fprintf(outfile, "%4ld %d %d %.17g %.17g\n", vedgenumber, -- p1, -1, tdest[1] - torg[1], torg[0] - tdest[0]); --#endif /* not TRILIBRARY */ -- } else { -- /* Find the number of the adjacent triangle (and Voronoi vertex). */ -- p2 = * (int *) (trisym.tri + 6); -- /* Finite edge. Write indices of two endpoints. */ --#ifdef TRILIBRARY -- elist[coordindex] = p1; -- normlist[coordindex++] = 0.0; -- elist[coordindex] = p2; -- normlist[coordindex++] = 0.0; --#else /* not TRILIBRARY */ -- fprintf(outfile, "%4ld %d %d\n", vedgenumber, p1, p2); --#endif /* not TRILIBRARY */ -- } -- vedgenumber++; -- } -- } -- triangleloop.tri = triangletraverse(m); -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writeneighbors(struct mesh *m, struct behavior *b, int **neighborlist) --#else /* not ANSI_DECLARATORS */ --void writeneighbors(m, b, neighborlist) --struct mesh *m; --struct behavior *b; --int **neighborlist; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --void writeneighbors(struct mesh *m, struct behavior *b, char *neighborfilename, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writeneighbors(m, b, neighborfilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *neighborfilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ --#ifdef TRILIBRARY -- int *nlist; -- int index; --#else /* not TRILIBRARY */ -- FILE *outfile; --#endif /* not TRILIBRARY */ -- struct otri triangleloop, trisym; -- long elementnumber; -- int neighbor1, neighbor2, neighbor3; -- triangle ptr; /* Temporary variable used by sym(). */ -- --#ifdef TRILIBRARY -- if (!b->quiet) { -- printf("Writing neighbors.\n"); -- } -- /* Allocate memory for neighbors if necessary. */ -- if (*neighborlist == (int *) NULL) { -- *neighborlist = (int *) trimalloc((int) (m->triangles.items * 3 * -- sizeof(int))); -- } -- nlist = *neighborlist; -- index = 0; --#else /* not TRILIBRARY */ -- if (!b->quiet) { -- printf("Writing %s.\n", neighborfilename); -- } -- outfile = fopen(neighborfilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", neighborfilename); -- triexit(1); -- } -- /* Number of triangles, three neighbors per triangle. */ -- fprintf(outfile, "%ld %d\n", m->triangles.items, 3); --#endif /* not TRILIBRARY */ -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- triangleloop.orient = 0; -- elementnumber = b->firstnumber; -- while (triangleloop.tri != (triangle *) NULL) { -- * (int *) (triangleloop.tri + 6) = (int) elementnumber; -- triangleloop.tri = triangletraverse(m); -- elementnumber++; -- } -- * (int *) (m->dummytri + 6) = -1; -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- elementnumber = b->firstnumber; -- while (triangleloop.tri != (triangle *) NULL) { -- triangleloop.orient = 1; -- sym(triangleloop, trisym); -- neighbor1 = * (int *) (trisym.tri + 6); -- triangleloop.orient = 2; -- sym(triangleloop, trisym); -- neighbor2 = * (int *) (trisym.tri + 6); -- triangleloop.orient = 0; -- sym(triangleloop, trisym); -- neighbor3 = * (int *) (trisym.tri + 6); --#ifdef TRILIBRARY -- nlist[index++] = neighbor1; -- nlist[index++] = neighbor2; -- nlist[index++] = neighbor3; --#else /* not TRILIBRARY */ -- /* Triangle number, neighboring triangle numbers. */ -- fprintf(outfile, "%4ld %d %d %d\n", elementnumber, -- neighbor1, neighbor2, neighbor3); --#endif /* not TRILIBRARY */ -- -- triangleloop.tri = triangletraverse(m); -- elementnumber++; -- } -- --#ifndef TRILIBRARY -- finishfile(outfile, argc, argv); --#endif /* not TRILIBRARY */ --} -- --/*****************************************************************************/ --/* */ --/* writeoff() Write the triangulation to an .off file. */ --/* */ --/* OFF stands for the Object File Format, a format used by the Geometry */ --/* Center's Geomview package. */ --/* */ --/*****************************************************************************/ -- --#ifndef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void writeoff(struct mesh *m, struct behavior *b, char *offfilename, -- int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --void writeoff(m, b, offfilename, argc, argv) --struct mesh *m; --struct behavior *b; --char *offfilename; --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --{ -- FILE *outfile; -- struct otri triangleloop; -- vertex vertexloop; -- vertex p1, p2, p3; -- long outvertices; -- -- if (!b->quiet) { -- printf("Writing %s.\n", offfilename); -- } -- -- if (b->jettison) { -- outvertices = m->vertices.items - m->undeads; -- } else { -- outvertices = m->vertices.items; -- } -- -- outfile = fopen(offfilename, "w"); -- if (outfile == (FILE *) NULL) { -- printf(" Error: Cannot create file %s.\n", offfilename); -- triexit(1); -- } -- /* Number of vertices, triangles, and edges. */ -- fprintf(outfile, "OFF\n%ld %ld %ld\n", outvertices, m->triangles.items, -- m->edges); -- -- /* Write the vertices. */ -- traversalinit(&m->vertices); -- vertexloop = vertextraverse(m); -- while (vertexloop != (vertex) NULL) { -- if (!b->jettison || (vertextype(vertexloop) != UNDEADVERTEX)) { -- /* The "0.0" is here because the OFF format uses 3D coordinates. */ -- fprintf(outfile, " %.17g %.17g %.17g\n", vertexloop[0], vertexloop[1], -- 0.0); -- } -- vertexloop = vertextraverse(m); -- } -- -- /* Write the triangles. */ -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- triangleloop.orient = 0; -- while (triangleloop.tri != (triangle *) NULL) { -- org(triangleloop, p1); -- dest(triangleloop, p2); -- apex(triangleloop, p3); -- /* The "3" means a three-vertex polygon. */ -- fprintf(outfile, " 3 %4d %4d %4d\n", vertexmark(p1) - b->firstnumber, -- vertexmark(p2) - b->firstnumber, vertexmark(p3) - b->firstnumber); -- triangleloop.tri = triangletraverse(m); -- } -- finishfile(outfile, argc, argv); --} -- --#endif /* not TRILIBRARY */ -- --/** **/ --/** **/ --/********* File I/O routines end here *********/ -- --/*****************************************************************************/ --/* */ --/* quality_statistics() Print statistics about the quality of the mesh. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void quality_statistics(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void quality_statistics(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- struct otri triangleloop; -- vertex p[3]; -- REAL cossquaretable[8]; -- REAL ratiotable[16]; -- REAL dx[3], dy[3]; -- REAL edgelength[3]; -- REAL dotproduct; -- REAL cossquare; -- REAL triarea; -- REAL shortest, longest; -- REAL trilongest2; -- REAL smallestarea, biggestarea; -- REAL triminaltitude2; -- REAL minaltitude; -- REAL triaspect2; -- REAL worstaspect; -- REAL smallestangle, biggestangle; -- REAL radconst, degconst; -- int angletable[18]; -- int aspecttable[16]; -- int aspectindex; -- int tendegree; -- int acutebiggest; -- int i, ii, j, k; -- -- printf("Mesh quality statistics:\n\n"); -- radconst = PI / 18.0; -- degconst = 180.0 / PI; -- for (i = 0; i < 8; i++) { -- cossquaretable[i] = cos(radconst * (REAL) (i + 1)); -- cossquaretable[i] = cossquaretable[i] * cossquaretable[i]; -- } -- for (i = 0; i < 18; i++) { -- angletable[i] = 0; -- } -- -- ratiotable[0] = 1.5; ratiotable[1] = 2.0; -- ratiotable[2] = 2.5; ratiotable[3] = 3.0; -- ratiotable[4] = 4.0; ratiotable[5] = 6.0; -- ratiotable[6] = 10.0; ratiotable[7] = 15.0; -- ratiotable[8] = 25.0; ratiotable[9] = 50.0; -- ratiotable[10] = 100.0; ratiotable[11] = 300.0; -- ratiotable[12] = 1000.0; ratiotable[13] = 10000.0; -- ratiotable[14] = 100000.0; ratiotable[15] = 0.0; -- for (i = 0; i < 16; i++) { -- aspecttable[i] = 0; -- } -- -- minaltitude = m->xmax - m->xmin + m->ymax - m->ymin; -- minaltitude = minaltitude * minaltitude; -- shortest = minaltitude; -- longest = 0.0; -- smallestarea = minaltitude; -- biggestarea = 0.0; -- worstaspect = 0.0; -- smallestangle = 0.0; -- biggestangle = 2.0; -- acutebiggest = 1; -- -- traversalinit(&m->triangles); -- triangleloop.tri = triangletraverse(m); -- triangleloop.orient = 0; -- while (triangleloop.tri != (triangle *) NULL) { -- org(triangleloop, p[0]); -- dest(triangleloop, p[1]); -- apex(triangleloop, p[2]); -- trilongest2 = 0.0; -- -- for (i = 0; i < 3; i++) { -- j = plus1mod3[i]; -- k = minus1mod3[i]; -- dx[i] = p[j][0] - p[k][0]; -- dy[i] = p[j][1] - p[k][1]; -- edgelength[i] = dx[i] * dx[i] + dy[i] * dy[i]; -- if (edgelength[i] > trilongest2) { -- trilongest2 = edgelength[i]; -- } -- if (edgelength[i] > longest) { -- longest = edgelength[i]; -- } -- if (edgelength[i] < shortest) { -- shortest = edgelength[i]; -- } -- } -- -- triarea = counterclockwise(m, b, p[0], p[1], p[2]); -- if (triarea < smallestarea) { -- smallestarea = triarea; -- } -- if (triarea > biggestarea) { -- biggestarea = triarea; -- } -- triminaltitude2 = triarea * triarea / trilongest2; -- if (triminaltitude2 < minaltitude) { -- minaltitude = triminaltitude2; -- } -- triaspect2 = trilongest2 / triminaltitude2; -- if (triaspect2 > worstaspect) { -- worstaspect = triaspect2; -- } -- aspectindex = 0; -- while ((triaspect2 > ratiotable[aspectindex] * ratiotable[aspectindex]) -- && (aspectindex < 15)) { -- aspectindex++; -- } -- aspecttable[aspectindex]++; -- -- for (i = 0; i < 3; i++) { -- j = plus1mod3[i]; -- k = minus1mod3[i]; -- dotproduct = dx[j] * dx[k] + dy[j] * dy[k]; -- cossquare = dotproduct * dotproduct / (edgelength[j] * edgelength[k]); -- tendegree = 8; -- for (ii = 7; ii >= 0; ii--) { -- if (cossquare > cossquaretable[ii]) { -- tendegree = ii; -- } -- } -- if (dotproduct <= 0.0) { -- angletable[tendegree]++; -- if (cossquare > smallestangle) { -- smallestangle = cossquare; -- } -- if (acutebiggest && (cossquare < biggestangle)) { -- biggestangle = cossquare; -- } -- } else { -- angletable[17 - tendegree]++; -- if (acutebiggest || (cossquare > biggestangle)) { -- biggestangle = cossquare; -- acutebiggest = 0; -- } -- } -- } -- triangleloop.tri = triangletraverse(m); -- } -- -- shortest = sqrt(shortest); -- longest = sqrt(longest); -- minaltitude = sqrt(minaltitude); -- worstaspect = sqrt(worstaspect); -- smallestarea *= 0.5; -- biggestarea *= 0.5; -- if (smallestangle >= 1.0) { -- smallestangle = 0.0; -- } else { -- smallestangle = degconst * acos(sqrt(smallestangle)); -- } -- if (biggestangle >= 1.0) { -- biggestangle = 180.0; -- } else { -- if (acutebiggest) { -- biggestangle = degconst * acos(sqrt(biggestangle)); -- } else { -- biggestangle = 180.0 - degconst * acos(sqrt(biggestangle)); -- } -- } -- -- printf(" Smallest area: %16.5g | Largest area: %16.5g\n", -- smallestarea, biggestarea); -- printf(" Shortest edge: %16.5g | Longest edge: %16.5g\n", -- shortest, longest); -- printf(" Shortest altitude: %12.5g | Largest aspect ratio: %8.5g\n\n", -- minaltitude, worstaspect); -- -- printf(" Triangle aspect ratio histogram:\n"); -- printf(" 1.1547 - %-6.6g : %8d | %6.6g - %-6.6g : %8d\n", -- ratiotable[0], aspecttable[0], ratiotable[7], ratiotable[8], -- aspecttable[8]); -- for (i = 1; i < 7; i++) { -- printf(" %6.6g - %-6.6g : %8d | %6.6g - %-6.6g : %8d\n", -- ratiotable[i - 1], ratiotable[i], aspecttable[i], -- ratiotable[i + 7], ratiotable[i + 8], aspecttable[i + 8]); -- } -- printf(" %6.6g - %-6.6g : %8d | %6.6g - : %8d\n", -- ratiotable[6], ratiotable[7], aspecttable[7], ratiotable[14], -- aspecttable[15]); -- printf(" (Aspect ratio is longest edge divided by shortest altitude)\n\n"); -- -- printf(" Smallest angle: %15.5g | Largest angle: %15.5g\n\n", -- smallestangle, biggestangle); -- -- printf(" Angle histogram:\n"); -- for (i = 0; i < 9; i++) { -- printf(" %3d - %3d degrees: %8d | %3d - %3d degrees: %8d\n", -- i * 10, i * 10 + 10, angletable[i], -- i * 10 + 90, i * 10 + 100, angletable[i + 9]); -- } -- printf("\n"); --} -- --/*****************************************************************************/ --/* */ --/* statistics() Print all sorts of cool facts. */ --/* */ --/*****************************************************************************/ -- --#ifdef ANSI_DECLARATORS --void statistics(struct mesh *m, struct behavior *b) --#else /* not ANSI_DECLARATORS */ --void statistics(m, b) --struct mesh *m; --struct behavior *b; --#endif /* not ANSI_DECLARATORS */ -- --{ -- printf("\nStatistics:\n\n"); -- printf(" Input vertices: %d\n", m->invertices); -- if (b->refine) { -- printf(" Input triangles: %d\n", m->inelements); -- } -- if (b->poly) { -- printf(" Input segments: %d\n", m->insegments); -- if (!b->refine) { -- printf(" Input holes: %d\n", m->holes); -- } -- } -- -- printf("\n Mesh vertices: %ld\n", m->vertices.items - m->undeads); -- printf(" Mesh triangles: %ld\n", m->triangles.items); -- printf(" Mesh edges: %ld\n", m->edges); -- printf(" Mesh exterior boundary edges: %ld\n", m->hullsize); -- if (b->poly || b->refine) { -- printf(" Mesh interior boundary edges: %ld\n", -- m->subsegs.items - m->hullsize); -- printf(" Mesh subsegments (constrained edges): %ld\n", -- m->subsegs.items); -- } -- printf("\n"); -- -- if (b->verbose) { -- quality_statistics(m, b); -- printf("Memory allocation statistics:\n\n"); -- printf(" Maximum number of vertices: %ld\n", m->vertices.maxitems); -- printf(" Maximum number of triangles: %ld\n", m->triangles.maxitems); -- if (m->subsegs.maxitems > 0) { -- printf(" Maximum number of subsegments: %ld\n", m->subsegs.maxitems); -- } -- if (m->viri.maxitems > 0) { -- printf(" Maximum number of viri: %ld\n", m->viri.maxitems); -- } -- if (m->badsubsegs.maxitems > 0) { -- printf(" Maximum number of encroached subsegments: %ld\n", -- m->badsubsegs.maxitems); -- } -- if (m->badtriangles.maxitems > 0) { -- printf(" Maximum number of bad triangles: %ld\n", -- m->badtriangles.maxitems); -- } -- if (m->flipstackers.maxitems > 0) { -- printf(" Maximum number of stacked triangle flips: %ld\n", -- m->flipstackers.maxitems); -- } -- if (m->splaynodes.maxitems > 0) { -- printf(" Maximum number of splay tree nodes: %ld\n", -- m->splaynodes.maxitems); -- } -- printf(" Approximate heap memory use (bytes): %ld\n\n", -- m->vertices.maxitems * m->vertices.itembytes + -- m->triangles.maxitems * m->triangles.itembytes + -- m->subsegs.maxitems * m->subsegs.itembytes + -- m->viri.maxitems * m->viri.itembytes + -- m->badsubsegs.maxitems * m->badsubsegs.itembytes + -- m->badtriangles.maxitems * m->badtriangles.itembytes + -- m->flipstackers.maxitems * m->flipstackers.itembytes + -- m->splaynodes.maxitems * m->splaynodes.itembytes); -- -- printf("Algorithmic statistics:\n\n"); -- if (!b->weighted) { -- printf(" Number of incircle tests: %ld\n", m->incirclecount); -- } else { -- printf(" Number of 3D orientation tests: %ld\n", m->orient3dcount); -- } -- printf(" Number of 2D orientation tests: %ld\n", m->counterclockcount); -- if (m->hyperbolacount > 0) { -- printf(" Number of right-of-hyperbola tests: %ld\n", -- m->hyperbolacount); -- } -- if (m->circletopcount > 0) { -- printf(" Number of circle top computations: %ld\n", -- m->circletopcount); -- } -- if (m->circumcentercount > 0) { -- printf(" Number of triangle circumcenter computations: %ld\n", -- m->circumcentercount); -- } -- printf("\n"); -- } --} -- --/*****************************************************************************/ --/* */ --/* main() or triangulate() Gosh, do everything. */ --/* */ --/* The sequence is roughly as follows. Many of these steps can be skipped, */ --/* depending on the command line switches. */ --/* */ --/* - Initialize constants and parse the command line. */ --/* - Read the vertices from a file and either */ --/* - triangulate them (no -r), or */ --/* - read an old mesh from files and reconstruct it (-r). */ --/* - Insert the PSLG segments (-p), and possibly segments on the convex */ --/* hull (-c). */ --/* - Read the holes (-p), regional attributes (-pA), and regional area */ --/* constraints (-pa). Carve the holes and concavities, and spread the */ --/* regional attributes and area constraints. */ --/* - Enforce the constraints on minimum angle (-q) and maximum area (-a). */ --/* Also enforce the conforming Delaunay property (-q and -a). */ --/* - Compute the number of edges in the resulting mesh. */ --/* - Promote the mesh's linear triangles to higher order elements (-o). */ --/* - Write the output files and print the statistics. */ --/* - Check the consistency and Delaunay property of the mesh (-C). */ --/* */ --/*****************************************************************************/ -- --#ifdef TRILIBRARY -- --#ifdef ANSI_DECLARATORS --void triangulate(const char *const triswitches, struct triangulateio *in, -- struct triangulateio *out, struct triangulateio *vorout) --#else /* not ANSI_DECLARATORS */ --void triangulate(triswitches, in, out, vorout) --const char *const triswitches; --struct triangulateio *in; --struct triangulateio *out; --struct triangulateio *vorout; --#endif /* not ANSI_DECLARATORS */ -- --#else /* not TRILIBRARY */ -- --#ifdef ANSI_DECLARATORS --int main(int argc, char **argv) --#else /* not ANSI_DECLARATORS */ --int main(argc, argv) --int argc; --char **argv; --#endif /* not ANSI_DECLARATORS */ -- --#endif /* not TRILIBRARY */ -- --{ -- struct mesh m; -- struct behavior b; -- REAL *holearray; /* Array of holes. */ -- REAL *regionarray; /* Array of regional attributes and area constraints. */ --#ifndef TRILIBRARY -- FILE *polyfile; --#endif /* not TRILIBRARY */ --#ifndef NO_TIMER -- /* Variables for timing the performance of Triangle. The types are */ -- /* defined in sys/time.h. */ -- struct timeval tv0, tv1, tv2, tv3, tv4, tv5, tv6; -- struct timezone tz; --#endif /* not NO_TIMER */ -- --#ifndef NO_TIMER -- gettimeofday(&tv0, &tz); --#endif /* not NO_TIMER */ -- -- triangleinit(&m); --#ifdef TRILIBRARY -- parsecommandline(1, &triswitches, &b); --#else /* not TRILIBRARY */ -- parsecommandline(argc, argv, &b); --#endif /* not TRILIBRARY */ -- m.steinerleft = b.steiner; -- --#ifdef TRILIBRARY -- transfernodes(&m, &b, in->pointlist, in->pointattributelist, -- in->pointmarkerlist, in->numberofpoints, -- in->numberofpointattributes); --#else /* not TRILIBRARY */ -- readnodes(&m, &b, b.innodefilename, b.inpolyfilename, &polyfile); --#endif /* not TRILIBRARY */ -- --#ifndef NO_TIMER -- if (!b.quiet) { -- gettimeofday(&tv1, &tz); -- } --#endif /* not NO_TIMER */ -- --#ifdef CDT_ONLY -- m.hullsize = delaunay(&m, &b); /* Triangulate the vertices. */ --#else /* not CDT_ONLY */ -- if (b.refine) { -- /* Read and reconstruct a mesh. */ --#ifdef TRILIBRARY -- m.hullsize = reconstruct(&m, &b, in->trianglelist, -- in->triangleattributelist, in->trianglearealist, -- in->numberoftriangles, in->numberofcorners, -- in->numberoftriangleattributes, -- in->segmentlist, in->segmentmarkerlist, -- in->numberofsegments); --#else /* not TRILIBRARY */ -- m.hullsize = reconstruct(&m, &b, b.inelefilename, b.areafilename, -- b.inpolyfilename, polyfile); --#endif /* not TRILIBRARY */ -- } else { -- m.hullsize = delaunay(&m, &b); /* Triangulate the vertices. */ -- } --#endif /* not CDT_ONLY */ -- --#ifndef NO_TIMER -- if (!b.quiet) { -- gettimeofday(&tv2, &tz); -- if (b.refine) { -- printf("Mesh reconstruction"); -- } else { -- printf("Delaunay"); -- } -- printf(" milliseconds: %ld\n", 1000l * (tv2.tv_sec - tv1.tv_sec) + -- (tv2.tv_usec - tv1.tv_usec) / 1000l); -- } --#endif /* not NO_TIMER */ -- -- /* Ensure that no vertex can be mistaken for a triangular bounding */ -- /* box vertex in insertvertex(). */ -- m.infvertex1 = (vertex) NULL; -- m.infvertex2 = (vertex) NULL; -- m.infvertex3 = (vertex) NULL; -- -- if (b.usesegments) { -- m.checksegments = 1; /* Segments will be introduced next. */ -- if (!b.refine) { -- /* Insert PSLG segments and/or convex hull segments. */ --#ifdef TRILIBRARY -- formskeleton(&m, &b, in->segmentlist, -- in->segmentmarkerlist, in->numberofsegments); --#else /* not TRILIBRARY */ -- formskeleton(&m, &b, polyfile, b.inpolyfilename); --#endif /* not TRILIBRARY */ -- } -- } -- --#ifndef NO_TIMER -- if (!b.quiet) { -- gettimeofday(&tv3, &tz); -- if (b.usesegments && !b.refine) { -- printf("Segment milliseconds: %ld\n", -- 1000l * (tv3.tv_sec - tv2.tv_sec) + -- (tv3.tv_usec - tv2.tv_usec) / 1000l); -- } -- } --#endif /* not NO_TIMER */ -- -- if (b.poly && (m.triangles.items > 0)) { --#ifdef TRILIBRARY -- holearray = in->holelist; -- m.holes = in->numberofholes; -- regionarray = in->regionlist; -- m.regions = in->numberofregions; --#else /* not TRILIBRARY */ -- readholes(&m, &b, polyfile, b.inpolyfilename, &holearray, &m.holes, -- ®ionarray, &m.regions); --#endif /* not TRILIBRARY */ -- if (!b.refine) { -- /* Carve out holes and concavities. */ -- carveholes(&m, &b, holearray, m.holes, regionarray, m.regions); -- } -- } else { -- /* Without a PSLG, there can be no holes or regional attributes */ -- /* or area constraints. The following are set to zero to avoid */ -- /* an accidental free() later. */ -- m.holes = 0; -- m.regions = 0; -- } -- --#ifndef NO_TIMER -- if (!b.quiet) { -- gettimeofday(&tv4, &tz); -- if (b.poly && !b.refine) { -- printf("Hole milliseconds: %ld\n", 1000l * (tv4.tv_sec - tv3.tv_sec) + -- (tv4.tv_usec - tv3.tv_usec) / 1000l); -- } -- } --#endif /* not NO_TIMER */ -- --#ifndef CDT_ONLY -- if (b.quality && (m.triangles.items > 0)) { -- enforcequality(&m, &b); /* Enforce angle and area constraints. */ -- } --#endif /* not CDT_ONLY */ -- --#ifndef NO_TIMER -- if (!b.quiet) { -- gettimeofday(&tv5, &tz); --#ifndef CDT_ONLY -- if (b.quality) { -- printf("Quality milliseconds: %ld\n", -- 1000l * (tv5.tv_sec - tv4.tv_sec) + -- (tv5.tv_usec - tv4.tv_usec) / 1000l); -- } --#endif /* not CDT_ONLY */ -- } --#endif /* not NO_TIMER */ -- -- /* Calculate the number of edges. */ -- m.edges = (3l * m.triangles.items + m.hullsize) / 2l; -- -- if (b.order > 1) { -- highorder(&m, &b); /* Promote elements to higher polynomial order. */ -- } -- if (!b.quiet) { -- printf("\n"); -- } -- --#ifdef TRILIBRARY -- if (b.jettison) { -- out->numberofpoints = m.vertices.items - m.undeads; -- } else { -- out->numberofpoints = m.vertices.items; -- } -- out->numberofpointattributes = m.nextras; -- out->numberoftriangles = m.triangles.items; -- out->numberofcorners = (b.order + 1) * (b.order + 2) / 2; -- out->numberoftriangleattributes = m.eextras; -- out->numberofedges = m.edges; -- if (b.usesegments) { -- out->numberofsegments = m.subsegs.items; -- } else { -- out->numberofsegments = m.hullsize; -- } -- if (vorout != (struct triangulateio *) NULL) { -- vorout->numberofpoints = m.triangles.items; -- vorout->numberofpointattributes = m.nextras; -- vorout->numberofedges = m.edges; -- } --#endif /* TRILIBRARY */ -- /* If not using iteration numbers, don't write a .node file if one was */ -- /* read, because the original one would be overwritten! */ -- if (b.nonodewritten || (b.noiterationnum && m.readnodefile)) { -- if (!b.quiet) { --#ifdef TRILIBRARY -- printf("NOT writing vertices.\n"); --#else /* not TRILIBRARY */ -- printf("NOT writing a .node file.\n"); --#endif /* not TRILIBRARY */ -- } -- numbernodes(&m, &b); /* We must remember to number the vertices. */ -- } else { -- /* writenodes() numbers the vertices too. */ --#ifdef TRILIBRARY -- writenodes(&m, &b, &out->pointlist, &out->pointattributelist, -- &out->pointmarkerlist); --#else /* not TRILIBRARY */ -- writenodes(&m, &b, b.outnodefilename, argc, argv); --#endif /* TRILIBRARY */ -- } -- if (b.noelewritten) { -- if (!b.quiet) { --#ifdef TRILIBRARY -- printf("NOT writing triangles.\n"); --#else /* not TRILIBRARY */ -- printf("NOT writing an .ele file.\n"); --#endif /* not TRILIBRARY */ -- } -- } else { --#ifdef TRILIBRARY -- writeelements(&m, &b, &out->trianglelist, &out->triangleattributelist); --#else /* not TRILIBRARY */ -- writeelements(&m, &b, b.outelefilename, argc, argv); --#endif /* not TRILIBRARY */ -- } -- /* The -c switch (convex switch) causes a PSLG to be written */ -- /* even if none was read. */ -- if (b.poly || b.convex) { -- /* If not using iteration numbers, don't overwrite the .poly file. */ -- if (b.nopolywritten || b.noiterationnum) { -- if (!b.quiet) { --#ifdef TRILIBRARY -- printf("NOT writing segments.\n"); --#else /* not TRILIBRARY */ -- printf("NOT writing a .poly file.\n"); --#endif /* not TRILIBRARY */ -- } -- } else { --#ifdef TRILIBRARY -- writepoly(&m, &b, &out->segmentlist, &out->segmentmarkerlist); -- out->numberofholes = m.holes; -- out->numberofregions = m.regions; -- if (b.poly) { -- out->holelist = in->holelist; -- out->regionlist = in->regionlist; -- } else { -- out->holelist = (REAL *) NULL; -- out->regionlist = (REAL *) NULL; -- } --#else /* not TRILIBRARY */ -- writepoly(&m, &b, b.outpolyfilename, holearray, m.holes, regionarray, -- m.regions, argc, argv); --#endif /* not TRILIBRARY */ -- } -- } --#ifndef TRILIBRARY --#ifndef CDT_ONLY -- if (m.regions > 0) { -- trifree((void *) regionarray); -- } --#endif /* not CDT_ONLY */ -- if (m.holes > 0) { -- trifree((void *) holearray); -- } -- if (b.geomview) { -- writeoff(&m, &b, b.offfilename, argc, argv); -- } --#endif /* not TRILIBRARY */ -- if (b.edgesout) { --#ifdef TRILIBRARY -- writeedges(&m, &b, &out->edgelist, &out->edgemarkerlist); --#else /* not TRILIBRARY */ -- writeedges(&m, &b, b.edgefilename, argc, argv); --#endif /* not TRILIBRARY */ -- } -- if (b.voronoi) { --#ifdef TRILIBRARY -- writevoronoi(&m, &b, &vorout->pointlist, &vorout->pointattributelist, -- &vorout->pointmarkerlist, &vorout->edgelist, -- &vorout->edgemarkerlist, &vorout->normlist); --#else /* not TRILIBRARY */ -- writevoronoi(&m, &b, b.vnodefilename, b.vedgefilename, argc, argv); --#endif /* not TRILIBRARY */ -- } -- if (b.neighbors) { --#ifdef TRILIBRARY -- writeneighbors(&m, &b, &out->neighborlist); --#else /* not TRILIBRARY */ -- writeneighbors(&m, &b, b.neighborfilename, argc, argv); --#endif /* not TRILIBRARY */ -- } -- -- if (!b.quiet) { --#ifndef NO_TIMER -- gettimeofday(&tv6, &tz); -- printf("\nOutput milliseconds: %ld\n", -- 1000l * (tv6.tv_sec - tv5.tv_sec) + -- (tv6.tv_usec - tv5.tv_usec) / 1000l); -- printf("Total running milliseconds: %ld\n", -- 1000l * (tv6.tv_sec - tv0.tv_sec) + -- (tv6.tv_usec - tv0.tv_usec) / 1000l); --#endif /* not NO_TIMER */ -- -- statistics(&m, &b); -- } -- --#ifndef REDUCED -- if (b.docheck) { -- checkmesh(&m, &b); -- checkdelaunay(&m, &b); -- } --#endif /* not REDUCED */ -- -- triangledeinit(&m, &b); --#ifndef TRILIBRARY -- return 0; --#endif /* not TRILIBRARY */ --}; -diff --git a/v3p/netlib/triangle.h b/v3p/netlib/triangle.h -deleted file mode 100644 -index de14cb5395..0000000000 ---- a/v3p/netlib/triangle.h -+++ /dev/null -@@ -1,299 +0,0 @@ --#ifndef netlib_triangle_h_ --#define netlib_triangle_h_ --/*****************************************************************************/ --/* */ --/* (triangle.h) */ --/* */ --/* Include file for programs that call Triangle. */ --/* */ --/* Accompanies Triangle Version 1.6 */ --/* July 28, 2005 */ --/* */ --/* Copyright 1996, 2005 */ --/* Jonathan Richard Shewchuk */ --/* 2360 Woolsey #H */ --/* Berkeley, California 94705-1927 */ --/* jrs@cs.berkeley.edu */ --/* */ --/*****************************************************************************/ -- --/*****************************************************************************/ --/* */ --/* How to call Triangle from another program */ --/* */ --/* */ --/* If you haven't read Triangle's instructions (run "triangle -h" to read */ --/* them), you won't understand what follows. */ --/* */ --/* Triangle must be compiled into an object file (triangle.o) with the */ --/* TRILIBRARY symbol defined (generally by using the -DTRILIBRARY compiler */ --/* switch). The makefile included with Triangle will do this for you if */ --/* you run "make trilibrary". The resulting object file can be called via */ --/* the procedure triangulate(). */ --/* */ --/* If the size of the object file is important to you, you may wish to */ --/* generate a reduced version of triangle.o. The REDUCED symbol gets rid */ --/* of all features that are primarily of research interest. Specifically, */ --/* the -DREDUCED switch eliminates Triangle's -i, -F, -s, and -C switches. */ --/* The CDT_ONLY symbol gets rid of all meshing algorithms above and beyond */ --/* constrained Delaunay triangulation. Specifically, the -DCDT_ONLY switch */ --/* eliminates Triangle's -r, -q, -a, -u, -D, -Y, -S, and -s switches. */ --/* */ --/* IMPORTANT: These definitions (TRILIBRARY, REDUCED, CDT_ONLY) must be */ --/* made in the makefile or in triangle.c itself. Putting these definitions */ --/* in this file (triangle.h) will not create the desired effect. */ --/* */ --/* */ --/* The calling convention for triangulate() follows. */ --/* */ --/* void triangulate(triswitches, in, out, vorout) */ --/* char *triswitches; */ --/* struct triangulateio *in; */ --/* struct triangulateio *out; */ --/* struct triangulateio *vorout; */ --/* */ --/* `triswitches' is a string containing the command line switches you wish */ --/* to invoke. No initial dash is required. Some suggestions: */ --/* */ --/* - You'll probably find it convenient to use the `z' switch so that */ --/* points (and other items) are numbered from zero. This simplifies */ --/* indexing, because the first item of any type always starts at index */ --/* [0] of the corresponding array, whether that item's number is zero or */ --/* one. */ --/* - You'll probably want to use the `Q' (quiet) switch in your final code, */ --/* but you can take advantage of Triangle's printed output (including the */ --/* `V' switch) while debugging. */ --/* - If you are not using the `q', `a', `u', `D', `j', or `s' switches, */ --/* then the output points will be identical to the input points, except */ --/* possibly for the boundary markers. If you don't need the boundary */ --/* markers, you should use the `N' (no nodes output) switch to save */ --/* memory. (If you do need boundary markers, but need to save memory, a */ --/* good nasty trick is to set out->pointlist equal to in->pointlist */ --/* before calling triangulate(), so that Triangle overwrites the input */ --/* points with identical copies.) */ --/* - The `I' (no iteration numbers) and `g' (.off file output) switches */ --/* have no effect when Triangle is compiled with TRILIBRARY defined. */ --/* */ --/* `in', `out', and `vorout' are descriptions of the input, the output, */ --/* and the Voronoi output. If the `v' (Voronoi output) switch is not used, */ --/* `vorout' may be NULL. `in' and `out' may never be NULL. */ --/* */ --/* Certain fields of the input and output structures must be initialized, */ --/* as described below. */ --/* */ --/*****************************************************************************/ -- --/*****************************************************************************/ --/* */ --/* The `triangulateio' structure. */ --/* */ --/* Used to pass data into and out of the triangulate() procedure. */ --/* */ --/* */ --/* Arrays are used to store points, triangles, markers, and so forth. In */ --/* all cases, the first item in any array is stored starting at index [0]. */ --/* However, that item is item number `1' unless the `z' switch is used, in */ --/* which case it is item number `0'. Hence, you may find it easier to */ --/* index points (and triangles in the neighbor list) if you use the `z' */ --/* switch. Unless, of course, you're calling Triangle from a Fortran */ --/* program. */ --/* */ --/* Description of fields (except the `numberof' fields, which are obvious): */ --/* */ --/* `pointlist': An array of point coordinates. The first point's x */ --/* coordinate is at index [0] and its y coordinate at index [1], followed */ --/* by the coordinates of the remaining points. Each point occupies two */ --/* REALs. */ --/* `pointattributelist': An array of point attributes. Each point's */ --/* attributes occupy `numberofpointattributes' REALs. */ --/* `pointmarkerlist': An array of point markers; one int per point. */ --/* */ --/* `trianglelist': An array of triangle corners. The first triangle's */ --/* first corner is at index [0], followed by its other two corners in */ --/* counterclockwise order, followed by any other nodes if the triangle */ --/* represents a nonlinear element. Each triangle occupies */ --/* `numberofcorners' ints. */ --/* `triangleattributelist': An array of triangle attributes. Each */ --/* triangle's attributes occupy `numberoftriangleattributes' REALs. */ --/* `trianglearealist': An array of triangle area constraints; one REAL per */ --/* triangle. Input only. */ --/* `neighborlist': An array of triangle neighbors; three ints per */ --/* triangle. Output only. */ --/* */ --/* `segmentlist': An array of segment endpoints. The first segment's */ --/* endpoints are at indices [0] and [1], followed by the remaining */ --/* segments. Two ints per segment. */ --/* `segmentmarkerlist': An array of segment markers; one int per segment. */ --/* */ --/* `holelist': An array of holes. The first hole's x and y coordinates */ --/* are at indices [0] and [1], followed by the remaining holes. Two */ --/* REALs per hole. Input only, although the pointer is copied to the */ --/* output structure for your convenience. */ --/* */ --/* `regionlist': An array of regional attributes and area constraints. */ --/* The first constraint's x and y coordinates are at indices [0] and [1], */ --/* followed by the regional attribute at index [2], followed by the */ --/* maximum area at index [3], followed by the remaining area constraints. */ --/* Four REALs per area constraint. Note that each regional attribute is */ --/* used only if you select the `A' switch, and each area constraint is */ --/* used only if you select the `a' switch (with no number following), but */ --/* omitting one of these switches does not change the memory layout. */ --/* Input only, although the pointer is copied to the output structure for */ --/* your convenience. */ --/* */ --/* `edgelist': An array of edge endpoints. The first edge's endpoints are */ --/* at indices [0] and [1], followed by the remaining edges. Two ints per */ --/* edge. Output only. */ --/* `edgemarkerlist': An array of edge markers; one int per edge. Output */ --/* only. */ --/* `normlist': An array of normal vectors, used for infinite rays in */ --/* Voronoi diagrams. The first normal vector's x and y magnitudes are */ --/* at indices [0] and [1], followed by the remaining vectors. For each */ --/* finite edge in a Voronoi diagram, the normal vector written is the */ --/* zero vector. Two REALs per edge. Output only. */ --/* */ --/* */ --/* Any input fields that Triangle will examine must be initialized. */ --/* Furthermore, for each output array that Triangle will write to, you */ --/* must either provide space by setting the appropriate pointer to point */ --/* to the space you want the data written to, or you must initialize the */ --/* pointer to NULL, which tells Triangle to allocate space for the results. */ --/* The latter option is preferable, because Triangle always knows exactly */ --/* how much space to allocate. The former option is provided mainly for */ --/* people who need to call Triangle from Fortran code, though it also makes */ --/* possible some nasty space-saving tricks, like writing the output to the */ --/* same arrays as the input. */ --/* */ --/* Triangle will not free() any input or output arrays, including those it */ --/* allocates itself; that's up to you. You should free arrays allocated by */ --/* Triangle by calling the trifree() procedure defined below. (By default, */ --/* trifree() just calls the standard free() library procedure, but */ --/* applications that call triangulate() may replace trimalloc() and */ --/* trifree() in triangle.c to use specialized memory allocators.) */ --/* */ --/* Here's a guide to help you decide which fields you must initialize */ --/* before you call triangulate(). */ --/* */ --/* `in': */ --/* */ --/* - `pointlist' must always point to a list of points; `numberofpoints' */ --/* and `numberofpointattributes' must be properly set. */ --/* `pointmarkerlist' must either be set to NULL (in which case all */ --/* markers default to zero), or must point to a list of markers. If */ --/* `numberofpointattributes' is not zero, `pointattributelist' must */ --/* point to a list of point attributes. */ --/* - If the `r' switch is used, `trianglelist' must point to a list of */ --/* triangles, and `numberoftriangles', `numberofcorners', and */ --/* `numberoftriangleattributes' must be properly set. If */ --/* `numberoftriangleattributes' is not zero, `triangleattributelist' */ --/* must point to a list of triangle attributes. If the `a' switch is */ --/* used (with no number following), `trianglearealist' must point to a */ --/* list of triangle area constraints. `neighborlist' may be ignored. */ --/* - If the `p' switch is used, `segmentlist' must point to a list of */ --/* segments, `numberofsegments' must be properly set, and */ --/* `segmentmarkerlist' must either be set to NULL (in which case all */ --/* markers default to zero), or must point to a list of markers. */ --/* - If the `p' switch is used without the `r' switch, then */ --/* `numberofholes' and `numberofregions' must be properly set. If */ --/* `numberofholes' is not zero, `holelist' must point to a list of */ --/* holes. If `numberofregions' is not zero, `regionlist' must point to */ --/* a list of region constraints. */ --/* - If the `p' switch is used, `holelist', `numberofholes', */ --/* `regionlist', and `numberofregions' is copied to `out'. (You can */ --/* nonetheless get away with not initializing them if the `r' switch is */ --/* used.) */ --/* - `edgelist', `edgemarkerlist', `normlist', and `numberofedges' may be */ --/* ignored. */ --/* */ --/* `out': */ --/* */ --/* - `pointlist' must be initialized (NULL or pointing to memory) unless */ --/* the `N' switch is used. `pointmarkerlist' must be initialized */ --/* unless the `N' or `B' switch is used. If `N' is not used and */ --/* `in->numberofpointattributes' is not zero, `pointattributelist' must */ --/* be initialized. */ --/* - `trianglelist' must be initialized unless the `E' switch is used. */ --/* `neighborlist' must be initialized if the `n' switch is used. If */ --/* the `E' switch is not used and (`in->numberofelementattributes' is */ --/* not zero or the `A' switch is used), `elementattributelist' must be */ --/* initialized. `trianglearealist' may be ignored. */ --/* - `segmentlist' must be initialized if the `p' or `c' switch is used, */ --/* and the `P' switch is not used. `segmentmarkerlist' must also be */ --/* initialized under these circumstances unless the `B' switch is used. */ --/* - `edgelist' must be initialized if the `e' switch is used. */ --/* `edgemarkerlist' must be initialized if the `e' switch is used and */ --/* the `B' switch is not. */ --/* - `holelist', `regionlist', `normlist', and all scalars may be ignored.*/ --/* */ --/* `vorout' (only needed if `v' switch is used): */ --/* */ --/* - `pointlist' must be initialized. If `in->numberofpointattributes' */ --/* is not zero, `pointattributelist' must be initialized. */ --/* `pointmarkerlist' may be ignored. */ --/* - `edgelist' and `normlist' must both be initialized. */ --/* `edgemarkerlist' may be ignored. */ --/* - Everything else may be ignored. */ --/* */ --/* After a call to triangulate(), the valid fields of `out' and `vorout' */ --/* will depend, in an obvious way, on the choice of switches used. Note */ --/* that when the `p' switch is used, the pointers `holelist' and */ --/* `regionlist' are copied from `in' to `out', but no new space is */ --/* allocated; be careful that you don't free() the same array twice. On */ --/* the other hand, Triangle will never copy the `pointlist' pointer (or any */ --/* others); new space is allocated for `out->pointlist', or if the `N' */ --/* switch is used, `out->pointlist' remains uninitialized. */ --/* */ --/* All of the meaningful `numberof' fields will be properly set; for */ --/* instance, `numberofedges' will represent the number of edges in the */ --/* triangulation whether or not the edges were written. If segments are */ --/* not used, `numberofsegments' will indicate the number of boundary edges. */ --/* */ --/*****************************************************************************/ --#undef REAL --#ifdef SINGLE --#define REAL float --#else /* not SINGLE */ --#define REAL double --#endif /* not SINGLE */ -- --struct triangulateio { -- REAL *pointlist; /* In / out */ -- REAL *pointattributelist; /* In / out */ -- int *pointmarkerlist; /* In / out */ -- int numberofpoints; /* In / out */ -- int numberofpointattributes; /* In / out */ -- -- int *trianglelist; /* In / out */ -- REAL *triangleattributelist; /* In / out */ -- REAL *trianglearealist; /* In only */ -- int *neighborlist; /* Out only */ -- int numberoftriangles; /* In / out */ -- int numberofcorners; /* In / out */ -- int numberoftriangleattributes; /* In / out */ -- -- int *segmentlist; /* In / out */ -- int *segmentmarkerlist; /* In / out */ -- int numberofsegments; /* In / out */ -- -- REAL *holelist; /* In / pointer to array copied out */ -- int numberofholes; /* In / copied out */ -- -- REAL *regionlist; /* In / pointer to array copied out */ -- int numberofregions; /* In / copied out */ -- -- int *edgelist; /* Out only */ -- int *edgemarkerlist; /* Not used with Voronoi diagram; out only */ -- REAL *normlist; /* Used only with Voronoi diagram; out only */ -- int numberofedges; /* Out only */ --}; -- --#define ANSI_DECLARATORS --#ifdef ANSI_DECLARATORS --void triangulate(const char * const, struct triangulateio *, struct triangulateio *, -- struct triangulateio *); --void trifree(void *memptr); --#else /* not ANSI_DECLARATORS */ --void triangulate(); --void trifree(); --#endif /* not ANSI_DECLARATORS */ --#endif /* netlib_triangle_h_ */ --- -2.46.1 - diff --git a/0006-v3.5.0-Correct-rply-includedir.patch b/0008-v2.0.2-Correct-rply-includedir.patch similarity index 67% rename from 0006-v3.5.0-Correct-rply-includedir.patch rename to 0008-v2.0.2-Correct-rply-includedir.patch index c579c1d..588393f 100644 --- a/0006-v3.5.0-Correct-rply-includedir.patch +++ b/0008-v2.0.2-Correct-rply-includedir.patch @@ -1,15 +1,16 @@ -From 2252a472803e52dd504e243593f32f4312342591 Mon Sep 17 00:00:00 2001 +From 074e01ca47a9c1379f293271ddc0470d8ddf5c9d Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Thu, 25 Apr 2019 23:32:15 +0100 -Subject: [PATCH 06/18] v3.5.0 Correct rply includedir +Subject: [PATCH 8/9] v2.0.2 Correct rply includedir --- - contrib/brl/bbas/bvrml/pro/CMakeLists.txt | 8 +++++++- - contrib/brl/bbas/bwm/exe/CMakeLists.txt | 8 +++++++- - contrib/brl/bbas/volm/pro/CMakeLists.txt | 8 +++++++- - contrib/brl/bseg/boxm2/pro/CMakeLists.txt | 7 +++++++ - contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt | 10 +++++++++- - 5 files changed, 37 insertions(+), 4 deletions(-) + contrib/brl/bbas/bvrml/pro/CMakeLists.txt | 8 +++++++- + contrib/brl/bbas/bwm/exe/CMakeLists.txt | 8 +++++++- + contrib/brl/bbas/volm/pro/CMakeLists.txt | 8 +++++++- + contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt | 7 +++++++ + contrib/brl/bseg/boxm2/pro/CMakeLists.txt | 7 +++++++ + contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt | 7 +++++++ + 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/contrib/brl/bbas/bvrml/pro/CMakeLists.txt b/contrib/brl/bbas/bvrml/pro/CMakeLists.txt index c1c82d0dd4..3a82f2e050 100644 @@ -68,6 +69,31 @@ index 76c1216a4f..aa028ca71f 100644 # The N-dimensional bin structure implementations use rpl/rsdl +diff --git a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt +index c821d10a77..2a41c2db1a 100644 +--- a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt +@@ -3,13 +3,20 @@ + # bprb depends on expat and bvxm_pro depends on bprb primarily + FIND_PACKAGE(EXPAT REQUIRED) + FIND_PACKAGE(EXPATPP REQUIRED) ++ + if(EXPAT_FOUND) + include_directories( ${BRL_INCLUDE_DIR}/bpro ) + include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) + include_directories( ${BRL_INCLUDE_DIR}/bseg ) + include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) + include_directories( ${GEL_INCLUDE_DIR}/mrc ) ++ ++FIND_PACKAGE(RPLY REQUIRED) ++if(RPLY_FOUND) ++ include_directories( ${RPLY_INCLUDE_DIR} ) ++else() + include_directories( ${VTHREEP_INCLUDE_DIR}/rply ) ++endif() + + set(boxm_algo_pro_sources + boxm_algo_processes.h diff --git a/contrib/brl/bseg/boxm2/pro/CMakeLists.txt b/contrib/brl/bseg/boxm2/pro/CMakeLists.txt index 7c2ec1d9c3..0536e327fd 100644 --- a/contrib/brl/bseg/boxm2/pro/CMakeLists.txt @@ -88,10 +114,10 @@ index 7c2ec1d9c3..0536e327fd 100644 set(boxm2_pro_sources boxm2_processes.h diff --git a/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt b/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt -index 265cd5d066..2ec707047f 100644 +index bea0c2c32d..f19374be80 100644 --- a/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt +++ b/contrib/brl/bseg/boxm2/volm/pro/CMakeLists.txt -@@ -11,8 +11,16 @@ if(EXPAT_FOUND) +@@ -11,7 +11,14 @@ if(EXPAT_FOUND) include_directories( ${BRL_INCLUDE_DIR}/bbas ) include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) include_directories( ${GEL_INCLUDE_DIR}/mrc ) @@ -101,14 +127,11 @@ index 265cd5d066..2ec707047f 100644 + include_directories( ${RPLY_INCLUDE_DIR} ) +else() include_directories( ${VTHREEP_INCLUDE_DIR}/rply ) --if(OpenCL_FOUND) +endif() + -+if(OPENCL_FOUND) -+ include_directories( ${OPENCL_INCLUDE_PATH} ) + if(OPENCL_FOUND) + include_directories( ${OPENCL_INCLUDE_PATH} ) set( BOXM2_VOLM_PRO_LIBS boxm2_ocl) - endif() - -- -2.46.1 +2.21.0 diff --git a/0008-v3.5.0-remove-bits-using-triangle.patch b/0008-v3.5.0-remove-bits-using-triangle.patch deleted file mode 100644 index e4e8a22..0000000 --- a/0008-v3.5.0-remove-bits-using-triangle.patch +++ /dev/null @@ -1,2051 +0,0 @@ -From da8df48049aa20240103f6da054d5245faa88c04 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 23 Oct 2023 11:31:49 +0100 -Subject: [PATCH 08/18] v3.5.0: remove bits using triangle - ---- - contrib/brl/bbas/imesh/algo/CMakeLists.txt | 11 - - .../bbas/imesh/algo/imesh_generate_mesh.cxx | 282 ------ - .../brl/bbas/imesh/algo/imesh_generate_mesh.h | 34 - - .../brl/bbas/imesh/algo/tests/CMakeLists.txt | 10 - - .../brl/bbas/imesh/algo/tests/test_driver.cxx | 12 - - .../imesh/algo/tests/test_generate_mesh.cxx | 53 -- - .../bbas/imesh/algo/tests/test_include.cxx | 1 - - contrib/brl/bseg/boxm2/pro/boxm2_processes.h | 1 - - contrib/brl/bseg/boxm2/pro/boxm2_register.cxx | 1 - - .../processes/boxm2_texture_mesh_process.cxx | 842 ------------------ - contrib/brl/bseg/sdet/CMakeLists.txt | 1 - - contrib/brl/bseg/sdet/sdet_image_mesh.cxx | 327 ------- - contrib/brl/bseg/sdet/sdet_image_mesh.h | 63 -- - contrib/brl/bseg/sdet/tests/test_include.cxx | 1 - - contrib/gel/gtrl/CMakeLists.txt | 13 - - contrib/gel/gtrl/examples/.NoDartCoverage | 0 - contrib/gel/gtrl/examples/CMakeLists.txt | 2 - - contrib/gel/gtrl/examples/triangulate.cxx | 45 - - contrib/gel/gtrl/gtrl_triangulation.cxx | 110 --- - contrib/gel/gtrl/gtrl_triangulation.h | 31 - - contrib/gel/gtrl/tests/test_include.cxx | 1 - - 21 files changed, 1841 deletions(-) - delete mode 100644 contrib/brl/bbas/imesh/algo/imesh_generate_mesh.cxx - delete mode 100644 contrib/brl/bbas/imesh/algo/imesh_generate_mesh.h - delete mode 100644 contrib/brl/bbas/imesh/algo/tests/test_driver.cxx - delete mode 100644 contrib/brl/bbas/imesh/algo/tests/test_generate_mesh.cxx - delete mode 100644 contrib/brl/bseg/boxm2/pro/processes/boxm2_texture_mesh_process.cxx - delete mode 100644 contrib/brl/bseg/sdet/sdet_image_mesh.cxx - delete mode 100644 contrib/brl/bseg/sdet/sdet_image_mesh.h - delete mode 100644 contrib/gel/gtrl/examples/.NoDartCoverage - delete mode 100644 contrib/gel/gtrl/examples/CMakeLists.txt - delete mode 100644 contrib/gel/gtrl/examples/triangulate.cxx - delete mode 100644 contrib/gel/gtrl/gtrl_triangulation.cxx - delete mode 100644 contrib/gel/gtrl/gtrl_triangulation.h - -diff --git a/contrib/brl/bbas/imesh/algo/CMakeLists.txt b/contrib/brl/bbas/imesh/algo/CMakeLists.txt -index cdf5af2819..38efa0d264 100644 ---- a/contrib/brl/bbas/imesh/algo/CMakeLists.txt -+++ b/contrib/brl/bbas/imesh/algo/CMakeLists.txt -@@ -16,20 +16,9 @@ set(imesh_algo_sources - ) - aux_source_directory(Templates imesh_algo_sources) - --if(NETLIB_FOUND) -- include_directories( ${NETLIB_INCLUDE_DIR} ) -- set(imesh_algo_sources ${imesh_algo_sources} -- imesh_generate_mesh.cxx imesh_generate_mesh.h) --endif() -- - vxl_add_library(LIBRARY_NAME imesh_algo LIBRARY_SOURCES ${imesh_algo_sources} ) - --if(NETLIB_FOUND) -- --target_link_libraries( imesh_algo imesh ${VXL_LIB_PREFIX}vpgl bpgl bpgl_algo ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vil netlib) --else() - target_link_libraries( imesh_algo imesh ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vil ) --endif() - - - if( BUILD_TESTING ) -diff --git a/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.cxx b/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.cxx -deleted file mode 100644 -index 423a673bb3..0000000000 ---- a/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.cxx -+++ /dev/null -@@ -1,282 +0,0 @@ --// This is brl/bbas/imesh/algo/imesh_generate_mesh.cxx --#include --#include "imesh_generate_mesh.h" --//: --// \file --extern "C" { --#include --} --#include --#include "vgl/vgl_point_2d.h" --#include "vgl/vgl_line_segment_2d.h" --#include "vgl/vgl_box_2d.h" --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif --#include "vil/vil_image_view.h" --#define GRID_SIZE 1000 // defined by the tolerance for equal vertices -- --// a grid index to find coincident vertices --class point_index --{ -- public: -- point_index(vgl_box_2d const& bb) -- : vi_(0), x_min_(bb.min_x()), y_min_(bb.min_y()), -- x_size_(bb.width()), y_size_(bb.height()) -- { -- img_.set_size(GRID_SIZE, GRID_SIZE); -- img_.fill(-1);//no vert at location -- } -- -- void pt_to_img(vgl_point_2d const& pt, unsigned& i, unsigned& j) -- { -- double xi = pt.x()-x_min_, yi = pt.y()-y_min_; -- i = static_cast((xi*GRID_SIZE)/x_size_); -- j = static_cast((yi*GRID_SIZE)/y_size_); -- if (i>=GRID_SIZE) i=GRID_SIZE-1; -- if (j>=GRID_SIZE) j=GRID_SIZE-1; -- } -- -- void insert_point(vgl_point_2d const& pt) -- { -- unsigned i=0, j=0; -- pt_to_img(pt, i, j); -- if (img_(i,j)>=0) -- return;//point already exists -- //insert vertex index -- img_(i,j) = vi_++; -- } -- -- int vert_index(vgl_point_2d const& pt) -- { -- unsigned i=0, j=0; -- pt_to_img(pt, i, j); -- int index = img_(i,j); -- assert(index>=0); -- return index; -- } -- -- unsigned size() const {return vi_;} -- -- private: -- unsigned vi_; -- double x_min_; -- double y_min_; -- double x_size_; -- double y_size_; -- vil_image_view img_; --}; -- --void --imesh_generate_mesh_2d(std::vector > const& convex_hull, -- std::vector > const& segs, -- imesh_mesh& mesh) --{ -- // form a grid to store vertex indices in order to detect -- // shared vertices -- unsigned nch = convex_hull.size(); -- vgl_box_2d bb; -- for (unsigned i = 0; i(); -- unsigned k = 0; -- for (unsigned i = 0; ipush_back(imesh_vertex<2>(out.pointlist[k], out.pointlist[k+1])); -- std::unique_ptr v(verts); -- mesh.set_vertices(std::move(v)); -- //construct triangular faces -- auto ntri = static_cast(out.numberoftriangles); -- auto* faces = new imesh_regular_face_array<3>(); -- for (unsigned t = 0; tpush_back(tri); -- } -- //set the faces on the mesh -- std::unique_ptr f(faces); -- mesh.set_faces(std::move(f)); --} -- -- --void --imesh_generate_mesh_2d_2(std::vector > const& convex_hull, -- std::vector > const& segs, -- std::vector > const & points, -- imesh_mesh& mesh) --{ -- // form a grid to store vertex indices in order to detect -- // shared vertices -- unsigned nch = convex_hull.size(); -- vgl_box_2d bb; -- for (unsigned i = 0; i(); -- unsigned k = 0; -- for (unsigned i = 0; ipush_back(imesh_vertex<2>(out.pointlist[k], out.pointlist[k+1])); -- std::unique_ptr v(verts); -- mesh.set_vertices(std::move(v)); -- //construct triangular faces -- auto ntri = static_cast(out.numberoftriangles); -- auto* faces = new imesh_regular_face_array<3>(); -- for (unsigned t = 0; tpush_back(tri); -- } -- //set the faces on the mesh -- std::unique_ptr f(faces); -- mesh.set_faces(std::move(f)); --} -diff --git a/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.h b/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.h -deleted file mode 100644 -index 9736c69aad..0000000000 ---- a/contrib/brl/bbas/imesh/algo/imesh_generate_mesh.h -+++ /dev/null -@@ -1,34 +0,0 @@ --// This is brl/bbas/imesh/algo/imesh_generate_mesh.h --#ifndef imesh_generate_mesh_h_ --#define imesh_generate_mesh_h_ --//: --// \file --// \brief mesh generation functions --// \author J.L. Mundy --// \date March 16, 2011 --// --// \verbatim --// Modifications --// --// \endverbatim -- --#include --#include --#include --#ifdef _MSC_VER --# include --#endif --#include -- --//: Fill the convex hull with triangles, constrained by the line segments --void --imesh_generate_mesh_2d(std::vector > const& convex_hull, -- std::vector< vgl_line_segment_2d > const & segs, -- imesh_mesh& mesh); --void --imesh_generate_mesh_2d_2(std::vector > const& convex_hull, -- std::vector > const& segs, -- std::vector > const & points, -- imesh_mesh& mesh); -- --#endif // imesh_generate_mesh_h_ -diff --git a/contrib/brl/bbas/imesh/algo/tests/CMakeLists.txt b/contrib/brl/bbas/imesh/algo/tests/CMakeLists.txt -index fe15f6b4a2..7d58eba683 100644 ---- a/contrib/brl/bbas/imesh/algo/tests/CMakeLists.txt -+++ b/contrib/brl/bbas/imesh/algo/tests/CMakeLists.txt -@@ -5,13 +5,3 @@ add_executable( imesh_algo_test_template_include test_template_include.cxx ) - target_link_libraries( imesh_algo_test_template_include imesh_algo) - - include( ${VXL_CMAKE_DIR}/FindNetlib.cmake ) --if(NETLIB_FOUND) --add_executable( imesh_algo_test_all -- test_driver.cxx -- test_generate_mesh.cxx --) --target_link_libraries( imesh_algo_test_all imesh imesh_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}testlib ) --if( VXL_RUN_FAILING_TESTS ) ## This test always fails in travis builds, segfault during memory free operation --add_test( NAME imesh_test_generate_mesh COMMAND $ test_generate_mesh) --endif() --endif() -diff --git a/contrib/brl/bbas/imesh/algo/tests/test_driver.cxx b/contrib/brl/bbas/imesh/algo/tests/test_driver.cxx -deleted file mode 100644 -index d21c4aefc0..0000000000 ---- a/contrib/brl/bbas/imesh/algo/tests/test_driver.cxx -+++ /dev/null -@@ -1,12 +0,0 @@ --#include "testlib/testlib_register.h" -- -- --DECLARE( test_generate_mesh ); -- --void --register_tests() --{ -- REGISTER( test_generate_mesh ); --} -- --DEFINE_MAIN; -diff --git a/contrib/brl/bbas/imesh/algo/tests/test_generate_mesh.cxx b/contrib/brl/bbas/imesh/algo/tests/test_generate_mesh.cxx -deleted file mode 100644 -index 94f57f46ef..0000000000 ---- a/contrib/brl/bbas/imesh/algo/tests/test_generate_mesh.cxx -+++ /dev/null -@@ -1,53 +0,0 @@ --#include --#include --#include "testlib/testlib_test.h" --#include --#include "vgl/vgl_point_2d.h" --#include "vgl/vgl_line_segment_2d.h" --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif -- --static void test_generate_mesh() --{ -- vgl_point_2d p0(0.0, 0.0); -- vgl_point_2d p1(1.0, 0.0); -- vgl_point_2d p2(1.0, 10.0); -- vgl_point_2d p3(0.0, 10.0); -- vgl_point_2d p4(0.25, 5.0); -- vgl_point_2d p5(0.75, 5.0); -- std::vector > c_hull; -- c_hull.push_back(p0); c_hull.push_back(p1); -- c_hull.push_back(p2); c_hull.push_back(p3); -- vgl_line_segment_2d ls(p4, p5); -- std::vector > segs; -- segs.push_back(ls); -- imesh_mesh mesh; -- imesh_generate_mesh_2d(c_hull, segs, mesh); -- TEST("num_verts, num_faces", mesh.num_verts()*mesh.num_faces(), 36); -- const imesh_face_array_base& faces = mesh.faces(); -- TEST("face verts", faces(0,0)+faces(0,1)+faces(0,2), 7); -- vgl_point_2d p6(0.25, 1); -- vgl_point_2d p7(0.75, 1); -- vgl_line_segment_2d l2(p5, p7); -- segs.push_back(l2); -- imesh_mesh mesh2; -- imesh_generate_mesh_2d(c_hull, segs,mesh2); -- unsigned nverts = mesh2.num_verts(); -- unsigned ntris = mesh2.num_faces(); -- TEST("two segs", nverts*ntris, 56); --#if 0 -- const imesh_regular_face_array<3>& tris = -- static_cast&>(mesh2.faces()); -- const imesh_vertex_array<2>& verts = mesh2.vertices<2>(); -- std::cout << "verts\n"; -- for (unsigned i = 0; i< nverts; ++i) -- std::cout << "v[" << i << "](" << verts[i][0] << ' ' << verts[i][1] << ")\n"; -- std::cout << "faces\n"; -- for (unsigned i = 0; i< ntris; ++i) -- std::cout << "f[" << i << "](" << tris[i][0]<< ' ' << tris[i][1] -- << ' ' << tris[i][2] << ")\n"; --#endif --} -- --TESTMAIN(test_generate_mesh); -diff --git a/contrib/brl/bbas/imesh/algo/tests/test_include.cxx b/contrib/brl/bbas/imesh/algo/tests/test_include.cxx -index bc7bcd02e4..bc5f817ebe 100644 ---- a/contrib/brl/bbas/imesh/algo/tests/test_include.cxx -+++ b/contrib/brl/bbas/imesh/algo/tests/test_include.cxx -@@ -1,5 +1,4 @@ - #include --#include - #include - #include - #include -diff --git a/contrib/brl/bseg/boxm2/pro/boxm2_processes.h b/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -index feae6ae9b2..4d68be95b0 100644 ---- a/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -+++ b/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -@@ -15,7 +15,6 @@ DECLARE_FUNC_CONS(boxm2_write_scene_xml_process); - DECLARE_FUNC_CONS(boxm2_add_block_process); - DECLARE_FUNC_CONS(boxm2_export_textured_mesh_process); - DECLARE_FUNC_CONS(boxm2_export_mesh_process); --DECLARE_FUNC_CONS(boxm2_texture_mesh_process); - DECLARE_FUNC_CONS(boxm2_describe_scene_process); - DECLARE_FUNC_CONS(boxm2_create_stream_cache_process); - DECLARE_FUNC_CONS(boxm2_roi_init_process); -diff --git a/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx b/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -index ea5dfbd6e5..a05b9e5c58 100644 ---- a/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -+++ b/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -@@ -35,7 +35,6 @@ void boxm2_register::register_process() - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_add_block_process, "boxm2AddBlockProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_export_textured_mesh_process,"boxm2ExportTexturedMeshProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_export_mesh_process,"boxm2ExportMeshProcess"); -- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_texture_mesh_process,"boxm2TextureMeshProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_describe_scene_process,"boxm2DescribeSceneProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_create_stream_cache_process, "boxm2CreateStreamCacheProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_roi_init_process, "boxm2RoiInitProcess"); -diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_texture_mesh_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_texture_mesh_process.cxx -deleted file mode 100644 -index 8254869a0d..0000000000 ---- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_texture_mesh_process.cxx -+++ /dev/null -@@ -1,842 +0,0 @@ --// This is brl/bseg/boxm2/pro/processes/boxm2_texture_mesh_process.cxx --#include --#include --#include --//: --// \file --// \brief A process for exporting a texture mapped mesh of a scene --// --// \author Vishal Jain --// \date Mar 15, 2011 -- --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif --#include "vul/vul_file.h" --#include "vul/vul_timer.h" --#include "vnl/vnl_random.h" --#include --#include -- --//vil includes --#include "vil/vil_image_view.h" --#include "vil/vil_save.h" --#include -- --//vgl --#include "vgl/vgl_distance.h" --#include "vgl/vgl_triangle_scan_iterator.h" --#include -- --//vpgl camera stuff --#include "vpgl/vpgl_perspective_camera.h" --// for loading cameras from directory --#include -- --//det and imesh includes --#include --#include --#include --#include -- --namespace boxm2_texture_mesh_process_globals --{ -- constexpr unsigned n_inputs_ = 4; -- constexpr unsigned n_outputs_ = 0; -- -- //struct for passing 3d triangles (couldn't find a 3d triangle in VGL...) -- struct triangle_3d { -- vgl_point_3d points[3]; -- unsigned face_id; -- }; -- -- //aux data structures (norm images, vis images) -- std::vector* > vis_images_; -- std::vector* > normx_, normy_, normz_; -- -- //main helper method - fills out a map of imesh_mesh's, each texture mapped with a separate image -- void boxm2_texture_mesh_from_imgs(const std::string& im_dir, -- const std::string& cam_dir, -- const std::string& out_dir, -- imesh_mesh& in_mesh, -- std::map& meshes); -- -- //populates a vector of visibility images (by face id int) -- void boxm2_visible_faces( std::vector* >& cameras, -- imesh_mesh& in_mesh, unsigned int ni, unsigned int nj); -- -- //stores a norm image (3d face norm) for each of the texture images -- void compute_norm_images( std::vector* >& cameras, -- imesh_mesh& in_mesh,unsigned int ni, unsigned int nj); -- -- //smooths the vector of norm images above -- void smooth_norm_images(double sigma); -- -- //checks if a triangle in UV space is visible. us and vs are double buffers of length 3 -- bool face_is_visible( vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- triangle_3d& world_tri); -- -- //matches textures -- void boxm2_match_textures(std::vector* >& cameras, -- std::vector& imfiles, -- imesh_mesh& in_mesh, -- std::map >& app_faces, -- std::map* >& texture_cams); -- -- //returns a list of visible triangles given a camera, -- //visibility image, and world coordinate 3d triangle -- std::vector get_visible_triangles(vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- triangle_3d& world_tri); -- -- //given revised lists of visible images, norms, etc, return the index of the best view -- int get_best_view(std::vector* >& cams, -- std::vector* >& vis_images, -- std::vector* >& normx, -- std::vector* >& normy, -- std::vector* >& normz, -- triangle_3d& world_tri ); -- -- vgl_vector_3d calc_smooth_norm( vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- vil_image_view* normx, -- vil_image_view* normy, -- vil_image_view* normz, -- triangle_3d& world_tri); --} -- --bool boxm2_texture_mesh_process_cons(bprb_func_process& pro) --{ -- using namespace boxm2_texture_mesh_process_globals; -- -- //process takes 2 inputs -- int i=0; -- std::vector input_types_(n_inputs_); -- input_types_[i++] = "imesh_mesh_sptr"; //depth image -- input_types_[i++] = "vcl_string"; //directory of scene images -- input_types_[i++] = "vcl_string"; //directory of corresponding cams -- input_types_[i++] = "vcl_string"; //output dir of saved mesh -- -- // process has 1 output -- std::vector output_types_(n_outputs_); -- //output_types_[0] = "boxm2_scene_sptr"; -- -- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); --} -- --bool boxm2_texture_mesh_process(bprb_func_process& pro) --{ -- using namespace boxm2_texture_mesh_process_globals; -- if ( pro.n_inputs() < n_inputs_ ) { -- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; -- return false; -- } -- unsigned argIdx = 0; -- imesh_mesh_sptr mesh = pro.get_input(argIdx++); -- std::string img_dir = pro.get_input(argIdx++); -- std::string cam_dir = pro.get_input(argIdx++); -- std::string out_dir = pro.get_input(argIdx++); -- -- //create the mesh directory -- if (out_dir != "") { -- if (!vul_file::make_directory_path(out_dir.c_str())) { -- std::cout<<"Couldn't make directory path "< meshes; -- boxm2_texture_mesh_from_imgs(img_dir, cam_dir, out_dir, *mesh, meshes); -- -- //////////////////////////////////////////////////////////////////////////////// -- //// Write out in VRML format -- //////////////////////////////////////////////////////////////////////////////// -- //output file and stream -- std::string vrfile = out_dir + "/vrmesh.wrl"; -- std::ofstream os(vrfile.c_str()); -- -- //write each submesh into one file -- std::map::iterator subMesh; -- for (subMesh = meshes.begin(); subMesh != meshes.end(); ++subMesh) -- { -- imesh_mesh& sMesh = subMesh->second; -- std::cout<<"Writing sub mesh: "<& meshes) --{ -- //////////////////////////////////////////////////////////////////////////////// -- // BEGIN TEXTURE MAPPING -- // Gather cameras and iamges that will contribute to the texture -- //////////////////////////////////////////////////////////////////////////////// -- std::vector allims = boxm2_util::images_from_directory(im_dir); -- -- //create blank texturemap image -- vil_image_view_base_sptr first_im = boxm2_util::prepare_input_image(allims[0]); -- auto* imptr = (vil_image_view >*) first_im.ptr(); -- vil_rgba mean = boxm2_util::mean_pixel(*imptr); -- vil_image_view > def(4,4); -- def.fill( mean ); -- vil_save(def, (out_dir + "/empty.png").c_str()); -- -- //chop paths to make mesh portable -- for (auto & allim : allims) { -- std::string full_path = allim; -- std::string rel_path = vul_file::basename(full_path); -- allim = rel_path; -- } -- std::vector* > allcams = bpgl_camera_utils::cameras_from_directory(cam_dir); -- if (allims.size() != allcams.size()) { -- std::cout<<"Texture images are not 1 to 1 with cameras:: dirs "< imfiles; -- std::vector* > cameras; -- -- //unsigned int handpicked[] = {0,1,13,25,33,40,51,64,73,82,96,105,109,114,125,133,140,147,153,164,175}; -- //int handpicked[] = { 0,1,13,25,33,51,73,96,109,114,133,147,164}; -- //int handpicked[] = {0,12,18}; -- //int handpicked[] = {0, 1, 26, 33, 56, 96, 114, 133 }; -- //int handpicked[] = {0, 8, 16, 23 }; -- for (unsigned int i=0; ini(),first_im->nj()); -- -- //////////////////////////////////////////////////////////////////////////////// -- // Render norm images (and then smooth them) -- //////////////////////////////////////////////////////////////////////////////// -- std::cout<<"calculating norm images (for each texture image)"<ni(),first_im->nj()); -- smooth_norm_images(30.0); -- -- //////////////////////////////////////////////////////////////////////////////// -- // match each face to best image, store a list for each texture image -- //////////////////////////////////////////////////////////////////////////////// -- std::cout<<"Populating faces for each texture"< > app_faces; //image_name to face_list -- std::map* > texture_cams; -- boxm2_match_textures(cameras, imfiles, in_mesh, app_faces, texture_cams); -- -- //////////////////////////////////////////////////////////////////////////////// -- // For each image/appearance: -- // - create a vert list -- // - create a face list -- // - create a sub mesh that is textured -- //////////////////////////////////////////////////////////////////////////////// -- auto& in_faces = (imesh_face_array&) in_mesh.faces(); -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- //for each appearance (texture image), create an imesh_mesh (subMesh); -- std::cout<<"Creating Sub Meshes for each texture"< >::iterator apps; -- for (apps = app_faces.begin(); apps != app_faces.end(); ++apps) -- { -- //for each appearance, we're creating a whole new mesh -- // first create the face list -- auto* flist = new imesh_face_array(); -- -- //now create the vertex list -- auto* verts3 = new imesh_vertex_array<3>(); -- -- //get faces list corresponding to this texture -- std::vector& face_list = apps->second; -- for (unsigned int i=0; ipush_back( imesh_vertex<3>(in_verts[v1][0], in_verts[v1][1], in_verts[v1][2]) ); -- verts3->push_back( imesh_vertex<3>(in_verts[v2][0], in_verts[v2][1], in_verts[v2][2]) ); -- verts3->push_back( imesh_vertex<3>(in_verts[v3][0], in_verts[v3][1], in_verts[v3][2]) ); -- -- imesh_tri tri(3*i, 3*i+1, 3*i+2); -- flist->push_back(tri); -- } -- -- //create the submesh using the auto ptrs -- std::unique_ptr v3(verts3); -- std::unique_ptr f3(flist); -- imesh_mesh subMesh(std::move(v3), std::move(f3)); -- -- std::cout<<"Setting tex source: "<first<first] = subMesh; -- meshes[apps->first].set_tex_source(apps->first); -- } -- -- ////////////////////////////////////////////////////////////////////////////// -- //For each mesh, map each vertex -- ////////////////////////////////////////////////////////////////////////////// -- std::cout<<"Mapping sub meshes for each texture"<::iterator subMesh; -- auto txCam = texture_cams.begin(); -- for (subMesh = meshes.begin(); subMesh != meshes.end(); ++subMesh, ++txCam) -- { -- imesh_mesh& mesh = subMesh->second; -- imesh_vertex_array<3>& verts = mesh.vertices<3>(); -- unsigned nverts = mesh.num_verts(); -- -- //texture map the non empty appearances -- if (txCam->first != "empty.png") -- { -- std::vector > tex_coords(nverts, vgl_point_2d(0.0,0.0)); -- for (unsigned iv = 0; iv* closest = txCam->second; -- vgl_point_2d principal_point = closest->get_calibration().principal_point(); -- double ni = principal_point.x()*2.0; -- double nj = principal_point.y()*2.0; -- -- //project the vertex onto the camera, store the texture coordinate -- double x = verts[iv][0]; -- double y = verts[iv][1]; -- double z = verts[iv][2]; -- double u,v; -- closest->project(x, y, z, u, v); -- -- //flip v about the y axis -- v=nj-v; -- -- //store the tex_coordinate -- vgl_point_2d uv(u/ni,v/nj); -- tex_coords[iv] = uv; -- } -- mesh.set_tex_coords(tex_coords); -- } -- else { -- //otherwise put in default texture (grey) -- std::vector > tex_coords(nverts, vgl_point_2d(0.0,0.0)); -- for (unsigned iv = 0; iv(.5, .5); -- } -- mesh.set_tex_coords(tex_coords); -- } -- } --} -- -- --//image_name to face_list --void boxm2_texture_mesh_process_globals::boxm2_match_textures(std::vector* >& cameras, -- std::vector& imfiles, -- imesh_mesh& in_mesh, -- std::map >& app_faces, -- std::map* >& texture_cams) --{ -- //grab faces and vertices from the mesh -- auto& in_faces = (imesh_face_array&) in_mesh.faces(); -- unsigned nfaces = in_mesh.num_faces(); -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- -- //for each face, determine which view is best -- for (unsigned iface = 0; iface(x,y,z); -- } -- -- //create list of cameras from which you can see this face -- std::vector visible_imfiles; -- std::vector* > visible_views; -- std::vector* > vis_images; -- std::vector* > normx, normy, normz; -- for (unsigned int i=0; i& normal = in_faces.normal(iface); -- std::cout<<"Face "<* closest = nullptr; -- std::string im_name = "empty.png"; -- if (closeIdx >= 0) { -- closest = visible_views[closeIdx]; -- im_name = visible_imfiles[closeIdx]; -- } -- -- //grab appropriate face list (create it if it's not there) -- auto iter = app_faces.find(im_name); -- if ( iter == app_faces.end() ) { -- std::cout<<"boxm2_match_textures:: Adding image "< faceList; -- faceList.push_back(iface); -- app_faces[im_name] = faceList; -- -- //keep track of the camera -- texture_cams[im_name] = closest; -- } -- else { -- app_faces[im_name].push_back(iface); -- } -- } -- --#if 0 -- //////////////////////////////////////////////////////////////////////////////// -- // Now there is a set of faces without textures, -- // for each face -- // for each image -- // - find visible portions of these faces, record area and angle from dist -- // find angle < 60 degrees AND largest area patch -- // cut the face such that the patch is exposed (patch may be some arbitrary polygon) -- // triangulate the n-gon into n triangles -- // add the *new* points to the mesh, as well as the new faces -- // remember to not leave the old face in the mesh... -- //////////////////////////////////////////////////////////////////////////////// -- for (unsigned iface = 0; iface final_triangles; -- for (int imIdx=0; imIdxprincipal_axis()); // return acos(cos_angle(a,b)); -- if (midAngle > vnl_math::pi/3) continue; -- -- //find visible portion of iface on this image, record area (make a 3d tri out of it first) -- triangle_3d world_tri; -- world_tri.face_id = iface; -- for (int i=0; i<3; ++i) { -- unsigned vertexId = in_faces[iface][i]; -- double x = in_verts[vertexId][0]; -- double y = in_verts[vertexId][1]; -- double z = in_verts[vertexId][2]; -- world_tri.points[i] = vgl_point_3d(x,y,z); -- } -- std::vector vis_tris = get_visible_triangles(cameras[imIdx], vis_images[imIdx], world_tri); -- -- //get the total area of the triangles -- double totalArea = 0; -- for (int tri_i = 0; tri_i < vis_tris.size(); ++tri_i) { -- totalArea+= vgl_triangle_3d_area(vis_tris[tri_i].points[0], -- vis_tris[tri_i].points[1], -- vis_tris[tri_i].points[2]); -- } -- -- //store it if it's the biggest patch so far -- if (totalArea > max_area) { -- max_area = totalArea; -- max_img = imIdx; -- final_triangles = vis_tris; -- } -- } -- -- //now that you have the visible triangles that will be mapped in your mesh... -- // 1. add the new vertices -- // 2. add the new faces -- -- // 3. add the new faces to the correct texture list -- std::string im_name = -- app_faces[im_name].push_back(iface); -- } -- -- //Be wary of this interpolation iterator - didn't match up with the imesh one -- bvgl_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *values, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2); -- -- // Create a new face list with the faces split by visibility -- imesh_regular_face_array<3>* newFaces = new imesh_regular_face_array<3>(); --#endif --} -- --//: Compares each visible camera with the average normal from each norm image, chooses the one that most closely matches --int boxm2_texture_mesh_process_globals::get_best_view(std::vector* >& cams, -- std::vector* >& vis_images, -- std::vector* >& normx, -- std::vector* >& normy, -- std::vector* >& normz, -- triangle_3d& world_tri) --{ -- if (cams.empty()) { -- return -1; -- } -- -- //find minimal dot product amongst cams/images -- double minAngle = 10e20; -- int minCam = -1; -- for (unsigned int i=0; i normal = calc_smooth_norm( cams[i], vis_images[i], normx[i], normy[i], normz[i], world_tri); -- //std::cout<<" face "<principal_axis()); -- double ang = std::acos(dotProd); --#ifdef DEBUG -- if ( std::fabs(normal.z()) > .8 ) { -- std::cout<<"Face normal: "<principal_axis()<<'\n' -- <<" and angle: " < --boxm2_texture_mesh_process_globals::calc_smooth_norm( vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- vil_image_view* normx, -- vil_image_view* normy, -- vil_image_view* normz, -- triangle_3d& world_tri) --{ -- //project triangle -- double us[3], vs[3]; -- for (int vIdx=0; vIdx<3; ++vIdx) { -- //project these verts into UV -- double x = world_tri.points[vIdx].x(); -- double y = world_tri.points[vIdx].y(); -- double z = world_tri.points[vIdx].z(); -- double u,v; -- cam->project(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- } -- -- //now create a polygon, and find the integer image coordinates (U,V) that this polygon covers -- int ni = vis_img->ni(); -- int nj = vis_img->nj(); -- double nx=0.0, ny=0.0, nz=0.0; //initialize normal -- int numNormals = 0; -- -- vgl_triangle_scan_iterator tsi; -- tsi.a.x = us[0]; tsi.a.y = vs[0]; -- tsi.b.x = us[1]; tsi.b.y = vs[1]; -- tsi.c.x = us[2]; tsi.c.y = vs[2]; -- for (tsi.reset(); tsi.next(); ) { -- int y = tsi.scany(); -- if (y<0 || y>=nj) continue; -- int min_x = tsi.startx(); -- int max_x = tsi.endx(); -- if (min_x >= ni || max_x < 0) -- continue; -- if (min_x < 0) min_x = 0; -- if (max_x >= ni) max_x = ni-1; -- for (int x = min_x; x <= max_x; ++x) { -- if ( (*vis_img)(x,y) == int(world_tri.face_id) ) { -- nx += (*normx)(x,y); -- ny += (*normy)(x,y); -- nz += (*normz)(x,y); -- numNormals++; -- } -- } -- } -- return {nx/numNormals, ny/numNormals, nz/numNormals}; --} -- -- --//: --// returns a list of visible triangles given a camera, --// visibility image, and world coordinate 3d triangle --std::vector --boxm2_texture_mesh_process_globals::get_visible_triangles(vpgl_perspective_camera* /*cam*/, -- vil_image_view* /*vis_img*/, -- triangle_3d& /*world_tri*/) --{ -- std::cerr << "TODO: boxm2_texture_mesh_process_globals::get_visible_triangles is not yet implemented\n"; -- return std::vector(); --} -- -- --//: --// given a camera, and an image with ID faces, this method returns true if the entire --// triangle (id face_id) is unoccluded from this point of view --bool boxm2_texture_mesh_process_globals::face_is_visible( vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- triangle_3d& world_tri) --{ -- //project triangle -- double us[3], vs[3]; -- for (int vIdx=0; vIdx<3; ++vIdx) { -- //project these verts into UV -- double x = world_tri.points[vIdx].x(); -- double y = world_tri.points[vIdx].y(); -- double z = world_tri.points[vIdx].z(); -- double u,v; -- cam->project(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- } -- -- //now create a polygon, and find the integer image coordinates (U,V) that this polygon covers -- int ni = vis_img->ni(); -- int nj = vis_img->nj(); -- unsigned int numPixels = 0; -- unsigned int numMatches = 0; -- -- vgl_triangle_scan_iterator tsi; -- tsi.a.x = us[0]; tsi.a.y = vs[0]; -- tsi.b.x = us[1]; tsi.b.y = vs[1]; -- tsi.c.x = us[2]; tsi.c.y = vs[2]; -- for (tsi.reset(); tsi.next(); ) { -- int y = tsi.scany(); -- if (y<0 || y>=nj) continue; -- int min_x = tsi.startx(); -- int max_x = tsi.endx(); -- if (min_x >= ni || max_x < 0) -- continue; -- if (min_x < 0) min_x = 0; -- if (max_x >= ni) max_x = ni-1; -- for (int x = min_x; x <= max_x; ++x) { -- ++numPixels; -- if ( (*vis_img)(x,y) == int(world_tri.face_id) ) -- ++numMatches; -- } -- } -- -- //if the majority match, it's visible -- if ( (double) numMatches / (double) numPixels > .99) -- return true; -- else -- return false; --} -- --//: Constructs vector of visibility images - images that identify which triangle is visible at which pixel. --// Function is more or less complete - not much more to it. --void boxm2_texture_mesh_process_globals::boxm2_visible_faces( std::vector* >& cameras, -- imesh_mesh& in_mesh, unsigned int ni=1024, unsigned int nj=768) --{ -- auto& in_faces = (imesh_face_array&) in_mesh.faces(); -- -- unsigned nfaces = in_mesh.num_faces(); -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- -- // iterate over each camera, creating a visibility image for each -- for (auto pcam : cameras) -- { -- //// get the principal point of the cam for image size -- //std::cout<<(*pcam); -- //vgl_point_2d principal_point = pcam->get_calibration().principal_point(); -- //unsigned ni = (unsigned) (principal_point.x()*2.0); -- //unsigned nj = (unsigned) (principal_point.y()*2.0); -- -- // render the face_id/distance image -- vil_image_view depth_im(ni, nj); -- auto* face_im = new vil_image_view(ni, nj); -- depth_im.fill(10e100); //Initial depth is huge, -- face_im->fill(-1); //initial face id is -1 -- for (unsigned iface = 0; ifaceproject(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- // keep track of distance to each vertex -- dists[vIdx] = vgl_distance(vgl_point_3d(x,y,z), pcam->get_camera_center()); -- } -- -- // render the triangle label onto the label image, using the depth image -- vgl_point_3d v1(us[0], vs[0], dists[0]); -- vgl_point_3d v2(us[1], vs[1], dists[1]); -- vgl_point_3d v3(us[2], vs[2], dists[2]); -- imesh_render_triangle_label(v1, v2, v3, (int) iface, (*face_im), depth_im); -- } //end for iface -- -- // keep the vis_image just calculated -- vis_images_.push_back(face_im); -- } --} -- --//: Constructs vector of visibility images - images that identify which triangle is visible at which pixel. --// Function is more or less complete - not much more to it. --void boxm2_texture_mesh_process_globals::compute_norm_images( std::vector* >& cameras, -- imesh_mesh& in_mesh,unsigned int ni, unsigned int nj) --{ -- auto& in_faces = (imesh_face_array&) in_mesh.faces(); -- unsigned nfaces = in_mesh.num_faces(); -- -- for (unsigned int i=0; i* pcam = cameras[i]; -- vgl_point_2d principal_point = pcam->get_calibration().principal_point(); -- unsigned ni = (unsigned) (principal_point.x()*2.0); -- unsigned nj = (unsigned) (principal_point.y()*2.0); --#endif // 0 -- // create a norm x,y, and z image for each visibility image -- vil_image_view* vis = vis_images_[i]; -- auto* nx = new vil_image_view(ni, nj); -- auto* ny = new vil_image_view(ni, nj); -- auto* nz = new vil_image_view(ni, nj); -- vgl_vector_3d paxis = cameras[i]->principal_axis(); -- nx->fill( (float) paxis.x()); -- ny->fill( (float) paxis.y()); -- nz->fill( (float) paxis.z()); -- for (unsigned int x=0; x= 0 && face_id < (int)nfaces) { -- vgl_vector_3d fnorm = in_faces.normal(face_id); -- (*nx)(x,y) = (float) fnorm.x(); -- (*ny)(x,y) = (float) fnorm.y(); -- (*nz)(x,y) = (float) fnorm.z(); -- } -- } -- } -- -- //keep the vis_image just calculated -- normx_.push_back(nx); -- normy_.push_back(ny); -- normz_.push_back(nz); -- } -- --#if 0 // commented out ... -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- //iterate over each camera, creating a visibility image for each -- for (unsigned int i=0; i* pcam = cameras[i]; -- vgl_point_2d principal_point = pcam->get_calibration().principal_point(); -- unsigned ni = (unsigned) (principal_point.x()*2.0); -- unsigned nj = (unsigned) (principal_point.y()*2.0); -- -- // render the norm images in each dimension -- vil_image_view* nx = new vil_image_view(ni, nj); -- vil_image_view* ny = new vil_image_view(ni, nj); -- vil_image_view* nz = new vil_image_view(ni, nj); -- vgl_vector_3d paxis = cameras[i]->principal_axis(); -- nx->fill( (float) paxis.x()); -- ny->fill( (float) paxis.y()); -- nz->fill( (float) paxis.z()); -- vil_image_view depth_im(ni, nj); -- depth_im.fill(10e100); -- for (unsigned iface = 0; iface fnorm = in_faces.normal(iface); -- -- //get the vertices from the face, project into UVs -- double us[3], vs[3], dists[3]; -- for (int vIdx=0; vIdx<3; ++vIdx) { -- unsigned vertIdx = in_faces[iface][vIdx]; -- -- //project these verts into UV -- double x = in_verts[vertIdx][0], y = in_verts[vertIdx][1], z = in_verts[vertIdx][2]; -- double u,v; -- pcam->project(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- -- //keep track of distance to each vertex -- dists[vIdx] = vgl_distance(vgl_point_3d(x,y,z), pcam->get_camera_center()); -- } -- -- //render the triangle label onto the label image, using the depth image -- vgl_point_3d v1(us[0], vs[0], dists[0]); -- vgl_point_3d v2(us[1], vs[1], dists[1]); -- vgl_point_3d v3(us[2], vs[2], dists[2]); -- imesh_render_triangle_label(v1, v2, v3, (float) fnorm.x(), (*nx), depth_im); -- imesh_render_triangle_label(v1, v2, v3, (float) fnorm.y(), (*ny), depth_im); -- imesh_render_triangle_label(v1, v2, v3, (float) fnorm.z(), (*nz), depth_im); -- } //end for iface -- -- //keep the vis_image just calculated -- normx_.push_back(nx); -- normy_.push_back(ny); -- normz_.push_back(nz); -- } --#endif // 0 --} -- --void boxm2_texture_mesh_process_globals::smooth_norm_images(double sigma) --{ -- vil_gauss_filter_5tap_params params(sigma); //set SIGMA -- for (unsigned int i=0; i* currX = normx_[i]; -- auto* newX = new vil_image_view(currX->ni(), currX->nj()); -- vil_gauss_filter_5tap(*currX, *newX, params); -- //store the filtered image -- delete currX; -- normx_[i] = newX; -- -- //repeat for y -- vil_image_view* currY = normy_[i]; -- auto* newY = new vil_image_view(currY->ni(), currY->nj()); -- vil_gauss_filter_5tap(*currY, *newY, params); -- delete currY; -- normy_[i] = newY; -- -- //z -- vil_image_view* currZ = normz_[i]; -- auto* newZ = new vil_image_view(currZ->ni(), currZ->nj()); -- vil_gauss_filter_5tap(*currZ, *newZ, params); -- delete currZ; -- normz_[i] = newZ; -- } --} -diff --git a/contrib/brl/bseg/sdet/CMakeLists.txt b/contrib/brl/bseg/sdet/CMakeLists.txt -index 60a1da2706..081a0a6452 100644 ---- a/contrib/brl/bseg/sdet/CMakeLists.txt -+++ b/contrib/brl/bseg/sdet/CMakeLists.txt -@@ -39,7 +39,6 @@ set(sdet_sources - sdet_nms.cxx sdet_nms.h - sdet_third_order_edge_det_params.cxx sdet_third_order_edge_det_params.h - sdet_third_order_edge_det.cxx sdet_third_order_edge_det.h -- sdet_image_mesh.cxx sdet_image_mesh.h - sdet_image_mesh_params.cxx sdet_image_mesh_params.h - sdet_denoise_mrf.cxx sdet_denoise_mrf.h - sdet_denoise_mrf_params.cxx sdet_denoise_mrf_params.h -diff --git a/contrib/brl/bseg/sdet/sdet_image_mesh.cxx b/contrib/brl/bseg/sdet/sdet_image_mesh.cxx -deleted file mode 100644 -index 81af9ebb83..0000000000 ---- a/contrib/brl/bseg/sdet/sdet_image_mesh.cxx -+++ /dev/null -@@ -1,327 +0,0 @@ --// This is brl/bseg/sdet/sdet_image_mesh.cxx --#include "sdet_image_mesh.h" --#include "vgl/vgl_point_2d.h" --#include "vgl/vgl_line_segment_2d.h" --#include "vil/vil_image_view.h" --#include "vil/vil_math.h" --#include "vil/vil_convert.h" --#include "vil/vil_new.h" --#include "vil/vil_pixel_format.h" --#include "vil/vil_save.h" --#include --#include --#include --#include --#include --#include --#include --#include -- --#include --#include -- --#include --#include --#include --#include --#include --#include --#include -- --//note: this method is somewhat of a hack and should be replaced by --// a computed step function transition width, e.g. by a 2nd derivative --// operator --bool sdet_image_mesh:: step_boundary(vgl_line_segment_2d const& parent, -- vgl_line_segment_2d& child0, -- vgl_line_segment_2d& child1) --{ -- if (! resc_ ) return false; -- unsigned ni = resc_->ni(), nj = resc_->nj(); -- vgl_vector_2d n = parent.normal(); -- vgl_point_2d p1 = parent.point1(); -- vgl_point_2d p2 = parent.point2(); -- vgl_point_2d p10 = p1 - step_half_width_*n; -- vgl_point_2d p11 = p1 + step_half_width_*n; -- vgl_point_2d p20 = p2 - step_half_width_*n; -- vgl_point_2d p21 = p2 + step_half_width_*n; -- if (p10.x()<0 || p10.y()<0||p20.x()<0||p20.y()<0|| -- p10.x()>=ni ||p10.y()>=nj||p20.x()>=ni||p20.y()>=nj) -- return false; -- else -- child0 = vgl_line_segment_2d(p10, p20); -- if (p11.x()<0 || p11.y()<0||p21.x()<0||p21.y()<0|| -- p11.x()>=ni ||p11.y()>=nj||p21.x()>=ni||p21.y()>=nj) -- return false; -- else -- child1 = vgl_line_segment_2d(p11, p21); -- return true; --} -- --//--------------------------------------------------------------- --// Constructors --// --//---------------------------------------------------------------- -- --// constructor from a parameter block (the only way) --sdet_image_mesh::sdet_image_mesh(sdet_image_mesh_params& imp) -- : sdet_image_mesh_params(imp), mesh_valid_(false), resc_(nullptr) --{ --} -- --// Destructor --sdet_image_mesh::~sdet_image_mesh() --= default; -- --bool sdet_image_mesh::compute_line_segments(vil_image_resource_sptr const& resc, -- std::vector > & segs) --{ -- if (!resc) return false; -- mesh_valid_ = false; -- sdet_detector_params dp; -- dp.smooth= smooth_; -- dp.noise_multiplier = thresh_; -- dp.aggressive_junction_closure=0; -- dp.junctionp=false; -- sdet_detector det(dp); -- det.SetImage(resc); -- det.DoContour(); -- std::vector* edges = det.GetEdges(); -- if (!edges) { -- std::cout<<"sdet_image_mesh:: could not detect edges in buffer"< line_img(resc_->ni(),resc_->nj());//some resource -- line_img.fill(255); -- -- std::vector > segs, segs_pair; -- sdet_detector_params dp; -- dp.smooth= smooth_; -- dp.noise_multiplier = thresh_; -- dp.aggressive_junction_closure=0; -- dp.junctionp=false; -- sdet_detector det(dp); -- det.SetImage(resc_); -- det.DoContour(); -- std::vector* edges = det.GetEdges(); -- for (auto & edge : *edges) -- { -- vsol_curve_2d_sptr c = edge->curve(); -- vdgl_digital_curve_sptr dc = c->cast_to_vdgl_digital_curve(); -- if (!dc) -- continue; -- vdgl_interpolator_sptr intp = dc->get_interpolator(); -- vdgl_edgel_chain_sptr ec = intp->get_edgel_chain(); -- int nedgl = ec->size(); -- for (int i=0; i((*ec)[i].x(),(*ec)[i].y())); -- line_img((int)(*ec)[i].x(),(int) (*ec)[i].y())=0; -- } -- } -- -- bil_cedt dt(line_img); -- if (!dt.compute_cedt()) -- std::cout<<"Error in computing DT"< dtimg=dt.cedtimg(); -- vil_image_view dtimg_threshed(dtimg.ni(),dtimg.nj());dtimg_threshed.fill(0); -- for (unsigned i=0;i > lines; -- this->compute_line_segments(vil_new_image_resource_of_view(dtimg_threshed),lines); -- segs_pair.insert(segs_pair.end(),lines.begin(),lines.end()); -- line_img.fill(255); -- -- for (auto & i : segs_pair) -- { -- bool init = true; -- float xs= float(i.point1().x()); -- float ys= float(i.point1().y()); -- float xe= float(i.point2().x()); -- float ye= float(i.point2().y()); -- float x=0.0f; -- float y=0.0f; -- while (brip_line_generator::generate(init, xs, ys, xe, ye, x, y)) -- { -- int xi = (int)x; -- int yi = (int)y; //convert the pixel location to integer -- line_img(xi, yi)=0; -- } -- } -- vil_save(line_img,"F:/visdt/line_img_more.png"); -- -- bil_cedt dt1(line_img); -- if (!dt1.compute_cedt()) -- std::cout<<"Error in computing DT"< ul(0.0, 0.0), ur(resc_->ni()-1,0.0); -- vgl_point_2d lr(resc_->ni()-1, resc_->nj()-1), ll(0.0, resc_->nj()-1); -- -- std::vector > convex_hull; -- convex_hull.push_back(ul); convex_hull.push_back(ur); -- convex_hull.push_back(lr); convex_hull.push_back(ll); -- std::vector > cvexh = convex_hull; -- imesh_mesh mesh_one; -- imesh_generate_mesh_2d_2(convex_hull, segs_pair,anchor_points_, mesh_one); -- -- //lift vertices to 3-d -- const imesh_vertex_array<2>& verts = mesh_one.vertices<2>(); -- auto* verts3 = new imesh_vertex_array<3>(); -- -- // convert image to float -- vil_image_view view = brip_vil_float_ops::convert_to_float(resc_); -- unsigned ni = view.ni(), nj = view.nj(); -- float minv=0, maxv=0; -- vil_math_value_range(view, minv, maxv); -- unsigned nverts = mesh_one.num_verts(); -- for (unsigned iv = 0; iv(verts[iv][0]); -- auto j = static_cast(verts[iv][1]); -- double height =maxv; -- if (i(view(i,j)); -- height = maxv-height; -- imesh_vertex<3> v3(verts[iv][0], verts[iv][1], height); -- verts3->push_back(v3); -- } -- std::unique_ptr v3(verts3); -- mesh_one.set_vertices(std::move(v3)); -- //mesh_valid_ = true; -- -- /////////////////////////////////////////////////////// -- //compute anchor points, and rerun generate_mesh_2d_2 -- /////////////////////////////////////////////////////// -- this->set_anchor_points(mesh_one,dt1.cedtimg()); -- -- std::cout<<"Number of anchor points: "<& verts2 = mesh_.vertices<2>(); -- auto* newVerts = new imesh_vertex_array<3>(); -- -- // convert image to float -- ni = view.ni(), nj = view.nj(); -- vil_math_value_range(view, minv, maxv); -- nverts = mesh_.num_verts(); -- for (unsigned iv = 0; iv(verts2[iv][0]); -- auto j = static_cast(verts2[iv][1]); -- double height =maxv; -- if (i(view(i,j)); -- height = maxv-height; -- imesh_vertex<3> v3(verts2[iv][0], verts2[iv][1], height); -- newVerts->push_back(v3); -- } -- std::unique_ptr v3_ptr(newVerts); -- mesh_.set_vertices(std::move(v3_ptr)); -- mesh_valid_ = true; -- -- return true; --} -- --//takes the 3d mesh, calculates depth disparity map (from top) --void sdet_image_mesh::set_anchor_points(imesh_mesh& mesh, vil_image_view dt_img) --{ -- //create a tri_depth image -- int ni = resc_->ni(); -- int nj = resc_->nj(); -- vil_image_view tri_depth(ni, nj); -- -- //find the range of triangles in the Z direction -- auto& faces = (imesh_regular_face_array<3>&) mesh.faces(); -- imesh_vertex_array<3>& verts = mesh.vertices<3>(); -- unsigned nfaces = mesh.num_faces(); -- for (unsigned iface = 0; iface tsi(verts_x, verts_y, verts_z); -- -- //scan the triangle, storing the depth -- for (tsi.reset(); tsi.next(); ) { -- int y = tsi.scany(); -- if (y<0 || y>=nj) continue; -- int min_x = tsi.startx(); -- int max_x = tsi.endx(); -- if (min_x >= ni || max_x < 0) -- continue; -- if (min_x < 0) min_x = 0; -- if (max_x >= ni) max_x = ni-1; -- for (int x = min_x; x <= max_x; ++x) { -- tri_depth(x,y) = (float) tsi.value_at(x); -- } -- } -- } -- -- //get range of triangle depths -- float minz, maxz; -- vil_math_value_range(tri_depth, minz, maxz); -- -- //maximum z diff allowed for a triangle is 1/512 of the total z range -- vil_image_view z_img = brip_vil_float_ops::convert_to_float(resc_); -- -- //for ( unsigned niter=1;niter<16;niter*=2) -- { -- double max_z_diff = (maxz-minz)/64.0; -- for (int i=0; i max_z_diff && dt_img(i,j) >= 3.5 ) -- anchor_points_.emplace_back(i,j); -- } --} -- --//ensure the image is a byte image (between 0 and 255) --void sdet_image_mesh::set_image(vil_image_resource_sptr const& resource) --{ -- resc_ = resource; -- if (resc_->pixel_format() != VIL_PIXEL_FORMAT_BYTE ) -- { -- std::cout<<"Converting image from "<pixel_format()<<" to vxl_byte image"<get_view()); -- -- //makvil_image_view_base_sptr byte_img = vil_convert_cast(0, stretched*255.0f); -- vil_image_view_base_sptr dest_sptr = new vil_image_view(stretched->ni(), stretched->nj()); -- auto* dest = (vil_image_view*) dest_sptr.ptr(); -- auto* stf = (vil_image_view*) stretched.ptr(); -- vil_convert_stretch_range( *stf, *dest, 0.0f, 255.0f); -- -- //now turn em into bytes -- vil_image_view_base_sptr converted = vil_convert_cast(0, dest_sptr); -- -- //create new resource sptr -- resc_ = vil_new_image_resource_of_view(*converted.ptr()); -- } --} -diff --git a/contrib/brl/bseg/sdet/sdet_image_mesh.h b/contrib/brl/bseg/sdet/sdet_image_mesh.h -deleted file mode 100644 -index 3f5a1129ef..0000000000 ---- a/contrib/brl/bseg/sdet/sdet_image_mesh.h -+++ /dev/null -@@ -1,63 +0,0 @@ --// This is brl/bseg/sdet/sdet_image_mesh.h --#ifndef sdet_image_mesh_h_ --#define sdet_image_mesh_h_ --//--------------------------------------------------------------------- --//: --// \file --// \brief a processor for triangulating a images based on detected line segments --// --// This algorithm triangulates an image into a 3-d mesh based on --// detected line segments. The line segments are fit to edge detection --// contour chains. --// --// \author --// J.L. Mundy - March 21, 2011 --// --// \verbatim --// Modifications --// --// \endverbatim --// --//------------------------------------------------------------------------- --#include --#include --#ifdef _MSC_VER --# include --#endif --#include --#include --#include --#include --#include -- --class sdet_image_mesh : public sdet_image_mesh_params --{ -- public: -- // === Constructors/destructor === -- sdet_image_mesh(sdet_image_mesh_params& imp); -- ~sdet_image_mesh() override; -- -- // === Process methods === -- void set_image(vil_image_resource_sptr const& resource); -- bool compute_mesh(); -- -- // === Accessors === -- imesh_mesh& get_mesh() { return mesh_; } -- bool mesh_valid() const { return mesh_valid_; } -- -- protected: -- // === protected methods === -- bool step_boundary(vgl_line_segment_2d const& parent, -- vgl_line_segment_2d& child0, -- vgl_line_segment_2d& child1); -- void set_anchor_points(imesh_mesh& mesh, vil_image_view dt_img); -- bool compute_line_segments(vil_image_resource_sptr const& resc, -- std::vector >& segs); -- -- // === members === -- bool mesh_valid_; //: process state flag -- vil_image_resource_sptr resc_; -- imesh_mesh mesh_; --}; -- --#endif // sdet_image_mesh_h_ -diff --git a/contrib/brl/bseg/sdet/tests/test_include.cxx b/contrib/brl/bseg/sdet/tests/test_include.cxx -index 01ca358991..0e4bcaf1f9 100644 ---- a/contrib/brl/bseg/sdet/tests/test_include.cxx -+++ b/contrib/brl/bseg/sdet/tests/test_include.cxx -@@ -22,7 +22,6 @@ - #include - #include - #include --#include - #include - #include - #include -diff --git a/contrib/gel/gtrl/CMakeLists.txt b/contrib/gel/gtrl/CMakeLists.txt -index 13562bb93c..709e5b6b55 100644 ---- a/contrib/gel/gtrl/CMakeLists.txt -+++ b/contrib/gel/gtrl/CMakeLists.txt -@@ -14,21 +14,8 @@ set(gtrl_sources - - aux_source_directory(Templates gtrl_sources) - --include( ${VXL_CMAKE_DIR}/FindNetlib.cmake ) -- --if(NETLIB_FOUND) -- include_directories(${NETLIB_INCLUDE_DIR}) -- -- set(gtrl_sources ${gtrl_sources} -- gtrl_triangulation.cxx gtrl_triangulation.h -- ) --endif() -- - vxl_add_library(LIBRARY_NAME gtrl LIBRARY_SOURCES ${gtrl_sources}) - target_link_libraries(gtrl ${VXL_LIB_PREFIX}vbl) --if(NETLIB_FOUND) -- target_link_libraries(gtrl ${NETLIB_LIBRARIES}) --endif() - - if( BUILD_TESTING ) - add_subdirectory(tests) -diff --git a/contrib/gel/gtrl/examples/.NoDartCoverage b/contrib/gel/gtrl/examples/.NoDartCoverage -deleted file mode 100644 -index e69de29bb2..0000000000 -diff --git a/contrib/gel/gtrl/examples/CMakeLists.txt b/contrib/gel/gtrl/examples/CMakeLists.txt -deleted file mode 100644 -index ee97397685..0000000000 ---- a/contrib/gel/gtrl/examples/CMakeLists.txt -+++ /dev/null -@@ -1,2 +0,0 @@ --add_executable( triangulate triangulate.cxx ) --target_link_libraries( triangulate gtrl ) -diff --git a/contrib/gel/gtrl/examples/triangulate.cxx b/contrib/gel/gtrl/examples/triangulate.cxx -deleted file mode 100644 -index fa8a0577b3..0000000000 ---- a/contrib/gel/gtrl/examples/triangulate.cxx -+++ /dev/null -@@ -1,45 +0,0 @@ --//: --// \file --// Simple example program to demonstrate the use of the gtrl_triangulation class --// \author Peter Vanroose --// \date 8 October 2002 -- --#include --#include --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif -- --inline std::ostream& operator<<(std::ostream& os, gtrl_vertex const& v) --{ -- return os << '(' << v.x() << ',' << v.y() << ')'; --} -- --inline std::ostream& operator<<(std::ostream& os, gtrl_triangle const& t) --{ -- return os << '[' << *(t.p1()) << ',' << *(t.p2()) << ',' << *(t.p3()) << ']'; --} -- --int main() --{ -- std::vector v(4); -- v[0] = new gtrl_vertex( 1.0, 1.0); -- v[1] = new gtrl_vertex(50.0, 1.0); -- v[2] = new gtrl_vertex(50.0,50.0); -- v[3] = new gtrl_vertex( 1.0,50.0); -- gtrl_polygon poly(v); -- gtrl_triangulation tri(poly); tri.run(); -- -- std::vector p = tri.get_points(); -- std::vector t = tri.get_triangles(); -- -- std::cout << p.size() << " triangle points:\n"; -- for (auto & i : p) -- std::cout << ' ' << *i << '\n'; -- -- std::cout << t.size() << " triangles:\n"; -- for (auto & i : t) -- std::cout << ' ' << *i << '\n'; -- -- return 0; --} -diff --git a/contrib/gel/gtrl/gtrl_triangulation.cxx b/contrib/gel/gtrl/gtrl_triangulation.cxx -deleted file mode 100644 -index 52103988f8..0000000000 ---- a/contrib/gel/gtrl/gtrl_triangulation.cxx -+++ /dev/null -@@ -1,110 +0,0 @@ --// This is gel/gtrl/gtrl_triangulation.cxx --//: --// \file --// \author crossge@crd.ge.com -- --#include --#include "gtrl_triangulation.h" --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif -- --// UNIX specific timer close --#ifdef _WIN32 --#define NO_TIMER --#endif -- --// triangulation library --extern "C" { --#ifdef SINGLE --#define REAL float --#else /* not SINGLE */ --#define REAL double --#endif /* not SINGLE */ -- --#include // from netlib, for triangulate() --} -- -- --gtrl_triangulation::gtrl_triangulation( gtrl_polygon poly) -- : poly_(std::move( poly)) --{ --} -- --void gtrl_triangulation::run() --{ -- REAL *points= new REAL[poly_.size()*2]; -- int *markers= new int[poly_.size()]; -- -- // for some reason, the markers don't seem to -- // like starting at 0 -- constexpr int offset = 100; -- -- std::vector pointlist; -- -- for (int i=0; i< poly_.size(); i++) -- { -- gtrl_vertex_sptr p= poly_[i]; -- pointlist.push_back( p); -- -- points[i*2] = p->x(); -- points[i*2+1]= p->y(); -- markers[i]= i+offset; -- } -- -- // input -- triangulateio in; -- in.numberofpoints= poly_.size(); -- in.pointlist= points; -- in.pointmarkerlist= markers; -- in.numberofpointattributes= 0; -- in.numberofholes= 0; -- in.trianglelist= nullptr; -- -- // output -- triangulateio out; -- out.pointlist= nullptr; -- out.trianglelist= nullptr; -- out.pointmarkerlist= nullptr; -- out.numberofpointattributes= 0; -- out.numberofholes= 0; -- out.numberoftriangleattributes= 0; -- -- // do triangulation -- triangulate( "-z -i -q", &in, &out, nullptr); -- -- // create any new points that are necessary -- for (int i=0; i< out.numberofpoints; i++) -- { -- if (out.pointmarkerlist[i]< offset) -- { -- pointlist.push_back( new gtrl_vertex( out.pointlist[i*2], -- out.pointlist[i*2+1])); -- -- out.pointmarkerlist[i]= pointlist.size()-1+ offset; -- } -- } -- -- // clean up from previous triangulation -- tris_.clear(); -- -- // create the triangles -- for (int i=0; i< out.numberoftriangles; i++) -- { -- gtrl_triangle_sptr triangle= new gtrl_triangle( pointlist[ out.pointmarkerlist[ out.trianglelist[i*3]]- offset], -- pointlist[ out.pointmarkerlist[ out.trianglelist[i*3+1]]- offset], -- pointlist[ out.pointmarkerlist[ out.trianglelist[i*3+2]]- offset]); -- -- if (poly_.inside( triangle->mid_point())) -- tris_.push_back( triangle); -- } -- -- pts_= pointlist; -- -- // clean memory -- delete[] out.pointlist; -- delete[] out.pointmarkerlist; -- delete[] out.trianglelist; -- delete[] points; -- delete[] markers; --} -diff --git a/contrib/gel/gtrl/gtrl_triangulation.h b/contrib/gel/gtrl/gtrl_triangulation.h -deleted file mode 100644 -index 5f63552278..0000000000 ---- a/contrib/gel/gtrl/gtrl_triangulation.h -+++ /dev/null -@@ -1,31 +0,0 @@ --// This is gel/gtrl/gtrl_triangulation.h --#ifndef gtrl_triangulation_h_ --#define gtrl_triangulation_h_ --//: --// \file --// \author crossge@crd.ge.com -- --#include --#include -- --//: triangulates holeless polygons -- --class gtrl_triangulation --{ -- public: -- // constructors / destructors -- gtrl_triangulation( gtrl_polygon poly); -- -- // implementation -- void run(); -- std::vector get_triangles() const { return tris_; } -- std::vector get_points() const { return pts_; } -- -- protected: -- gtrl_polygon poly_; -- -- std::vector tris_; -- std::vector pts_; --}; -- --#endif // gtrl_triangulation_h_ -diff --git a/contrib/gel/gtrl/tests/test_include.cxx b/contrib/gel/gtrl/tests/test_include.cxx -index df3ed4bd29..f3e98fca4c 100644 ---- a/contrib/gel/gtrl/tests/test_include.cxx -+++ b/contrib/gel/gtrl/tests/test_include.cxx -@@ -1,5 +1,4 @@ - #include --#include - #include - #include - --- -2.46.1 - diff --git a/0009-removed-the-obsolete-octree-library-boxm.patch b/0009-removed-the-obsolete-octree-library-boxm.patch new file mode 100644 index 0000000..75f635b --- /dev/null +++ b/0009-removed-the-obsolete-octree-library-boxm.patch @@ -0,0 +1,53224 @@ +From 48437e3f454347c8348d4554d614cf2d27e545c3 Mon Sep 17 00:00:00 2001 +From: Joseph Mundy +Date: Sat, 2 Feb 2019 10:43:26 -0500 +Subject: [PATCH 9/9] removed the obsolete octree library boxm + +--- + contrib/brl/bseg/CMakeLists.txt | 12 - + contrib/brl/bseg/boxm/CMakeLists.txt | 52 - + ...ee+short.bsta_num_obs+bsta_gauss_sf1--.cxx | 9 - + ...ree+short.vnl_vector_fixed+double.10--.cxx | 9 - + ...tree+short.vnl_vector_fixed+float.10--.cxx | 9 - + ..._tree+short.vnl_vector_fixed+float.3--.cxx | 10 - + ...ll+short.bsta_num_obs+bsta_gauss_sf1--.cxx | 9 - + .../boxm_block+boct_tree+short.bool--.cxx | 5 - + ...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 9 - + .../boxm_block+boct_tree+short.char--.cxx | 5 - + .../boxm_block+boct_tree+short.float--.cxx | 5 - + .../boxm_block+boct_tree+short.int--.cxx | 8 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + ...ee+short.vnl_vector_fixed+double.10---.cxx | 17 - + ...ree+short.vnl_vector_fixed+float.10---.cxx | 17 - + ...tree+short.vnl_vector_fixed+float.3---.cxx | 17 - + ..._block_iterator+boct_tree+short.bool--.cxx | 5 - + ...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 - + ..._block_iterator+boct_tree+short.char--.cxx | 5 - + ...block_iterator+boct_tree+short.float--.cxx | 5 - + ...m_block_iterator+boct_tree+short.int--.cxx | 8 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + .../boxm_scene+boct_tree+short.bool--.cxx | 5 - + ...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 - + .../boxm_scene+boct_tree+short.char--.cxx | 5 - + .../boxm_scene+boct_tree+short.float--.cxx | 5 - + .../boxm_scene+boct_tree+short.int--.cxx | 8 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + .../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 - + ...3d+boxm_block+boct_tree+short.bool--~-.cxx | 11 - + ...short.bsta_num_obs+bsta_gauss_sf1---~-.cxx | 10 - + ...3d+boxm_block+boct_tree+short.char--~-.cxx | 11 - + ...d+boxm_block+boct_tree+short.float--~-.cxx | 11 - + ..._3d+boxm_block+boct_tree+short.int--~-.cxx | 14 - + ...ct_tree+short.vgl_point_3d+double---~-.cxx | 12 - + .../vbl_array_3d+vsl_b_ifstream~-.cxx | 9 - + .../vbl_io_smart_ptr+boxm_scene_base-.cxx | 5 - + .../vbl_smart_ptr+boxm_scene_base-.cxx | 4 - + contrib/brl/bseg/boxm/algo/CMakeLists.txt | 38 - + .../boxm/algo/boxm_compute_scene_difference.h | 98 - + .../boxm/algo/boxm_compute_scene_statistics.h | 100 - + contrib/brl/bseg/boxm/algo/boxm_crop_scene.h | 95 - + .../brl/bseg/boxm/algo/boxm_fill_in_mesh.h | 316 --- + .../bseg/boxm/algo/boxm_fill_internal_cells.h | 80 - + contrib/brl/bseg/boxm/algo/boxm_init_scene.h | 60 - + .../bseg/boxm/algo/boxm_linear_operations.h | 60 - + contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx | 239 --- + contrib/brl/bseg/boxm/algo/boxm_merge_mog.h | 65 - + contrib/brl/bseg/boxm/algo/boxm_refine.h | 100 - + .../brl/bseg/boxm/algo/boxm_save_block_raw.h | 155 -- + .../brl/bseg/boxm/algo/boxm_save_scene_raw.h | 277 --- + .../boxm/algo/boxm_save_scene_raw_general.h | 824 -------- + .../bseg/boxm/algo/boxm_scene_levels_utils.h | 97 - + .../brl/bseg/boxm/algo/boxm_split_sample.h | 105 - + contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h | 156 -- + contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt | 40 - + .../bseg/boxm/algo/pro/boxm_algo_processes.h | 28 - + .../bseg/boxm/algo/pro/boxm_algo_register.cxx | 35 - + .../bseg/boxm/algo/pro/boxm_algo_register.h | 11 - + .../boxm_compute_entropy_process.cxx | 83 - + ...m_compute_expected_color_scene_process.cxx | 83 - + .../boxm_compute_scene_difference_process.cxx | 91 - + .../boxm_create_scene_from_ply_process.cxx | 257 --- + .../processes/boxm_describe_scene_process.cxx | 106 - + .../boxm_explore_cells_at_level_process.cxx | 61 - + .../boxm_fill_internal_cells_process.cxx | 72 - + .../pro/processes/boxm_init_scene_process.cxx | 111 -- + .../boxm_line_backproject_process.cxx | 259 --- + .../boxm_linear_combination_process.cxx | 102 - + .../processes/boxm_merge_mixtures_process.cxx | 90 - + .../processes/boxm_refine_scene_process.cxx | 119 -- + .../processes/boxm_remove_level0_process.cxx | 87 - + ...boxm_render_expected_edge_vrml_process.cxx | 149 -- + .../boxm_replace_const_app_process.cxx | 95 - + .../pro/processes/boxm_roi_init_process.cxx | 195 -- + .../boxm_roi_init_rational_camera_process.cxx | 310 --- + .../boxm_save_occupancy_raw_process.cxx | 229 --- + .../processes/boxm_save_scene_raw_process.cxx | 140 -- + .../processes/boxm_split_scene_process.cxx | 97 - + .../bseg/boxm/algo/pro/tests/CMakeLists.txt | 2 - + .../bseg/boxm/algo/pro/tests/test_include.cxx | 4 - + contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt | 46 - + ...dge_tangent_updater+short.float.float-.cxx | 4 - + .../boxm_edge_updater+short.float.float-.cxx | 3 - + ....BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx | 4 - + ...XM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx | 4 - + ...t.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx | 4 - + ...OXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx | 4 - + ...OXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 4 - + ..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 4 - + ..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 3 - + ..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 3 - + ...or+short.boxm_inf_line_sample+float---.cxx | 7 - + .../boxm/algo/rt/boxm_change_3d_functor.h | 100 - + .../algo/rt/boxm_change_probability_functor.h | 83 - + .../rt/boxm_compute_num_rays_statistics.h | 65 - + .../boxm/algo/rt/boxm_edge_tangent_updater.h | 76 - + .../algo/rt/boxm_edge_tangent_updater.hxx | 291 --- + .../brl/bseg/boxm/algo/rt/boxm_edge_updater.h | 34 - + .../bseg/boxm/algo/rt/boxm_edge_updater.hxx | 110 - + .../boxm/algo/rt/boxm_expected_edge_functor.h | 53 - + .../rt/boxm_generate_edge_sample_functor.h | 65 - + ...oxm_generate_edge_tangent_sample_functor.h | 78 - + .../rt/boxm_generate_opt2_sample_functor.h | 197 -- + .../rt/boxm_generate_opt3_sample_functor.h | 219 -- + .../rt/boxm_generate_opt_sample_functor.h | 164 -- + .../rt/boxm_generate_shadow_sample_functor.h | 212 -- + .../bseg/boxm/algo/rt/boxm_opt2_optimizer.h | 37 - + .../bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx | 152 -- + .../bseg/boxm/algo/rt/boxm_opt3_optimizer.h | 37 - + .../bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx | 172 -- + .../algo/rt/boxm_opt_appearance_estimator.h | 85 - + .../algo/rt/boxm_opt_rt_bayesian_optimizer.h | 36 - + .../rt/boxm_opt_rt_bayesian_optimizer.hxx | 151 -- + .../boxm/algo/rt/boxm_pre_infinity_functor.h | 67 - + .../rt/boxm_render_expected_depth_functor.h | 109 - + .../boxm_render_expected_edge_image_functor.h | 109 - + ...nder_expected_edge_tangent_image_functor.h | 126 -- + .../rt/boxm_render_expected_image_functor.h | 103 - + ...oxm_render_expected_shadow_image_functor.h | 120 -- + .../bseg/boxm/algo/rt/boxm_rpc_registration.h | 447 ----- + .../algo/rt/boxm_shadow_app_initializer.h | 45 - + .../algo/rt/boxm_shadow_app_initializer.hxx | 122 -- + .../rt/boxm_shadow_appearance_estimator.h | 114 -- + .../algo/rt/boxm_shadow_bayes_optimizer.h | 51 - + .../algo/rt/boxm_shadow_bayes_optimizer.hxx | 195 -- + .../boxm/algo/rt/boxm_sun_vis_prob_functor.h | 103 - + .../boxm/algo/rt/boxm_update_image_functor.h | 172 -- + contrib/brl/bseg/boxm/algo/rt/dummy.cxx | 0 + .../brl/bseg/boxm/algo/rt/pro/CMakeLists.txt | 29 - + .../boxm/algo/rt/pro/boxm_algo_rt_processes.h | 29 - + .../algo/rt/pro/boxm_algo_rt_register.cxx | 33 - + .../boxm/algo/rt/pro/boxm_algo_rt_register.h | 11 - + .../boxm_change_probabilty_process.cxx | 120 -- + .../processes/boxm_edge_update_process.cxx | 280 --- + .../boxm_estimate_camera_process.cxx | 199 -- + .../boxm_generate_edge_samples_process.cxx | 139 -- + .../boxm_generate_opt2_samples_process.cxx | 142 -- + .../boxm_generate_opt3_samples_process.cxx | 114 -- + .../boxm_generate_opt_samples_process.cxx | 102 - + .../processes/boxm_opt2_update_process.cxx | 153 -- + .../processes/boxm_opt3_update_process.cxx | 153 -- + .../boxm_opt_bayesian_update_process.cxx | 145 -- + .../processes/boxm_ray_statistics_process.cxx | 107 - + .../boxm_render_expected_depth_rt_process.cxx | 114 -- + .../boxm_render_expected_edge_process.cxx | 162 -- + .../boxm_render_expected_rt_process.cxx | 143 -- + .../boxm_rpc_registration_process.cxx | 119 -- + .../pro/processes/boxm_update_rt_process.cxx | 136 -- + .../boxm/algo/rt/pro/tests/CMakeLists.txt | 2 - + .../boxm/algo/rt/pro/tests/test_include.cxx | 4 - + .../bseg/boxm/algo/rt/tests/CMakeLists.txt | 16 - + .../algo/rt/tests/test_bayesian_optimizer.cxx | 102 - + .../bseg/boxm/algo/rt/tests/test_driver.cxx | 15 - + .../bseg/boxm/algo/rt/tests/test_edges.cxx | 26 - + .../bseg/boxm/algo/rt/tests/test_include.cxx | 30 - + .../algo/rt/tests/test_shadow_appearance.cxx | 72 - + .../algo/rt/tests/test_template_include.cxx | 9 - + contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt | 22 - + .../algo/sp/boxm_compute_volume_visibility.h | 172 -- + .../boxm/algo/sp/boxm_depth_image_triangle.h | 127 -- + .../brl/bseg/boxm/algo/sp/boxm_render_image.h | 166 -- + .../boxm/algo/sp/boxm_render_image_triangle.h | 167 -- + contrib/brl/bseg/boxm/algo/sp/boxm_update.h | 374 ---- + .../bseg/boxm/algo/sp/boxm_update_triangle.h | 356 ---- + contrib/brl/bseg/boxm/algo/sp/dummy.cxx | 0 + .../brl/bseg/boxm/algo/sp/pro/CMakeLists.txt | 27 - + ...brdb_value_t+vil_image_view_base_sptr-.cxx | 10 - + .../boxm/algo/sp/pro/boxm_algo_sp_processes.h | 14 - + .../algo/sp/pro/boxm_algo_sp_register.cxx | 18 - + .../boxm/algo/sp/pro/boxm_algo_sp_register.h | 11 - + .../boxm_render_expected_process.cxx | 117 -- + .../sp/pro/processes/boxm_update_process.cxx | 107 - + .../boxm_volume_visibility_process.cxx | 129 -- + .../boxm/algo/sp/pro/tests/CMakeLists.txt | 2 - + .../boxm/algo/sp/pro/tests/test_include.cxx | 4 - + .../bseg/boxm/algo/sp/tests/CMakeLists.txt | 19 - + .../algo/sp/tests/test_compute_visibility.cxx | 90 - + .../bseg/boxm/algo/sp/tests/test_driver.cxx | 17 - + .../bseg/boxm/algo/sp/tests/test_include.cxx | 8 - + .../boxm/algo/sp/tests/test_render_image.cxx | 103 - + .../bseg/boxm/algo/sp/tests/test_update.cxx | 259 --- + .../algo/sp/tests/test_update_multi_bin.cxx | 262 --- + .../brl/bseg/boxm/algo/tests/CMakeLists.txt | 31 - + .../tests/test_boxm_fill_internal_cells.cxx | 112 -- + .../boxm/algo/tests/test_boxm_scene_crop.cxx | 129 -- + .../brl/bseg/boxm/algo/tests/test_driver.cxx | 23 - + .../boxm/algo/tests/test_fill_in_mesh.cxx | 121 -- + .../brl/bseg/boxm/algo/tests/test_include.cxx | 17 - + .../algo/tests/test_linear_operations.cxx | 82 - + .../boxm/algo/tests/test_remove_level0.cxx | 54 - + .../boxm/algo/tests/test_save_scene_raw.cxx | 122 -- + .../bseg/boxm/algo/tests/test_upload_mesh.cxx | 127 -- + .../brl/bseg/boxm/algo/tests/test_utils.cxx | 71 - + contrib/brl/bseg/boxm/algo/tests/test_utils.h | 18 - + contrib/brl/bseg/boxm/basic/CMakeLists.txt | 21 - + ...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 - + ...block_iterator+boct_tree+short.float--.cxx | 5 - + ...m_block_iterator+boct_tree+short.int--.cxx | 5 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + ...t_tree+short.boxm_edge_sample+float---.cxx | 6 - + ...hort.boxm_edge_tangent_sample+float---.cxx | 13 - + ...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 - + ...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 7 - + ...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 7 - + ..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + ...boct_tree+short.vgl_point_3d+double---.cxx | 6 - + ...terator+short.boxm_edge_sample+float--.cxx | 7 - + ...short.boxm_edge_tangent_sample+float--.cxx | 6 - + ...tor+short.boxm_inf_line_sample+float--.cxx | 6 - + ...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 - + ...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 6 - + ...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 6 - + ...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 6 - + ...h_iterator+short.vgl_point_3d+double--.cxx | 5 - + ...brdb_value_t+boxm_array_1d_float_sptr-.cxx | 4 - + .../vbl_io_smart_ptr+boxm_array_1d_float-.cxx | 4 - + .../vbl_smart_ptr+boxm_array_1d_float-.cxx | 4 - + .../basic/boxm_block_vis_graph_iterator.h | 53 - + .../basic/boxm_block_vis_graph_iterator.hxx | 173 -- + .../boxm/basic/boxm_block_vis_graph_node.h | 52 - + .../boxm/basic/boxm_cell_vis_graph_iterator.h | 54 - + .../basic/boxm_cell_vis_graph_iterator.hxx | 131 -- + .../bseg/boxm/basic/boxm_num_rays_functor.h | 44 - + .../bseg/boxm/basic/boxm_raytrace_function.h | 618 ------ + .../bseg/boxm/basic/boxm_seg_length_functor.h | 46 - + .../bseg/boxm/basic/boxm_util_data_types.cxx | 17 - + .../bseg/boxm/basic/boxm_util_data_types.h | 30 - + .../brl/bseg/boxm/basic/tests/CMakeLists.txt | 15 - + .../boxm/basic/tests/test_block_vis_graph.cxx | 48 - + .../boxm/basic/tests/test_cell_vis_graph.cxx | 54 - + .../brl/bseg/boxm/basic/tests/test_driver.cxx | 13 - + .../bseg/boxm/basic/tests/test_include.cxx | 9 - + .../basic/tests/test_template_include.cxx | 4 - + contrib/brl/bseg/boxm/boxm_apm_traits.cxx | 86 - + contrib/brl/bseg/boxm/boxm_apm_traits.h | 206 -- + contrib/brl/bseg/boxm/boxm_aux_scene.h | 54 - + contrib/brl/bseg/boxm/boxm_aux_scene.hxx | 121 -- + contrib/brl/bseg/boxm/boxm_aux_traits.h | 74 - + contrib/brl/bseg/boxm/boxm_block.h | 58 - + contrib/brl/bseg/boxm/boxm_block.hxx | 80 - + contrib/brl/bseg/boxm/boxm_export.h | 23 - + contrib/brl/bseg/boxm/boxm_io_scene_base.cxx | 25 - + contrib/brl/bseg/boxm/boxm_io_scene_base.h | 21 - + contrib/brl/bseg/boxm/boxm_scene.h | 559 ------ + contrib/brl/bseg/boxm/boxm_scene.hxx | 1764 ----------------- + contrib/brl/bseg/boxm/boxm_scene_base.cxx | 35 - + contrib/brl/bseg/boxm/boxm_scene_base.h | 85 - + contrib/brl/bseg/boxm/boxm_scene_parser.cxx | 277 --- + contrib/brl/bseg/boxm/boxm_scene_parser.h | 108 - + contrib/brl/bseg/boxm/pro/CMakeLists.txt | 29 - + ..._tree+short.vnl_vector_fixed+float.3--.cxx | 10 - + ...tree+short.vnl_vector_fixed+float.3---.cxx | 17 - + ...tree+short.vnl_vector_fixed+float.3---.cxx | 6 - + .../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 - + ...ee+short.vnl_vector_fixed+float.3---~-.cxx | 12 - + contrib/brl/bseg/boxm/pro/boxm_processes.h | 16 - + contrib/brl/bseg/boxm/pro/boxm_register.cxx | 27 - + contrib/brl/bseg/boxm/pro/boxm_register.h | 11 - + .../boxm_camera_viewing_scene_process.cxx | 131 -- + .../processes/boxm_clean_scene_process.cxx | 102 - + ...oxm_construct_scene_from_image_process.cxx | 219 -- + .../processes/boxm_create_scene_process.cxx | 218 -- + .../boxm_force_write_blocks_process.cxx | 102 - + .../pro/processes/boxm_load_scene_process.cxx | 73 - + .../processes/boxm_proj_local_cam_process.cxx | 103 - + .../processes/boxm_upload_mesh_process.cxx | 148 -- + .../brl/bseg/boxm/pro/tests/CMakeLists.txt | 2 - + .../brl/bseg/boxm/pro/tests/test_include.cxx | 4 - + contrib/brl/bseg/boxm/sample/CMakeLists.txt | 29 - + ...ct_tree+short.boxm_edge_sample+float--.cxx | 5 - + ...short.boxm_edge_tangent_sample+float--.cxx | 6 - + ...ct_tree+short.boxm_opt2_sample+float--.cxx | 4 - + ...boct_tree+short.boxm_rt_sample+float--.cxx | 4 - + ...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 5 - + ...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 12 - + ...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 9 - + ...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 5 - + ..._tree+short.boxm_scalar_sample+float--.cxx | 4 - + ...ee_cell+short.boxm_edge_sample+float--.cxx | 5 - + ...short.boxm_edge_tangent_sample+float--.cxx | 6 - + ...ee_cell+short.boxm_opt2_sample+float--.cxx | 4 - + ...tree_cell+short.boxm_rt_sample+float--.cxx | 4 - + ...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 - + ...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 11 - + ...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 10 - + ...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 6 - + ..._cell+short.boxm_scalar_sample+float--.cxx | 4 - + ..._reader+short.boxm_edge_sample+float--.cxx | 8 - + ...short.boxm_edge_tangent_sample+float--.cxx | 5 - + ...der+short.boxm_inf_line_sample+float--.cxx | 5 - + ..._reader+short.boxm_opt2_sample+float--.cxx | 5 - + ...ll_reader+short.boxm_rt_sample+float--.cxx | 5 - + ...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 - + ...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 6 - + ...eader+short.boxm_scalar_sample+float--.cxx | 5 - + ...le+float-.boxm_aux_edge_sample+float--.cxx | 5 - + ...loat-.boxm_edge_tangent_sample+float--.cxx | 7 - + ...M_APM_MOB_GREY-.boxm_rt_sample+float--.cxx | 7 - + ...APM_MOG_GREY-.boxm_opt2_sample+float--.cxx | 7 - + ...M_APM_MOG_GREY-.boxm_rt_sample+float--.cxx | 7 - + ....boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx | 7 - + ..._SIMPLE_GREY-.boxm_opt2_sample+float--.cxx | 7 - + ...PM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx | 7 - + ...IMPLE_GREY-.boxm_scalar_sample+float--.cxx | 8 - + ...xm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx | 7 - + ...float.boxm_edge_tangent_sample+float--.cxx | 7 - + ...t_tree+short.boxm_edge_sample+float---.cxx | 13 - + ...hort.boxm_edge_tangent_sample+float---.cxx | 6 - + ...ee+short.boxm_inf_line_sample+float---.cxx | 6 - + ...t_tree+short.boxm_opt2_sample+float---.cxx | 9 - + ...oct_tree+short.boxm_rt_sample+float---.cxx | 9 - + ...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 - + ...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 12 - + ...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 12 - + ..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 - + ...tree+short.boxm_scalar_sample+float---.cxx | 9 - + ...t_tree+short.boxm_edge_sample+float---.cxx | 9 - + ...hort.boxm_edge_tangent_sample+float---.cxx | 10 - + ...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 - + ...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 11 - + ...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 12 - + ..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 - + .../Templates/boxm_edge_sample+float-.cxx | 4 - + .../boxm_edge_tangent_sample+float-.cxx | 3 - + .../Templates/boxm_inf_line_sample+float-.cxx | 3 - + .../Templates/boxm_opt2_sample+float-.cxx | 4 - + .../Templates/boxm_plane_obs+float-.cxx | 3 - + .../Templates/boxm_rt_sample+float-.cxx | 3 - + .../boxm_sample+BOXM_APM_MOB_GREY-.cxx | 7 - + .../boxm_sample+BOXM_APM_MOG_GREY-.cxx | 9 - + .../boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx | 4 - + ...xm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx | 4 - + .../Templates/boxm_scalar_sample+float-.cxx | 4 - + ...t_tree+short.boxm_edge_sample+float---.cxx | 9 - + ...hort.boxm_edge_tangent_sample+float---.cxx | 10 - + ...t_tree+short.boxm_opt2_sample+float---.cxx | 6 - + ...oct_tree+short.boxm_rt_sample+float---.cxx | 6 - + ...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 6 - + ...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 10 - + ...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 11 - + ..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 6 - + ...tree+short.boxm_scalar_sample+float---.cxx | 6 - + .../boxm_scene+boct_tree+short.int--.cxx | 5 - + ...tree+short.boxm_edge_sample+float---~-.cxx | 16 - + ...rt.boxm_edge_tangent_sample+float---~-.cxx | 17 - + ...tree+short.boxm_opt2_sample+float---~-.cxx | 13 - + ...t_tree+short.boxm_rt_sample+float---~-.cxx | 13 - + ...ort.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx | 13 - + ...ort.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx | 17 - + ....boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx | 18 - + ...ample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx | 13 - + ...ee+short.boxm_scalar_sample+float---~-.cxx | 13 - + ...mage_view+boxm_inf_line_sample+float--.cxx | 5 - + .../brl/bseg/boxm/sample/algo/CMakeLists.txt | 18 - + ...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 5 - + ...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 5 - + ...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 6 - + ...-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 7 - + ...-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 7 - + ....boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx | 10 - + .../boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx | 3 - + ....boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx | 7 - + ...oxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx | 14 - + .../sample/algo/boxm_mob_grey_processor.cxx | 83 - + .../sample/algo/boxm_mob_grey_processor.h | 35 - + .../sample/algo/boxm_mog_grey_processor.cxx | 286 --- + .../sample/algo/boxm_mog_grey_processor.h | 50 - + .../sample/algo/boxm_sigma_normalizer.cxx | 104 - + .../boxm/sample/algo/boxm_sigma_normalizer.h | 43 - + .../algo/boxm_simple_grey_processor.cxx | 437 ---- + .../sample/algo/boxm_simple_grey_processor.h | 86 - + .../boxm/sample/algo/tests/CMakeLists.txt | 11 - + .../boxm/sample/algo/tests/test_driver.cxx | 11 - + .../boxm/sample/algo/tests/test_include.cxx | 6 - + .../algo/tests/test_sigma_normalizer.cxx | 59 - + .../brl/bseg/boxm/sample/boxm_edge_sample.h | 97 - + .../brl/bseg/boxm/sample/boxm_edge_sample.hxx | 137 -- + .../boxm/sample/boxm_edge_tangent_sample.h | 69 - + .../boxm/sample/boxm_edge_tangent_sample.hxx | 79 - + .../bseg/boxm/sample/boxm_inf_line_sample.h | 55 - + .../bseg/boxm/sample/boxm_inf_line_sample.hxx | 79 - + .../brl/bseg/boxm/sample/boxm_opt2_sample.h | 72 - + .../brl/bseg/boxm/sample/boxm_opt2_sample.hxx | 83 - + .../brl/bseg/boxm/sample/boxm_opt3_sample.h | 76 - + .../brl/bseg/boxm/sample/boxm_opt3_sample.hxx | 92 - + contrib/brl/bseg/boxm/sample/boxm_plane_obs.h | 45 - + .../brl/bseg/boxm/sample/boxm_plane_obs.hxx | 69 - + contrib/brl/bseg/boxm/sample/boxm_rt_sample.h | 70 - + .../brl/bseg/boxm/sample/boxm_rt_sample.hxx | 81 - + contrib/brl/bseg/boxm/sample/boxm_sample.h | 68 - + contrib/brl/bseg/boxm/sample/boxm_sample.hxx | 71 - + .../bseg/boxm/sample/boxm_sample_multi_bin.h | 63 - + .../boxm/sample/boxm_sample_multi_bin.hxx | 98 - + .../brl/bseg/boxm/sample/boxm_scalar_sample.h | 55 - + .../bseg/boxm/sample/boxm_scalar_sample.hxx | 70 - + .../brl/bseg/boxm/sample/boxm_update_sample.h | 17 - + .../boxm/sample/boxm_vis_implicit_sample.h | 16 - + contrib/brl/bseg/boxm/sample/dummy.cxx | 0 + .../brl/bseg/boxm/sample/tests/CMakeLists.txt | 4 - + .../bseg/boxm/sample/tests/test_include.cxx | 14 - + .../sample/tests/test_template_include.cxx | 12 - + contrib/brl/bseg/boxm/tests/CMakeLists.txt | 32 - + contrib/brl/bseg/boxm/tests/camera0.txt | 104 - + contrib/brl/bseg/boxm/tests/frame_00000.txt | 7 - + .../brl/bseg/boxm/tests/test_binary_io.cxx | 75 - + .../brl/bseg/boxm/tests/test_block_iter.cxx | 47 - + .../bseg/boxm/tests/test_cell_iterator.cxx | 51 - + contrib/brl/bseg/boxm/tests/test_driver.cxx | 21 - + contrib/brl/bseg/boxm/tests/test_include.cxx | 10 - + .../tests/test_load_neighboring_blocks.cxx | 89 - + .../bseg/boxm/tests/test_region_finder.cxx | 80 - + .../bseg/boxm/tests/test_template_include.cxx | 5 - + contrib/brl/bseg/boxm/tests/test_utils.cxx | 72 - + contrib/brl/bseg/boxm/tests/test_utils.h | 17 - + contrib/brl/bseg/boxm/util/CMakeLists.txt | 23 - + ...triangle_interpolation_iterator+float-.cxx | 3 - + .../bseg/boxm/util/boxm_cell_data_traits.cxx | 25 - + .../bseg/boxm/util/boxm_cell_data_traits.h | 89 - + .../brl/bseg/boxm/util/boxm_plane_ransac.h | 126 -- + .../boxm/util/boxm_quad_scan_iterator.cxx | 188 -- + .../bseg/boxm/util/boxm_quad_scan_iterator.h | 66 - + .../boxm/util/boxm_rational_camera_utils.cxx | 36 - + .../boxm/util/boxm_rational_camera_utils.h | 30 - + .../boxm/util/boxm_raytrace_operations.cxx | 232 --- + .../bseg/boxm/util/boxm_raytrace_operations.h | 452 ----- + contrib/brl/bseg/boxm/util/boxm_test_util.cxx | 141 -- + contrib/brl/bseg/boxm/util/boxm_test_util.h | 37 - + .../boxm_triangle_interpolation_iterator.h | 53 - + .../boxm_triangle_interpolation_iterator.hxx | 100 - + .../boxm/util/boxm_triangle_scan_iterator.cxx | 59 - + .../boxm/util/boxm_triangle_scan_iterator.h | 46 - + contrib/brl/bseg/boxm/util/boxm_utils.cxx | 1469 -------------- + contrib/brl/bseg/boxm/util/boxm_utils.h | 168 -- + contrib/brl/bseg/boxm/util/boxm_vrml_util.h | 214 -- + .../brl/bseg/boxm/util/tests/CMakeLists.txt | 18 - + contrib/brl/bseg/boxm/util/tests/camera0.txt | 104 - + .../brl/bseg/boxm/util/tests/frame_00000.txt | 7 - + .../util/tests/test_boxm_plane_ransac.cxx | 79 - + .../tests/test_boxm_rational_camera_utils.cxx | 24 - + .../brl/bseg/boxm/util/tests/test_driver.cxx | 15 - + .../brl/bseg/boxm/util/tests/test_include.cxx | 12 - + .../boxm/util/tests/test_quad_interpolate.cxx | 117 -- + .../boxm/util/tests/test_template_include.cxx | 3 - + contrib/brl/bseg/boxm_batch/CMakeLists.txt | 59 - + contrib/brl/bseg/boxm_batch/reg_boxm.cxx | 135 -- + contrib/brl/bseg/boxm_batch/reg_boxm.h | 12 - + .../brl/bseg/boxm_batch/tests/CMakeLists.txt | 2 - + .../bseg/boxm_batch/tests/test_include.cxx | 3 - + contrib/brl/bseg/boxm_bridge/CMakeLists.txt | 25 - + .../boxm_bridge/boxm2_normails_to_boxm.cxx | 233 --- + .../brl/bseg/boxm_bridge/boxm2_to_boxm.cxx | 292 --- + contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h | 24 - + .../boxm_bridge/boxm_normals_to_boxm2.cxx | 326 --- + .../brl/bseg/boxm_bridge/boxm_to_boxm2.cxx | 262 --- + contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h | 30 - + .../brl/bseg/boxm_bridge/tests/CMakeLists.txt | 2 - + .../bseg/boxm_bridge/tests/test_include.cxx | 4 - + contrib/brl/bseg/bvpl/CMakeLists.txt | 1 - + .../brl/bseg/bvpl/bvpl_octree/CMakeLists.txt | 71 - + ..._sample+bsta_num_obs+bsta_gauss_sf1---.cxx | 11 - + ..._tree+short.bvpl_octree_sample+float--.cxx | 6 - + ..._tree+short.bvpl_pca_basis_sample+10--.cxx | 6 - + ..._tree+short.bvpl_taylor_basis2_sample-.cxx | 6 - + ...sample+bsta_num_obs+bsta_gauss_sf1----.cxx | 20 - + ...tree+short.bvpl_octree_sample+float---.cxx | 17 - + ...tree+short.bvpl_pca_basis_sample+10---.cxx | 11 - + ...tree+short.bvpl_taylor_basis2_sample--.cxx | 12 - + .../Templates/bvpl_global_pca+125-.cxx | 2 - + .../bvpl_global_taylor+double.10-.cxx | 3 - + .../Templates/bvpl_global_taylor+float.3-.cxx | 3 - + ...l_smart_ptr+bvpl_discover_pca_kernels-.cxx | 4 - + .../vbl_smart_ptr+bvpl_global_corners-.cxx | 4 - + .../vbl_smart_ptr+bvpl_global_pca+125--.cxx | 5 - + ...art_ptr+bvpl_global_taylor+double.10--.cxx | 5 - + .../vbl_smart_ptr+bvpl_pca_error_scenes-.cxx | 4 - + .../vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 - + .../vnl_matrix_fixed+double.125.125-.cxx | 2 - + .../bvpl_octree/bvpl_block_kernel_operator.h | 134 -- + .../bvpl_octree/bvpl_block_vector_operator.h | 146 -- + .../bvpl/bvpl_octree/bvpl_cell_data_traits.h | 34 - + .../bvpl/bvpl_octree/bvpl_corner_detector.h | 299 --- + .../bvpl/bvpl_octree/bvpl_corner_functors.h | 68 - + .../bvpl_octree/bvpl_discover_pca_kernels.cxx | 1028 ---------- + .../bvpl_octree/bvpl_discover_pca_kernels.h | 309 --- + .../bvpl_gauss3D_steerable_filters.cxx | 512 ----- + .../bvpl_gauss3D_steerable_filters.h | 61 - + .../bvpl/bvpl_octree/bvpl_global_corners.cxx | 475 ----- + .../bvpl/bvpl_octree/bvpl_global_corners.h | 71 - + .../bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx | 5 - + .../bseg/bvpl/bvpl_octree/bvpl_global_pca.h | 153 -- + .../bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx | 1018 ---------- + .../bvpl/bvpl_octree/bvpl_global_taylor.cxx | 12 - + .../bvpl/bvpl_octree/bvpl_global_taylor.h | 100 - + .../bvpl/bvpl_octree/bvpl_global_taylor.hxx | 645 ------ + .../bvpl_octree/bvpl_octree_kernel_operator.h | 142 -- + .../bvpl/bvpl_octree/bvpl_octree_neighbors.h | 78 - + .../bvpl_octree/bvpl_octree_vector_operator.h | 84 - + .../bvpl_octree_vector_operator_impl.h | 30 - + .../bvpl/bvpl_octree/bvpl_octree_vrml_util.h | 84 - + .../bvpl_octree/bvpl_pca_error_scenes.cxx | 50 - + .../bvpl/bvpl_octree/bvpl_pca_error_scenes.h | 39 - + .../bvpl_octree/bvpl_scene_kernel_operator.h | 213 -- + .../bvpl_scene_neighborhood_operator.cxx | 6 - + .../bvpl_scene_neighborhood_operator.h | 97 - + .../bvpl_octree/bvpl_scene_statistics.cxx | 80 - + .../bvpl/bvpl_octree/bvpl_scene_statistics.h | 102 - + .../bvpl_octree/bvpl_scene_vector_operator.h | 178 -- + .../bvpl/bvpl_octree/bvpl_taylor_basis.cxx | 258 --- + .../bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h | 50 - + .../bvpl_octree/bvpl_taylor_scenes_map.cxx | 61 - + .../bvpl/bvpl_octree/bvpl_taylor_scenes_map.h | 41 - + .../bseg/bvpl/bvpl_octree/io/CMakeLists.txt | 20 - + ...o_smart_ptr+bvpl_discover_pca_kernels-.cxx | 4 - + .../vbl_io_smart_ptr+bvpl_global_corners-.cxx | 4 - + ...vbl_io_smart_ptr+bvpl_global_pca+125--.cxx | 6 - + ...art_ptr+bvpl_global_taylor+double.10--.cxx | 6 - + ...bl_io_smart_ptr+bvpl_pca_error_scenes-.cxx | 4 - + ...l_io_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 - + .../io/bvpl_io_discover_pca_kernels.cxx | 50 - + .../io/bvpl_io_discover_pca_kernels.h | 43 - + .../bvpl_octree/io/bvpl_io_global_corners.cxx | 50 - + .../bvpl_octree/io/bvpl_io_global_corners.h | 44 - + .../bvpl_octree/io/bvpl_io_global_pca.cxx | 50 - + .../bvpl/bvpl_octree/io/bvpl_io_global_pca.h | 44 - + .../bvpl_octree/io/bvpl_io_global_taylor.h | 75 - + .../io/bvpl_io_pca_error_scenes.cxx | 50 - + .../bvpl_octree/io/bvpl_io_pca_error_scenes.h | 43 - + .../io/bvpl_io_taylor_scenes_map.cxx | 50 - + .../io/bvpl_io_taylor_scenes_map.h | 38 - + .../bvpl/bvpl_octree/io/tests/CMakeLists.txt | 2 - + .../bvpl_octree/io/tests/test_include.cxx | 8 - + .../bseg/bvpl/bvpl_octree/pro/CMakeLists.txt | 31 - + .../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 - + ...alue_t+bvpl_discover_pca_kernels_sptr-.cxx | 6 - + ...brdb_value_t+bvpl_global_corners_sptr-.cxx | 6 - + ...brdb_value_t+bvpl_global_pca_125_sptr-.cxx | 6 - + ...db_value_t+bvpl_pca_error_scenes_sptr-.cxx | 6 - + ...b_value_t+bvpl_taylor_scenes_map_sptr-.cxx | 6 - + ...rt_ptr+bvpl_global_taylor+double.10---.cxx | 8 - + .../bvpl_octree/pro/bvpl_octree_processes.h | 61 - + .../bvpl_octree/pro/bvpl_octree_register.cxx | 81 - + .../bvpl_octree/pro/bvpl_octree_register.h | 11 - + .../bvpl_block_avg_value_process.cxx | 81 - + .../bvpl_block_kernel_operator_process.cxx | 208 -- + .../bvpl_compute_gauss_gradients.cxx | 86 - + .../processes/bvpl_create_scene_process.cxx | 88 - + .../bvpl_grad_scene_to_bin_process.cxx | 136 -- + .../processes/bvpl_nonmax_supp_process.cxx | 178 -- + .../bvpl_plane_propagate_process.cxx | 209 -- + .../pro/processes/bvpl_save_vrml_process.cxx | 89 - + .../bvpl_scene_histogram_process.cxx | 66 - + .../bvpl_scene_kernel_operator_process.cxx | 179 -- + .../bvpl_scene_vector_operator_process.cxx | 151 -- + .../bvpl_compute_beaudet_measure_process.cxx | 64 - + .../bvpl_compute_harris_measure_process.cxx | 65 - + .../bvpl_corner_statistics_process.cxx | 57 - + .../bvpl_load_global_corners_process.cxx | 50 - + .../bvpl_threshold_corners_process.cxx | 61 - + .../pca/bvpl_add_pca_errors_process.cxx | 94 - + ...pl_combine_pairwise_statistics_process.cxx | 95 - + .../bvpl_compute_pca_error_block_process.cxx | 69 - + .../bvpl_compute_pca_error_scene_process.cxx | 132 -- + .../bvpl_compute_pca_test_error_process.cxx | 59 - + .../bvpl_discover_pca_features_process.cxx | 98 - + .../processes/pca/bvpl_global_pca_process.cxx | 64 - + .../pca/bvpl_init_global_pca_process.cxx | 50 - + .../pca/bvpl_load_global_pca_process.cxx | 50 - + .../bvpl_load_pca_error_scenes_process.cxx | 58 - + .../pca/bvpl_load_pca_info_process.cxx | 55 - + ...l_normalize_pca_training_error_process.cxx | 61 - + .../pca/bvpl_pca_global_add_error_process.cxx | 77 - + .../bvpl_pca_global_proj_error_process.cxx | 63 - + .../bvpl_pca_global_statistics_process.cxx | 75 - + .../pca/bvpl_pca_project_process.cxx | 63 - + .../bvpl_compute_sf_raw_response_process.cxx | 70 - + .../bvpl_init_sf_response_scene_process.cxx | 87 - + .../taylor/bvpl_add_taylor_errors_process.cxx | 90 - + ...pl_compute_taylor_coefficients_process.cxx | 80 - + .../bvpl_compute_taylor_error_process.cxx | 78 - + ...bvpl_explore_coefficient_scene_process.cxx | 77 - + .../bvpl_init_global_taylor_process.cxx | 68 - + .../bvpl_load_global_taylor_process.cxx | 52 - + .../bvpl_load_taylor_scenes_process.cxx | 72 - + .../bvpl_taylor_global_add_error_process.cxx | 77 - + .../bvpl_taylor_global_proj_error_process.cxx | 63 - + .../bvpl/bvpl_octree/pro/tests/CMakeLists.txt | 16 - + .../test_bvpl_plane_propagation_process.cxx | 144 -- + .../bvpl_octree/pro/tests/test_driver.cxx | 10 - + .../bvpl_octree/pro/tests/test_include.cxx | 4 - + .../bvpl/bvpl_octree/python/pca/readme.txt | 7 - + .../pca/reconstruction_error/add_pca_error.py | 193 -- + .../compute_pca_error_scene.py | 164 -- + .../extract_pca_kernels.py | 61 - + .../python/pca/reconstruction_error/pca.sh | 68 - + .../pca/reconstruction_error/save_pca_raw.py | 108 - + .../pca/training_error/extract_pca_kernels.py | 66 - + .../normalized_training_error.py | 42 - + .../python/pca/training_error/pca.sh | 42 - + .../bseg/bvpl/bvpl_octree/python/readme.txt | 1 - + .../reconstruction_error/add_taylor_error.py | 183 -- + .../compute_taylor_error_scene.py | 156 -- + .../reconstruction_error/explore_histogram.py | 113 -- + .../run_taylor_kernels.py | 98 - + .../reconstruction_error/save_taylor_raw.py | 146 -- + .../taylor/reconstruction_error/taylor.sh | 67 - + .../taylor_kernel_threads.py | 72 - + .../bvpl/bvpl_octree/sample/CMakeLists.txt | 16 - + .../bsta_gaussian_sphere+float.1-.cxx | 3 - + ...e_sample+bsta_num_obs+bsta_gauss_sf1--.cxx | 7 - + .../Templates/bvpl_octree_sample+float-.cxx | 3 - + .../Templates/bvpl_pca_basis_sample+10-.cxx | 3 - + .../bvpl_octree/sample/bvpl_octree_sample.h | 57 - + .../bvpl_octree/sample/bvpl_octree_sample.hxx | 70 - + .../sample/bvpl_pca_basis_sample.h | 57 - + .../sample/bvpl_pca_basis_sample.hxx | 72 - + .../sample/bvpl_taylor_basis_sample.cxx | 58 - + .../sample/bvpl_taylor_basis_sample.h | 59 - + .../bvpl_octree/sample/tests/CMakeLists.txt | 4 - + .../bvpl_octree/sample/tests/test_include.cxx | 5 - + .../sample/tests/test_template_include.cxx | 4 - + .../bvpl/bvpl_octree/tests/CMakeLists.txt | 35 - + .../bvpl/bvpl_octree/tests/test_driver.cxx | 19 - + .../tests/test_gauss3D_steerable_filters.cxx | 127 -- + .../bvpl/bvpl_octree/tests/test_include.cxx | 24 - + .../tests/test_octree_kernel_operator.cxx | 352 ---- + .../tests/test_octree_neighbors.cxx | 92 - + .../bvpl_octree/tests/test_pca_kernels.cxx | 304 --- + .../bvpl_octree/tests/test_taylor_basis.cxx | 143 -- + .../tests/test_template_include.cxx | 4 - + .../bvpl/bvpl_octree/tests/test_utils.cxx | 94 - + .../bseg/bvpl/bvpl_octree/tests/test_utils.h | 20 - + .../brl/bseg/bvpl/kernels/pro/CMakeLists.txt | 2 +- + ...b_value_t+bvpl_taylor_scenes_map_sptr-.cxx | 6 - + ...l_io_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 - + .../kernels/pro/bvpl_kernels_register.cxx | 1 - + .../bvpl_load_taylor_responses_process.cxx | 53 - + .../brl/bseg/bvpl_octree_batch/CMakeLists.txt | 44 - + .../bvpl_octree_batch/reg_bvpl_octree.cxx | 61 - + .../bseg/bvpl_octree_batch/reg_bvpl_octree.h | 10 - + .../bvpl_octree_batch/tests/CMakeLists.txt | 2 - + .../bvpl_octree_batch/tests/test_include.cxx | 3 - + contrib/brl/bseg/bvxm/algo/CMakeLists.txt | 3 +- + .../brl/bseg/bvxm/algo/bvxm_boxm_convert.h | 152 -- + contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt | 3 +- + .../bseg/bvxm/algo/pro/bvxm_algo_processes.h | 2 +- + .../bseg/bvxm/algo/pro/bvxm_algo_register.cxx | 2 +- + .../boxm_scene_to_bvxm_grid_process.cxx | 129 -- + .../brl/bseg/bvxm/algo/tests/CMakeLists.txt | 3 - + .../tests/test_boxm_scene_to_bvxm_grid.cxx | 111 -- + .../brl/bseg/bvxm/algo/tests/test_driver.cxx | 4 +- + .../brl/bseg/bvxm/algo/tests/test_include.cxx | 1 - + 653 files changed, 7 insertions(+), 47919 deletions(-) + delete mode 100644 contrib/brl/bseg/boxm/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx + delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_crop_scene.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_init_scene.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_linear_operations.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_merge_mog.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_refine.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_block_raw.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_split_sample.h + delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_change_probability_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt3_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_update_image_functor.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/dummy.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_render_image.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_render_image_triangle.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_update.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/dummy.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_utils.cxx + delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_utils.h + delete mode 100644 contrib/brl/bseg/boxm/basic/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_raytrace_function.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_util_data_types.h + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_apm_traits.cxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_apm_traits.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_scene.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_scene.hxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_traits.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_block.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_block.hxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_export.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_io_scene_base.cxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_io_scene_base.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene.hxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_base.cxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_base.h + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_parser.cxx + delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_parser.h + delete mode 100644 contrib/brl/bseg/boxm/pro/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_processes.h + delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_register.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_register.h + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx + delete mode 100644 contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/pro/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_plane_obs.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_rt_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_update_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h + delete mode 100644 contrib/brl/bseg/boxm/sample/dummy.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/sample/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/tests/camera0.txt + delete mode 100644 contrib/brl/bseg/boxm/tests/frame_00000.txt + delete mode 100644 contrib/brl/bseg/boxm/tests/test_binary_io.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_block_iter.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_region_finder.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_utils.cxx + delete mode 100644 contrib/brl/bseg/boxm/tests/test_utils.h + delete mode 100644 contrib/brl/bseg/boxm/util/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_plane_ransac.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_test_util.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_test_util.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_utils.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_utils.h + delete mode 100644 contrib/brl/bseg/boxm/util/boxm_vrml_util.h + delete mode 100644 contrib/brl/bseg/boxm/util/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm/util/tests/camera0.txt + delete mode 100644 contrib/brl/bseg/boxm/util/tests/frame_00000.txt + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx + delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/boxm_batch/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm_batch/reg_boxm.cxx + delete mode 100644 contrib/brl/bseg/boxm_batch/reg_boxm.h + delete mode 100644 contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm_batch/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/boxm_bridge/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx + delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h + delete mode 100644 contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/boxm_bridge/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_test_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py + delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py + delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py + delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx + delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h + delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx + delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx + delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx + delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.h + delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt + delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx + delete mode 100644 contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h + delete mode 100644 contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx + delete mode 100644 contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx + +diff --git a/contrib/brl/bseg/CMakeLists.txt b/contrib/brl/bseg/CMakeLists.txt +index f2b53d63ae..0d20b12438 100644 +--- a/contrib/brl/bseg/CMakeLists.txt ++++ b/contrib/brl/bseg/CMakeLists.txt +@@ -41,18 +41,12 @@ add_subdirectory(brec_batch) + # octree + add_subdirectory(boct) + +-# octree based modeling +-add_subdirectory(boxm) +- + # updated, gpu compatible octree based modeling + add_subdirectory(boxm2) + + # updated, gpu compatible octree based modeling + add_subdirectory(boxm2_batch) + +-# octree based modeling python interface +-add_subdirectory(boxm_batch) +- + # semi-global matching + add_subdirectory(bsgm) + +@@ -62,15 +56,9 @@ add_subdirectory(bvpl) + # voxel processing library python interface + add_subdirectory(bvpl_batch) + +-# voxel processing library python interface for octrees +-add_subdirectory(bvpl_octree_batch) +- + # Brown affine patch library, SIFT keypoint & descriptor + add_subdirectory(bapl) + +-#the bridge lib to convert between boxm and boxm2 scenes +-add_subdirectory(boxm_bridge) +- + #multi gpu library + add_subdirectory(boxm2_multi) + +diff --git a/contrib/brl/bseg/boxm/CMakeLists.txt b/contrib/brl/bseg/boxm/CMakeLists.txt +deleted file mode 100644 +index 6a0e5159f4..0000000000 +--- a/contrib/brl/bseg/boxm/CMakeLists.txt ++++ /dev/null +@@ -1,52 +0,0 @@ +-# contrib/brl/bseg/boxm/CMakeLists.txt +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +-if(EXPAT_FOUND) +- +-include_directories( ${EXPAT_INCLUDE_DIR} ) +-include_directories( ${GEL_INCLUDE_DIR} ) +-include_directories( ${GEL_INCLUDE_DIR}/mrc ) +-include_directories( ${BRL_INCLUDE_DIR}/b3p/expatpp ) +- +-set(boxm_sources +- boxm_export.h +- boxm_block.hxx boxm_block.h +- boxm_scene_base.cxx boxm_scene_base.h +- boxm_scene.hxx boxm_scene.h +- boxm_aux_scene.hxx boxm_aux_scene.h +- boxm_scene_parser.cxx boxm_scene_parser.h +- boxm_apm_traits.cxx boxm_apm_traits.h +- boxm_aux_traits.h +- boxm_io_scene_base.h boxm_io_scene_base.cxx +-) +- +-aux_source_directory(Templates boxm_sources) +- +-vxl_add_library(LIBRARY_NAME boxm LIBRARY_SOURCES ${boxm_sources}) +- +-target_link_libraries(boxm boct bsta brdb ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_xio ${VXL_LIB_PREFIX}vpgl_algo vsol expatpp ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vsl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vcl) +- +-#processes +-add_subdirectory(pro) +- +-#util +-add_subdirectory(util) +- +-#samples +-add_subdirectory(sample) +- +-#basic algorithms involving scenes +-add_subdirectory(algo) +- +-#basic structures +-add_subdirectory(basic) +- +- +-#tests +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-endif() +- +-#install the .h .hxx and libs +diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx +deleted file mode 100644 +index 3c4f37b302..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +- +-BOCT_TREE_INSTANTIATE(short, gauss_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx +deleted file mode 100644 +index 7612eb4071..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef vnl_vector_fixed vector; +- +-BOCT_TREE_INSTANTIATE(short, vector ); +-BOCT_TREE_CELL_INSTANTIATE(short, vector); +diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx +deleted file mode 100644 +index 63921f9183..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef vnl_vector_fixed vector; +- +-BOCT_TREE_INSTANTIATE(short, vector ); +-BOCT_TREE_CELL_INSTANTIATE(short, vector); +diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx +deleted file mode 100644 +index fb055c2df5..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef vnl_vector_fixed vector; +- +- +-BOCT_TREE_INSTANTIATE(short, vector ); +-BOCT_TREE_CELL_INSTANTIATE(short, vector); +diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx +deleted file mode 100644 +index 1a7c7d6247..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +- +-BOCT_TREE_CELL_INSTANTIATE(short, gauss_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx +deleted file mode 100644 +index c104d2eed5..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx +deleted file mode 100644 +index e629c522cb..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx +deleted file mode 100644 +index 562247092f..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx +deleted file mode 100644 +index 3c0bdbf155..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx +deleted file mode 100644 +index 247d59847c..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +- +-typedef boct_tree short_tree_type; +-BOXM_BLOCK_INSTANTIATE(short_tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index 5bee916221..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx +deleted file mode 100644 +index 177fcfeeee..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx +deleted file mode 100644 +index 5f31529e08..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx +deleted file mode 100644 +index ac40b5ec2d..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx +deleted file mode 100644 +index 5834cafab6..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx +deleted file mode 100644 +index b4bce045ed..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree tree_type; +- +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx +deleted file mode 100644 +index 09f831722a..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx +deleted file mode 100644 +index 4129f1a830..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx +deleted file mode 100644 +index 50ef71285a..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +- +-typedef boct_tree short_tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(short_tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index 2cd39a3534..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx +deleted file mode 100644 +index 02bbdc01a7..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx +deleted file mode 100644 +index 88886e65c2..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree tree_type; +- +-BOXM_SCENE_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx +deleted file mode 100644 +index 273a95c2a6..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx +deleted file mode 100644 +index cf8ef6a19e..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx +deleted file mode 100644 +index 234256af7c..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree; +-BOXM_SCENE_INSTANTIATE(tree); +- +-typedef boct_tree short_tree; +-BOXM_SCENE_INSTANTIATE(short_tree); +diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index 4f9dff9071..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx +deleted file mode 100644 +index 5de38b0662..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +-#include +-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr"); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx +deleted file mode 100644 +index 08145d2ca1..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-typedef boct_tree tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx +deleted file mode 100644 +index a84c7ef3e4..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree tree_type; +- +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx +deleted file mode 100644 +index 0464e1208e..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-typedef boct_tree tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx +deleted file mode 100644 +index f3ea04b9df..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-typedef boct_tree tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx +deleted file mode 100644 +index 01b86c0776..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx ++++ /dev/null +@@ -1,14 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-typedef boct_tree tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +- +-typedef boct_tree short_tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx +deleted file mode 100644 +index ff3080df2c..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx +deleted file mode 100644 +index 912522b858..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-VBL_ARRAY_3D_INSTANTIATE(vsl_b_ifstream*); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx +deleted file mode 100644 +index 7158d38f30..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(boxm_scene_base); +diff --git a/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx +deleted file mode 100644 +index f9544ebe70..0000000000 +--- a/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(boxm_scene_base); +diff --git a/contrib/brl/bseg/boxm/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/CMakeLists.txt +deleted file mode 100644 +index 16694fbbc4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/CMakeLists.txt ++++ /dev/null +@@ -1,38 +0,0 @@ +-# brl/bseg/boxm/algo/CMakeLists.txt +-FIND_PACKAGE(RPLY REQUIRED) +-include_directories( ${MUL_INCLUDE_DIR} ) +-include_directories( ${RPLY_INCLUDE_DIR} ) +-set(boxm_algo_sources +- boxm_compute_scene_statistics.h +- boxm_crop_scene.h +- boxm_fill_in_mesh.h +- boxm_fill_internal_cells.h +- boxm_init_scene.h +- boxm_refine.h +- boxm_save_block_raw.h +- boxm_save_scene_raw.h +- boxm_save_scene_raw_general.h +- boxm_upload_mesh.h +- boxm_merge_mog.h boxm_merge_mog.cxx +- boxm_split_sample.h +- boxm_compute_scene_difference.h +- boxm_linear_operations.h +- boxm_scene_levels_utils.h +- ) +- +-vxl_add_library(LIBRARY_NAME boxm_algo LIBRARY_SOURCES ${boxm_algo_sources}) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-target_link_libraries(boxm_algo boxm boxm_util boxm_sample boxm_sample_algo boxm_basic bsta imesh ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl) +- +-#raytracing algorithms +-add_subdirectory(rt) +- +-#splatting algorithms +-add_subdirectory(sp) +- +-#processes +-add_subdirectory(pro) +diff --git a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h b/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h +deleted file mode 100644 +index 5043e4a2a3..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h ++++ /dev/null +@@ -1,98 +0,0 @@ +-#ifndef boxm_compute_scene_difference_h_ +-#define boxm_compute_scene_difference_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-void boxm_compute_block_difference(boxm_block > > * block1, +- boxm_block > > * block2, +- boxm_block > > * blockout, +- float threshold) +-{ +- typedef boxm_sample data_type; +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- tree_type* tree1 = block1->get_tree(); +- tree_type* tree2 = block2->get_tree(); +- tree_type* treeout = blockout->get_tree(); +- +- std::vector leaves=tree1->leaf_cells(); +- std::vector leavesout=treeout->leaf_cells(); +- +- for (unsigned i=0;i p=cell1->local_bounding_box(tree1->root_level()).centroid(); +- cell_type *cell2=tree2->locate_point(p); +- if (cell2) +- { +- data_type data1=cell1->data(); +- double len1=tree1->cell_bounding_box(cell1).width(); +- +- data_type data2=cell2->data(); +- double len2=tree2->cell_bounding_box(cell2).width(); +- +- data_type dataout=cellout->data(); +- +- double p1=1-std::exp(-data1.alpha*len1); +- double p2=1-std::exp(-data2.alpha*len2); +- +- double p=p1+p2-2*p1*p2; +- +- double alphaout=-std::log(1-p)/len1; +- if (pp2) +- dataout.appearance_=data1.appearance_; +- else +- dataout.appearance_=data2.appearance_; +- +- cellout->set_data(dataout); +- } +- } +-} +- +- +-void boxm_compute_scene_difference(boxm_scene > >&scene1, +- boxm_scene > >&scene2, +- boxm_scene > >&sceneout, +- float threshold) +-{ +- typedef boct_tree >tree_type; +- boxm_block_iterator iter1(&scene1); +- boxm_block_iterator iter2(&scene2); +- +- // scene out is cloned as scene1. +- scene1.clone_blocks(sceneout); +- boxm_block_iterator iterout(&sceneout); +- +- for (; !iter1.end(); iter1++,iter2++,iterout++) { +- std::cout<<'.'; +- scene1.load_block(iter1.index()); +- scene2.load_block(iter2.index()); +- sceneout.load_block(iterout.index()); +- +- //boxm_block* block1 = *iter1; +- //boxm_block* block2 = *iter2; +- //boxm_block* blockout = *iterout; +- +- boxm_compute_block_difference((*iter1),(*iter2),(*iterout), threshold); +- sceneout.write_active_block(); +- } +-} +- +-#endif // boxm_compute_scene_difference_h_ +diff --git a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h b/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h +deleted file mode 100644 +index c697a4e6b4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h ++++ /dev/null +@@ -1,100 +0,0 @@ +-#ifndef boxm_compute_scene_statistics_h +-#define boxm_compute_scene_statistics_h +-//: +-// \file +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//: Compute histogram of a simple-type scenes. e.g. T_data = float, double +-template +-bool boxm_compute_scene_statistics(boxm_scene >* scene, bsta_histogram& response_hist )//, bsta_histogram& level_hist, unsigned& n_leaves) +-{ +- std::cout << " Using compute_scene_statistics\n"; +- +- typedef boct_tree tree_type; +- +- //(1) Traverse the leaves of the scene +- boxm_cell_iterator iterator = scene->cell_iterator(&boxm_scene::load_block, true); +- +- iterator.begin(); +- float cell_count = 0; +- float max = (float)(*iterator)->data(); +- float min = max; +- float this_val = max; +- while (!iterator.end()) { +- cell_count++; +- this_val = (float)(*iterator)->data(); +- if ( this_val > max) max = this_val; +- if ( this_val < min) min = this_val; +- ++iterator; +- } +- +- unsigned int nbins = (unsigned int)std::abs(max-min);// std::floor(std::sqrt(cell_count)); +- response_hist = bsta_histogram(min, max, nbins); +- scene->unload_active_blocks(); +- iterator.begin(); +- while (!iterator.end()) { +- response_hist.upcount((float)(*iterator)->data(), 1.0f); +- ++iterator; +- } +- +- scene->unload_active_blocks(); +- +- return true; +-} +- +-//: Compute histogram for appearance model scene - where alpha, omega etc are relevant +-template +-bool compute_scene_statistics(boxm_scene >& scene, bsta_histogram& omega_hist, bsta_histogram& sigma_hist, bsta_histogram& level_hist, unsigned& n_leaves) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- omega_hist = bsta_histogram(0.0f, 1.0f, 20); +- sigma_hist = bsta_histogram(0.0f, 1.0f, 20); +- level_hist = bsta_histogram(0.0f, 10.0f, 10); +- boxm_block_iterator bit = scene.iterator(); +- for (;!bit.end(); ++bit) +- { +- vgl_point_3d block_index = bit.index(); +- scene.load_block(block_index); +- boxm_block * block = scene.get_active_block(); +- tree_type* tree=block->get_tree(); +- if (!tree) return false; +- int n_levels = tree->number_levels(); +- int fin_level = tree->finest_level(); +- for (int level = n_levels-1; level>=fin_level; --level) +- { +- std::vector cells_at_level = +- tree->leaf_cells_at_level(static_cast(level)); +- level_hist.upcount(static_cast(level), +- static_cast(cells_at_level.size())); +- } +- std::vector leaves = tree->leaf_cells(); +- n_leaves = leaves.size(); +- for (typename std::vector::iterator cit = leaves.begin(); cit != leaves.end(); ++cit) +- { +- T_data data = (*cit)->data(); +- vgl_box_3d bb = tree->cell_bounding_box(*cit); +- double dx = bb.width(), dy = bb.height(), dz = bb.depth(); +- double diag = std::sqrt(dx*dx + dy*dy + dz*dz); +- double alpha = data.alpha; +- double omega = 1.0 - std::exp(-alpha*diag); +- omega_hist.upcount(static_cast(omega), 1.0f); +- +- if (scene.appearence_model() == BOXM_APM_SIMPLE_GREY) +- { +- float sigma = data.appearance_.sigma(); +- sigma_hist.upcount(sigma, 1.0f); +- } +- } +- } +- return true; +-} +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h b/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h +deleted file mode 100644 +index 63aa888efa..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h ++++ /dev/null +@@ -1,95 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_crop_scene.h +-#ifndef boxm_crop_scene_h +-#define boxm_crop_scene_h +- +-//: +-// \file +-// \brief Template functions to create a new scene that is a cropped portion of another +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date January 11, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-boxm_scene > * boxm_crop_scene(boxm_scene > *scene_in,vgl_box_3d bbox) +-{ +- //only one-block scenes are supported for now +- if (!(scene_in->world_dim().x() == 1 && scene_in->world_dim().y()==1 && scene_in->world_dim().z()==1)) +- { +- std::cerr << "In bvxm_crop_scene -- Input scene has more than one block, which is not supported\n"; +- return nullptr; +- } +- +- //get the tree inside the block and locate region +- boxm_block_iterator > iter_in = scene_in->iterator(); +- iter_in.begin(); +- +- //there is no need to increase iterator, since there should only be one block in the scene +- scene_in->load_block(iter_in.index()); +- boct_tree *tree_in= (*iter_in)->get_tree(); +- +- boct_tree_cell* root = tree_in->locate_region_global(bbox, true); +- +- //most parameters of the output scene are the same as those of the input scene, +- //except the ROI which is determined by the root node +- double cell_length = 1.0/(double)(1<<(tree_in->root_level() - root->level())); +- double cell_origin_x = (double)(root->get_code().x_loc_)/(double)(1<<(tree_in->root_level())); +- double cell_origin_y = (double)(root->get_code().y_loc_)/(double)(1<<(tree_in->root_level())); +- double cell_origin_z = (double)(root->get_code().z_loc_)/(double)(1<<(tree_in->root_level())); +- +- vgl_box_3d global_bbox = tree_in->bounding_box(); +- +- vgl_point_3d origin(cell_origin_x, cell_origin_y, cell_origin_z); +- +- vgl_point_3d min_point((global_bbox.min_x() + global_bbox.width()*origin.x()), +- (global_bbox.min_y() + global_bbox.height()*origin.y()), +- (global_bbox.min_z() + global_bbox.depth()*origin.z())); +- +- vgl_vector_3d block_dim(cell_length*global_bbox.width(), +- cell_length*global_bbox.height(), +- cell_length*global_bbox.depth()); +- +- boxm_scene > *scene_out = +- new boxm_scene >(scene_in->lvcs(),min_point,block_dim,scene_in->world_dim(), scene_in->save_internal_nodes()); +- +- scene_out->set_paths(scene_in->path(), "cropped"); +- scene_out->set_appearance_model(scene_in->appearence_model()); +- scene_out->clean_scene(); +- boxm_block_iterator > iter_out = scene_out->iterator(); +- iter_out.begin(); +- scene_out->load_block(iter_out.index()); +- +- +- //Region of interest in [0,1)x[0,1)x[0,1) coordinates +- vgl_point_3d norm_bbox_min((bbox.min_x()-global_bbox.min_x())/global_bbox.width(), +- (bbox.min_y()-global_bbox.min_y())/global_bbox.height(), +- (bbox.min_z()-global_bbox.min_z())/global_bbox.depth()); +- vgl_point_3d norm_bbox_max((bbox.max_x()-global_bbox.min_x())/global_bbox.width(), +- (bbox.max_y()-global_bbox.min_y())/global_bbox.height(), +- (bbox.max_z()-global_bbox.min_z())/global_bbox.depth()); +- +- +- //output tree +- boct_tree *tree_out = tree_in->clone_and_intersect(root, tree_in->root_level(), vgl_box_3d(norm_bbox_min,norm_bbox_max)); +- +- //write the output tree +- (*iter_out)->init_tree(tree_out); +- scene_out->write_active_block(); +- scene_out->write_scene("/cropped_scene.xml"); +- +- return scene_out; +-} +- +- +-#endif // boxm_crop_scene_h +diff --git a/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h b/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h +deleted file mode 100644 +index f41af5bca8..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h ++++ /dev/null +@@ -1,316 +0,0 @@ +-#ifndef boxm_fill_in_mesh_h_ +-#define boxm_fill_in_mesh_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-bool is_mesh_in_block(imesh_mesh & mesh, vgl_box_3d block_bbox,vpgl_lvcs& lvcs, bool use_lvcs) +-{ +- imesh_face_array_base& fs = mesh.faces(); +- std::list > v_list; +- vgl_box_3d bb_global; +- +- for (unsigned i=0; i < fs.size(); ++i) +- { +- imesh_vertex_array<3>& vertices = mesh.vertices<3>(); +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- v_list.push_back(v); +- } +- } +- +- vgl_box_3d inters = vgl_intersection(block_bbox,bb_global); +- if (inters.is_empty()) +- return false; +- +- return true; +-} +- +-template +-bool are_meshes_in_block(std::vector meshes, vgl_box_3d block_bbox,vpgl_lvcs& lvcs, bool use_lvcs) +-{ +- bool flag=false; +- for (auto & meshe : meshes) +- { +- meshe.compute_face_normals(true); +- imesh_face_array_base& fs = meshe.faces(); +- std::list > v_list; +- vgl_box_3d bb_global; +- +- for (unsigned i=0; i < fs.size(); ++i) +- { +- imesh_vertex_array<3>& vertices = meshe.vertices<3>(); +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- v_list.push_back(v); +- } +- } +- +- vgl_box_3d inters = vgl_intersection(block_bbox,bb_global); +- if (!inters.is_empty()) +- flag=true; +- } +- return flag; +-} +- +-template +-void boxm_fill_in_mesh_into_block(boxm_block > *block, +- std::vector meshes, vpgl_lvcs& lvcs, bool use_lvcs, T_data val) +-{ +- typedef boct_tree tree_type; +- tree_type* tree = block->get_tree(); +- vgl_box_3d block_bb = block->bounding_box(); +- for (auto & meshe : meshes) +- { +- imesh_face_array_base& fs = meshe.faces(); +- std::list > v_list; +- vgl_box_3d bb_scale, bb_global; +- for (unsigned i=0; i < fs.size(); ++i) +- { +- imesh_vertex_array<3>& vertices = meshe.vertices<3>(); +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- vgl_vector_3d diff = v-block_bb.min_point(); // get the value according to the block origin +- v.set(diff.x(), diff.y(), diff.z()); +- // the local coordinates inside the box region +- v_list.push_back(v); +- //convert the values into [0,1] range +- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth()); +- bb_scale.add(v); +- } +- } +- // check if polygon's bounding box intersects with the block +- vgl_box_3d inters = vgl_intersection(vgl_box_3d(0,0,0,1,1,1), bb_scale); +- if (inters.is_empty()) +- continue; +- +- // locate the polygon bounding box in tree +- boct_tree_cell* region=tree->locate_region(inters); +- if (region) { +- // test all the children for intersection +- std::vector*> children; +- if (!region->is_leaf()) +- region->leaf_children(children); +- else // insert the node itself, if no children +- children.push_back(region); +- for (unsigned i=0; i* cell=children[i]; +- vgl_box_3d cell_bb=tree->cell_bounding_box_local(cell); +- if (contains_point(meshe,cell_bb.centroid())) { +- cell->set_data(val); +- } +- } +- } +- } +-} +- +-//: this is to copy mesh into existing tree and replacing the appearance model of the existing tree. +-template <> +-void boxm_fill_in_mesh_into_block(boxm_block > > *block, +- std::vector meshes, vpgl_lvcs& lvcs, +- bool use_lvcs, boxm_sample val) +-{ +- typedef boct_tree > tree_type; +- tree_type* tree = block->get_tree(); +- vgl_box_3d block_bb = block->bounding_box(); +- for (auto & meshe : meshes) +- { +- if (is_mesh_in_block(meshe, block_bb,lvcs, use_lvcs)) +- { +- imesh_face_array_base& fs = meshe.faces(); +- std::list > v_list; +- vgl_box_3d bb_scale, bb_global; +- +- for (unsigned i=0; i < fs.size(); ++i) +- { +- imesh_vertex_array<3>& vertices = meshe.vertices<3>(); +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- vgl_vector_3d diff = v-block_bb.min_point(); // get the value according to the block origin +- v.set(diff.x(), diff.y(), diff.z()); +- // the local coordinates inside the box region +- v_list.push_back(v); +- //convert the values into [0,1] range +- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth()); +- bb_scale.add(v); +- } +- } +- +- // check if polygon's bounding box intersects with the block +- vgl_box_3d inters = vgl_intersection(vgl_box_3d(0,0,0,1,1,1), bb_scale); +- if (inters.is_empty()) +- continue; +- +- meshe.compute_face_normals(); +- +- // locate the polygon bounding box in tree +- boct_tree_cell >* region=tree->locate_region(inters); +- if (region) +- { +- // test all the children for intersection +- std::vector >*> children; +- if (!region->is_leaf()) +- region->leaf_children(children); +- else // insert the node itself, if no children +- children.push_back(region); +- for (auto cell : children) { +- vgl_box_3d cell_bb=tree->cell_bounding_box(cell); +- +- if (contains_point(meshe,cell_bb.centroid())) { +- boxm_sample tempdata=cell->data(); +- tempdata.set_appearance(val.appearance()); +- tempdata.alpha*=val.alpha; +- cell->set_data(tempdata); +- } +- } +- } +- } +- } +-} +- +-template <> +-void boxm_fill_in_mesh_into_block(boxm_block > > *block, +- std::vector meshes, vpgl_lvcs& lvcs, +- bool use_lvcs, boxm_sample val) +-{ +- typedef boct_tree > tree_type; +- tree_type* tree = block->get_tree(); +- vgl_box_3d block_bb = block->bounding_box(); +- for (auto & meshe : meshes) +- { +- if (is_mesh_in_block(meshe, block_bb,lvcs, use_lvcs)) +- { +- imesh_face_array_base& fs = meshe.faces(); +- std::list > v_list; +- vgl_box_3d bb_scale, bb_global; +- +- for (unsigned i=0; i < fs.size(); ++i) +- { +- imesh_vertex_array<3>& vertices = meshe.vertices<3>(); +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- vgl_vector_3d diff = v-block_bb.min_point(); // get the value according to the block origin +- v.set(diff.x(), diff.y(), diff.z()); +- // the local coordinates inside the box region +- v_list.push_back(v); +- //convert the values into [0,1] range +- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth()); +- bb_scale.add(v); +- } +- } +- +- // check if polygon's bounding box intersects with the block +- vgl_box_3d inters = vgl_intersection(vgl_box_3d(0,0,0,1,1,1), bb_scale); +- if (inters.is_empty()) +- continue; +- +- meshe.compute_face_normals(); +- +- // locate the polygon bounding box in tree +- boct_tree_cell >* region=tree->locate_region(inters); +- if (region) +- { +- // test all the children for intersection +- std::vector >*> children; +- if (!region->is_leaf()) +- region->leaf_children(children); +- else // insert the node itself, if no children +- children.push_back(region); +- for (auto cell : children) { +- vgl_box_3d cell_bb=tree->cell_bounding_box(cell); +- +- if (contains_point(meshe,cell_bb.centroid())) { +- boxm_sample tempdata=cell->data(); +- tempdata.set_appearance(val.appearance()); +- tempdata.alpha*=val.alpha; +- cell->set_data(tempdata); +- } +- } +- } +- } +- } +-} +- +-template +-void boxm_fill_in_mesh_into_scene(boxm_scene > &scene, +- std::vector meshes, bool use_lvcs, T_data val) +-{ +- typedef boct_tree tree_type; +- vpgl_lvcs lvcs=scene.lvcs(); +- boxm_block_iterator iter(&scene); +- for (; !iter.end(); iter++) { +- vgl_box_3d block_bb=scene.get_block_bbox(iter.index().x(),iter.index().y(),iter.index().z()); +- if (are_meshes_in_block(meshes,block_bb,lvcs,use_lvcs)) +- { +- scene.load_block(iter.index()); +- boxm_block* block = *iter; +- boxm_fill_in_mesh_into_block(block, meshes, lvcs, use_lvcs, val); +- scene.write_active_block(); +- } +- } +-} +- +-#endif // boxm_fill_in_mesh_h_ +diff --git a/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h b/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h +deleted file mode 100644 +index 6d81beef0f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h ++++ /dev/null +@@ -1,80 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_fill_internal_cells.h +-#ifndef boxm_fill_internal_cells_h +-#define boxm_fill_internal_cells_h +-//: +-// \file +-// \brief Class in charged of filling the intermediate nodes of a tree. +-// \author Maria Isabel Restrepo mir@lems.brown.edu +-// \date Feb 3, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//: A class to combine children cells and fill intermediate nodes +-template +-class boxm_fill_internal_cells +-{ +- public: +- typedef boct_tree tree_type; +- +- boxm_scene > * traverse_and_fill(boxm_scene > *scene_in) +- { +- // Most parameters of the output scene are the same as those of the input scene +- // but we need to change the mode of the scene to be saving internal nodes +- bool save_internal_nodes = true; +- boxm_scene *scene_out = new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), +- scene_in->world_dim(), scene_in->max_level(), scene_in->init_level(), +- false, save_internal_nodes); +- std::string block_pref = scene_in->block_prefix() + "_all_nodes"; +- scene_out->set_paths(scene_in->path(), block_pref); +- scene_out->set_appearance_model(scene_in->appearence_model()); +- +- scene_out->write_scene(block_pref + ".xml"); +- +- //Iterate through the blocks +- boxm_block_iterator iter_in = scene_in->iterator(); +- boxm_block_iterator iter_out = scene_out->iterator(); +- +- iter_in.begin(); +- iter_out.begin(); +- +- while (!iter_in.end() && !iter_out.end()) +- { +- scene_in->load_block(iter_in.index()); +- scene_out->load_block(iter_out.index()); +- +- tree_type *tree_in= (*iter_in)->get_tree(); +- // Copy input tree into output tree and fill +- tree_type *tree_out = tree_in->clone(); +- this->traverse_and_fill(tree_out); +- (*iter_out)->init_tree(tree_out); +- std::cout << "writing block: " << iter_out.index() <write_active_block(); +- +- iter_in++; iter_out++; +- } +- +- return scene_out; +- } +- +- protected: +- +- //: Traverses a tree and fills intermediate cells with the average of the 8 children. +- // If there is need to fill cells with something different to the average, this function can be made abstract and +- // write specializations. As in the template method design pattern +- void traverse_and_fill(tree_type *tree_to_fill) +- { +- tree_to_fill->fill_with_average(); +- } +-}; +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_init_scene.h b/contrib/brl/bseg/boxm/algo/boxm_init_scene.h +deleted file mode 100644 +index 9325f47c46..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_init_scene.h ++++ /dev/null +@@ -1,60 +0,0 @@ +-#ifndef boxm_init_scene_h_ +-#define boxm_init_scene_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-//: This method inits the blocks (octrees) of the scene of type boxm_sample +-template +-void boxm_init_scene(boxm_scene > > &scene) +-{ +- typedef boct_tree > tree_type; +- boxm_block_iterator iter(&scene); +- float pinit=scene.pinit(); +- float dimx=(float)scene.block_dim().x(); +- float numbercells=(float)(1<<(scene.init_level()-1)); +- +- float alpha_init=-std::log(1-pinit)*numbercells/dimx; +- for (; !iter.end(); iter++) { +- vgl_point_3d index=iter.index(); +- if (!scene.discover_block(index.x(),index.y(),index.z())) +- { +- boxm_sample initsample(alpha_init); +- tree_type* tree= new tree_type(initsample,scene.max_level(),scene.init_level()); +- boxm_block * block=new boxm_block(scene.get_block_bbox(index.x(),index.y(),index.z()),tree); +- scene.set_block(index,block); +- scene.write_active_block(); +- } +- } +-} +- +-//: Initializes a general scene +-template +-void boxm_init_scene(boxm_scene > &scene) +-{ +- typedef boct_tree tree_type; +- boxm_block_iterator iter(&scene); +- float dimx=(float)scene.block_dim().x(); +- +- for (; !iter.end(); iter++) { +- vgl_point_3d index=iter.index(); +- if (!scene.discover_block(index.x(),index.y(),index.z())) +- { +- T_data initdata; +- tree_type* tree= new tree_type(initdata,scene.max_level(),scene.init_level()); +- boxm_block * block=new boxm_block(scene.get_block_bbox(index.x(),index.y(),index.z()),tree); +- scene.set_block(index,block); +- scene.write_active_block(); +- } +- } +-} +- +-#endif // boxm_init_scene_h_ +diff --git a/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h b/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h +deleted file mode 100644 +index 01726ab977..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h ++++ /dev/null +@@ -1,60 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_linear_operations.h +-#ifndef boxm_linear_operations_h +-#define boxm_linear_operations_h +-//: +-// \file +-// \brief Functions to perfoms linear operations on boxm scenes and/or blocks +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 2-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#ifdef DEBUG +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-//: Computes the linear combination of two blocks in place. i.e block1 = s1*block1 + s2*block2 +-template +-bool boxm_linear_combination(boxm_block > *block1, boxm_block > *block2, float s1, float s2) +-{ +- boct_tree *tree1 = block1->get_tree(); +- boct_tree *tree2 = block2->get_tree(); +- +- std::vector* > cells1 = tree1->leaf_cells(); +- std::vector* > cells2 = tree2->leaf_cells(); +- +- //iterators +- typename std::vector* >::iterator it1 = cells1.begin(); +- typename std::vector* >::iterator it2 = cells2.begin(); +- +- for (; (it1!=cells1.end())&&(it2!= cells2.end()); it1++, it2++) +- { +- boct_tree_cell *cell1 = *it1; +- boct_tree_cell *cell2 = *it2; +- +-#ifdef DEBUG +- //if level and location code of cells isn't the same quit +- boct_loc_code code1 = cell1->get_code(); +- boct_loc_code code2 = cell2->get_code(); +- if (!(code1.isequal(code2))) +- { +- std::cerr << "In boxm_linear_combination: Blocks must have the same structure\n"; +- return false; +- } +-#endif +- +- cell1->set_data(s1*cell1->data() + s2*cell2->data()); +- } +- return true; +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx b/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx +deleted file mode 100644 +index e7e2f6585c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx ++++ /dev/null +@@ -1,239 +0,0 @@ +-#include +-#include +-#include +-#include "boxm_merge_mog.h" +-//: +-// \file +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include // for vnl_math::sqr() +- +-#include +- +-void boxm_merge_mog::kl_merge(mix_gauss_type const& mixture,bsta_gauss_sf1 &gaussian) +-{ +- //When merging components of gaussian mixtures, we need to perform the following calculations +- //1. find the normalizing weight of the new component. +- // In this case this value is 1 because we are merging all the components +- //2. find the mean +- //3. find the variance +- +- float mean = 0.0f; +- float var = 0.0f; +- +- //CAUTION: only mixtures of 3 modes are supported for now. +- assert(mixture.num_components() == 3); +- unsigned num_components = mixture.num_components(); +- +- for (unsigned i = 0; i= 0); +- +- gaussian.set_mean(mean); +- gaussian.set_var(var); +- return; +-} +- +-//: Merges the components of the gaussian mixtures at each voxel into a single gaussian +-// Thus the resulting grid contains unimodal gaussians +-bool boxm_merge_mog::kl_merge_scene(boxm_scene > &mog_scene, +- boxm_scene > &gauss_scene) +-{ +- // iterate through the scene +- boxm_block_iterator mog_iter = mog_scene.iterator(); +- boxm_block_iterator gauss_iter = gauss_scene.iterator(); +- +- for (mog_iter.begin(), gauss_iter.begin(); !mog_iter.end(); ++mog_iter, ++gauss_iter) { +- mog_scene.load_block(mog_iter.index()); +- gauss_scene.load_block(gauss_iter.index()); +- mog_tree_type *mog_tree = (*mog_iter)->get_tree(); +- gauss_tree_type *gauss_tree = mog_tree->clone_to_type(); +-#if 0 +- gauss_tree->init_cells(func_max.min_response()); +-#endif +- this->kl_merge_octree(mog_tree,gauss_tree); +- (*gauss_iter)->init_tree(gauss_tree); +- gauss_scene.write_active_block(); +- } +- +- return true; +-} +- +-//: Merges the components of the gaussian mixtures at each voxel into a single gaussian +-// Thus the resulting grid contains unimodal gaussians +-bool boxm_merge_mog::kl_merge_octree(boct_tree *mog_tree, +- boct_tree *gauss_tree) +-{ +- // iterate through the trees +- std::vector mog_cells = mog_tree->all_cells(); +- std::vector gauss_cells = gauss_tree->all_cells(); +- +- if (mog_cells.size()!=gauss_cells.size() ) { +- std::cerr << "Different size vectors in boxm_merge_mog::kl_merge_octree\n"; +- return false; +- } +- +- +- for (unsigned i = 0; i < mog_cells.size(); ++i) +- { +- gauss_type result_gauss; +- this->kl_merge(mog_cells[i]->data(), result_gauss); +- gauss_cells[i]->set_data(result_gauss); +- } +- return true; +-} +- +-/********************** Non-class functions************************************/ +- +-//: Computes the differential entropy of a gaussian scene- only for leave cells +-bool compute_differential_entropy(boxm_scene > >& scene_in,boxm_scene >& scene_out) +-{ +- typedef bsta_num_obs gauss_type; +- +- scene_in.clone_blocks_to_type >(scene_out, std::numeric_limits::min()); +- +- //iterate through the leaf cells computing entropy +- boxm_cell_iterator > it_in = +- scene_in.cell_iterator(&boxm_scene >::load_block); +- +- boxm_cell_iterator > it_out = +- scene_out.cell_iterator(&boxm_scene >::load_block); +- +- it_in.begin(); +- it_out.begin(); +- +- while ( !(it_in.end() || it_out.end()) ) { +- boct_tree_cell *cell_in = *it_in; +- boct_tree_cell *cell_out = *it_out; +- +- boct_loc_code out_code = cell_in->get_code(); +- boct_loc_code in_code = cell_out->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- ++it_in; +- ++it_out; +- continue; +- } +- +- double h = 0.5*std::log(vnl_math::pi*vnl_math::e*2*cell_in->data().var()); +- cell_out->set_data(float(h)); +- ++it_in; +- ++it_out; +- } +- +- return true; +-} +- +- +-//: Compute expectation given that the voxel is occupied +-bool compute_expected_color(boxm_scene > >& scene_in, boxm_scene >& scene_out, float grey_offset) +-{ +- typedef boct_tree > scene_tree_type; +- scene_in.clone_blocks_to_type >(scene_out, std::numeric_limits::min()); +- +- //iterate through the leaf cells computing mean appearance +- boxm_cell_iterator it_in = +- scene_in.cell_iterator(&boxm_scene::load_block, true); +- +- boxm_cell_iterator > it_out = +- scene_out.cell_iterator(&boxm_scene >::load_block); +- +- it_in.begin(); +- it_out.begin(); +- +- while ( !(it_in.end() || it_out.end()) ) { +- boct_tree_cell > *cell_in = *it_in; +- boct_tree_cell *cell_out = *it_out; +- +- boct_loc_code out_code = cell_in->get_code(); +- boct_loc_code in_code = cell_out->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- ++it_in; +- ++it_out; +- continue; +- } +- +- float mean_color = boxm_mog_grey_processor::expected_color(cell_in->data().appearance()); +- // update alpha integral +- float vis_color = float(1.0 - std::exp(- cell_in->data().alpha * it_in.length()))*(mean_color+grey_offset); +- cell_out->set_data(vis_color); +- ++it_in; +- ++it_out; +- } +- +- scene_in.unload_active_blocks(); +- scene_out.unload_active_blocks(); +- +- return true; +-} +- +- +-#if 0 +-//: Compute total expectation E(I) = E(I| X \in S) P(X \in S) + E(I| X !\in S) P(X !\in S) +-// Expected appearance of a non surface voxel is not defined. Every intensity is equally likely therefore E(I| X !\in S) = 127.5 for I in [0,255] +-bool compute_expected_color(boxm_scene > >& scene_in, boxm_scene >& scene_out) +-{ +- typedef boct_tree > scene_tree_type; +- scene_in.clone_blocks_to_type >(scene_out, std::numeric_limits::min()); +- +- //iterate through the leaf cells computing mean appearance +- boxm_cell_iterator it_in = +- scene_in.cell_iterator(&boxm_scene::load_block, true); +- +- boxm_cell_iterator > it_out = +- scene_out.cell_iterator(&boxm_scene >::load_block); +- +- it_in.begin(); +- it_out.begin(); +- +- while ( !(it_in.end() || it_out.end()) ) +- { +- boct_tree_cell > *cell_in = *it_in; +- boct_tree_cell *cell_out = *it_out; +- +- boct_loc_code out_code = cell_in->get_code(); +- boct_loc_code in_code = cell_out->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- ++it_in; +- ++it_out; +- continue; +- } +- +- float mean_color = boxm_mog_grey_processor::expected_color(cell_in->data().appearance()); +- //alpha integral +- float vis = std::exp(- cell_in->data().alpha * it_in.length()); +- float vis_color = (1.0f - vis) *mean_color; +- float invis_color = vis * 0.5f; // E(I| X !\in S) = 127.5/255 +- cell_out->set_data(vis_color + invis_color); +- ++it_in; +- ++it_out; +- } +- +- scene_in.unload_active_blocks(); +- scene_out.unload_active_blocks(); +- +- return true; +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h b/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h +deleted file mode 100644 +index 1c39b9e84c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h ++++ /dev/null +@@ -1,65 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_merge_mog.h +-#ifndef boxm_merge_mog_h_ +-#define boxm_merge_mog_h_ +-//: +-// \file +-// \brief class with methods to merge gaussian mixtures. +-// \author Isabel Restrepo +-// \date April 20, 2009 +-// +-// \verbatim +-// Modifications +-// Nov 7 2009 - Isabel Restrepo: Copied from bvxm +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-//: +-// Only floating point are supported for now and mixtures with 3 components. +-// This class can be further templated if necessary +-class boxm_merge_mog +-{ +- private: +- typedef bsta_num_obs gauss_type; +- typedef bsta_mixture_fixed mix_gauss; +- typedef bsta_num_obs mix_gauss_type; +- typedef boct_tree mog_tree_type; +- typedef boct_tree gauss_tree_type; +- typedef boct_tree_cell mog_cell_type; +- typedef boct_tree_cell gauss_cell_type; +- +- public: +- +- // === Scene operations === +- +- //: Merges the components of the gaussian mixtures at each voxel into a single gaussian, that minimizes KL divergence. +- // The resulting scene contains unimodal Gaussians. +- bool kl_merge_scene(boxm_scene > &app_scene, boxm_scene > &gauss_app); +- +- bool kl_merge_octree(boct_tree *mog_tree, boct_tree *gauss_tree); +- +-#if 0 +- //: Converts a mixture of gaussians grid into an unimodal gaussian grid corresponding to the most probable mode +- static bool mpm_merge_scene(boxm_scene app_scene, boxm_scene gauss_app); +-#endif +- +- // === Distribution operations === +- +- //: Merges all the components in the mixture into one component that minimizes the KL divergence between the two distributions +- static void kl_merge(mix_gauss_type const& mixture,bsta_gauss_sf1 &gaussian); +-}; +- +- +-//: Computes the differential entropy of a gaussian scene- only for leave cells +-bool compute_differential_entropy(boxm_scene > >& scene,boxm_scene >& scene_out); +- +-//: Computes expected color of a voxel as mean/occupancy +-bool compute_expected_color(boxm_scene > >& scene, boxm_scene >& scene_out, float grey_offset); +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_refine.h b/contrib/brl/bseg/boxm/algo/boxm_refine.h +deleted file mode 100644 +index c3f464f906..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_refine.h ++++ /dev/null +@@ -1,100 +0,0 @@ +-#ifndef boxm_refine_h_ +-#define boxm_refine_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-void boxm_refine_block(boxm_block > *block, +- float occlusion_prob_thresh, unsigned & num_split, bool reset_appearance = true) +-{ +- typedef boct_tree tree_type; +- tree_type* tree = block->get_tree(); +- float max_alpha_int = (float)-std::log(1.0 - occlusion_prob_thresh); +- // get the leaf nodes of the block +- std::vector*> leaf_nodes = tree->leaf_cells(); +-#ifdef DEBUG +- std::cout << " NUMBER OF LEAF NODES=" << leaf_nodes.size(); +-#endif +- std::vector*> split_list; +- for (unsigned i=0; i* cell = leaf_nodes[i]; +- T_data data = cell->data(); +- +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- float side_len = (float) (cell_bb.max_z() - cell_bb.min_z()); +- float alpha_int = data.alpha * side_len; +- +- if ((alpha_int > max_alpha_int) && (cell->level() > 0)) { +- split_list.push_back(cell); +- // make sure neighbor cells are not already coarser than this cell +- // get all the faces; +-#if 0 +- boct_face_idx faces = ALL; +- std::vector*> neighbors; +- cell->find_neighbors(faces, neighbors, cell->level()+1); +- split_list.insert(split_list.end(), neighbors.begin(), neighbors.end()); +-#endif +- } +- } +- num_split+=(int)split_list.size(); +-#ifdef DEBUG +- std::cout<<" Splitting "<* cell = split_list[i]; +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- float side_len = (float) (cell_bb.max_z() - cell_bb.min_z()); +- float new_alpha = max_alpha_int / side_len; +- +- T_data old_sample = cell->data(); +- typename T_data::apm_datatype app; +- if (!reset_appearance) { +- // if it is not set, transfer the old appearance to the new sample +- T_data new_sample = old_sample; +- new_sample.alpha=new_alpha; +- cell->split(new_sample); +- } +- else { +- T_data new_sample = T_data(); +- new_sample.alpha = new_alpha; +- cell->split(new_sample); +- } +- } +-} +- +-//: This method refines the blocks (octrees) of the scene +-// If there are some cells with big values they are spitted into new child cells; +-// the data of the cell is copied to the children's data. The purpose of this +-// method is to elaborate the octree at the areas where more details exist. +-// returns the number of leaf nodes in the refined octree +-template +-unsigned int boxm_refine_scene(boxm_scene > &scene, +- float occlusion_prob_thresh, +- bool reset_appearance = true) +-{ +- typedef boct_tree tree_type; +- +- unsigned int nleaves = 0; +- boxm_block_iterator iter(&scene); +- //float max_alpha_int = (float)-std::log(1.0 - occlusion_prob_thresh); +- for (; !iter.end(); iter++) { +- scene.load_block(iter.index()); +- boxm_block* block = *iter; +- boxm_refine_block(block, occlusion_prob_thresh,nleaves, reset_appearance); +- //nleaves += block->size(); +- scene.write_active_block(); +- } +- std::cout<<"Total No of leaves split "< +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-void boxm_save_block_raw(boxm_scene > &scene, +- vgl_point_3d block_idx, +- std::string filename, +- unsigned int resolution_level) +-{ +- typedef boct_tree tree_type; +- +- scene.load_block(block_idx); +- boxm_block* block = scene.get_block(block_idx); +- vgl_box_3d block_bb = block->bounding_box(); +- tree_type* tree = block->get_tree(); +- +- // query the finest level of the tree and do not make the resolution smaller than that +- if (tree->finest_level() > (int)resolution_level) +- resolution_level = tree->finest_level(); +- +- // get origin of block +- vgl_point_3d min = block_bb.min_point(); +- +- const unsigned int ncells = 1 << (tree->root_level() - (int)resolution_level); +- +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +- +- // origin should specify center of first cell +- vgl_point_3d data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0)); +- +- int data_size = ncells*ncells*ncells; +- int y_size = ncells*ncells; +- float *data = nullptr; +- data = new (std::nothrow)float[data_size]; +- +- if (data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl; +- return; +- } +- // init to zero +- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) { +- *dp = 0.0f; +- } +- +- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1); +- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume; +- +- std::vector *> cells = tree->leaf_cells(); +- for (unsigned i=0; i node = tree->cell_bounding_box_local(cells[i]).min_point(); +- +- float cell_val = boxm_cell_to_float(cells[i], step_len); +- +- unsigned int level = cells[i]->get_code().level; +- +- if (level == resolution_level) { +- // just copy value to output array +- int out_index = static_cast((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len)); +- if (out_index >= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- else if (level > resolution_level) { +- // cell is bigger than output cells. copy value to all contained output cells. +- const unsigned int us_factor = 1 << (level - resolution_level); +- const unsigned int node_x_start = static_cast(node.x()/step_len); +- const unsigned int node_y_start = static_cast(node.y()/step_len); +- const unsigned int node_z_start = static_cast(node.z()/step_len); +- for (unsigned int z=node_z_start; z= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- } +- } +- } +- else { +- // cell is smaller than output cells. increment output cell value +- unsigned int ds_factor = 1 << (resolution_level - level); +- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor); +- const unsigned int node_x = static_cast(node.x()/step_len); +- const unsigned int node_y = static_cast(node.y()/step_len); +- const unsigned int node_z = static_cast(node.z()/step_len); +- unsigned int out_index = static_cast((node_z)*y_size + (node_y)*ncells + (node_x)); +- data[out_index] += float(cell_val*update_weight); +- } +- } +- // convert float values to char +- +- unsigned char *byte_data = nullptr; +- byte_data = new (std::nothrow) unsigned char[data_size]; +- if (byte_data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl; +- return; +- } +- +- float* dp = data; +- for (unsigned char* bdp = byte_data; dp < data + data_size; ++dp, ++bdp) { +- //double P = 1.0 - std::exp(-*dp*step_len); +- *bdp = (unsigned char)(std::floor((255.0 * (*dp)) + 0.5)); // always positive so this is an ok way to round +- } +- delete[] data; +- +- // write header +- unsigned char data_type = 0; // 0 means unsigned byte +- +- vxl_uint_32 nx = ncells; +- vxl_uint_32 ny = ncells; +- vxl_uint_32 nz = ncells; +- +- std::ofstream os(filename.c_str(),std::ios::binary); +- if (!os.good()) { +- std::cerr << "error opening " << filename << " for write!\n"; +- return; +- } +- +- os.write(reinterpret_cast(&data_type),sizeof(data_type)); +- os.write(reinterpret_cast(&nx),sizeof(nx)); +- os.write(reinterpret_cast(&ny),sizeof(ny)); +- os.write(reinterpret_cast(&nz),sizeof(nz)); +- +- os.write((char*)byte_data,data_size); +- delete[] byte_data; +- +- return; +-} +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h b/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h +deleted file mode 100644 +index f3051e8f6e..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h ++++ /dev/null +@@ -1,277 +0,0 @@ +-#ifndef boxm_save_scene_raw_h_ +-#define boxm_save_scene_raw_h_ +-//: +-// \file +-// \brief Writes the 3D scene into a raw file by combining all the spatial data in a set of octrees. +-// The octree data mapped to a 3D regular grid and kept in binary files temporarily. +-// And then these sets of data combined and saved in a raw file. +-// +-// \author Gamze Tunali +-// \date September 9, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-template +-void boxm_save_scene_raw(boxm_scene > &scene, +- std::string filename, +- unsigned int resolution_level) +-{ +- float minv = 1.0e10, maxv = 0.0; +- bsta_histogram h(0.0f, 1.0f, 20); +- typedef boct_tree tree_type; +- +- // create an array for each block, and save in a binary file +- +- // number of cells for each block should be the same, because they have the +- // same tree max_level definitions +- unsigned int ncells = 0; +- boxm_block_iterator iter(&scene); +- +- unsigned int finest_level=scene.finest_level(); +- +- // query the finest level of the tree and do not make the resolution +- // smaller than that +- if (resolution_level < finest_level) +- resolution_level=finest_level; +- +- iter.begin(); +- while (!iter.end()) { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- tree_type* tree = block->get_tree(); +- +- // get origin of block +- vgl_point_3d min = block_bb.min_point(); +- +- ncells = 1 << (tree->root_level() - (int)resolution_level); +- +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +- +- // origin should specify center of first cell +- vgl_point_3d data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0)); +- +- int data_size = ncells*ncells*ncells; +- float *data = nullptr; +- std::cout << "Data Size=" << data_size << std::endl; +- data = new (std::nothrow)float[data_size]; +- +- if (data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl; +- return; +- } +- // init to zero +- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) { +- *dp = 0.0f; +- } +- +- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1); +- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume; +- +- std::vector *> cells = tree->leaf_cells(); +- for (unsigned i=0; i node = tree->cell_bounding_box_local(cells[i]).min_point(); +- +- float cell_val = boxm_cell_to_float(cells[i], step_len); +- +- unsigned int level = cells[i]->get_code().level; +- if (level == resolution_level) { +- // just copy value to output array +- //int out_index = static_cast((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len)); +- int out_index=static_cast(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- //////int out_index=static_cast((node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- //////int out_index=static_cast(ncells-(node.z()/step_len)-1 + (node.x()/step_len)*ncells + (node.y()/step_len)*ncells*ncells); +- +- if (out_index >= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- else if (level > resolution_level) { +- // cell is bigger than output cells. copy value to all contained output cells. +- const unsigned int us_factor = 1 << (level - resolution_level); +- const unsigned int node_x_start = static_cast(node.x()/step_len); +- const unsigned int node_y_start = static_cast(node.y()/step_len); +- const unsigned int node_z_start = static_cast(node.z()/step_len); +- for (unsigned int z=node_z_start; z= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- } +- } +- } +- else { +- // cell is smaller than output cells. increment output cell value +- unsigned int ds_factor = 1 << (resolution_level - level); +- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor); +- const unsigned int node_x = static_cast(node.x()/step_len); +- const unsigned int node_y = static_cast(node.y()/step_len); +- const unsigned int node_z = static_cast(node.z()/step_len); +- //unsigned int out_index=node_x*y_size + node_y*ncells + node_z; +- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells; +- //////int out_index=node_z + node_y*ncells + node_x*ncells*ncells; +- //////int out_index=ncells-1-node_z + node_x*ncells + node_y*ncells*ncells; +- +- data[out_index] += float(cell_val*update_weight); +- } +- } +- +- // write the data into a bin file, generate a file name +- std::stringstream strm; +- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin"; +- std::string fn(strm.str()); +- vsl_b_ofstream os(fn.c_str(),std::ios::binary); +- if (!os.os().good()) { +- std::cerr << "error opening " << fn << " for write!\n"; +- return; +- } +- +- vsl_b_write(os, (unsigned int) ncells); // x dimension +- vsl_b_write(os, (unsigned int) ncells); // y dimension +- vsl_b_write(os, (unsigned int) ncells); // z dimension +- +- float* dp = data; +- for (; dp < data + data_size; ++dp) { +- //double P = 1.0 - std::exp(-*dp*step_len); +- // always positive so this is an ok way to round +- float fv = *dp; +- h.upcount(fv, 1.0f); +- if (fvmaxv) maxv = fv; +- unsigned char c = (unsigned char)(std::floor((255.0 * (*dp)) + 0.5)); +- vsl_b_write(os, (char) c); +- } +- delete[] data; +- os.close(); +- iter++; +- } +- scene.unload_active_blocks(); +- +- assert(ncells > 0); +- +- // combine the blocks +- vgl_vector_3d dim = scene.world_dim(); +- unsigned dimx = dim.x()*ncells; +- unsigned dimy = dim.y()*ncells; +- unsigned dimz = dim.z()*ncells; +- // we will read the data a column at a time and this is enough +- int row_data_size = ncells; +- char* byte_data = new (std::nothrow) char[row_data_size]; +- if (byte_data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl; +- return; +- } +- +- // open the binary files streams, saved earlier +- unsigned int nx,ny,nz; +- vbl_array_3d streams(dim.x(), dim.y(), dim.z()); +- for (unsigned z=0; z(&data_type),sizeof(data_type)); +- os.write(reinterpret_cast(&nx_uint),sizeof(nx_uint)); +- os.write(reinterpret_cast(&ny_uint),sizeof(ny_uint)); +- os.write(reinterpret_cast(&nz_uint),sizeof(nz_uint)); +- +- // combine the column from streams to generate one raw file +- for (unsigned x=0; x0; z--) { +- vsl_b_ifstream* s=streams(x,y,z-1); +- s->is().read(byte_data, ncells); +- os.write((char*)byte_data,ncells); +- j+=ncells; +- k+=ncells; +- } +- } +- } +- } +- } +- +- os.close(); +- delete[] byte_data; +- +- // remove the intermediate bin files +- for (unsigned z=0; zclose(); +- std::stringstream strm; +- strm << filename << x << '_' << y << '_' << z << ".bin"; +- std::string fn(strm.str()); +- std::cout << "Deleting " << fn << std::endl; +- vpl_unlink(fn.data()); +- delete s; +- } +- } +- } +- std::cout << "Volume Histogram(" << minv << ' ' << maxv << "):[0->1]20bins\n"; +- h.print(); +- return; +-} +- +-#endif // boxm_save_scene_raw_h_ +diff --git a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h b/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h +deleted file mode 100644 +index 28753c4595..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h ++++ /dev/null +@@ -1,824 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_save_scene_raw_general.h +-#ifndef boxm_save_scene_raw_general_h +-#define boxm_save_scene_raw_general_h +- +-//: +-// \file +-// \brief Writes the 3D scene into a raw file by combining all the spatial data in a set of octrees. +-// The octree data mapped to a 3D regular grid and kept in binary files temporarily. +-// And then these sets of data combined and saved in a raw file. +-// +-// \author Gamze Tunali +-// \date September 9, 2009 +-// \verbatim +-// Modifications +-// February 17, 2011 Isabel Restrepo: Modified functions to use with more general scenes. +-// Double, float values are not converted to byte, nor assumptions are made. Values are saves as they are +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-#include +- +- +-//: Traits for saving grids of different datatypes to Drishti .raw file +-template +-class boxm_dristhi_traits; +- +-//: Drishti datatypes for header: +-// * 0 : unsigned byte - 1 byte per voxel +-// * 1 : signed byte - 1 byte per voxel +-// * 2 : unsigned short - 2 bytes per voxel +-// * 3 : signed short - 2 bytes per voxel +-// * 4 : integer - 4 bytes per voxel +-// * 8 : float - 4 bytes per voxel +- +-//: Drishti traits specializations. Please extent as needed +- +-template <> +-class boxm_dristhi_traits +-{ +- public: +- static unsigned char dristhi_header() {return 8;} +-}; +- +- +-template <> +-class boxm_dristhi_traits +-{ +- public: +- static unsigned char dristhi_header() {return 0;} +-}; +- +-template <> +-class boxm_dristhi_traits +-{ +- public: +- static unsigned char dristhi_header() {return 1;} +-}; +- +-template <> +-class boxm_dristhi_traits +-{ +- public: +- static unsigned char dristhi_header() {return 3;} +-}; +- +-template <> +-class boxm_dristhi_traits +-{ +- public: +- static unsigned char dristhi_header() {return 4;} +-}; +- +-template <> +-class boxm_dristhi_traits > +-{ +- public: +- static unsigned char dristhi_header() {return 8;} +-}; +- +- +-template +-void boxm_save_scene_raw_general(boxm_scene > &scene, +- std::string filename, +- unsigned int resolution_level) +-{ +- unsigned long n_zeros = 0; +- unsigned long n_ones = 0; +- unsigned long n_zeros_level0 = 0; +- unsigned long n_ones_level0 = 0; +- +- typedef boct_tree tree_type; +- +- // create an array for each block, and save in a binary file +- +- // number of cells for each block should be the same, because they have the +- // same tree max_level definitions +- unsigned int ncells = 0; +- boxm_block_iterator iter(&scene); +- +- // query the finest level of the tree and do not make the resolution +- // smaller than that +- unsigned int finest_level=scene.finest_level(); +- +- if (resolution_level < finest_level) +- resolution_level=finest_level; +- +- iter.begin(); +- while (!iter.end()) +- { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- tree_type* tree = block->get_tree(); +- +- // get origin of block +- vgl_point_3d min = block_bb.min_point(); +- +- ncells = 1 << (tree->root_level() - (int)resolution_level); +- +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +- +- // origin should specify center of first cell +- vgl_point_3d data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0)); +- +- int data_size = ncells*ncells*ncells; +- unsigned char *data = nullptr; +- std::cout << "Data Size=" << data_size << std::endl; +- data = new (std::nothrow)unsigned char[data_size]; +- +- if (data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl; +- return; +- } +- +- // init to zero +- for (unsigned char* dp = data; dp < data + ncells*ncells*ncells; ++dp) { +- *dp = (unsigned char)0.0; +- } +- +- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1); +- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume; +- +- std::vector *> cells = tree->leaf_cells(); +- for (unsigned i=0; i node = tree->cell_bounding_box_local(cells[i]).min_point(); +- +- unsigned char cell_val = (unsigned char)cells[i]->data()*255; +- if (cells[i]->data()) { +- n_ones++; +- if (cells[i]->get_code().level ==0) +- n_ones_level0++; +- } +- else { +- n_zeros++; +- if (cells[i]->get_code().level ==0) +- n_zeros_level0++; +- } +- +- unsigned int level = cells[i]->get_code().level; +- if (level == resolution_level) { +- // just copy value to output array +- int out_index=static_cast(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- +- if (out_index >= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- else if (level > resolution_level) { +- // cell is bigger than output cells. copy value to all contained output cells. +- const unsigned int us_factor = 1 << (level - resolution_level); +- const unsigned int node_x_start = static_cast(node.x()/step_len); +- const unsigned int node_y_start = static_cast(node.y()/step_len); +- const unsigned int node_z_start = static_cast(node.z()/step_len); +- for (unsigned int z=node_z_start; z= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- } +- } +- } +- else { +- // cell is smaller than output cells. increment output cell value +- unsigned int ds_factor = 1 << (resolution_level - level); +- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor); +- const unsigned int node_x = static_cast(node.x()/step_len); +- const unsigned int node_y = static_cast(node.y()/step_len); +- const unsigned int node_z = static_cast(node.z()/step_len); +- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells; +- +- data[out_index] += (unsigned char)(cell_val*update_weight); +- } +- } +- +- // write the data into a bin file, generate a file name +- std::stringstream strm; +- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin"; +- std::string fn(strm.str()); +- vsl_b_ofstream os(fn.c_str(),std::ios::binary); +- if (!os.os().good()) { +- std::cerr << "error opening " << filename << " for write!\n"; +- return; +- } +- +- vsl_b_write(os, (unsigned int) ncells); // x dimension +- vsl_b_write(os, (unsigned int) ncells); // y dimension +- vsl_b_write(os, (unsigned int) ncells); // z dimension +- +- unsigned char* dp = data; +- for (; dp < data + data_size; ++dp) { +- unsigned char v = *dp; +- vsl_b_write(os, (unsigned char)v); +- } +- delete[] data; +- os.close(); +- iter++; +- } +- +- scene.unload_active_blocks(); +- +- assert(ncells > 0); +- +- // combine the blocks +- vgl_vector_3d dim = scene.world_dim(); +- unsigned dimx = dim.x()*ncells; +- unsigned dimy = dim.y()*ncells; +- unsigned dimz = dim.z()*ncells; +- // we will read the data a column at a time and this is enough +- int row_data_size = ncells; +- unsigned char* read_data = new (std::nothrow) unsigned char[row_data_size]; +- if (read_data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate read data!" << std::endl; +- return; +- } +- +- // open the binary files streams, saved earlier +- unsigned int nx,ny,nz; +- vbl_array_3d streams(dim.x(), dim.y(), dim.z()); +- for (unsigned z=0; z(&data_type),sizeof(data_type)); +- os.write(reinterpret_cast(&nx_uint),sizeof(nx_uint)); +- os.write(reinterpret_cast(&ny_uint),sizeof(ny_uint)); +- os.write(reinterpret_cast(&nz_uint),sizeof(nz_uint)); +- +- // combine the column from streams to generate one raw file +- for (unsigned x=0; x0; z--) { +- vsl_b_ifstream* s=streams(x,y,z-1); +- s->is().read(reinterpret_cast(read_data), ncells*sizeof(unsigned char)); +- os.write(reinterpret_cast(read_data),ncells*sizeof(unsigned char)); +- j+=ncells; +- k+=ncells; +- } +- } +- } +- } +- } +- +- os.close(); +- delete[] read_data; +- +- // remove the intermediate bin files +- for (unsigned z=0; zclose(); +- std::stringstream strm; +- strm << filename << x << '_' << y << '_' << z << ".bin"; +- std::string fn(strm.str()); +- std::cout << "Deleting " << fn << std::endl; +- vpl_unlink(fn.data()); +- delete s; +- } +- } +- } +- +- std::cout << "Number of true cells : " << n_ones << "\n Number of false cells: " << n_zeros << std::endl; +- std::cout << "Number of true cells at level 0 : " << n_ones_level0 << "\n Number of false cells at level 0: " << n_zeros_level0 << std::endl; +- +- return; +-} +- +- +-template +-void boxm_save_scene_raw_general(boxm_scene > &scene, +- std::string filename, +- unsigned int resolution_level) +-{ +- std::cout << " Using boxm_save_scene_raw_general\n"; +- bsta_histogram hist; +- boxm_compute_scene_statistics(&scene, hist); +- hist.pretty_print(); +- +- std::stringstream ss; +- ss << vul_file::strip_extension(filename) << "_hist_plot.txt" ; +- std::ofstream hist_arrays_ofs((ss.str()).c_str()); +- hist.print_to_arrays(hist_arrays_ofs); +- hist_arrays_ofs.close(); +- +- typedef boct_tree tree_type; +- +- // create an array for each block, and save in a binary file +- +- // number of cells for each block should be the same, because they have the +- // same tree max_level definitions +- unsigned int ncells = 0; +- boxm_block_iterator iter(&scene); +- +- // query the finest level of the tree and do not make the resolution +- // smaller than that +- unsigned int finest_level=scene.finest_level(); +- +- if (resolution_level < finest_level) +- resolution_level=finest_level; +- +- iter.begin(); +- while (!iter.end()) +- { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- tree_type* tree = block->get_tree(); +- +- // get origin of block +- vgl_point_3d min = block_bb.min_point(); +- +- ncells = 1 << (tree->root_level() - (int)resolution_level); +- +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +- +- // origin should specify center of first cell +- vgl_point_3d data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0)); +- +- int data_size = ncells*ncells*ncells; +- T_data *data = nullptr; +- std::cout << "Data Size=" << data_size << std::endl; +- data = new (std::nothrow)T_data[data_size]; +- +- if (data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl; +- return; +- } +- +- // init to zero +- for (T_data* dp = data; dp < data + ncells*ncells*ncells; ++dp) { +- *dp = (T_data)0.0; +- } +- +- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1); +- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume; +- +- std::vector *> cells = tree->leaf_cells(); +- for (unsigned i=0; i node = tree->cell_bounding_box_local(cells[i]).min_point(); +- +- T_data cell_val = cells[i]->data(); +- +- unsigned int level = cells[i]->get_code().level; +- if (level == resolution_level) { +- // just copy value to output array +- int out_index=static_cast(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- +- if (out_index >= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- else if (level > resolution_level) { +- // cell is bigger than output cells. copy value to all contained output cells. +- const unsigned int us_factor = 1 << (level - resolution_level); +- const unsigned int node_x_start = static_cast(node.x()/step_len); +- const unsigned int node_y_start = static_cast(node.y()/step_len); +- const unsigned int node_z_start = static_cast(node.z()/step_len); +- for (unsigned int z=node_z_start; z= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- } +- } +- } +- else { +- // cell is smaller than output cells. increment output cell value +- unsigned int ds_factor = 1 << (resolution_level - level); +- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor); +- const unsigned int node_x = static_cast(node.x()/step_len); +- const unsigned int node_y = static_cast(node.y()/step_len); +- const unsigned int node_z = static_cast(node.z()/step_len); +- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells; +- +- data[out_index] += (T_data)(cell_val*update_weight); +- } +- } +- +- // write the data into a bin file, generate a file name +- std::stringstream strm; +- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin"; +- std::string fn(strm.str()); +- vsl_b_ofstream os(fn.c_str(),std::ios::binary); +- if (!os.os().good()) { +- std::cerr << "error opening " << filename << " for write!\n"; +- return; +- } +- +- vsl_b_write(os, (unsigned int) ncells); // x dimension +- vsl_b_write(os, (unsigned int) ncells); // y dimension +- vsl_b_write(os, (unsigned int) ncells); // z dimension +- +- T_data* dp = data; +- for (; dp < data + data_size; ++dp) { +- T_data v = *dp; +- if (v > 19 || v < -1) +- std::cerr << "Error, v: " << v << '\n'; +- vsl_b_write(os, (T_data)v); +- } +- std::cerr << " Data Correct ? " << '\n'; +- +- delete[] data; +- os.close(); +- iter++; +- } +- +- scene.unload_active_blocks(); +- +- assert(ncells > 0); +- +- // combine the blocks +- vgl_vector_3d dim = scene.world_dim(); +- unsigned dimx = dim.x()*ncells; +- unsigned dimy = dim.y()*ncells; +- unsigned dimz = dim.z()*ncells; +- // we will read the data a column at a time and this is enough +- int row_data_size = ncells; +- T_data* read_data = new (std::nothrow) T_data[row_data_size]; +- if (read_data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate read data!" << std::endl; +- return; +- } +- +- // open the binary files streams, saved earlier +- unsigned int nx,ny,nz; +- vbl_array_3d streams(dim.x(), dim.y(), dim.z()); +- for (unsigned z=0; z::dristhi_header(); +- vxl_uint_32 nx_uint = dimx; +- vxl_uint_32 ny_uint = dimy; +- vxl_uint_32 nz_uint = dimz; +- std::ofstream os(filename.c_str(),std::ios::binary); +- if (!os.good()) { +- std::cerr << "error opening " << filename << " for write!\n"; +- return; +- } +- +- os.write(reinterpret_cast(&data_type),sizeof(data_type)); +- os.write(reinterpret_cast(&nx_uint),sizeof(nx_uint)); +- os.write(reinterpret_cast(&ny_uint),sizeof(ny_uint)); +- os.write(reinterpret_cast(&nz_uint),sizeof(nz_uint)); +- +- // combine the column from streams to generate one raw file +- for (unsigned x=0; x0; z--) { +- vsl_b_ifstream* s=streams(x,y,z-1); +- s->is().read((char*)read_data, ncells*sizeof(T_data)); +- os.write((char*)read_data,ncells*sizeof(T_data)); +- j+=ncells; +- k+=ncells; +- } +- } +- } +- } +- } +- +- os.close(); +- delete[] read_data; +- +- // remove the intermediate bin files +- for (unsigned z=0; zclose(); +- std::stringstream strm; +- strm << filename << x << '_' << y << '_' << z << ".bin"; +- std::string fn(strm.str()); +- std::cout << "Deleting " << fn << std::endl; +- vpl_unlink(fn.data()); +- delete s; +- } +- } +- } +- return; +-} +- +- +-template +-void boxm_save_scene_raw_general_to_byte(boxm_scene > &scene, +- std::string filename, +- unsigned int resolution_level) +-{ +- typedef boct_tree tree_type; +- +- std::cout << " Using boxm_save_scene_raw_general_to_byte\n"; +- +- bsta_histogram hist; +- boxm_compute_scene_statistics(&scene, hist); +- +- // create an array for each block, and save in a binary file +- +- // number of cells for each block should be the same, because they have the +- // same tree max_level definitions +- unsigned int ncells = 0; +- boxm_block_iterator iter(&scene); +- +- unsigned int finest_level=scene.finest_level(); +- +- // query the finest level of the tree and do not make the resolution +- // smaller than that +- if (resolution_level < finest_level) +- resolution_level=finest_level; +- +- iter.begin(); +- while (!iter.end()) +- { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- tree_type* tree = block->get_tree(); +- +- // get origin of block +- vgl_point_3d min = block_bb.min_point(); +- +- ncells = 1 << (tree->root_level() - (int)resolution_level); +- +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +- +- // origin should specify center of first cell +- vgl_point_3d data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0)); +- +- int data_size = ncells*ncells*ncells; +- float *data = nullptr; +- std::cout << "Data Size=" << data_size << std::endl; +- data = new (std::nothrow)float[data_size]; +- +- if (data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl; +- return; +- } +- // init to zero +- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) { +- *dp = 0.0f; +- } +- +- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1); +- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume; +- +- std::vector *> cells = tree->leaf_cells(); +- for (unsigned i=0; i node = tree->cell_bounding_box_local(cells[i]).min_point(); +- +- float cell_val = boxm_cell_to_float(cells[i], step_len); +- +- unsigned int level = cells[i]->get_code().level; +- if (level == resolution_level) { +- // just copy value to output array +- //int out_index = static_cast((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len)); +- int out_index=static_cast(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- //////int out_index=static_cast((node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells); +- //////int out_index=static_cast(ncells-(node.z()/step_len)-1 + (node.x()/step_len)*ncells + (node.y()/step_len)*ncells*ncells); +- +- if (out_index >= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- else if (level > resolution_level) { +- // cell is bigger than output cells. copy value to all contained output cells. +- const unsigned int us_factor = 1 << (level - resolution_level); +- const unsigned int node_x_start = static_cast(node.x()/step_len); +- const unsigned int node_y_start = static_cast(node.y()/step_len); +- const unsigned int node_z_start = static_cast(node.z()/step_len); +- for (unsigned int z=node_z_start; z= data_size) +- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl; +- else +- data[out_index] = cell_val; +- } +- } +- } +- } +- else { +- // cell is smaller than output cells. increment output cell value +- unsigned int ds_factor = 1 << (resolution_level - level); +- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor); +- const unsigned int node_x = static_cast(node.x()/step_len); +- const unsigned int node_y = static_cast(node.y()/step_len); +- const unsigned int node_z = static_cast(node.z()/step_len); +- //unsigned int out_index=node_x*y_size + node_y*ncells + node_z; +- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells; +- //////int out_index=node_z + node_y*ncells + node_x*ncells*ncells; +- //////int out_index=ncells-1-node_z + node_x*ncells + node_y*ncells*ncells; +- +- data[out_index] += float(cell_val*update_weight); +- } +- } +- +- // write the data into a bin file, generate a file name +- std::stringstream strm; +- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin"; +- std::string fn(strm.str()); +- vsl_b_ofstream os(fn.c_str(),std::ios::binary); +- if (!os.os().good()) { +- std::cerr << "error opening " << filename << " for write!\n"; +- return; +- } +- +- vsl_b_write(os, (unsigned int) ncells); // x dimension +- vsl_b_write(os, (unsigned int) ncells); // y dimension +- vsl_b_write(os, (unsigned int) ncells); // z dimension +- +- T_data minv = hist.min(); +- T_data maxv = hist.max(); +- T_data rangev = maxv-minv; +- +- float* dp = data; +- for (; dp < data + data_size; ++dp) { +- unsigned char c = (unsigned char)(std::floor((255.0f * float((*dp)-minv)/float(rangev)) + 0.5f)); +- vsl_b_write(os, (char) c); +- } +- delete[] data; +- os.close(); +- iter++; +- } +- assert(ncells > 0); +- +- scene.unload_active_blocks(); +- +- // combine the blocks +- vgl_vector_3d dim = scene.world_dim(); +- unsigned dimx = dim.x()*ncells; +- unsigned dimy = dim.y()*ncells; +- unsigned dimz = dim.z()*ncells; +- // we will read the data a column at a time and this is enough +- int row_data_size = ncells; +- char* byte_data = new (std::nothrow) char[row_data_size]; +- if (byte_data == nullptr) { +- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl; +- return; +- } +- +- // open the binary files streams, saved earlier +- unsigned int nx,ny,nz; +- vbl_array_3d streams(dim.x(), dim.y(), dim.z()); +- for (unsigned z=0; z(&data_type),sizeof(data_type)); +- os.write(reinterpret_cast(&nx_uint),sizeof(nx_uint)); +- os.write(reinterpret_cast(&ny_uint),sizeof(ny_uint)); +- os.write(reinterpret_cast(&nz_uint),sizeof(nz_uint)); +- +- // combine the column from streams to generate one raw file +- for (unsigned x=0; x0; z--) { +- vsl_b_ifstream* s=streams(x,y,z-1); +- s->is().read(byte_data, ncells); +- os.write((char*)byte_data,ncells); +- j+=ncells; +- k+=ncells; +- } +- } +- } +- } +- } +- +- os.close(); +- delete[] byte_data; +- +- // remove the intermediate bin files +- for (unsigned z=0; zclose(); +- std::stringstream strm; +- strm << filename << x << '_' << y << '_' << z << ".bin"; +- std::string fn(strm.str()); +- std::cout << "Deleting " << fn << std::endl; +- vpl_unlink(fn.data()); +- delete s; +- } +- } +- } +- std::cout << "Volume Histogram\n"; +- hist.pretty_print(); +- return; +-} +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h b/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h +deleted file mode 100644 +index bdfb1db979..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h ++++ /dev/null +@@ -1,97 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_scene_levels_utils.h +-#ifndef boxm_scene_levels_utils_h +-#define boxm_scene_levels_utils_h +-//: +-// \file +-// \brief Functions to explore the levels of an octre +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Sep-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_scene >* boxm_explore_cells_at_level(boxm_scene > *scene_in, short level) +-{ +- //parameters and structure of the output scene are the same as those of the input scene +- boxm_scene > *scene_out = new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(scene_in->path(), "level"); +- scene_out->set_appearance_model(BOXM_BOOL); +- scene_out->write_scene("level.xml"); +- +- scene_in->template clone_blocks_to_type >(*scene_out, false); +- +- //iterate through the leaf cells +- boxm_cell_iterator > it_in = +- scene_in->cell_iterator(&boxm_scene >::load_block, true); +- boxm_cell_iterator > it_out = +- scene_out->cell_iterator(&boxm_scene >::load_block); +- +- for (it_in.begin(), it_out.begin(); !it_in.end() && !it_out.end(); ++it_in, ++it_out) +- { +- boct_tree_cell *cell_in = *it_in; +- boct_tree_cell *cell_out = *it_out; +- +- //check for level +- if ((cell_in->level() == level)) { +- cell_out->set_data(true); +- } +- } +- +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- +- return scene_out; +-} +- +- +-template +-void boxm_remove_level_0_leaves(boxm_scene > *scene_in) +-{ +- typedef boct_tree tree_type; +- +- //Iterate through the blocks +- boxm_block_iterator it_in = scene_in->iterator(); +- for (it_in.begin(); !it_in.end(); ++it_in) +- { +- scene_in->load_block(it_in.index()); +- tree_type *tree_in= (*it_in)->get_tree(); +- +- std::vector * > all_cells = tree_in->all_cells(); +- typename std::vector * >::iterator cells_it = all_cells.begin(); +- +- for (; cells_it!=all_cells.end(); cells_it++) { +- boct_tree_cell * cell_in = *cells_it; +- //check for level +- short level = cell_in->level(); +- if (level == 0) { +- cell_in = nullptr; +- } +- else { +- if (level == 1) +- cell_in->set_children_null(); +- //shift loccode one space to the rigth +- boct_loc_code shift_code; +- shift_code.set_code(cell_in->get_code().x_loc_ >> 1, cell_in->get_code().y_loc_ >> 1, cell_in->get_code().z_loc_ >> 1); +- shift_code.set_level(level - 1); +- cell_in->set_code(shift_code); +- } +- } +- +- tree_in->reset_num_levels(tree_in->number_levels() - 1); +- scene_in->write_active_block(); +- std::cout << '.'; +- } +- std::cout << "\nCleaning\n"; +- scene_in->unload_active_blocks(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_split_sample.h b/contrib/brl/bseg/boxm/algo/boxm_split_sample.h +deleted file mode 100644 +index eb982606db..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_split_sample.h ++++ /dev/null +@@ -1,105 +0,0 @@ +-// This is brl/bseg/boxm/algo/boxm_split_sample.h +-#ifndef boxm_split_sample_h +-#define boxm_split_sample_h +-//: +-// \file +-// \brief A class enclosing set of functions to split a boxm_sample scenes/trees into appearance and occupancy scenes/trees +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date December 3, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_split_sample +-{ +- public: +- typedef boct_tree > sample_tree_type; +- typedef boct_tree_cell > sample_cell_type; +- +- typedef typename boxm_apm_traits::apm_datatype apm_datatype; +- typedef boct_tree apm_tree_type; +- typedef boct_tree_cell apm_cell_type; +- +- typedef typename boxm_apm_traits::obs_mathtype alpha_datatype; +- typedef boct_tree alpha_tree_type; +- typedef boct_tree_cell alpha_cell_type; +- +- //: A function to split an boxm_sample scene, into an appearance and an occupancy scene +- void split_scene(boxm_scene &scene_in, boxm_scene &apm_scene, boxm_scene &alpha_scene); +- +- //: A function to split an boxm_sample tree, into an appearance and an occupancy tree +- void split_tree(sample_tree_type *tree_in, apm_tree_type *apm_tree, alpha_tree_type *alpha_tree); +-}; +- +- +-//: A function to split an boxm_sample scene, into an appearance and an occupancy scene +-template +-void boxm_split_sample::split_scene(boxm_scene &scene_in, +- boxm_scene &apm_scene, +- boxm_scene &alpha_scene) +-{ +- //missing:check that dimensions of all scenes agree +- +- //iterate through blocks in the scenes +- boxm_block_iterator iter_in = scene_in.iterator(); +- boxm_block_iterator apm_iter = apm_scene.iterator(); +- boxm_block_iterator alpha_iter = alpha_scene.iterator(); +- +- iter_in.begin(); +- apm_iter.begin(); +- alpha_iter.begin(); +- while (!iter_in.end() || !apm_iter.end() ||!alpha_iter.end()) +- { +- scene_in.load_block(iter_in.index()); +- apm_scene.load_block(apm_iter.index()); +- alpha_scene.load_block(alpha_iter.index()); +- +- sample_tree_type *tree_in= (*iter_in)->get_tree(); +- apm_tree_type *apm_tree = tree_in->template clone_to_type(); +- alpha_tree_type *alpha_tree = tree_in->template clone_to_type(); +- this->split_tree(tree_in, apm_tree,alpha_tree); +- (*apm_iter)->init_tree(apm_tree); +- (*alpha_iter)->init_tree(alpha_tree); +- apm_scene.write_active_block(); +- alpha_scene.write_active_block(); +- +- iter_in++; apm_iter++; alpha_iter++; +- } +-} +- +- +-//: A function to split an boxm_sample tree, into an appearance and an occupancy tree +-template +-void boxm_split_sample::split_tree(sample_tree_type *tree_in, apm_tree_type *apm_tree, alpha_tree_type *alpha_tree) +-{ +- //iterate through the trees +- std::vector sample_cells = tree_in->all_cells(); +- std::vector apm_cells = apm_tree->all_cells(); +- std::vector alpha_cells = alpha_tree->all_cells(); +- +- if (sample_cells.size()!=apm_cells.size() || apm_cells.size()!=alpha_cells.size()){ +- std::cerr << "Different size vectors in split_sample_scene::split_tree\n"; +- return; +- } +- +- for (unsigned i = 0; i < sample_cells.size(); i++) +- { +- boxm_sample sample = sample_cells[i]->data(); +- apm_cells[i]->set_data(sample.appearance_); +- alpha_cells[i]->set_data(sample.alpha); +- } +-} +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h b/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h +deleted file mode 100644 +index 63fe2ff02b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h ++++ /dev/null +@@ -1,156 +0,0 @@ +-#ifndef boxm_render_mesh_h_ +-#define boxm_render_mesh_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-void boxm_upload_mesh_into_block(boxm_block > *block, +- imesh_mesh& mesh, vpgl_lvcs& lvcs, bool use_lvcs, T_data val) +-{ +- typedef boct_tree tree_type; +- tree_type* tree = block->get_tree(); +- vgl_box_3d block_bb = block->bounding_box(); +- imesh_face_array_base& fs = mesh.faces(); +- for (unsigned i=0; i < fs.size(); ++i) +- { +- std::list > v_list; +- imesh_vertex_array<3>& vertices = mesh.vertices<3>(); +- vgl_box_3d bb_scale, bb_global; +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- vgl_vector_3d diff = v-block_bb.min_point(); // get the value according to the block origin +- v.set(diff.x(), diff.y(), diff.z()); +- // the local coordinates inside the box region +- v_list.push_back(v); +- //convert the values into [0,1] range +- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth()); +- bb_scale.add(v); +- } +- // check if polygon's bounding box intersects with the block +- vgl_box_3d inters = vgl_intersection(vgl_box_3d(0,0,0,1,1,1), bb_scale); +- if (inters.is_empty()) +- return; +- +- // locate the polygon bounding box in tree +- boct_tree_cell* region=tree->locate_region(inters); +- if (region) { +- // test all the children for intersection +- std::vector*> children; +- if (!region->is_leaf()) +- region->leaf_children(children); +- else // insert the node itself, if no children +- children.push_back(region); +- for (unsigned i=0; i* cell=children[i]; +- vgl_box_3d cell_bb=tree->cell_bounding_box_local(cell); +- if (vgl_intersection(cell_bb, v_list)) { +- cell->set_data(val); +- } +- } +- } +- } +-} +- +-//: this is to copy mesh into existing tree and replacing the appearance model of the existing tree. +-template <> +-void boxm_upload_mesh_into_block(boxm_block > > *block, +- imesh_mesh& mesh, vpgl_lvcs& lvcs, +- bool use_lvcs, boxm_sample val) +-{ +- typedef boct_tree > tree_type; +- tree_type* tree = block->get_tree(); +- vgl_box_3d block_bb = block->bounding_box(); +- imesh_face_array_base& fs = mesh.faces(); +- for (unsigned i=0; i < fs.size(); ++i) +- { +- std::list > v_list; +- imesh_vertex_array<3>& vertices = mesh.vertices<3>(); +- vgl_box_3d bb_scale, bb_global; +- for (unsigned j=0; j v; +- if (use_lvcs) { +- double lx, ly, lz; +- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2), +- vpgl_lvcs::wgs84,lx,ly,lz); +- v=vgl_point_3d(lx,ly,lz); +- } +- else +- v=vgl_point_3d(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2)); +- bb_global.add(v); +- vgl_vector_3d diff = v-block_bb.min_point(); // get the value according to the block origin +- v.set(diff.x(), diff.y(), diff.z()); +- // the local coordinates inside the box region +- v_list.push_back(v); +- //convert the values into [0,1] range +- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth()); +- bb_scale.add(v); +- } +- // check if polygon's bounding box intersects with the block +- vgl_box_3d inters = vgl_intersection(vgl_box_3d(0,0,0,0.999,0.999,0.999), bb_scale); +- if (inters.is_empty()) +- return; +- +- // locate the polygon bounding box in tree +- boct_tree_cell >* region=tree->locate_region(inters); +- if (region) { +- // test all the children for intersection +- std::vector >*> children; +- if (!region->is_leaf()) +- region->leaf_children(children); +- else // insert the node itself, if no children +- children.push_back(region); +- for (auto cell : children) { +- vgl_box_3d cell_bb=tree->cell_bounding_box(cell); +- if (vgl_intersection(cell_bb, v_list)) { +- boxm_sample tempdata=cell->data(); +- tempdata.set_appearance(val.appearance()); +- tempdata.alpha*=val.alpha; +- cell->set_data(tempdata); +- } +- } +- } +- } +-} +- +-//: calls all the blocks for drawing meshes +-template +-void boxm_upload_mesh_into_scene(boxm_scene > &scene, +- imesh_mesh& mesh, bool use_lvcs, T_data val) +-{ +- typedef boct_tree tree_type; +- vpgl_lvcs lvcs=scene.lvcs(); +- boxm_block_iterator iter(&scene); +- mesh.compute_face_normals(true); +- for (; !iter.end(); iter++) { +- scene.load_block(iter.index()); +- boxm_block* block = *iter; +- boxm_upload_mesh_into_block(block, mesh, lvcs, use_lvcs, val); +- scene.write_active_block(); +- } +-} +- +-#endif // boxm_render_mesh_h_ +diff --git a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt +deleted file mode 100644 +index 2a41c2db1a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt ++++ /dev/null +@@ -1,40 +0,0 @@ +-# boxm's Process Library +- +-# bprb depends on expat and bvxm_pro depends on bprb primarily +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +- +-if(EXPAT_FOUND) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- +-FIND_PACKAGE(RPLY REQUIRED) +-if(RPLY_FOUND) +- include_directories( ${RPLY_INCLUDE_DIR} ) +-else() +- include_directories( ${VTHREEP_INCLUDE_DIR}/rply ) +-endif() +- +- set(boxm_algo_pro_sources +- boxm_algo_processes.h +- boxm_algo_register.h boxm_algo_register.cxx +- ) +- +- #aux_source_directory(Templates boxm_algo_pro_sources) +- aux_source_directory(processes boxm_algo_pro_sources) +- +- vxl_add_library(LIBRARY_NAME boxm_algo_pro LIBRARY_SOURCES ${boxm_algo_pro_sources} ) +- +- target_link_libraries(boxm_algo_pro boxm_algo boxm boxm_sample boxm_util boct bprb brdb bsta_pro vil_pro bsta vpgl_pro ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vil vsol ${VXL_LIB_PREFIX}vgl brip ${VXL_LIB_PREFIX}vcl rply) +- # Need bsta_pro only for the instantiation of brdb_value_t > +- # Need vpgl_pro only for the instantiation of brdb_value_t > > +- # Need vil_pro only for the instantiation of brdb_value_t > +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +-endif() +diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h +deleted file mode 100644 +index f22427eeed..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h ++++ /dev/null +@@ -1,28 +0,0 @@ +-#ifndef boxm_algo_processes_h_ +-#define boxm_algo_processes_h_ +- +-#include +-#include +- +-//the init functions +-DECLARE_FUNC_CONS(boxm_describe_scene_process); +-DECLARE_FUNC_CONS(boxm_init_scene_process); +-DECLARE_FUNC_CONS(boxm_line_backproject_process); +-DECLARE_FUNC_CONS(boxm_refine_scene_process); +-DECLARE_FUNC_CONS(boxm_replace_const_app_process); +-DECLARE_FUNC_CONS(boxm_roi_init_process); +-DECLARE_FUNC_CONS(boxm_roi_init_rational_camera_process); +-DECLARE_FUNC_CONS(boxm_save_occupancy_raw_process); +-DECLARE_FUNC_CONS(boxm_save_scene_raw_process); +-DECLARE_FUNC_CONS(boxm_render_expected_edge_vrml_process); +-DECLARE_FUNC_CONS(boxm_merge_mixtures_process); +-DECLARE_FUNC_CONS(boxm_split_scene_process); +-DECLARE_FUNC_CONS(boxm_compute_scene_difference_process); +-DECLARE_FUNC_CONS(boxm_compute_entropy_process); +-DECLARE_FUNC_CONS(boxm_compute_expected_color_scene_process); +-DECLARE_FUNC_CONS(boxm_linear_combination_process); +-DECLARE_FUNC_CONS(boxm_explore_cells_at_level_process); +-DECLARE_FUNC_CONS(boxm_fill_internal_cells_process); +-DECLARE_FUNC_CONS(boxm_remove_level0_process); +-DECLARE_FUNC_CONS(boxm_create_scene_from_ply_process); +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx +deleted file mode 100644 +index b883c164fa..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx ++++ /dev/null +@@ -1,35 +0,0 @@ +-#include "boxm_algo_register.h" +- +-#include +-#include +-#include +- +-#include "boxm_algo_processes.h" +- +-void boxm_algo_register::register_datatype() +-{ +-} +- +-void boxm_algo_register::register_process() +-{ +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_describe_scene_process,"boxmDescribeSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_init_scene_process,"boxmInitSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_line_backproject_process,"boxmLineBackprojectProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_refine_scene_process, "boxmRefineSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_replace_const_app_process,"boxmReplaceConstAppProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_roi_init_process, "boxmROIInitProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_roi_init_rational_camera_process, "boxmROIInitRationalCameraProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_save_occupancy_raw_process, "boxmSaveOccupancyRawProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_save_scene_raw_process, "boxmSaveSceneRawProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_edge_vrml_process, "boxmRenderExpectedEdgeVRMLProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_merge_mixtures_process, "boxmMergeMixturesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_split_scene_process ,"boxmSplitSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_scene_difference_process, "boxmComputeSceneDifferenceProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_entropy_process, "boxmComputeEntropyProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_expected_color_scene_process, "boxmComputeExpectedColorSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_linear_combination_process, "boxmLinearCombinationProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_explore_cells_at_level_process, "boxmExploreCellsAtLevelProcess"); +- REG_PROCESS_FUNC_CONS2(boxm_fill_internal_cells_process); +- REG_PROCESS_FUNC_CONS2(boxm_remove_level0_process); +- REG_PROCESS_FUNC_CONS2(boxm_create_scene_from_ply_process); +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h +deleted file mode 100644 +index 3c21937894..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-#ifndef boxm_algo_register_h_ +-#define boxm_algo_register_h_ +- +-class boxm_algo_register +-{ +- public: +- static void register_datatype(); +- static void register_process(); +-}; +- +-#endif // boxm_algo_register_h_ +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx +deleted file mode 100644 +index 1b8cf32459..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx ++++ /dev/null +@@ -1,83 +0,0 @@ +-//: +-// \file +-// \brief A process that outputs the differential entropy of the gaussian stored at every leave cell +-// \author Isabel Restrepo +-// \date 15-Nov-2010 +- +-#include +-#include +- +-#include +- +-#include +- +- +-//:global variables +-namespace boxm_compute_entropy_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool boxm_compute_entropy_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_compute_entropy_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool boxm_compute_entropy_process(bprb_func_process& pro) +-{ +- using namespace boxm_compute_entropy_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Scene is not valid!\n"; +- return false; +- } +- +- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed +- +- typedef bsta_num_obs gauss_type; +- typedef boct_tree gauss_tree_type; +- +- auto *gauss_scene = dynamic_cast* > (scene_base.as_pointer()); +- +- //check input's validity +- if (!gauss_scene) { +- std::cout << " :-- Scene is not of valid type!\n"; +- return false; +- } +- +- //parameters and structure of the output scene are the same as those of the input scene +- boxm_scene > *entropy_scene = new boxm_scene >(gauss_scene->lvcs(), gauss_scene->origin(), gauss_scene->block_dim(), gauss_scene->world_dim(), gauss_scene->max_level(), gauss_scene->init_level()); +- entropy_scene->set_paths(gauss_scene->path(), "entropy"); +- entropy_scene->set_appearance_model(BOXM_FLOAT); +- +- compute_differential_entropy(*gauss_scene, *entropy_scene); +- gauss_scene->write_scene("entropy_scene.xml"); +- pro.set_output_val(0, entropy_scene); +- std::cout<<"Exiting" << std::endl; +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx +deleted file mode 100644 +index e99f978d28..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx ++++ /dev/null +@@ -1,83 +0,0 @@ +-//: +-// \file +-// \brief A process that computes the "expected visible color" at each voxel +-// \author Isabel Restrepo +-// \date 17-Nov-2010 +- +-#include +-#include +- +-#include +- +-#include +- +- +-//:global variables +-namespace boxm_compute_expected_color_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool boxm_compute_expected_color_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_compute_expected_color_scene_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "float"; //offset for appearance values +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool boxm_compute_expected_color_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_compute_expected_color_scene_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- auto grey_offset = pro.get_input(1); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Scene is not valid!\n"; +- return false; +- } +- +- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed +- +- typedef boct_tree > scene_tree_type; +- +- auto *scene = dynamic_cast* > (scene_base.as_pointer()); +- +- //check input's validity +- if (!scene) { +- std::cout << " :-- Scene is not of valid type!\n"; +- return false; +- } +- +- //parameters and structure of the output scene are the same as those of the input scene +- boxm_scene > *mean_color_scene = new boxm_scene >(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level()); +- mean_color_scene->set_paths(scene->path(), "mean_color"); +- mean_color_scene->set_appearance_model(BOXM_FLOAT); +- +- compute_expected_color(*scene, *mean_color_scene, grey_offset); +- mean_color_scene->write_scene("mean_color_scene.xml"); +- pro.set_output_val(0, mean_color_scene); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx +deleted file mode 100644 +index f7efed8c52..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx ++++ /dev/null +@@ -1,91 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx +- +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for computing the difference between two scenes. +-// +-// \author Vishal Jain +-// \date Sept 8, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-//: global variables +-namespace boxm_compute_scene_difference_process_globals +-{ +- //this process takes no outputs +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 0; +-} +- +-//: sets input and output types +-bool boxm_compute_scene_difference_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_compute_scene_difference_process_globals; +- +- // process takes 1 input and no outputs +- //input[0]: The scene +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "boxm_scene_base_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "float"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//: creates a scene from parameters +-bool boxm_compute_scene_difference_process(bprb_func_process& pro) +-{ +- using namespace boxm_compute_scene_difference_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_compute_scene_difference_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene1_ptr = pro.get_input(i++); +- boxm_scene_base_sptr scene2_ptr = pro.get_input(i++); +- boxm_scene_base_sptr sceneout_ptr = pro.get_input(i++); +- auto t = pro.get_input(i++); +- +- if (scene1_ptr->appearence_model() == BOXM_APM_MOG_GREY && +- scene2_ptr->appearence_model() == BOXM_APM_MOG_GREY && +- sceneout_ptr->appearence_model() == BOXM_APM_MOG_GREY ) +- { +- typedef boct_tree > tree_type; +- auto *scene1 = static_cast*> (scene1_ptr.as_pointer()); +- auto *scene2 = static_cast*> (scene2_ptr.as_pointer()); +- auto *sceneout = static_cast*> (sceneout_ptr.as_pointer()); +- +- boxm_compute_scene_difference(*scene1,*scene2,*sceneout,t); +- } +- else { +- std::cout << "boxm_compute_scene_difference_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx +deleted file mode 100644 +index fdf40edf0e..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx ++++ /dev/null +@@ -1,257 +0,0 @@ +-//: +-// \file +-// \brief A process that creates a boxm scene from a .ply file +-// \author Isabel Restrepo +-// \date 2-Jan-2012 +- +-#include +-#include +- +-#include +- +-#include +-#include //.ply parser +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#define DEBUG_PLY +- +-class boxm_vgl_point_3d_coord_compare +-{ +- public: +- boxm_vgl_point_3d_coord_compare() = default; +- ~boxm_vgl_point_3d_coord_compare() = default; +- +- bool operator() ( vgl_point_3d const& pa, vgl_point_3d pb ) const +- { +- if ( pa.x() != pb.x() ) return pa.x() < pb.x(); +- else if ( pa.y() != pb.y() ) return pa.y() < pb.y(); +- else return pa.z() < pb.z(); +- } +-}; +- +- +-class boxm_apperace_fileio_parsed_ply_ +-{ +- public: +- double p[3]; //holds location +- unsigned char color; //holds color +- double grey_offset; //offset the floating point (0,1) color value +- //accumulated data in the shape of leaf cells +- std::map, std::vector >, boxm_vgl_point_3d_coord_compare > data; +- boxm_scene > *scene; +-}; +- +-bool boxm_load_color_ply(const std::string &ply_file, boxm_scene > *scene, +- std::map, +- std::vector >,boxm_vgl_point_3d_coord_compare > &data, +- const float &grey_offset); +- +-//: Call-back function for a "vertex" element +-int boxm_plyio_vertex_cb_(p_ply_argument argument); +- +-//: global variables +-namespace boxm_create_scene_from_ply_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//: sets input and output types +-bool boxm_create_scene_from_ply_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_create_scene_from_ply_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; //path to .ply file +- input_types_[1] = "boxm_scene_base_sptr"; //the scene to fill up +- input_types_[2] = "float"; //offset for appearance values +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool boxm_create_scene_from_ply_process(bprb_func_process& pro) +-{ +- using namespace boxm_create_scene_from_ply_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- std::string ply_file = pro.get_input(0); +- boxm_scene_base_sptr scene_base = pro.get_input(1); +- auto grey_offset = pro.get_input(2); +- +- // Note initial implementation is for fixed types, but this can be changed if more cases are needed +- // cast input scene +- auto *scene = dynamic_cast >* > (scene_base.as_pointer()); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Scene is not valid!\n"; +- return false; +- } +- +- // Map to hold the index of block and the cell containing appearance (0,1) +- std::map, std::vector >, boxm_vgl_point_3d_coord_compare > data; +- +- boxm_block_iterator > block_iter = scene->iterator(); +- +- for (block_iter.begin(); !block_iter.end(); ++block_iter) +- { +- data[block_iter.index()]= std::vector >(); +- } +- +- if (!boxm_load_color_ply(ply_file, scene, data, grey_offset)){ +- pro.set_output_val(0, nullptr); +- return false; +- } +- +- +- //construct trees +- for (block_iter.begin(); !block_iter.end(); ++block_iter) +- { +- std::cout << "In block: " << block_iter.index() << "Number of leaves: " <* root = boct_construct_tree(data[block_iter.index()], scene->max_level(), 0.0f ); +- auto* tree = new boct_tree(root, scene->max_level()); +- vgl_box_3d tree_bbox= scene->get_block_bbox(block_iter.index()); +- tree->set_bbox(tree_bbox); +- +- scene->load_block(block_iter.index()); +- (*block_iter)->init_tree(tree); +- scene->write_active_block(); +- data[block_iter.index()].clear(); +- } +- +- pro.set_output_val(0, scene); +- +- return true; +-} +- +- +-// ============================== PLY ============================== +- +- +-bool boxm_load_color_ply(const std::string &ply_file, boxm_scene > *scene, +- std::map, +- std::vector >,boxm_vgl_point_3d_coord_compare > &data, +- const float &grey_offset) +-{ +- long nvertices; +- +- boxm_apperace_fileio_parsed_ply_ parsed_ply; +- parsed_ply.grey_offset = grey_offset; +- parsed_ply.data = data; +- parsed_ply.scene = scene; +- +- +- // OPEN file +-#ifdef DEBUG_PLY +- std::cerr << " loading " << ply_file << " :\n"; +- std::cerr << " gray_offset " << parsed_ply.grey_offset << grey_offset << " :\n"; +- +-#endif +- +- p_ply ply = ply_open(ply_file.c_str(), nullptr, 0, nullptr); +- if (!ply){ +- std::cerr << "Couldn't open ply file: " << ply_file << '\n'; +- return false; +- } +- +- // Read HEADER +- if (!ply_read_header(ply)) return false; +- +- // vertex +- nvertices = +- ply_set_read_cb(ply, "vertex", "x", +- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 0); +- ply_set_read_cb(ply, "vertex", "y", +- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 1); +- ply_set_read_cb(ply, "vertex", "z", +- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 2); +- ply_set_read_cb(ply, "vertex", "diffuse_red", +- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 3); +- +-#ifdef DEBUG_PLY +- std::cerr << nvertices << " points\n"; +-#endif +- +- // Read DATA +- if (!ply_read(ply)) return false; +- +- // CLOSE file +- ply_close(ply); +- +- data=parsed_ply.data; +- +-#ifdef DEBUG_PLY +- std::cerr << " done.\n"; +-#endif +- +- return true; +-} +- +- +-//: Call-back function for a "vertex" element +-int boxm_plyio_vertex_cb_(p_ply_argument argument) +-{ +- long index; +- void* temp; +- ply_get_argument_user_data(argument, &temp, &index); +- +- auto* parsed_ply = (boxm_apperace_fileio_parsed_ply_*) temp; +- //std::cout << "color: " << parsed_ply->grey_offset << std::endl; +- +- switch (index) +- { +- case 0: // "x" coordinate +- parsed_ply->p[0] = ply_get_argument_value(argument); +- break; +- case 1: // "y" coordinate +- parsed_ply->p[1] = ply_get_argument_value(argument); +- break; +- case 2: // "z" coordinate +- parsed_ply->p[2] = ply_get_argument_value(argument); +- break; +- case 3: +- { +- parsed_ply->color = (unsigned char)ply_get_argument_value(argument); +- //insert data +- vgl_point_3d block_index(-1,-1,-1); +- if (parsed_ply->scene->get_block_index(vgl_point_3d(parsed_ply->p), block_index)) +- { +- //convert point into local(tree coordinates) +- vgl_box_3d global_bbox= parsed_ply->scene->get_block_bbox(block_index); +- vgl_point_3d norm_p((parsed_ply->p[0]-global_bbox.min_x())/global_bbox.width(), +- (parsed_ply->p[1]-global_bbox.min_y())/global_bbox.height(), +- (parsed_ply->p[2]-global_bbox.min_z())/global_bbox.depth()); +- // convert point to location code. +- boct_loc_code loc_code(norm_p, parsed_ply->scene->max_level()-1); +- boct_tree_cell leaf_cell(loc_code); +- float expected_color = float(parsed_ply->color)/255.0f + float(parsed_ply->grey_offset); +- if (expected_color > 2.0f || expected_color < 0.0f) +- std::cout << "color: " << parsed_ply->grey_offset << std::endl; +- leaf_cell.set_data(expected_color); +- parsed_ply->data[block_index].push_back(leaf_cell); +- } +- break; +- } +- default: +- assert(!"This should not happen: index out of range"); +- break; +- } +- return 1; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx +deleted file mode 100644 +index 2fb47d460f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx ++++ /dev/null +@@ -1,106 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx +-#include +-//: +-// \file +-// \brief A process for describing the attributes of a scene +-// +-// \author J.L. Mundy +-// \date January 24, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_describe_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 4; +-} +- +-bool boxm_describe_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_describe_scene_process_globals; +- +- //process takes 1 input +- //input[0]: scene binary file +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- // process has 4 outputs: +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bsta_histogram_sptr"; // Omega Histogram +- output_types_[1] = "bsta_histogram_sptr"; // Sigma Histogram +- output_types_[2] = "bsta_histogram_sptr"; // Level Histogram +- output_types_[3] = "unsigned"; // Number of leaves +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-// This process produces four outputs +-// 1) The distribution of "Omega" values where Omega = 1-e^( alpha x length ) +-// 2) The distribution of "Sigma" values where Sigma is the std_dev of +-// the appearance model. (currently implemented only for simple grey) +-// 3) The histogram of levels for leaves in the octree +-// 4) The number of leaves in the tree +-// +-bool boxm_describe_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_describe_scene_process_globals; +- +- if ( !pro.verify_inputs() ) { +- std::cerr << pro.name() << ": invalid inputs\n"; +- return false; +- } +- unsigned n_leaves = 0; +- //assign tree type +- boxm_scene_base_sptr scene_ptr = pro.get_input(0); +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- if (!scene_ptr->multi_bin()) +- { +- std::cerr<<"boxm_describe_scene_process not yet implemented for Gaussian mixture\n"; +- return false;//not implemented +- } +- else +- { +- std::cerr<<"boxm_describe_scene_process not yet implemented for multi-bin/Gaussian mixture\n"; +- return false; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) +- { +- if (!scene_ptr->multi_bin()) { +- typedef boct_tree > tree_type; +- auto* scene = dynamic_cast *> (scene_ptr.as_pointer()); +- +- bsta_histogram omega_hist, sigma_hist, level_hist; +- if (!compute_scene_statistics(*scene, omega_hist, sigma_hist, +- level_hist, n_leaves)) +- return false; +- std::cout << "Omega Hist\n"; +- omega_hist.print_vals_prob(); +- std::cout << "Sigma Hist\n"; +- sigma_hist.print_vals_prob(); +- std::cout << "Level Hist\n"; +- level_hist.print_vals_prob(); +- std::cout << "Number of Leaves " << n_leaves << '\n'; +- pro.set_output_val(0, new bsta_histogram(omega_hist)); +- pro.set_output_val(1, new bsta_histogram(sigma_hist)); +- pro.set_output_val(2, new bsta_histogram(level_hist)); +- pro.set_output_val(3, n_leaves); +- } +- else { +- std::cerr<<"boxm_describe_scene_process not yet implemented for multi-bin/simple_grey\n"; +- return false; +- } +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx +deleted file mode 100644 +index 1dfc74a8ee..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx ++++ /dev/null +@@ -1,61 +0,0 @@ +-//: +-// \file +-// \brief A process to label cells at a given leve +-// \author Isabel Restrepo +-// \date 15-Sep-2011 +- +-#include +-#include +-#include +- +-#include +- +- +-//:global variables +-namespace boxm_explore_cells_at_level_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool boxm_explore_cells_at_level_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_explore_cells_at_level_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; //scene in +- input_types_[1] = "unsigned"; //octree level +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; //label scene +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool boxm_explore_cells_at_level_process(bprb_func_process& pro) +-{ +- using namespace boxm_explore_cells_at_level_process_globals; +- +- //get inputs +- boxm_scene_base_sptr scene_in_base = pro.get_input(0); +- auto level = pro.get_input(1); +- +- if (scene_in_base->appearence_model() == BOXM_FLOAT) +- { +- typedef boct_tree type; +- +- auto* scene = dynamic_cast*>(scene_in_base.as_pointer()); +- +- if (!scene) +- return false; +- +- //store output +- pro.set_output_val(0, boxm_explore_cells_at_level(scene,level)); +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx +deleted file mode 100644 +index c222d74cd7..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx ++++ /dev/null +@@ -1,72 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx +-//: +-// \file +-// \brief process fills the internal cells of the octrees in the scene +-// +-// \author Isabel Restrepo +-// \date December 3, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +-#include +- +- +-namespace boxm_fill_internal_cells_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: process takes 1 input and 1 output. +-// input[0]: The input scene +-// output[0]: The output scene +- +-bool boxm_fill_internal_cells_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_fill_internal_cells_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_fill_internal_cells_process(bprb_func_process& pro) +-{ +- using namespace boxm_fill_internal_cells_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the number of inputs should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- if (auto *scene_in = dynamic_cast >* > (scene_base.as_pointer())) +- { +- boxm_fill_internal_cells filler; +- pro.set_output_val(0, filler.traverse_and_fill(scene_in)); +- return true; +- } +- +- std::cerr << "In boxm_fill_internal_cells_process: Unsupportted scene type\n"; +- return false; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx +deleted file mode 100644 +index e023ca2500..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx ++++ /dev/null +@@ -1,111 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx +- +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for initializing a new boxm_scene when there is not a saved one. +-// It receives the parameters from a parameter file in XML +-// +-// \author Vishal Jain +-// \date Feb 8, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-//: global variables +-namespace boxm_init_scene_process_globals +-{ +- //this process takes no outputs +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 0; +-} +- +-//: sets input and output types +-bool boxm_init_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_init_scene_process_globals; +- +- // process takes 1 input and no outputs +- //input[0]: The scene +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//: creates a scene from parameters +-bool boxm_init_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_init_scene_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_init_scene_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- // check the input validity +- if (scene == nullptr) { +- std::cout << "boxm_init_scene_process: scene is null, cannot run" << std::endl; +- return false; +- } +- +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- if (!scene->multi_bin()) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_init_scene(*s); +- } +- } +- else if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- if (scene->multi_bin()) { +- std::cout << "boxm_init_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl; +- return false; +- } +- else { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_init_scene(*s); +- } +- } +- else if (scene->appearence_model() == BOXM_APM_MOB_GREY) { +- if (scene->multi_bin()) { +- std::cout << "boxm_init_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl; +- return false; +- } +- else { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_init_scene(*s); +- } +- } +- else { +- std::cout << "boxm_init_scene_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx +deleted file mode 100644 +index b8767b24bc..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx ++++ /dev/null +@@ -1,259 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for computing the backprojection of lines. +-// Lines are represented as an image with 3 plane images (plane 0=a, plane1=b, +-// plane2=c, line is defined as ax+by=c). The backprojection, which is a plane +-// is stored as an other image with 4 planes (ax+by+cz=d) as the output. +-// +-// \author Gamze Tunali +-// \date Feb 4, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-//: globals +-namespace boxm_line_backproject_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: set input and output types +-// process takes 2 inputs and has 1 output: +-// input[0]: The edge image (vil_image_view with three planes for (a,b,c)) +-// input[1]: camera +-// output[0]: The plane image +-bool boxm_line_backproject_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_line_backproject_process_globals; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "vil_image_view_base_sptr"; +- input_types_[i++] = "vpgl_camera_double_sptr"; +- +- std::vector output_types_(n_outputs_); +- unsigned j = 0; +- output_types_[j++] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-vpgl_rational_camera +-perspective_to_rational(vpgl_perspective_camera&cam_pers) +-{ +- vnl_matrix_fixed cam_pers_matrix = cam_pers.get_matrix(); +- std::vector neu_u,den_u,neu_v,den_v; +- double x_scale = 1.0, x_off = 0.0, y_scale = 1.0, y_off = 0.0, z_scale = 1.0, z_off = 0.0, u_scale = 1.0, u_off = 0.0, v_scale = 1.0, v_off = 0.0; +- +- for (int i=0; i<20; i++) { +- neu_u.push_back(0.0); +- neu_v.push_back(0.0); +- den_u.push_back(0.0); +- den_v.push_back(0.0); +- } +- +- int vector_map[] = {9,15,18,19}; +- +- for (int i=0; i<4; i++) { +- neu_u[vector_map[i]] = cam_pers_matrix(0,i); +- neu_v[vector_map[i]] = cam_pers_matrix(1,i); +- den_u[vector_map[i]] = cam_pers_matrix(2,i); +- den_v[vector_map[i]] = cam_pers_matrix(2,i); +- } +- +- vpgl_rational_camera cam_rat(neu_u,den_u,neu_v,den_v, +- x_scale,x_off,y_scale,y_off,z_scale,z_off, +- u_scale,u_off,v_scale,v_off); +- return cam_rat; +-} +- +-//: optimizes rpc camera parameters based on edges +-bool boxm_line_backproject_process(bprb_func_process& pro) +-{ +- using namespace boxm_line_backproject_process_globals; +- +- // check number of inputs +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The number of inputs should be " << n_inputs_<< std::endl; +- return false; +- } +- +- // get the inputs +- unsigned i = 0; +- +- // image +- vil_image_view_base_sptr edge_image_sptr = pro.get_input(i++); +- +- // camera +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- +- // make sure that image has 3 planes +- if (edge_image_sptr->nplanes() != 3) { +- std::cerr << "boxm_line_backproject_process: The edge image is expected to have 3 planes!\n"; +- return false; +- } +- +- vil_image_view *plane_image; +- if (edge_image_sptr->pixel_format() == VIL_PIXEL_FORMAT_FLOAT) { +- vil_image_view edge_image(edge_image_sptr); +- unsigned ni=edge_image.ni(); +- unsigned nj=edge_image.nj(); +- +- // the output image +- plane_image = new vil_image_view(ni,nj,4); +- float col, row, theta; +- +- if (camera->type_name() == "vpgl_proj_camera") { +- auto* cam = dynamic_cast*>(camera.ptr()); +- +- for (unsigned i=0; i p1(col,row); +- +- float x = col + 0.5f*std::cos(theta); +- float y = row + 0.5f*std::sin(theta); +- vgl_point_2d p2(x,y); +- +- vgl_line_2d line(p1,p2); +- +- //create a line and backproject it +- vgl_homg_line_2d image_line(line); +- vgl_homg_plane_3d plane = cam->backproject(image_line); +- if (plane.a()==0 && plane.b()==0 && plane.c()==0 && plane.d()==0) +- std::cout << "ZERO a,b,c,d" << std::endl; +- (*plane_image)(i,j,0)=float(plane.a()); +- (*plane_image)(i,j,1)=float(plane.b()); +- (*plane_image)(i,j,2)=float(plane.c()); +- (*plane_image)(i,j,3)=float(plane.d()); +- } +- } +- } +- } +- else if (camera->type_name() == "vpgl_local_rational_camera") { +- auto* cam = dynamic_cast*>(camera.ptr()); +- for (unsigned i=0; i p1(col, row); +- +- float x = col + 0.5f*std::cos(theta); +- float y = row + 0.5f*std::sin(theta); +- vgl_point_2d p2(x,y); +- +- //backproject it +- vgl_plane_3d plane; +- if (vpgl_ray::plane_ray(*cam, p1, p2, plane)) { +- (*plane_image)(i,j,0)=float(plane.a()); +- (*plane_image)(i,j,1)=float(plane.b()); +- (*plane_image)(i,j,2)=float(plane.c()); +- (*plane_image)(i,j,3)=float(plane.d()); +- } +- else { // the backprojection was unsuccessful +- std::cout << i << ',' << j << "NO PLANE!!!!!" << std::endl; +- (*plane_image)(i,j,0) = 0.0f; +- (*plane_image)(i,j,1) = 0.0f; +- (*plane_image)(i,j,2) = 0.0f; +- (*plane_image)(i,j,3) = 0.0f; +- } +- } +- } +- } +- } +- else if (camera->type_name() == "vpgl_perspective_camera") { +- auto* cam = dynamic_cast*>(camera.ptr()); +- auto* proj_cam = static_cast*>(cam); +- for (unsigned i=0; i p1(col, row); +- +- float x = col + 0.5f*std::cos(theta); +- float y = row + 0.5f*std::sin(theta); +- vgl_point_2d p2(x,y); +- +- vgl_line_2d line(p1,p2); +- +- //create a line and backproject it +- vgl_homg_line_2d image_line(line); +- +- vgl_homg_plane_3d plane = proj_cam->backproject(image_line); +- if (plane.a()==0 && plane.b()==0 && plane.c()==0 && plane.d()==0) +- std::cout << "ZERO a,b,c,d" << std::endl; +- (*plane_image)(i,j,0)=float(plane.a()); +- (*plane_image)(i,j,1)=float(plane.b()); +- (*plane_image)(i,j,2)=float(plane.c()); +- (*plane_image)(i,j,3)=float(plane.d()); +- } +- } +- } +- } +- else { +- std::cerr << "boxm_line_backproject_process: The camera type [" << camera->type_name() << "]is not defined yet!\n"; +- return false; +- } +- } +- else { +- std::cerr << "boxm_line_backproject_process: This pixel format is not supported yet!\n"; +- return false; +- } +- // output +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, plane_image); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx +deleted file mode 100644 +index 3cdbcbe8e4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx ++++ /dev/null +@@ -1,102 +0,0 @@ +-//: +-// \file +-// \brief A process to perform linear combination of blocks in situ i.e block1 = s1*block1+ s2*block2 +-// \author Isabel Restrepo +-// \date 2-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace boxm_linear_combination_process_globals +-{ +- constexpr unsigned n_inputs_ = 7; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool boxm_linear_combination_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_linear_combination_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr" ; //scene1 +- input_types_[i++] = "boxm_scene_base_sptr" ; //scene2 +- input_types_[i++] = "float" ; //s1 +- input_types_[i++] = "float" ; //s2 +- input_types_[i++] = "int" ; //block index in x-dimension +- input_types_[i++] = "int" ; //block index in y-dimension +- input_types_[i++] = "int" ; //block index in z-dimension +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool boxm_linear_combination_process(bprb_func_process& pro) +-{ +- using namespace boxm_linear_combination_process_globals; +- +- //get inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_base1 = pro.get_input(i++); +- boxm_scene_base_sptr scene_base2 = pro.get_input(i++); +- auto s1 = pro.get_input(i++); +- auto s2 = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!(scene_base1 && scene_base2)) +- { +- std::cerr << "In boxm_linear_combination_process: Null input scene\n"; +- return false; +- } +- +- switch (scene_base1->appearence_model()) +- { +- case BOXM_FLOAT: +- { +- if (scene_base2->appearence_model()!= BOXM_FLOAT) +- { +- std::cerr << "In boxm_linear_combination_process, datatype not supported\n"; +- return false; +- } +- auto *scene1 = static_cast >*> (scene_base1.as_pointer()); +- auto *scene2 = static_cast >*> (scene_base2.as_pointer()); +- +- scene1->load_block(block_i,block_j,block_k); +- scene2->load_block(block_i,block_j,block_k); +- +- boxm_block > *block1 = scene1->get_block(block_i,block_j,block_k); +- boxm_block > *block2 = scene2->get_block(block_i,block_j,block_k); +- +- //The result is block1 = s1*block1+ s2*block2 +- boxm_linear_combination(block1, block2, s1, s2); +- +- //make sure to write the block back to disk +- scene1->write_active_block(); +- +- //clean memory +- scene1->unload_active_blocks(); +- scene2->unload_active_blocks(); +- +- break; +- } +- default: +- std::cerr << "In boxm_linear_combination_process: Invalid datatype\n"; +- return false; +- break; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx +deleted file mode 100644 +index 700f8bba5c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx ++++ /dev/null +@@ -1,90 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx +-#include +-//: +-// \file +-// \brief process that merges all gaussian mixtures in a boxm_scene into unimodal gaussians +-// +-// \author Isabel Restrepo +-// \date December 8, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +- +-#include +-#include +- +- +-namespace boxm_merge_mixtures_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: process takes 1 input and 1 output. +-// input[0]: The sample scene +-// output[0]: The appearance scene +- +-bool boxm_merge_mixtures_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_merge_mixtures_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_merge_mixtures_process(bprb_func_process& pro) +-{ +- using namespace boxm_merge_mixtures_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed +- typedef boxm_apm_traits::apm_datatype apm_datatype; +- typedef boct_tree mog_tree_type; +- +- typedef bsta_num_obs gauss_type; +- typedef boct_tree gauss_tree_type; +- +- auto *mog_scene = dynamic_cast* > (scene_base.as_pointer()); +- +- //check input's validity +- if (!mog_scene) { +- std::cout << " :-- Grid is not of valid type!\n"; +- return false; +- } +- +- //parameters of the output scene are the same as those of the input scene +- boxm_scene *gauss_scene = new boxm_scene(mog_scene->lvcs(), mog_scene->origin(), mog_scene->block_dim(), mog_scene->world_dim()); +- gauss_scene->set_paths(mog_scene->path(), "bsta_gauss_sf1"); +- gauss_scene->set_appearance_model(BSTA_GAUSS_F1); +- +- boxm_merge_mog merger; +- merger.kl_merge_scene( *mog_scene, *gauss_scene); +- gauss_scene->write_scene("gaussf1_scene.xml"); +- pro.set_output_val(0, gauss_scene); +- std::cout<<"Exiting" << std::endl; +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx +deleted file mode 100644 +index 6b3f53a79c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx ++++ /dev/null +@@ -1,119 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief Process to refine the block (octrees) of the scene +-// If there are some cells with big values they are spit into +-// new child cells; the data of the cell is copied to the +-// children's data. The purpose of this process is to elaborate +-// the octree at the areas where more details exist. +-// +-// \author Gamze Tunali +-// \date April 24, 2009 +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_refine_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_refine_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_refine_scene_process_globals; +- +- //process takes 3 inputs +- //input[0]: The scene +- //input[1]: The threshold for splitting +- //input[2]: bool for resetting the appearence model +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "float"; +- input_types_[2] = "bool"; +- +- //process has 1 output +- //output[0]: The number of leaf cells in the refined scene +- std::vector output_types_(n_outputs_); +- output_types_[0] = "int"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_refine_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_refine_scene_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_refine_scene_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene = pro.get_input(i++); +- auto thresh = pro.get_input(i++); +- bool reset = pro.get_input(i++); +- +- // check the input validity +- if (scene == nullptr) { +- std::cout << "boxm_refine_scene_process: scene is null, cannot run" << std::endl; +- return false; +- } +- +- unsigned int ncells = 0; +- +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- if (scene->multi_bin()) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- ncells = boxm_refine_scene >(*s, thresh, reset); +- } +- else { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- ncells = boxm_refine_scene >(*s, thresh, reset); +- } +- } +- else if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- if (scene->multi_bin()) { +- std::cout << "boxm_refine_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl; +- return false; +- } +- else { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- ncells = boxm_refine_scene >(*s, thresh, reset); +- } +- } +- else if (scene->appearence_model() == BOXM_APM_MOB_GREY) { +- if (scene->multi_bin()) { +- std::cout << "boxm_refine_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl; +- return false; +- } +- else { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- ncells = boxm_refine_scene >(*s, thresh, reset); +- } +- } +- else { +- std::cout << "boxm_refine_scene_process: undefined APM type" << std::endl; +- return false; +- } +- +- // set output +- pro.set_output_val(0,ncells); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx +deleted file mode 100644 +index 67086ac142..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx ++++ /dev/null +@@ -1,87 +0,0 @@ +-//: +-// \file +-// \brief A process to remove level 0 of the octrees +-// \author Isabel Restrepo +-// \date Nov 23 2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace boxm_remove_level0_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool boxm_remove_level0_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_remove_level0_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; //scene_in +- input_types_[1] = "vcl_string"; //block_prefix for scene out +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; //scene_out +- +- return pro.set_input_types(input_types_) +- && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool boxm_remove_level0_process(bprb_func_process& pro) +-{ +- using namespace boxm_remove_level0_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the number of inputs should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string block_pref = pro.get_input(1); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- if (auto *scene_in = dynamic_cast >* > (scene_base.as_pointer())) +- { +- //clone the input scene +- boxm_scene > *scene_out = new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), +- scene_in->world_dim(), scene_in->max_level(), scene_in->init_level(), +- scene_in->load_all_blocks(), scene_in->save_internal_nodes()); +- +- scene_out->set_paths(scene_in->path(), block_pref); +- scene_out->set_appearance_model(scene_in->appearence_model()); +- std::cout << "Cloning\n"; +- scene_in->clone_blocks(*scene_out); +- +- std::cout << "Restructuring\n"; +- boxm_remove_level_0_leaves(scene_out); +- std::cout << "Done\n"; +- +- //write the scene after the number of levels has been adjusted +- scene_out->set_octree_levels(scene_in->max_level() - 1, scene_in->init_level()); +- scene_out->write_scene(block_pref + ".xml"); +- +- pro.set_output_val(0, scene_out); +- return true; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx +deleted file mode 100644 +index c14dfbda09..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx ++++ /dev/null +@@ -1,149 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for obtaining roc curve from change detection results. +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-namespace boxm_render_expected_edge_vrml_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_render_expected_edge_vrml_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_edge_vrml_process_globals; +- +- // process takes 4 inputs and no output +- //input[0]: scene binary file +- //input[1]: the path for vrml file +- //input[2]: threshold +- //input[3]: s (to write every s cell) +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "float"; +- input_types_[3] = "int"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_render_expected_edge_vrml_process(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_edge_vrml_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cerr << pro.name() << ": The input number should be " << n_inputs_<< '\n'; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- //vpgl_camera_double_sptr camera = pro.get_input(i++); +- std::string path = pro.get_input(i++); +- auto threshold = pro.get_input(i++); +- int s = pro.get_input(i++); // FIXME - unused! +- +- std::ofstream stream(path.c_str()); +- +- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) +- { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- if (!scene) { +- std::cout << "boxm_render_expected_edge_process: the scene is not of expected type" << std::endl; +- return false; +- } +- bvrml_write::write_vrml_header(stream); +-#if 0 +- vgl_point_3d origin(0.0,0.0,0.0); +- vgl_vector_3d dirx(1,0,0); +- vgl_vector_3d diry(0,1,0); +- vgl_vector_3d dirz(0,0,1); +- bvrml_write::write_vrml_line(stream,origin,dirx,3,1,0,0); +- bvrml_write::write_vrml_line(stream,origin,diry,3,0,1,0); +- bvrml_write::write_vrml_line(stream,origin,dirz,3,0,0,1); +-#endif +- // for each block +- boxm_block_iterator iter(scene); +- iter.begin(); +- while (!iter.end()) +- { +- scene->load_block(iter.index()); +- boxm_block* block = *iter; +- type* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // iterate over cells +- for (auto cell : cells) +- { +- boxm_inf_line_sample data = cell->data(); +- vgl_infinite_line_3d line = data.line_; +- vgl_vector_2d x0(line.x0().x(), line.x0().y()); +- // TODO: revise with segment length +- if (!(line.x0().x()==0 && line.x0().y()==0)) { +- //if (data.num_obs_ > threshold) +- { +- vgl_point_3d p0,p1; +- vgl_box_3d bb = tree->cell_bounding_box(cell); +- // convert to line type (from float to double) +- vgl_vector_3d dir(line.direction().x(), line.direction().y(), line.direction().z()); +- +- vgl_infinite_line_3d dline(x0,dir); +- if (vgl_intersection(bb, dline, p0, p1)) { +- vgl_vector_3d dir(p1-p0); +- double length=dir.length(); +- dir/=length; +- std::cout< +-#include +-#include +-//: +-// \file +-// \brief Process to replace the appearance model for the whole scene by a constant appearance model +-// \author Vishal Jain +-// \date July 28, 2009 +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-void boxm_replace_constant_app(boxm_scene > > &scene, float mean); +- +-namespace boxm_replace_const_app_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_replace_const_app_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_replace_const_app_process_globals; +- +- //process takes 2 inputs and no output +- //input[0]: The scene +- //input[1]: mean value for appearance +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "float"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_replace_const_app_process(bprb_func_process& pro) +-{ +- using namespace boxm_replace_const_app_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_replace_const_app_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene = pro.get_input(i++); +- auto meanval = pro.get_input(i++); +- +- // check the input validity +- if (scene == nullptr) { +- std::cout << "boxm_replace_const_app_process: scene is null, cannot run" << std::endl; +- return false; +- } +- +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_replace_constant_app(*s,meanval ); +- } +- else { +- std::cout << "boxm_replace_const_app_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +- +-void boxm_replace_constant_app(boxm_scene > > &scene, float mean) +-{ +- boxm_block_iterator > > iter(&scene); +- boxm_apm_traits::apm_datatype app=boxm_utils::obtain_mog_grey_single_mode(mean); +- for (; !iter.end(); iter++) { +- scene.load_block(iter.index()); +- boxm_block > >* block = *iter; +- boct_tree >* tree = block->get_tree(); +- +- std::vector >*> leaf_cells=tree->leaf_cells(); +- for (auto & leaf_cell : leaf_cells) +- { +- boxm_sample new_data(leaf_cell->data().alpha,app); +- leaf_cell->set_data(new_data); +- } +- scene.write_active_block(); +- } +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx +deleted file mode 100644 +index ce50f795ba..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx ++++ /dev/null +@@ -1,195 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx +-#include +-//: +-// \file +-// \brief A class for clipping and image based on a 3D bounding box. +-// - Input: +-// - Image path (string) +-// - boxm_voxel_world_sptr +-// +-// - Output: +-// - modified rational camera "vpgl_camera_double_sptr" +-// - clipped image area (NITF) "vil_image_view_base_sptr" +-// +-// - Params: +-// -geographic uncertainty (error) in meters +-// +-// \author Copied from boxm/pro +-// \date May 5, 2008 +-// \verbatim +-// \endverbatim +- +-#include +-#include +- +-#include +-#include +-#include +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-//: globals variables and functions +-namespace boxm_roi_init_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 3; +- +- //functions +- bool roi_init(const std::string& img_path, +- const vpgl_camera_double_sptr& camera, +- vgl_box_3d box, +- vil_image_view & roi_img); +- +- //: projects the box on the image by taking the union of all the projected corners +- vgl_box_2d* project_box(const vpgl_camera_double_sptr& cam, +- vgl_box_3d box); +-} +- +-//: set input and output types +-bool boxm_roi_init_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_roi_init_process_globals; +- +- //this process takes 3 input: +- //the filename of the image, the camera and the voxel world +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++] = "vcl_string"; // image path +- input_types_[i++] = "vpgl_camera_double_sptr"; // camera +- input_types_[i++] = "boxm_scene_base_sptr"; // voxel world spec +- +- //output +- unsigned j = 0; +- std::vector output_types_(n_outputs_); +- output_types_[j++] = "vpgl_camera_double_sptr"; // unadjusted local rational camera +- output_types_[j++] = "vil_image_view_base_sptr"; // image ROI +- output_types_[j++] = "float"; // uncertainty +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-bool boxm_roi_init_process(bprb_func_process& pro) +-{ +- using namespace boxm_roi_init_process_globals; +- //static const parameters +- static const std::string error = "error"; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- // get the inputs: +- unsigned i = 0; +- // image +- std::string image_path = pro.get_input(i++); +- // camera +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- //voxel_world +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- vil_image_view_base_sptr img_ptr=vil_load(image_path.c_str()); +- auto *temp=new vil_image_view(); +- if (img_ptr->pixel_format()==VIL_PIXEL_FORMAT_BYTE) +- { +- if (auto *img=dynamic_cast * > (img_ptr.ptr())) +- { +- vgl_box_2d* roi_box = project_box(camera, scene->get_world_bbox()); +- brip_roi broi(img->ni(), img->nj()); +- vsol_box_2d_sptr bb = new vsol_box_2d(); +- bb->add_point(roi_box->min_x(), roi_box->min_y()); +- bb->add_point(roi_box->max_x(), roi_box->max_y()); +- bb = broi.clip_to_image_bounds(bb); +- if (bb->width() <= 0 || bb->height() <= 0) { +- std::cerr << "boxm_roi_init_process::roi_init()-- clipping box is out of image boundaries\n"; +- return false; +- } +- temp->set_size(int(bb->width()),int(bb->height())); +- temp->deep_copy(vil_crop(*img,(unsigned int)bb->get_min_x(), +- (unsigned int)bb->width(), +- (unsigned int)bb->get_min_y(), +- (unsigned int)bb->height())); +- } +- } +- if (temp->ni() == 0 || temp->nj() == 0) +- return false; +- +- //Store outputs +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, camera); +- // store image output +- pro.set_output_val(j++, temp); +- // store uncertainty +- pro.set_output_val(j++, 0); +- +- return true; +-} +- +-//: roi_init function +-bool boxm_roi_init_process_globals::roi_init(const std::string& img_path, +- const vpgl_camera_double_sptr& camera, +- vgl_box_3d box, +- vil_image_view & roi_img) +-{ +- vil_image_view_base_sptr img_ptr=vil_load(img_path.c_str()); +- if (img_ptr->pixel_format()==VIL_PIXEL_FORMAT_BYTE) +- { +- if (auto *img=dynamic_cast * > (img_ptr.ptr())) +- { +- vgl_box_2d* roi_box = project_box(camera, box); +- brip_roi broi(img->ni(), img->nj()); +- vsol_box_2d_sptr bb = new vsol_box_2d(); +- bb->add_point(roi_box->min_x(), roi_box->min_y()); +- bb->add_point(roi_box->max_x(), roi_box->max_y()); +- bb = broi.clip_to_image_bounds(bb); +- if (bb->width() <= 0 || bb->height() <= 0) { +- std::cerr << "boxm_roi_init_process::roi_init()-- clipping box is out of image boundaries\n"; +- return false; +- } +- +- vil_image_view temp=vil_crop(*img, +- (unsigned int)bb->get_min_x(), +- (unsigned int)bb->width(), +- (unsigned int)bb->get_min_y(), +- (unsigned int)bb->height()); +- roi_img=temp; +- return true; +- } +- else +- return false; +- } +- else // non-supported pixel format +- return false; +-} +- +-//: project_box function +-vgl_box_2d* boxm_roi_init_process_globals::project_box( const vpgl_camera_double_sptr& cam, +- vgl_box_3d box) +-{ +- // create a box with uncertainty +- std::vector > box_corners = boxm_utils::corners_of_box_3d(box); +- +- auto* roi = new vgl_box_2d(); +- +- for (auto & box_corner : box_corners) { +- double u,v; +- cam->project(box_corner.x(),box_corner.y(),box_corner.z(),u,v); +- vgl_point_2d p2d(u,v); +- std::cout<add(p2d); +- } +- return roi; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx +deleted file mode 100644 +index fbfe3b9704..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx ++++ /dev/null +@@ -1,310 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx +-#include +-//: +-// \file +-// \brief A class for clipping and image based on a 3D bounding box. +-// * Input: +-// - Image path (string) +-// - boxm_voxel_world_sptr +-// +-// * Output: +-// - modified rational camera "vpgl_camera_double_sptr" +-// - clipped image area (NITF) "vil_image_view_base_sptr" +-// +-// * Params: +-// - geographic uncertainty (error) in meters +-// +-// \author Copied from boxm/pro +-// \date May 5, 2008 +- +-#include +-#include +- +-#include +-#include +-#include +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-//: globals variables and functions +-namespace boxm_roi_init_rational_camera_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 3; +- +- // functions +- bool roi_init(std::string const& image_path, +- vpgl_rational_camera* camera, +- vgl_box_3d box, +- const vpgl_lvcs& lvcs, +- float uncertainty, +- vil_image_view* nitf_image_unsigned_char, +- vpgl_local_rational_camera& local_camera); +- +- //: projects the box on the image by taking the union of all the projected corners +- vgl_box_2d* project_box(vpgl_rational_camera* cam, +- vpgl_lvcs lvcs, +- vgl_box_3d box, +- float r); +-} +- +-//:set input and output types +-bool boxm_roi_init_rational_camera_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_roi_init_rational_camera_process_globals; +- +- //this process takes 3 input: +- //the filename of the image, the camera and the voxel world +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++] = "vcl_string"; // NITF image path +- input_types_[i++] = "vpgl_camera_double_sptr"; // rational camera +- input_types_[i++] = "boxm_scene_base_sptr"; // voxel world spec +- +- //output +- unsigned j = 0; +- std::vector output_types_(n_outputs_); +- output_types_[j++] = "vpgl_camera_double_sptr"; // unadjusted local rational camera +- output_types_[j++] = "vil_image_view_base_sptr"; // image ROI +- output_types_[j++] = "float"; // uncertainty +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-bool boxm_roi_init_rational_camera_process(bprb_func_process& pro) +-{ +- using namespace boxm_roi_init_rational_camera_process_globals; +- //static const parameters +- static const std::string error = "error"; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- // uncertainty (meters) -- SHOULD BE A PARAM +- float uncertainty=10.0; +- if ( !pro.parameters()->get_value(error, uncertainty) ) { +- std::cout << pro.name() << ": error in retrieving parameters\n"; +- return false; +- } +- +- // get the inputs: +- unsigned i = 0; +- // image +- std::string image_path = pro.get_input(i++); +- // camera +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- //voxel_world +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- auto* img_ptr = new vil_image_view(); +- auto* rat_camera = +- dynamic_cast*> (camera.as_pointer()); +- +- if (!rat_camera) { +- std::cerr << "The camera input is not a rational camera\n"; +- return false; +- } +- +- vpgl_local_rational_camera local_camera; +- if (scene->appearence_model() == BOXM_APM_MOG_GREY || +- scene->appearence_model() == BOXM_EDGE_FLOAT || +- scene->appearence_model() == BOXM_EDGE_LINE) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- +- if (!roi_init(image_path, rat_camera, s->get_world_bbox(),(s->lvcs()), uncertainty, img_ptr, local_camera)) { +- std::cerr << "The process has failed!\n"; +- return false; +- } +- +- if (img_ptr->ni() == 0 || img_ptr->nj() == 0) +- return false; +- +- //Store outputs +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, new vpgl_local_rational_camera (local_camera)); +- // store image output +- pro.set_output_val(j++, img_ptr); +- // store uncertainty +- pro.set_output_val(j++, uncertainty); +- } +- else { +- std::cout << "boxm_refine_scene_process: undefined APM type" << std::endl; +- return false; +- } +- return true; +-} +- +-//: roi_init function +-bool boxm_roi_init_rational_camera_process_globals::roi_init(std::string const& image_path, +- vpgl_rational_camera* camera, +- vgl_box_3d box, +- const vpgl_lvcs& lvcs, +- float uncertainty, +- vil_image_view* nitf_image_unsigned_char, +- vpgl_local_rational_camera& local_camera) +-{ +- // read the image and extract the camera +- vil_image_resource_sptr img = vil_load_image_resource(image_path.c_str()); +- std::string format = img->file_format(); +- std::string prefix = format.substr(0,4); +- if (prefix.compare("nitf") != 0) { +- std::cerr << "boxm_roi_init_rational_camera_process::execute - The image should be an NITF\n"; +- return false; +- } +- +- auto* nitf = static_cast (img.ptr()); +- +- vgl_box_2d* roi_box = project_box(camera, lvcs, box, uncertainty); +- +- brip_roi broi(nitf->ni(), nitf->nj()); +- vsol_box_2d_sptr bb = new vsol_box_2d(); +- bb->add_point(roi_box->min_x(), roi_box->min_y()); +- bb->add_point(roi_box->max_x(), roi_box->max_y()); +- bb = broi.clip_to_image_bounds(bb); +- +- if (bb->width() <= 0 || bb->height() <= 0) { +- std::cerr << "boxm_roi_init_rational_camera_process::roi_init()-- clipping box is out of image boundaries\n"; +- return false; +- } +- +- vil_image_view_base_sptr roi = nitf->get_copy_view((unsigned int)bb->get_min_x(), +- (unsigned int)bb->width(), +- (unsigned int)bb->get_min_y(), +- (unsigned int)bb->height()); +- if (!roi) { +- std::cerr << "boxm_roi_init_rational_camera_process::roi_init()-- clipping box is out of image boundaries\n"; +- return false; +- } +- +- if (!roi.as_pointer()) +- return false; +- +- if (roi->pixel_format() == VIL_PIXEL_FORMAT_UINT_16) +- { +- vil_image_view nitf_image_vxl_uint_16(roi); +- +- *nitf_image_unsigned_char = vil_image_view (roi->ni(),roi->nj(),roi->nplanes()); +- +- int bigendian = 0; +- { union { unsigned int i; char c[4]; } u; u.i = 1; bigendian = u.c[0] == 0; } +- for (unsigned m=0; mni(); ++m) +- { +- for (unsigned n=0; nnj(); ++n) +- { +- for (unsigned p=0; pnplanes(); ++p) +- { +- // we will ignore the most significant 5 bits and less significant 3 bits +- vxl_uint_16 curr_pixel_val = nitf_image_vxl_uint_16(m,n,p); +- +- if (bigendian) { +- auto* arr = (unsigned char*) &curr_pixel_val; +- // [defgh3][5abc] +- // --> [abcdefgh] +- unsigned char big = *arr; +- unsigned char small = *(++arr); +- big >>= 3; +- small <<= 5; +- curr_pixel_val = big || small; +- } +- else { // little endian +- // [5abc][defgh3] +- // --> [abcdefgh] +- curr_pixel_val <<= 5; +- // [defgh3][5abc] +- // --> [abcdefgh] +- curr_pixel_val >>= 8; +- } +- +- auto pixel_val = static_cast (curr_pixel_val); +- +-#if 0 +- //This is how Thom uses to get the region +- int temp_pix_val = int(int(curr_pixel_val)*255.0/1500.0); +- if (temp_pix_val > 255) +- temp_pix_val =255; +- unsigned char pixel_val = static_cast(temp_pix_val); +- //end hack +-#endif +- +- (*nitf_image_unsigned_char)(m,n,p) = pixel_val; +- } +- } +- } +- } +- else if (roi->pixel_format() == VIL_PIXEL_FORMAT_BYTE) { +- *nitf_image_unsigned_char = vil_image_view(roi); +- } +- else +- std::cout << "boxm_roi_init_rational_camera_process - Unsupported Pixel Format = " << roi->pixel_format() << std::endl; +- +- double u, v; +- camera->image_offset(u, v); +- double tu = u - roi_box->min_x(); +- double tv = v - roi_box->min_y(); +- camera->set_image_offset(tu, tv); +- local_camera = vpgl_local_rational_camera (lvcs, *camera); +- delete roi_box; +- +- return true; +-} +- +-//:project_box function +-vgl_box_2d*boxm_roi_init_rational_camera_process_globals::project_box( vpgl_rational_camera* cam, +- vpgl_lvcs lvcs, +- vgl_box_3d box, +- float r) +-{ +- double xoff, yoff, zoff; +- xoff = cam->offset(vpgl_rational_camera::X_INDX); +- yoff = cam->offset(vpgl_rational_camera::Y_INDX); +- zoff = cam->offset(vpgl_rational_camera::Z_INDX); +- +- // global to local +- double lx, ly, lz; +- lvcs.global_to_local(xoff, yoff, zoff, vpgl_lvcs::wgs84, lx, ly, lz, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- double center[3]; +- center[0] = lx; +- center[1] = ly; +- center[2] = lz; +- +- // create a box with uncertainty +- vgl_box_3d cam_box(center, 2*r, 2*r, 2*r, vgl_box_3d::centre); +- std::vector > cam_corners = boxm_utils::corners_of_box_3d(cam_box); +- std::vector > box_corners = boxm_utils::corners_of_box_3d(box); +- auto* roi = new vgl_box_2d(); +- +- double lon, lat, gz; +- for (auto cam_corner : cam_corners) { +- lvcs.local_to_global(cam_corner.x(), cam_corner.y(), cam_corner.z(), +- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vpgl_rational_camera* new_cam = cam->clone(); +- new_cam->set_offset(vpgl_rational_camera::X_INDX, lon); +- new_cam->set_offset(vpgl_rational_camera::Y_INDX, lat); +- new_cam->set_offset(vpgl_rational_camera::Z_INDX, gz); +- +- // project the box +- for (auto & box_corner : box_corners) { +- // convert the box corners to world coordinates +- lvcs.local_to_global(box_corner.x(), box_corner.y(), box_corner.z(), +- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_2d p2d = new_cam->project(vgl_point_3d(lon, lat, gz)); +- roi->add(p2d); +- } +- } +- return roi; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx +deleted file mode 100644 +index 8c8b260f04..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx ++++ /dev/null +@@ -1,229 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for writing the occupancy probability of scenes to drishti raw files +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// Sep 11, 2009 Gamze Tunali +-// Added scene writing option, input number is increased to 4 and if 4th +-// input is 0, blocks saved as raw files separately, if 1, then blocks +-// combined to generate 1 raw file for the whole scene +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_save_occupancy_raw_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_save_occupancy_raw_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_save_occupancy_raw_process_globals; +- +- // process takes 4 inputs but has no outputs +- //input[0]: scene binary file +- //input[1]: output file (raw) path +- //input[2]: the resolution level wanted.. 0 is the most detailed (lowest possible level) +- //input[3]: 0 for writing blocks individually, 1 for writing the scene into one file +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_save_occupancy_raw_process(bprb_func_process& pro) +-{ +- using namespace boxm_save_occupancy_raw_process_globals; +- +- if ( pro.n_inputs() < n_inputs_) { +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- std::string filepath = pro.get_input(i++); +- auto resolution = pro.get_input(i++); +- auto whole = pro.get_input(i++); +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) +- { +- if (scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- if (!whole) { +- boxm_block_iterator it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- } +- else +- { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- if (!whole) { +- boxm_block_iterator it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- if (!whole) { +- boxm_block_iterator it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- } +- else if ( auto *scene= dynamic_cast > * >(scene_ptr.as_pointer())) { +- if (!whole) { +- boxm_block_iterator > it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw(*scene, filepath + ".raw", resolution); +- } +- } +- else if (scene_ptr->appearence_model() == BSTA_MOG_F1){ +- if (!whole) { +- typedef boct_tree::apm_datatype > tree_type; +- auto *scene = dynamic_cast* > (scene_ptr.as_pointer()); +- boxm_block_iterator it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw::apm_datatype >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- //boxm_save_scene_raw::apm_datatype >(*scene, filepath + ".raw", resolution); +- } +- } +- else if ( auto *scene= dynamic_cast > > * >(scene_ptr.as_pointer())) { +- if (!whole) { +- boxm_block_iterator > > it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- if (!whole) { +- boxm_block_iterator it(scene); +- it.begin(); +- while (!it.end()) { +- std::stringstream strm; +- vgl_point_3d index = it.index(); +- strm << index.x() << '_' << index.y() << '_' << index.z(); +- std::string str(strm.str()); +- std::string s = filepath + str + ".raw"; +- boxm_save_block_raw >(*scene, it.index(), s, resolution); +- it++; +- } +- } +- else { // write the whole scene +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- else if (scene_ptr->appearence_model() == BOXM_SCALAR_FLOAT) { +- typedef boct_tree > type; +- auto* scene = static_cast*>(scene_ptr.as_pointer()); +- boxm_save_scene_raw >(*scene, filepath + ".raw", resolution); +- } +- else { +- std::cout << "boxm_save_occupancy_raw_process: undefined APM type" << std::endl; +- return false; +- } +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx +deleted file mode 100644 +index 5f4d68c008..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx ++++ /dev/null +@@ -1,140 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for writing general scenes to drishti raw files. Values in voxels are saved as they are +-// +-// \author Isabel Restrepo +-// \date Feb 17, 2011 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +- +-namespace boxm_save_scene_raw_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_save_scene_raw_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_save_scene_raw_process_globals; +- +- // process takes 4 inputs but has no outputs +- //input[0]: scene binary file +- //input[1]: output file (raw) path +- //input[2]: the resolution level wanted.. 0 is the most detailed (lowest possible level) +- //input[3]: 0 for writing blocks individually, 1 for writing the scene into one file +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_save_scene_raw_process(bprb_func_process& pro) +-{ +- using namespace boxm_save_scene_raw_process_globals; +- +- if ( pro.n_inputs() < n_inputs_) { +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- std::string filepath = pro.get_input(i++); +- auto resolution = pro.get_input(i++); +- auto whole = pro.get_input(i++); +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_FLOAT) +- { +- if (scene_ptr->multi_bin()) +- { +- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl; +- return false; +- } +- else +- { +- typedef boct_tree type; +- auto* scene = dynamic_cast*>(scene_ptr.as_pointer()); +- if(!scene) +- return false; +- if (!whole) { +- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl; +- return false; +- } +- else { // write the whole scene +- boxm_save_scene_raw_general_to_byte(*scene, filepath + ".raw", resolution); +- } +- } +- } +- // check the scene's app model +- else if (scene_ptr->appearence_model() == BOXM_CHAR) +- { +- if (scene_ptr->multi_bin()) +- { +- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl; +- return false; +- } +- else +- { +- typedef boct_tree type; +- auto* scene = dynamic_cast*>(scene_ptr.as_pointer()); +- if(!scene) +- return false; +- if (!whole) { +- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl; +- return false; +- } +- else { // write the whole scene +- boxm_save_scene_raw_general(*scene, filepath + ".raw", resolution); +- } +- } +- } +- // check the scene's app model +- else if (scene_ptr->appearence_model() == BOXM_BOOL) +- { +- if (scene_ptr->multi_bin()) +- { +- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl; +- return false; +- } +- else +- { +- typedef boct_tree type; +- auto* scene = dynamic_cast*>(scene_ptr.as_pointer()); +- if(!scene) +- return false; +- if (!whole) { +- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl; +- return false; +- } +- else { // write the whole scene +- boxm_save_scene_raw_general(*scene, filepath + ".raw", resolution); +- } +- } +- } +- else { +- std::cout << "boxm_save_scene_raw_process: undefined APM type" << std::endl; +- return false; +- } +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx +deleted file mode 100644 +index d5b044d0db..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx ++++ /dev/null +@@ -1,97 +0,0 @@ +-// This is brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx +-//: +-// \file +-// \brief process that splits a boxm_scene of boxm samples into an appearance and occupancy scene +-// +-// \author Isabel Restrepo +-// \date December 3, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +-#include +- +- +-namespace boxm_split_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 2; +-} +- +-//: process takes 1 input and two outputs. +-// input[0]: The sample scene +-// output[0]: The appearance scene +-// output[1]: The alpha scene +- +-bool boxm_split_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_split_scene_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- output_types_[1] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_split_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_split_scene_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- //: Note initial implementation is for fixed types, but this can be changed if more cases are needed +- +- typedef boct_tree > sample_tree_type; +- +- typedef boxm_apm_traits::apm_datatype apm_datatype; +- typedef boct_tree apm_tree_type; +- +- typedef boxm_apm_traits::obs_mathtype alpha_type; +- typedef boct_tree alpha_tree_type; +- +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- +- // parameters of the output scene are the same as those of the input scene +- boxm_scene *apm_scene = new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), +- scene_in->max_level(), scene_in->init_level()); +- apm_scene->set_paths(scene_in->path(), "apm_mog_grey"); +- apm_scene->set_appearance_model(BSTA_MOG_F1); +- boxm_scene *alpha_scene = new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), +- scene_in->max_level(), scene_in->init_level()); +- alpha_scene->set_paths(scene_in->path(), "alpha"); +- alpha_scene->set_appearance_model(BOXM_FLOAT); +- boxm_split_sample splitter; +- +- splitter.split_scene( *scene_in, *apm_scene, *alpha_scene); +- +- apm_scene->write_scene("apm_scene.xml"); +- alpha_scene->write_scene("/alpha_scene.xml"); +- +- pro.set_output_val(0, apm_scene); +- pro.set_output_val(1, alpha_scene); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt +deleted file mode 100644 +index 2c499a1c2f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( boxm_algo_pro_test_include test_include.cxx ) +-target_link_libraries( boxm_algo_pro_test_include boxm_algo_pro) +diff --git a/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx +deleted file mode 100644 +index 8ee327ed5f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt +deleted file mode 100644 +index 6140bcbb4a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt ++++ /dev/null +@@ -1,46 +0,0 @@ +-# brl/bseg/boxm/algo/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_algo_rt_sources +- boxm_change_probability_functor.h +- boxm_edge_tangent_updater.h boxm_edge_tangent_updater.hxx +- boxm_edge_updater.h boxm_edge_updater.hxx +- boxm_generate_edge_sample_functor.h +- boxm_generate_edge_tangent_sample_functor.h +- boxm_generate_opt2_sample_functor.h +- boxm_generate_opt3_sample_functor.h +- boxm_generate_opt_sample_functor.h +- boxm_opt2_optimizer.h boxm_opt2_optimizer.hxx +- boxm_opt3_optimizer.h boxm_opt3_optimizer.hxx +- boxm_opt_appearance_estimator.h +- boxm_opt_rt_bayesian_optimizer.h boxm_opt_rt_bayesian_optimizer.hxx +- boxm_pre_infinity_functor.h +- boxm_render_expected_depth_functor.h +- boxm_render_expected_edge_image_functor.h +- boxm_render_expected_edge_tangent_image_functor.h +- boxm_render_expected_image_functor.h +- boxm_render_expected_shadow_image_functor.h +- boxm_rpc_registration.h +- boxm_sun_vis_prob_functor.h +- boxm_update_image_functor.h +- boxm_compute_num_rays_statistics.h +- boxm_expected_edge_functor.h +- boxm_shadow_appearance_estimator.h +- boxm_generate_shadow_sample_functor.h +- boxm_shadow_app_initializer.h boxm_shadow_app_initializer.hxx +- boxm_shadow_bayes_optimizer.h boxm_shadow_bayes_optimizer.hxx +- dummy.cxx +- ) +- +-aux_source_directory(Templates boxm_algo_rt_sources) +- +-vxl_add_library(LIBRARY_NAME boxm_algo_rt LIBRARY_SOURCES ${boxm_algo_rt_sources}) +- +-#processes +-add_subdirectory(pro) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-target_link_libraries(boxm_algo_rt boxm boxm_sample boxm_sample_algo boxm_basic boxm_util ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vgl_algo bsta ${VXL_LIB_PREFIX}vnl sdet brip ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ) +- +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx +deleted file mode 100644 +index ef11ac6b96..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +- +-BOXM_EDGE_TANGENT_UPDATER_INSTANTIATE(short,float,float); +-BOXM_EDGE_TANGENT_REFINE_UPDATES_INSTANTIATE(short,float,float); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx +deleted file mode 100644 +index 8d4e1a9f37..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_EDGE_UPDATER_INSTANTIATE(short,float,float); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx +deleted file mode 100644 +index ca43ee5ebf..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT2_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_AUX_OPT2_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx +deleted file mode 100644 +index fc93c9b10a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT2_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT2_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx +deleted file mode 100644 +index a9b24b175b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT3_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_APM_MOG_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx +deleted file mode 100644 +index 318336e55b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT3_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY, BOXM_APM_MOG_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx +deleted file mode 100644 +index 89f46b6393..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT_RT_BAYESIAN_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_AUX_OPT_RT_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx +deleted file mode 100644 +index 0c8a2da7d1..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT_RT_BAYESIAN_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx +deleted file mode 100644 +index 1cc6084872..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +-#include +-BOXM_SHADOW_APP_INITIALIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx +deleted file mode 100644 +index 8a9638f4b1..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +-#include +-BOXM_SHADOW_BAYES_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY); +diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx +deleted file mode 100644 +index 71036d42a6..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +- +-typedef boxm_inf_line_sample sample; +-typedef boxm_expected_edge_functor functor; +-BPGL_CAMERA_ESTIMATOR_INSTANTIATE(functor); +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h +deleted file mode 100644 +index 5700690341..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h ++++ /dev/null +@@ -1,100 +0,0 @@ +-#ifndef boxm_change_3d_functor_h +-#define boxm_change_3d_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-class boxm_change_3d_functor +-{ +- public: +- //: "default" constructor +- boxm_change_3d_functor(vil_image_view const& change_image, float prob_ratio) +- : change_image_(change_image), +- vis_img_(change_image.ni(),change_image.nj(), 1), +- alpha_integral_(change_image.ni(),change_image.nj(), 1), +- prob_ratio_(prob_ratio) +- { +- vis_img_.fill(1.0f); +- alpha_integral_.fill(0.0f); +- +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample& cell_value, boxm_scalar_sample& scalar) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- +- // update segment length sum +- scalar.seg_len_ += seg_len; +- +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- +- float back_prob = change_image_(i,j); +- float fore_prob = 1.0f/(1.0f + prob_ratio_*back_prob); +- +- // set change prob in auxiliary voxel +- scalar.scalar_sum_ += Omega * fore_prob * seg_len; +- +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view change_image_; +- vil_image_view alpha_integral_; +- vil_image_view vis_img_; +- float prob_ratio_; +-}; +- +-template +-void boxm_change_3d(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &change_image, +- std::string chng_name, +- float prob_ratio) +-{ +- typedef boxm_scalar_sample sample_datatype; +- boxm_aux_scene aux_scene(&scene,chng_name, boxm_aux_scene::CLONE); +- +- std::cout<<"Chng visibility"< change_functor; +- +- // set up the raytrace function +- boxm_raytrace_function raytracer_chng(scene,aux_scene,cam.ptr(),change_image.ni(),change_image.nj()); +- +- // construct the change probability functor +- change_functor chng_func(change_image, prob_ratio); +- +- // run the functor over the octree +- raytracer_chng.run(chng_func); +- +- std::cout<<"Change 3-d Done."< +-#include +-#include +-#include +-#include +-#include +- +-template +-class boxm_change_probability_functor +-{ +- public: +- //: "default" constructor +- boxm_change_probability_functor(vil_image_view::obs_datatype> const & image, vil_image_view::obs_datatype> &change_prob, +- vil_image_view &mask_vis, +- unsigned int ni,unsigned nj, +- bool scene_read_only=false,bool is_aux=true) +- : image_(image), change_prob_(change_prob), vis_img_(mask_vis), alpha_integral_(ni,nj, 1) +- { +- alpha_integral_.fill(0.0f); +- typename boxm_apm_traits::obs_datatype nil(0); +- change_prob_.fill(nil); +- vis_img_.fill(1.0f); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, +- T_aux /*aux_val*/) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- const float prob_den = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), image_(i,j)); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update expected image +- change_prob_(i,j) += prob_den* Omega; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- +- return true; +- } +- +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> const& image_; +- vil_image_view::obs_datatype> &change_prob_; +- vil_image_view &vis_img_; +- vil_image_view alpha_integral_; +-}; +- +- +-template +-void boxm_change_prob_rt(boxm_scene > &scene, +- vil_image_view const& image, +- vpgl_camera_double_sptr cam, +- vil_image_view &change_prob, +- vil_image_view & mask, +- int /*bin*/ = -1, +- bool /*use_black_background*/ = false) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::LOAD); +- typedef boxm_change_probability_functor > chng_functor; +- boxm_raytrace_function > raytracer(scene,aux_scene,cam.ptr(),change_prob.ni(),change_prob.nj()); +- chng_functor functor(image, change_prob,mask,change_prob.ni(),change_prob.nj(),true,false); +- raytracer.run(functor); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h b/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h +deleted file mode 100644 +index 144d5bd7bf..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h ++++ /dev/null +@@ -1,65 +0,0 @@ +-#ifndef boxm_compute_num_rays_statistics_h +-#define boxm_compute_num_rays_statistics_h +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-template +-bool compute_ray_statistics(boxm_scene >& scene, +- vpgl_camera_double_sptr cam, +- bsta_histogram& num_rays_hist, +- unsigned ni, unsigned nj) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::CLONE); +- +- typedef boxm_num_rays_functor > functor_type; +- boxm_raytrace_function > raytracer(scene,aux_scene,cam.ptr(),ni,nj); +- functor_type num_rays_functor; +- raytracer.run(num_rays_functor); +- +- typedef boct_tree tree_type; +- +- typedef boct_tree > aux_tree_type; +- typedef boct_tree_cell > aux_cell_type; +- +- num_rays_hist = bsta_histogram(0.0f, 80.0f, 40); +- boxm_block_iterator bit = scene.iterator(); +- float avg_rays=0; +- float num_cells=0; +- for (; !bit.end(); ++bit) +- { +- vgl_point_3d block_index = bit.index(); +- //aux_scene.load_block(block_index); +- boxm_block * block = aux_scene.get_block(block_index); +- aux_tree_type* tree=block->get_tree(); +- if (!tree) return false; +- std::vector leaves = tree->leaf_cells(); +- for (typename std::vector::iterator cit = leaves.begin(); cit != leaves.end(); ++cit) +- { +- boxm_scalar_sample data = (*cit)->data(); +- num_rays_hist.upcount(static_cast(data.scalar_sum_), 1.0f); +- avg_rays+=data.scalar_sum_; +- num_cells++; +- } +- } +- +- //aux_scene.clean_scene(); +- std::cout<<"Avg num of rays per cell "< +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +- +-template +-boxm_edge_tangent_updater::boxm_edge_tangent_updater(boxm_scene > > &scene, +- std::vector image_ids, +- bool use_ransac, +- float ransac_ortho_thres, +- float ransac_volume_ratio, +- int ransac_concensus_cnt) +-: image_ids_(std::move(image_ids)), use_ransac_(use_ransac), ransac_ortho_thres_(ransac_ortho_thres), ransac_volume_ratio_(ransac_volume_ratio), ransac_consensus_cnt_(ransac_concensus_cnt), scene_(scene) +-{} +- +- +-template +-bool boxm_edge_tangent_updater::add_cells() +-{ +- // get auxiliary scenes associated with each input image +- +- typedef boct_tree > tree_type; +- +- std::vector, boxm_edge_tangent_sample > > aux_scenes; +- for (unsigned int i=0; i, boxm_edge_tangent_sample > +- aux_scene(&scene_,image_ids_[i],boxm_aux_scene, +- boxm_edge_tangent_sample >::LOAD, BOXM_EDGE_TANGENT_LINE); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- int nums=0; +- // get a vector of incremental readers for each aux scene. +- std::vector > *> aux_readers(aux_scenes.size()); +- std::vector aux_samples_num(aux_scenes.size()); +- for (unsigned int i=0; i>a; +- // iterate over cells +- for (unsigned i=0; i >* cell = cells[i]; +- // initialize the cell +- boxm_inf_line_sample data(vgl_infinite_line_3d(vgl_vector_2d(0,0),vgl_vector_3d(1,1,1))); +- cell->set_data(data); +- +- for (unsigned j=0; j > temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().num_obs()>0) +- { +- aux_samples.push_back(temp_cell.data()); +- //aux_samples_num[j]++; +- } +- } +- +- if (aux_samples.size() > 1) +- { +- std::vector > planes; +- std::vector weights; +- +- for (unsigned int k=0;k s = aux_samples[k]; +- for (unsigned int j=0; j obs = s.obs(j); +- weights.push_back(obs.seg_len_); +- vgl_plane_3d plane(obs.plane_); +- planes.push_back(plane); +- } +- } +- nums+=planes.size(); +- if (planes.size() > 1) { +- if (use_ransac_) { +- vgl_infinite_line_3d line; +- float residual=1e5; +- vgl_box_3d bb = tree->cell_bounding_box(cell); +- +- // ransac_consensus_cnt_ used to be hard-coded here to 5; made it into a parameter with a default value of 3 +- if (boxm_plane_ransac(aux_samples, weights, line, residual,bb, ransac_consensus_cnt_, ransac_ortho_thres_, ransac_volume_ratio_)) { +- boxm_inf_line_sample data(line,aux_samples.size()); +- data.residual_=residual; +- +- // now set the clipped line +- // convert to type double +- vgl_vector_2d x0(line.x0().x(), line.x0().y()); +- vgl_point_3d p0,p1; +- vgl_vector_3d dir(line.direction().x(), line.direction().y(), line.direction().z()); +- vgl_infinite_line_3d dline(x0,dir); +- if (!vgl_intersection(bb, dline, p0, p1)) +- data.residual_=0; +- else { +- // convert back to type AUX +- vgl_point_3d p0_t(AUX(p0.x()), AUX(p0.y()), AUX(p0.z())); +- vgl_point_3d p1_t(AUX(p1.x()), AUX(p1.y()), AUX(p1.z())); +- vgl_line_3d_2_points line_clipped(p0_t,p1_t); +- data.line_clipped_ = line_clipped; +- } +- +- cell->set_data(data); +- } +- else +- { +- boxm_inf_line_sample sample(vgl_infinite_line_3d(vgl_vector_2d(-10000,-10000),vgl_vector_3d(0,0,1))); +- cell->set_data(sample); +- } +- } +- else +- { +- boxm_inf_line_sample sample(vgl_infinite_line_3d(vgl_vector_2d(-10000,-10000),vgl_vector_3d(0,0,1))); +- cell->set_data(sample); +- } +- } +- else +- { +- boxm_inf_line_sample sample(vgl_infinite_line_3d(vgl_vector_2d(-10000,-10000),vgl_vector_3d(0,0,1))); +- cell->set_data(sample); +- } +- } +- else +- { +- boxm_inf_line_sample sample(vgl_infinite_line_3d(vgl_vector_2d(-10000,-10000),vgl_vector_3d(0,0,1))); +- cell->set_data(sample); +- } +- } +- nums/=cells.size(); +- +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +-#ifdef DEBUG +- std::cout << "done with all cells" << std::endl; +-#endif +-#if 0 +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +-boxm_edge_tangent_refine_updates::boxm_edge_tangent_refine_updates(boxm_scene > > &scene, +- int consensus_cnt, +- std::vector > edge_images, +- std::vector cameras) +-: edge_images_(std::move(edge_images)), cameras_(std::move(cameras)), consensus_cnt_(consensus_cnt), scene_(scene) +-{} +- +-template +-bool boxm_edge_tangent_refine_updates::refine_cells() +-{ +- std::cout << "using " << edge_images_.size() << " images to refine edge world!" << std::endl; +- +- typedef boct_tree > tree_type; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // iterate over cells +- for (unsigned i=0; i >* cell = cells[i]; +- boxm_inf_line_sample cell_value = cell->data(); +- +- // update residual of cell_value based on the visibility and support of this 3D line in all the images +- if (cell_value.residual_<1.0) +- { +- // go through each image +- int cnt = 0; +- for (unsigned k = 0; k < edge_images_.size(); k++) { +- int ni = edge_images_[k].ni(); +- int nj = edge_images_[k].nj(); +- // project this 3D line to the image +- double u1,v1,u2,v2; +- vgl_point_3d p1=cell_value.line_clipped_.point1(); +- vgl_point_3d p2=cell_value.line_clipped_.point2(); +- cameras_[k]->project(p1.x(),p1.y(),p1.z(),u1,v1); +- cameras_[k]->project(p2.x(),p2.y(),p2.z(),u2,v2); +- +- double line_angle = vnl_math::angle_0_to_2pi(std::atan2(v2-v1, -(u2-u1))); +- double line_angle2 = vnl_math::angle_0_to_2pi(line_angle + vnl_math::pi); // line segment is symmetric +- +- // find mid point of line seg +- int cent_i = int(u1+(u2-u1)/2.0); +- int cent_j = int(v1+(v2-v1)/2.0); +- +- // check a neighborhood of 10x10 in the image to find the edgel that is nearest to this line segment +- double angle_of_min = 0.0; +- double dist = 10.0; +- for (int ii = cent_i - 10; ii < cent_i + 10; ii++) { +- if (ii < 0 || ii >= ni) continue; +- for (int jj = cent_j - 10; jj < cent_j + 10; jj++) { +- if (jj < 0 || jj >= nj) continue; +- double ex = edge_images_[k](ii,jj,0); +- double ey = edge_images_[k](ii,jj,1); +- double dir = edge_images_[k](ii,jj,2); +- double dist_to_seg = vgl_distance_to_linesegment(u1, v1, u2, v2, ex, ey); +- if (dist_to_seg < dist) { +- dist = dist_to_seg; +- angle_of_min = dir; +- } +- } +- } +- if (dist < 10.0) +- if (std::abs(angle_of_min - line_angle) < vnl_math::pi/16.0 || std::abs(angle_of_min - line_angle2) < vnl_math::pi/16.0) +- cnt++; +- } +- +- if (cnt >= consensus_cnt_) +- cell_value.residual_ = AUX(1.0)-AUX(cnt)/AUX(edge_images_.size()); +- else +- cell_value.residual_ = AUX(1.0); +- cell->set_data(cell_value); +- } +- } +- scene_.write_active_block(); +- iter++; +- } +- +- return true; +-} +- +- +-#define BOXM_EDGE_TANGENT_UPDATER_INSTANTIATE(T1,T2,T3) \ +-template class boxm_edge_tangent_updater +- +-#define BOXM_EDGE_TANGENT_REFINE_UPDATES_INSTANTIATE(T1,T2,T3) \ +-template class boxm_edge_tangent_refine_updates +- +-#endif // boxm_edge_tangent_updater_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h +deleted file mode 100644 +index 646f92a418..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h ++++ /dev/null +@@ -1,34 +0,0 @@ +-#ifndef boxm_edge_updater_h_ +-#define boxm_edge_updater_h_ +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_edge_updater +-{ +- public: +- boxm_edge_updater(boxm_scene > > &scene, +- std::vector image_ids); +- +- ~boxm_edge_updater()= default; +- +- bool add_cells(); +- +- protected: +- std::vector image_ids_; +- +- boxm_scene > > &scene_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx +deleted file mode 100644 +index 029f503587..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx ++++ /dev/null +@@ -1,110 +0,0 @@ +-#ifndef boxm_edge_updater_hxx_ +-#define boxm_edge_updater_hxx_ +- +-#include +-#include +-#include +-#include +-#include "boxm_edge_updater.h" +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_edge_updater::boxm_edge_updater(boxm_scene > > &scene, +- std::vector image_ids) +-: image_ids_(std::move(image_ids)), scene_(scene) +-{} +- +- +-template +-bool boxm_edge_updater::add_cells() +-{ +- // get auxiliary scenes associated with each input image +- //typedef typename boxm_aux_traits::sample_datatype AUX; +- +- typedef boct_tree > tree_type; +- +- std::vector, boxm_aux_edge_sample > > aux_scenes; +- for (unsigned int i=0; i, boxm_aux_edge_sample > aux_scene(&scene_,image_ids_[i],boxm_aux_scene, boxm_aux_edge_sample >::LOAD); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector > *> aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_edge_sample data = cell->data(); +- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl; +- for (unsigned j=0; j > temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().seg_len_ > 0.0f) { +- aux_samples.push_back(temp_cell.data()); +- } +- } +- +- //std::vector > obs_vector(aux_samples.size()); +- for (unsigned int s=0; sset_data(data); +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +-#ifdef DEBUG +- std::cout << "done with all cells" << std::endl; +-#endif +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +- +-#endif // boxm_edge_updater_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h +deleted file mode 100644 +index b0d443ca27..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h ++++ /dev/null +@@ -1,53 +0,0 @@ +-#ifndef boxm_expected_edge_functor_h_ +-#define boxm_expected_edge_functor_h_ +-//: +-// \file +-#include +-#include +- +-#include +-#include +-#include +- +-#include +- +-//: Functor class to compute (1-x) +-// assumes that max range value is "1" +-// only sensible for real types +-class boxm_exp_edge_vil_not_functor +-{ +- public: +- float operator()(float x) const { return x<1.0f?(1.0f-x):0.0f; } +- double operator()(double x) const { return x<1.0?1.0-x:0.0; } +-}; +- +-template +-class boxm_expected_edge_functor +-{ +- public: +- boxm_expected_edge_functor(boxm_scene > &scene) +- : scene_(scene) {} +- ~boxm_expected_edge_functor() = default; +- +- bool apply(const vpgl_camera_double_sptr& cam, vil_image_view *img_eei) +- { +- boxm_render_edge_tangent_image_rt(scene_,cam,*img_eei); +- // now take the inverse of this image, pixels which contain edges will have values closer to 1 and others will be zero +- boxm_exp_edge_vil_not_functor nt; +- vil_transform(*img_eei, nt); +- +- // now blur this image +- *img_eei = brip_vil_float_ops::gaussian(*img_eei, 1.0f); +- +- return true; +- } +- +- private: +- boxm_scene > scene_; +-}; +- +-#undef BOXM_EXPECTED_EDGE_INSTANTIATE +-#define BOXM_EXPECTED_EDGE_INSTANTIATE(T1,T2) \ +-template class boxm_expected_edge_functor +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h +deleted file mode 100644 +index 756c0ca4a6..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h ++++ /dev/null +@@ -1,65 +0,0 @@ +-#ifndef boxm_generate_edge_sample_functor_h +-#define boxm_generate_edge_sample_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_generate_edge_sample_functor +-{ +- public: +- boxm_generate_edge_sample_functor(vil_image_view &observation, +- unsigned int /*ni*/=0,unsigned /*nj*/=0) +- : obs_(observation) +- { +- scene_read_only_=true; +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- T &cell_value, // FIXME: unused... +- T_aux &aux_val) +- { +- const float seg_len = (float)(s1 - s0).length(); +- aux_val.obs_ += obs_(i,j) * seg_len; +- aux_val.seg_len_ += seg_len; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view &obs_; +-}; +- +-template +-void boxm_generate_edge_sample_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname) +-{ +- typedef boxm_aux_edge_sample aux_datatype; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE); +- typedef boxm_generate_edge_sample_functor,aux_datatype> func; +- boxm_raytrace_function raytracer(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cerr << "PROCESSING EDGE IMAGE\n"; +- func functor(obs,obs.ni(),obs.nj()); +- raytracer.run(functor); +- +- //aux_scene.clean_scene(); +- std::cerr << "DONE.\n"; +-} +- +-#endif // boxm_generate_edge_sample_functor_h +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h +deleted file mode 100644 +index 009e75228c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h ++++ /dev/null +@@ -1,78 +0,0 @@ +-#ifndef boxm_generate_edge_tangent_sample_functor_h +-#define boxm_generate_edge_tangent_sample_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_generate_edge_tangent_sample_functor +-{ +- public: +- boxm_generate_edge_tangent_sample_functor(vil_image_view &observation, +- unsigned int /*ni*/=0, unsigned /*nj*/=0) +- : obs_(observation) +- { +- scene_read_only_=true; +- is_aux_=true; +- // make sure that the image has 4 planes ((a,b,c,d) params of a plane ax+by+cz=d ) +- if (observation.nplanes() != 4) +- std::cerr << "boxm_generate_edge_tangent_sample_functor: the image does not have 4 planes\n"; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- T &cell_value, // FIXME - unused +- T_aux &aux_val) +- { +- const float seg_len = (float)(s1 - s0).length(); +- float a = obs_(i,j,0); +- float b = obs_(i,j,1); +- float c = obs_(i,j,2); +- float d = obs_(i,j,3); +- +- if (a||b||c||d) { +- vgl_homg_plane_3d p(a,b,c,d); +- boxm_plane_obs observation(p,seg_len); +- aux_val.insert(observation); +- } +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view &obs_; +-}; +- +-template +-void boxm_generate_edge_tangent_sample_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname) +-{ +- typedef boxm_edge_tangent_sample aux_datatype; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE, BOXM_EDGE_TANGENT_LINE); +- typedef boxm_generate_edge_tangent_sample_functor,aux_datatype> func; +- boxm_raytrace_function raytracer(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cerr << "PROCESSING EDGE IMAGE\n"; +- func functor(obs,obs.ni(),obs.nj()); +- raytracer.run(functor); +- //aux_scene.clean_scene(); +- std::cerr << "DONE.\n"; +-} +- +-#endif // boxm_generate_edge_tangent_sample_functor_h +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h +deleted file mode 100644 +index 5cbaef86fc..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h ++++ /dev/null +@@ -1,197 +0,0 @@ +-#ifndef boxm_generate_opt2_sample_functor_h +-#define boxm_generate_opt2_sample_functor_h +-//: +-// \file +-#include +-#include "boxm_pre_infinity_functor.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-class boxm_generate_opt2_sample_functor_pass_2 +-{ +- public: +- //: "default" constructor +- boxm_generate_opt2_sample_functor_pass_2(vil_image_view::obs_datatype> const& image, +- vil_image_view const& beta_denom, +- float model_prior, +- vil_image_view const& alt_prob_img) +- : scene_read_only_(true) /*only reads info from the scene*/, is_aux_(true) /*needs to write aux*/, +- model_prior_(model_prior), alt_prob_img_(alt_prob_img), obs_(image), beta_denom_(beta_denom), +- vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1) +- { +- vis_img_.fill(1.0f); +- pre_img_.fill(0.0f); +- alpha_integral_.fill(0.0f); +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- float mean_obs = aux_val.obs_/aux_val.seg_len_; +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), mean_obs); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // grab this cell's pre and vis value +- const float pre = pre_img_(i,j); +- const float vis = vis_img_(i,j); +- // compute weight for this cell +- const float Omega = vis - vis_prob_end; +- +- // update vis and pre +- pre_img_(i,j) += PI * Omega; +- vis_img_(i,j) = vis_prob_end; +- // accumulate aux sample values +- aux_val.pre_ += (pre * model_prior_ + alt_prob_img_(i,j)) * seg_len; +- aux_val.vis_ += vis * model_prior_ * seg_len; +- +- const float beta_num = pre + vis*PI; +- const float beta_num_expanded = (beta_num * model_prior_) + alt_prob_img_(i,j); +- const float beta_denom = beta_denom_(i,j); +- const float beta_denom_expanded = (beta_denom * model_prior_) + alt_prob_img_(i,j); +- +- float beta = 1.0f; +- if (beta_denom_expanded > 1e-5f) { +- beta = beta_num_expanded / beta_denom_expanded; +- } +- const float old_PQ = (float)(1.0 - std::exp(-cell_value.alpha*seg_len)); +- const float new_PQ = old_PQ * beta; +- const float pass_prob_old = 1.0f - old_PQ; +- float pass_prob = 1.0f - new_PQ; +- +- // compute expected information gained from update +- const float weight = new_PQ * std::log(new_PQ / old_PQ) + pass_prob * std::log(pass_prob / pass_prob_old); +- // ensure log doesn't go to infinity +- if (pass_prob < 1e-5f) { +- pass_prob = 1e-5f; +- } +- aux_val.log_pass_prob_sum_ += std::log(pass_prob) * weight/seg_len; +- aux_val.weighted_seg_len_sum_ += weight; // += seg_len * weight/seg_len; +- +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- float model_prior_; +- vil_image_view const& alt_prob_img_; +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view const& beta_denom_; +- +- //vil_image_view const& pre_inf_; +- vil_image_view vis_img_; +- vil_image_view pre_img_; +- vil_image_view alpha_integral_; +-}; +- +-template +-void boxm_generate_opt2_samples(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname, +- std::vector const& alt_appearance_priors, +- std::vector const& alt_appearance_models, +- bool black_background = false) +-{ +- typedef typename boxm_aux_traits::sample_datatype sample_datatype; +- //std::cout << "scene.save_platform_independent() = " << scene.save_platform_independent() << std::endl; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE); +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 0"< pre_inf(obs.ni(),obs.nj(),1); +- vil_image_view vis_inf(obs.ni(),obs.nj(),1); +- vil_image_view inf_term(obs.ni(), obs.nj()); +- +- typedef boxm_pre_infinity_functor pass_1; +- boxm_raytrace_function raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 1"< gauss_type; +- typename T_data::obs_mathtype black(0); +- const float black_std_dev = 8.0f/255; +- const gauss_type appearance_dist(black, black_std_dev*black_std_dev); +- +- //float peak=T_data::apm_processor::expected_color(background_apm); +- //std::cout<<"Peak: "< PI_inf(obs.ni(), obs.nj(),1); +- typename vil_image_view::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator PI_it = PI_inf.begin(); +- for (; img_it != obs.end(); ++img_it, ++PI_it) { +- *PI_it = appearance_dist.prob_density(*img_it); +- } +- vil_math_image_product(vis_inf,PI_inf,inf_term); +- } +- else { +- // assume uniform prob. density on interval [0, 1] +- //PI_inf.fill(1.0f); +- // don't actually have to compute anything since multiplying by 1 +- inf_term = vis_inf; +- } +- vil_image_view beta_denom_img(obs.ni(), obs.nj()); +- vil_math_image_sum(pre_inf,inf_term,beta_denom_img); +- +- // compute model prior +- float model_prior = 1.0f; +- for (float alt_appearance_prior : alt_appearance_priors) { +- model_prior -= alt_appearance_prior; +- } +- // sanity check +- if (model_prior <= 0.0f) { +- std::cerr << "error: boxm_generate_opt2_samples : alt_appearance_priors sum to " << 1.0f - model_prior << " >= 1.0!\n"; +- } +- +- // compute alternate appearance probability for each pixel in the image +- vil_image_view alt_prob_img(obs.ni(), obs.nj()); +- alt_prob_img.fill(0.0f); +- const unsigned int n_alt = alt_appearance_priors.size(); +- if (n_alt > 0) { +- typename vil_image_view::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator alt_prob_it = alt_prob_img.begin(); +- for (; img_it != obs.end(); ++img_it, ++alt_prob_it) { +- for (unsigned int a=0; a< n_alt; ++a) { +- const float alt_prob_density = boxm_apm_traits::apm_processor::prob_density(alt_appearance_models[a],*img_it); +- *alt_prob_it += alt_prob_density * alt_appearance_priors[a]; +- } +- } +- } +- +- // run the raytrace function +- std::cout<<"PASS 2"< pass_2; +- boxm_raytrace_function raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- pass_2 pass_2_functor(obs,beta_denom_img, model_prior, alt_prob_img); +- raytracer_2.run(pass_2_functor); +- +- //aux_scene.clean_scene(); +- std::cout<<"DONE."< +-#include "boxm_pre_infinity_functor.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-class pre_inf_functor +-{ +- typedef typename boxm_aux_traits::sample_datatype aux_null_t; +- public: +- //: "default" constructor +- pre_inf_functor(vil_image_view::obs_datatype> const& image, +- vil_image_view &pre_inf, vil_image_view &vis_inf) +- : alpha_integral_(image.ni(),image.nj(),1), obs_(image), vis_img_(vis_inf), pre_img_(pre_inf) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //no need to write aux +- is_aux_=false; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, aux_null_t & /*aux_val*/) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(),obs_(i,j)); // aux_val.PI_; +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update pre +- pre_img_(i,j) += PI * Omega; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- vil_image_view alpha_integral_; +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view &vis_img_; +- vil_image_view &pre_img_; +-}; +- +- +-template +-class boxm_generate_opt3_sample_functor +-{ +- public: +- //: "default" constructor +- boxm_generate_opt3_sample_functor(vil_image_view::obs_datatype> const& image, +- vil_image_view const& beta_denom) +- : obs_(image), beta_denom_(beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux &aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), obs_(i,j)); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = (float)std::exp(-alpha_integral_(i,j)); +- // grab this cell's pre and vis value +- const float pre = pre_img_(i,j); +- const float vis = vis_img_(i,j); +- // compute weight for this cell +- const float Omega = vis - vis_prob_end; +- +- // update vis and pre +- pre_img_(i,j) += PI * Omega; +- vis_img_(i,j) = vis_prob_end; +- +- // update observation distribution +- aux_val.update_obs_dist(obs_(i,j),vis); +- aux_val.weighted_vis_sum_ += vis*seg_len; +- +- const float old_PQ = 1.0f - (float)std::exp(-cell_value.alpha * seg_len); +- float new_PQ = old_PQ; +- const float beta_denom_val = beta_denom_(i,j); +- const double epsilon = 1e-6; +- if (beta_denom_val > epsilon) { +- const float beta = (pre + vis*PI) / beta_denom_val; +- new_PQ = old_PQ * beta; +- } +- double pass_prob = 1.0 - new_PQ; +- if (pass_prob < epsilon) { +- pass_prob = epsilon; +- } +- aux_val.log_pass_prob_sum_ += (float)std::log(pass_prob); +- aux_val.seg_len_sum_ += seg_len; +- +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view const& beta_denom_; +- +- vil_image_view vis_img_; +- vil_image_view pre_img_; +- vil_image_view alpha_integral_; +-}; +- +-template +-void boxm_generate_opt3_sample(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string image_id, +- bool black_background = false) +-{ +- typedef boxm_opt3_sample::APM_TYPE> aux_sample_datatype; +- boxm_aux_scene aux_scene(&scene, image_id, boxm_aux_scene::CLONE); +-#if 0 +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 0"< pre_inf(obs.ni(),obs.nj(),1); +- vil_image_view vis_inf(obs.ni(),obs.nj(),1); +- +- typedef pre_inf_functor pre_inf_functor_t; +- boxm_raytrace_function raytracer_1(scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 1"< inf_term(obs.ni(), obs.nj()); +- vil_image_view beta_denom_img(obs.ni(), obs.nj()); +- +- // compute observation probability for "infinity" appearance model +- vil_image_view PI_inf(obs.ni(), obs.nj(),1); +- if (black_background) { +- std::cout << "using black background model" << std::endl; +- // use single-mode gaussian centered at 0 +- typedef bsta_gaussian_sphere gauss_type; +- typename T_data::obs_mathtype black(0); +- const float black_std_dev = 8.0f/255; +- const gauss_type appearance_dist(black, black_std_dev); +-#if 0 +- float peak=T_data::apm_processor::expected_color(background_apm); +- std::cout<<"Peak: "<::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator PI_it = PI_inf.begin(); +- for (; img_it != obs.end(); ++img_it, ++PI_it) { +- *PI_it = appearance_dist.prob_density(*img_it); +- } +- vil_math_image_product(vis_inf,PI_inf,inf_term); +- } +- else { +- // assume uniform prob. density on interval [0, 1] +- //PI_inf.fill(1.0f); +- // don't actually have to compute anything since multiplying by 1 +- inf_term = vis_inf; +- } +- vil_math_image_sum(pre_inf,inf_term,beta_denom_img); +- +-#ifdef DEBUG +- vil_save(vis_inf, "E:/tests/capitol/vis_inf.tiff"); +- vil_save(pre_inf, "E:/tests/capitol/pre_inf.tiff"); +- vil_save(beta_denom_img, "E:/tests/capitol/beta_denom_img.tiff"); +- vil_save(pass_1_functor.alpha_integral_, "E:/tests/capitol/alpha_integr.tiff"); +-#endif +- +- std::cout<<"PASS 2"< pass_2_functor_t; +- boxm_raytrace_function raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- pass_2_functor_t pass_2_functor(obs, beta_denom_img); +- raytracer_2.run(pass_2_functor); +-#if 0 +- aux_scene.clean_scene(); +-#endif +- std::cout<<"DONE."< +-#include "boxm_pre_infinity_functor.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-class boxm_generate_opt_sample_functor_pass_2 +-{ +- public: +- //: "default" constructor +- boxm_generate_opt_sample_functor_pass_2(vil_image_view::obs_datatype> const& image, +- vil_image_view const& Beta_denom) +- : obs_(image), Beta_denom_(Beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- float mean_obs= aux_val.obs_/aux_val.seg_len_; +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), mean_obs); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // grab this cell's pre and vis value +- const float pre = pre_img_(i,j); +- const float vis = vis_img_(i,j); +- // compute weight for this cell +- const float Omega = vis - vis_prob_end; +- +- // update vis and pre +- pre_img_(i,j) += PI * Omega; +- vis_img_(i,j) = vis_prob_end; +- // accumulate aux sample values +- aux_val.pre_ += pre * seg_len; +- aux_val.vis_ += vis * seg_len; +- +- const float Beta_num = pre + vis*PI; +- float Beta = 1.0f; +- if (Beta_denom_(i,j) < 1e-6) { +- if (Beta_num > 1e-5) { +- Beta = 10.0f; +- } +- } +- else { +- Beta = Beta_num / Beta_denom_(i,j); +- } +- if (Beta < 0) { +- if (Beta < -1e-5) { +- std::cerr << " error: beta = " << Beta << " setting to 0. " << '\n'; +- } +- Beta = 0; +- } +- aux_val.Beta_ += Beta * seg_len; +- //aux_val.seg_len_ += seg_len; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view const& Beta_denom_; +- +- vil_image_view vis_img_; +- vil_image_view pre_img_; +- vil_image_view alpha_integral_; +-}; +- +-template +-void boxm_generate_opt_sample_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname, +- bool black_background = false) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE); +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 0"< pre_inf(obs.ni(),obs.nj(),1); +- vil_image_view vis_inf(obs.ni(),obs.nj(),1); +- +- typedef boxm_pre_infinity_functor pass_1; +- boxm_raytrace_function raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 1"< PI_inf(obs.ni(), obs.nj(),1); +- +- +- if (black_background) { +- std::cout << "using black background model" << std::endl; +- typename T_data::obs_datatype black(0.0f); +- float background_std_dev = 8.0f/255; // ???????????? 4/255 Vishal's +- typename T_data::apm_datatype background_apm(black, background_std_dev*background_std_dev,1.0f); +- +- float peak=T_data::apm_processor::expected_color(background_apm); +- std::cout<<"Peak: "<::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator PI_it = PI_inf.begin(); +- for (; img_it != obs.end(); ++img_it, ++PI_it) { +- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it); +- } +- } +- else { +- PI_inf.fill(1.0f); +- } +- +- vil_image_view inf_term(obs.ni(), obs.nj()); +- vil_math_image_product(vis_inf,PI_inf,inf_term); +- vil_image_view Beta_denom_img(obs.ni(), obs.nj()); +- vil_math_image_sum(pre_inf,inf_term,Beta_denom_img); +-#ifdef DEBUG +- vil_save(vis_inf, "E:/tests/capitol/vis_inf.tiff"); +- vil_save(pre_inf, "E:/tests/capitol/pre_inf.tiff"); +- vil_save(Beta_denom_img, "E:/tests/capitol/Beta_denom_img.tiff"); +- vil_save(pass_1_functor.alpha_integral_, "E:/tests/capitol/alpha_integr.tiff"); +-#endif +- std::cout<<"PASS 2"< pass_2; +- boxm_raytrace_function raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- pass_2 pass_2_functor(obs,Beta_denom_img); +- raytracer_2.run(pass_2_functor); +- +-#if 0 +- aux_scene.clean_scene(); +-#endif +- std::cout<<"DONE."< +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_generate_shadow_sample_functor_pass_2 +-{ +- public: +- //: "default" constructor +- boxm_generate_shadow_sample_functor_pass_2(vil_image_view::obs_datatype> const& image, +- vil_image_view const& Beta_denom, float shadow_prior, vil_image_view const& shadow_density) +- : obs_(image), Beta_denom_(Beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1), shadow_prior_(shadow_prior), shadow_density_(shadow_density) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- float mean_obs= aux_val.obs_/aux_val.seg_len_; +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), mean_obs); +- // update alpha integral +- float alpha_l = cell_value.alpha * seg_len; //change +- alpha_integral_(i,j) += alpha_l; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // grab this cell's pre and vis value +- const float pre = pre_img_(i,j); +- const float vis = vis_img_(i,j); +- // compute weight for this cell +- const float Omega = vis - vis_prob_end; +- +- // update vis and pre +- pre_img_(i,j) += PI * Omega; +- vis_img_(i,j) = vis_prob_end; +- // accumulate aux sample values +- aux_val.pre_ += pre * seg_len; +- aux_val.vis_ += vis * seg_len; //< 1e-5) { +- Beta = 10.0f; +- } +- } +- else { +- Beta = Beta_num / Beta_denom_(i,j); +- } +- if (Beta < 0) { +- if (Beta < -1e-5) { +- std::cerr << " error: beta = " << Beta << " setting to 0.\n"; +- } +- Beta = 0; +- } +-#if 0 +- if (mean_obs == 0.0f){ +- std::cout << PI << ' ' << shadow_density_(i,j) << ' ' +- << pre << ' ' << vis << ' ' << Beta_denom_(i,j) +- << ' ' << Beta << '\n'; +- } +-#endif +- aux_val.Beta_ += Beta * seg_len; +- //New discrete probability computations +- float PQ_prior = 1.0f - std::exp(-alpha_l); +- float PQ_post = Beta*PQ_prior; +- if (PQ_post>=0.999f) PQ_post = 0.999f; +- // v------note minus sign +- float lg = -std::log(1.0f-PQ_post); +- aux_val.log_sum_ += lg; +- //End of new discrete probability calculations +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- float shadow_prior_; +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view const& Beta_denom_; +- +- //vil_image_view const& pre_inf_; +- vil_image_view vis_img_; +- vil_image_view pre_img_; +- vil_image_view alpha_integral_; +- vil_image_view shadow_density_; +-}; +- +-template +-void boxm_initial_shadow_sampler_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE); +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"Collect Observations"< +-void boxm_generate_shadow_sample_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- std::string iname, +- float shadow_prior, +- float shadow_mean, +- float shadow_sigma, +- bool black_background = false) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene aux_scene(&scene,iname, boxm_aux_scene::CLONE); +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 0"< pre_inf(obs.ni(),obs.nj(),1); +- vil_image_view vis_inf(obs.ni(),obs.nj(),1); +- +- typedef boxm_pre_infinity_functor pass_1; +- boxm_raytrace_function raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cout<<"PASS 1"< PI_inf(obs.ni(), obs.nj(),1); +- +- +- if (black_background) { +- std::cout << "using black background model" << std::endl; +- typename T_data::obs_datatype black(0.0f); +- float background_std_dev = 8.0f/255;//???????????? 4/255 Vishal's +- typename T_data::apm_datatype background_apm(black, background_std_dev,1.0f); +- +- float peak=T_data::apm_processor::expected_color(background_apm); +- std::cout<<"Peak: "<::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator PI_it = PI_inf.begin(); +- for (; img_it != obs.end(); ++img_it, ++PI_it) { +- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it); +- } +- } +- else { +- PI_inf.fill(1.0f); +- } +- +- vil_image_view inf_term(obs.ni(), obs.nj()); +- vil_math_image_product(vis_inf,PI_inf,inf_term); +- vil_image_view Beta_denom_img(obs.ni(), obs.nj()); +- vil_math_image_sum(pre_inf,inf_term,Beta_denom_img); +- +- boxm_simple_grey shadow_dist(shadow_mean, shadow_sigma); +- vil_image_view shadow_density(obs.ni(), obs.nj()); +- for (unsigned j=0; j pass_2; +- boxm_raytrace_function raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- pass_2 pass_2_functor(obs,Beta_denom_img, shadow_prior, shadow_density); +- raytracer_2.run(pass_2_functor); +- +- //aux_scene.clean_scene(); +- std::cout<<"DONE."< +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_opt2_optimizer +-{ +- public: +- boxm_opt2_optimizer(boxm_scene > > &scene, +- std::vector image_ids); +- +- ~boxm_opt2_optimizer()= default; +- +- bool update(); +- +- protected: +- std::vector image_ids_; +- +- boxm_scene > > &scene_; +- +- const float max_cell_P_; +- const float min_cell_P_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx +deleted file mode 100644 +index ae00724692..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx ++++ /dev/null +@@ -1,152 +0,0 @@ +-#ifndef boxm_opt2_optimizer_hxx_ +-#define boxm_opt2_optimizer_hxx_ +- +-#include +-#include +-#include +-#include +-#include "boxm_opt2_optimizer.h" +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-template +-boxm_opt2_optimizer::boxm_opt2_optimizer(boxm_scene > > &scene, +- std::vector image_ids) +- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f) +-{} +- +- +-template +-bool boxm_opt2_optimizer::update() +-{ +- // get auxiliary scenes associated with each input image +- typedef typename boxm_aux_traits::sample_datatype aux_type; +- +- typedef boct_tree > tree_type; +- +- std::vector, aux_type> > aux_scenes; +- for (unsigned int i=0; i, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene, aux_type>::LOAD, APM); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector::obs_datatype> > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector* > aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_sample data = cell->data(); +- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl; +- for (unsigned j=0; j temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- //boxm_opt_sample::obs_datatype> aux_cell = temp_cell.data(); +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().seg_len_ > 0.0f) { +- aux_samples.push_back(temp_cell.data()); +- } +- } +- std::vector pre_vector; +- std::vector vis_vector; +- std::vector::obs_datatype> obs_vector; +- +- // UPDATE METHOD #1 : "OR" of occlusion probabilities +- double log_pass_prob_sum = 0.0; +- double weighted_seg_len_sum = 0.0; +- for (unsigned int s=0; s 1e-6) { +- if (obs_weighted_seg_len > 1e-6) { +- log_pass_prob_sum += aux_samples[s].log_pass_prob_sum_; +- weighted_seg_len_sum += obs_weighted_seg_len; +- } +- // add observation and vis,pre to list +- obs_vector.push_back(aux_samples[s].obs_ / obs_seg_len); +- pre_vector.push_back(aux_samples[s].pre_ / obs_seg_len); +- vis_vector.push_back(aux_samples[s].vis_ / obs_seg_len); +- } +- } +- // update the occlusion density +- if (weighted_seg_len_sum > 1e-6) { +- data.alpha = (float)(-log_pass_prob_sum / weighted_seg_len_sum); +- } +- +- // do bounds check on new alpha value +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- const float cell_len = float(cell_bb.width()); +- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len; +- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len; +- if (data.alpha > max_alpha) { +- data.alpha = max_alpha; +- } +- if (data.alpha < min_alpha) { +- data.alpha = min_alpha; +- } +- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){ +- std::cerr << "\nerror: data.alpha = " << data.alpha << '\n'; +- //std::cerr << " log_alpha_sum = " << log_alpha_sum << ", n_actual_samples = " << n_actual_samples << '\n'; +- } +- // update with new appearance +- const float min_sigma = 0.02f; +- boxm_apm_traits::apm_processor::compute_appearance(obs_vector, pre_vector, vis_vector, data.appearance_, min_sigma); +- +- //std::cout << "cell OUT " << data.alpha << data.appearence_ << std::endl << std::endl; +- cell->set_data(data); +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +-#ifdef DEBUG +- std::cout << "done with all cells" << std::endl; +-#endif +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +- +-#endif // boxm_opt2_optimizer_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h +deleted file mode 100644 +index d19ab2d9f4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h ++++ /dev/null +@@ -1,37 +0,0 @@ +-#ifndef boxm_opt3_optimizer_h_ +-#define boxm_opt3_optimizer_h_ +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_opt3_optimizer +-{ +- public: +- boxm_opt3_optimizer(boxm_scene > > &scene, +- std::vector image_ids); +- +- ~boxm_opt3_optimizer()= default; +- +- bool optimize_cells(); +- +- protected: +- std::vector image_ids_; +- +- boxm_scene > > &scene_; +- +- const float max_cell_P_; +- const float min_cell_P_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx +deleted file mode 100644 +index da5f7ba0fb..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx ++++ /dev/null +@@ -1,172 +0,0 @@ +-#ifndef boxm_opt3_optimizer_hxx_ +-#define boxm_opt3_optimizer_hxx_ +- +-#include +-#include +-#include +-#include +-#include "boxm_opt3_optimizer.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_opt3_optimizer::boxm_opt3_optimizer(boxm_scene > > &scene, +- std::vector image_ids) +- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f) +-{} +- +- +-template +-bool boxm_opt3_optimizer::optimize_cells() +-{ +- constexpr unsigned int n_samples_per_obs = 10; +- +- // get auxiliary scenes associated with each input image +- typedef boxm_opt3_sample aux_type; +- +- typedef boct_tree > tree_type; +- +- typedef typename boxm_apm_traits::obs_datatype obs_t; +- +- std::vector, aux_type> > aux_scenes; +- for (unsigned int i=0; i, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene, aux_type>::LOAD, APM); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector vis_vector; +- std::vector obs_vector; +- vnl_random rand_gen; +- std::vector > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector* > aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_sample data = cell->data(); +- +- for (unsigned j=0; j temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- //boxm_opt_sample::obs_datatype> aux_cell = temp_cell.data(); +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- aux_samples.push_back(temp_cell.data()); +- } +- +- vis_vector.clear(); +- obs_vector.clear(); +- +- double log_alpha_sum = 0.0; +- unsigned int n_actual_observations = 0; +- +- for (unsigned int s=0; s 1e-6) { +- ++n_actual_observations; +- // compute mean vis +- float obs_vis = (float)(aux_samples[s].weighted_vis_sum_ / total_seg_len); +- // draw samples from obs_dist +- +- for (unsigned int n=0; n::apm_processor::sample(aux_samples[s].obs_dist_, rand_gen); +- //obs_t obs_sample = boxm_apm_traits::apm_processor::expected_color(aux_samples[s].obs_dist_); +- obs_vector.push_back(obs_sample); +- vis_vector.push_back(obs_vis); +- } +- double alpha_s = -aux_samples[s].log_pass_prob_sum_ / total_seg_len; +- log_alpha_sum += std::log(alpha_s); +- } +- } +- float alpha_new = 0.0f; +- if (n_actual_observations > 0) { +- //std::cout << "cell IN " << data.alpha << ' ' << data.appearance_<< std::endl; +- // compute new alpha value +- alpha_new = (float)std::exp(log_alpha_sum / n_actual_observations); +- +- // do bounds check on new alpha value +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- const float cell_len = float(cell_bb.width()); +- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len; +- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len; +- if (alpha_new > max_alpha) { +- alpha_new = max_alpha; +- } +- if (alpha_new < min_alpha) { +- alpha_new = min_alpha; +- } +- if (!((alpha_new >= min_alpha) && (alpha_new <= max_alpha)) ){ +- std::cerr << std::endl << "error: alpha_new = " << alpha_new << '\n' +- << "n_actual_observations = " << n_actual_observations << " log_alpha_sum = " << log_alpha_sum << '\n'; +- alpha_new = min_alpha; +- } +- else { +- data.alpha = alpha_new; +- } +- // update with new appearance +- //std::cout << obs_vector.size() << ' ' << std::endl; +- if (obs_vector.size() != n_samples_per_obs * n_actual_observations) { +- std::cerr << "error: n_samples_per_obs = " << n_samples_per_obs << " n_actual_observations = " << n_actual_observations << " obs_vector.size() " << obs_vector.size() << '\n'; +- } +- boxm_apm_traits::apm_processor::compute_appearance(obs_vector, vis_vector, data.appearance_, 0.025f); +- //std::cout << "cell OUT " << data.alpha << data.appearance_ << std::endl << std::endl; +- cell->set_data(data); +- } +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +-#ifdef DEBUG +- std::cout << "done with all cells" << std::endl; +-#endif +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +- +-#endif // boxm_opt3_optimizer_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h +deleted file mode 100644 +index c6f87c3817..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h ++++ /dev/null +@@ -1,85 +0,0 @@ +-#ifndef boxm_opt_appearance_estimator_h_ +-#define boxm_opt_appearance_estimator_h_ +- +-#include +-#include +-#include +-#include +-#include +-#if 0 +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-template +-void boxm_opt_compute_appearance(std::vector::obs_datatype> const& obs, +- std::vector const& pre, +- std::vector const& vis, +- typename boxm_apm_traits::apm_datatype &model) +-{ +- const float min_sigma=0.1f; +- // initialize appearance model estimate using visibility probabilities as weights. +- boxm_apm_traits::apm_processor::compute_appearance(obs,vis,model,min_sigma); +-#if 1 +- // use EM to refine estimate until convergence. +- unsigned int nobs= obs.size(); +- if (nobs == 0) { +- // nothing to do. +- return; +- } +- std::vector obs_weights = vis; +- +- const float epsilon = 1e-4f; +- constexpr unsigned int max_its = 100; +- const float min_weight_change = 1e-5f; +- for (unsigned int i=0; i::apm_processor::prob_density(model,obs[n]); +- const float P2 = 0.0f; //post_prob[n]; +- const float P3 = pre[n]; +- const float normalizing_factor = P1 + P2 + P3; +- float new_obs_weight = 0; +- if (normalizing_factor > epsilon) { +- new_obs_weight = P1 / normalizing_factor; +- } +- +- // compute delta weight for convergence check +- float weight_delta = std::fabs(obs_weights[n] - new_obs_weight); +- if (weight_delta > max_weight_change) { +- max_weight_change = weight_delta; +- } +- obs_weights[n] = new_obs_weight; +- } +- // check for convergence +- if (max_weight_change < min_weight_change) { +-#if 0 +- if (nobs > 1) { +- std::cout << "EM converged in " << i << " iterations." << std::endl; +- float total_prob = 0.0f; +- for (unsigned int n=0; n +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_opt_rt_bayesian_optimizer::boxm_opt_rt_bayesian_optimizer(boxm_scene > > &scene, +- std::vector image_ids) +-: image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f) +-{} +- +- +-template +-bool boxm_opt_rt_bayesian_optimizer::optimize_cells(double damping_factor) +-{ +- // get auxiliary scenes associated with each input image +- typedef typename boxm_aux_traits::sample_datatype aux_type; +- +- typedef boct_tree > tree_type; +- +- std::vector, aux_type> > aux_scenes; +- for (unsigned int i=0; i, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene, aux_type>::LOAD, APM); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector::obs_datatype> > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector* > aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_sample data = cell->data(); +- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl; +- for (unsigned j=0; j temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- //boxm_opt_sample::obs_datatype> aux_cell = temp_cell.data(); +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().seg_len_ > 0.0f) { +- aux_samples.push_back(temp_cell.data()); +- } +- } +- +- //boxm_sample &cell_data = cell_it->data(); +- std::vector pre_vector(aux_samples.size()); +- std::vector vis_vector(aux_samples.size()); +- //std::vector post_prob_vector(aux_samples.size()); +- std::vector::obs_datatype> obs_vector(aux_samples.size()); +- double Beta = 1.0; +- for (unsigned int s=0; s 1e-5) { +- Beta *= (aux_samples[s].Beta_ / seg_len); +- obs_vector[s] = aux_samples[s].obs_ / seg_len; +- pre_vector[s] = aux_samples[s].pre_ / seg_len; +- vis_vector[s] = aux_samples[s].vis_ / seg_len; +- //post_prob_vector[s] = aux_samples[s].post_prob_ / seg_len; +- } +- else { +- pre_vector[s] = 0.0f; +- vis_vector[s] = 0.0f; +- //post_prob_vector[s] = 0.0f; +- obs_vector[s] = typename boxm_apm_traits::obs_datatype(0); +- } +- } +- double damped_Beta = (Beta + damping_factor)/(damping_factor*Beta + 1.0); +- +- if ((damped_Beta < 0.00000001) && (damped_Beta > -0.00000001)) +- std::cout << "ERROR: damped_Beta is:" << damped_Beta << std::endl; +- +- data.alpha *= (float)damped_Beta; +- // do bounds check on new alpha value +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- const float cell_len = float(cell_bb.width()); +- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len; +- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len; +- if (data.alpha > max_alpha) { +- data.alpha = max_alpha; +- } +- if (data.alpha < min_alpha) { +- data.alpha = min_alpha; +- } +- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){ +- std::cerr << "\nerror: data.alpha = " << data.alpha << '\n' +- << "damped_Beta = " << damped_Beta << '\n'; +- } +- // update with new appearance +- boxm_opt_compute_appearance(obs_vector, pre_vector, vis_vector, data.appearance_); +- //std::cout << "cell OUT " << data.alpha << data.appearence_ << std::endl << std::endl; +- cell->set_data(data); +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +-#ifdef DEBUG +- std::cout << "done with all cells" << std::endl; +-#endif +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +- +-#endif // boxm_opt_rt_bayesian_optimizer_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h +deleted file mode 100644 +index 0d50efd8a4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h ++++ /dev/null +@@ -1,67 +0,0 @@ +-#ifndef boxm_pre_infinity_functor_h +-#define boxm_pre_infinity_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_pre_infinity_functor +-{ +- public: +- //: "default" constructor +- boxm_pre_infinity_functor(vil_image_view::obs_datatype> const& image, +- vil_image_view &pre_inf, vil_image_view &vis_inf) +- : alpha_integral_(image.ni(),image.nj(),1), obs_(image), vis_img_(vis_inf), pre_img_(pre_inf) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute average intensity for the cell +- const float mean_obs_ =aux_val.obs_/aux_val.seg_len_; +- // compute appearance probability of observation +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(),mean_obs_); // aux_val.PI_; +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update pre +- pre_img_(i,j) += PI * Omega; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- vil_image_view alpha_integral_; +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view &vis_img_; +- vil_image_view &pre_img_; +-}; +- +-#endif // boxm_pre_infinity_functor_h +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h +deleted file mode 100644 +index bfd4c3b08d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h ++++ /dev/null +@@ -1,109 +0,0 @@ +-#ifndef boxm_render_expected_depth_functor_h +-#define boxm_render_expected_depth_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-template +-class boxm_render_expected_depth_functor +-{ +- public: +- //: "default" constructor +- boxm_render_expected_depth_functor(vil_image_view &expected, +- vil_image_view &mask_vis, +- vgl_point_3d cam_center, +- unsigned int ni,unsigned nj, +- bool scene_read_only=false, +- bool is_aux=true) +- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj,1), center_(cam_center) +- { +- alpha_integral_.fill(0.0f); +- expected_.fill(0.0f); +- vis_img_.fill(1.0f); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, T_aux /*aux_val*/) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- const float depthexp = (float)(s1 - center_).length(); +-#if 0 +- // compute appearance probability of observation +- const float exp = boxm_apm_traits::apm_processor::expected_color(cell_value.appearance()); +-#endif +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update expected image +- expected_(i,j) += depthexp * Omega; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view &expected_; +- vil_image_view &vis_img_; +- vil_image_view alpha_integral_; +- vgl_point_3d center_; +-}; +- +- +-//: Functor class to normalize expected image +-class normalize_expected_functor_depth_rt +-{ +- public: +- normalize_expected_functor_depth_rt(float depth_max):depth_max_(depth_max) {} +- +- void operator()(float mask, float &pix) const +- { +- pix += mask*depth_max_; +- } +- +- private: +- float depth_max_; +-}; +- +- +-template +-void boxm_render_depth_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected, +- vil_image_view &mask, +- int bin = -1, // FIXME - unused +- bool use_black_background = false) // FIXME - unused +-{ +- if (vpgl_perspective_camera *pcam=dynamic_cast *>(cam.ptr())) +- { +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::LOAD); +- +- typedef boxm_render_expected_depth_functor > expfunctor; +- boxm_raytrace_function > raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj()); +- expfunctor exp_functor(expected,mask,pcam->camera_center(),expected.ni(),expected.nj(),true,false); +- raytracer.run(exp_functor); +- +- float max_depth=(float)boxm_utils::max_point_to_box_dist(scene.get_world_bbox(),pcam->camera_center()); +- +- normalize_expected_functor_depth_rt norm_fn(max_depth); +- vil_transform2(mask,expected,norm_fn); +- } +-} +- +-#endif // boxm_render_expected_depth_functor_h +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h +deleted file mode 100644 +index c210b8d20f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h ++++ /dev/null +@@ -1,109 +0,0 @@ +-#ifndef boxm_render_expected_edge_image_functor_h +-#define boxm_render_expected_edge_image_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#ifdef DEBUG +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-template +-class boxm_render_expected_edge_image_functor +-{ +- public: +- //: "default" constructor +- boxm_render_expected_edge_image_functor(vil_image_view::obs_datatype> &expected, +- vil_image_view &mask_vis, // FIXME: unused... +- unsigned int /*ni*/=0, unsigned /*nj*/=0, +- bool scene_read_only=false, +- bool is_aux=true) +- : expected_(expected) +- { +- typename boxm_apm_traits::obs_datatype nil(0); +- expected_.fill(nil); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d /*s0*/, // currently unused, see below +- vgl_point_3d /*s1*/, +- boxm_edge_sample::obs_datatype> &cell_value, +- T_aux /*aux_val*/) +- { +- // compute segment length +- //const float seg_len = (float)(s1-s0).length(); // FIXME: unused... +- +- // TODO: revise with segment length +- const float exp = cell_value.edge_prob_; +- +- // keep the max value in expected image +- // if (expected_(i,j) < exp) +- expected_(i,j) = std::max(expected_(i,j), exp); +- +- return true; +- } +- +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> &expected_; +-}; +- +- +-//: Functor class to normalize expected image +-template +-class normalize_expected_functor_edge +-{ +- public: +- normalize_expected_functor_edge(float n_normal, unsigned int dof) : n_normal_(n_normal), dof_(dof) +- { +-#ifdef DEBUG +- std::cout << "Degrees of freedom: " << dof << std::endl; +-#endif +- } +- +- void operator()(float mask, float &pix) const +- { +- pix = sdet_img_edge::convert_edge_statistics_to_probability(pix,n_normal_,dof_); +- } +- +- float n_normal_; +- unsigned int dof_; +-}; +- +- +-template +-void boxm_render_edge_image_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected, +- vil_image_view & mask, +- float n_normal, +- unsigned int num_samples, //degrees of freedom +- int bin = -1) // FIXME - unused +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::LOAD); +- typedef boxm_render_expected_edge_image_functor expfunctor; +- boxm_raytrace_function raytracer(scene,cam.ptr(),expected.ni(),expected.nj()); +- expfunctor exp_functor(expected,mask,expected.ni(),expected.nj(),true,false); +- raytracer.run(exp_functor); +- +- normalize_expected_functor_edge norm_fn(n_normal,num_samples-1); +- vil_transform2 >(mask,expected,norm_fn); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h +deleted file mode 100644 +index 17f8da724c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h ++++ /dev/null +@@ -1,126 +0,0 @@ +-#ifndef boxm_render_expected_edge_tangent_image_functor_h +-#define boxm_render_expected_edge_tangent_image_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef DEBUG +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-template +-class boxm_render_expected_edge_tangent_image_functor +-{ +- public: +- //: "default" constructor +- boxm_render_expected_edge_tangent_image_functor(vil_image_view &expected, +- vpgl_camera_double_sptr cam, +- //float threshold, +- unsigned int /*ni*/=0, unsigned /*nj*/=0, +- bool scene_read_only=false, +- bool is_aux=true) +- : expected_(expected), num_obs_(expected.ni(),expected.nj()), cam_(cam), residual(1.0) +- { +- expected_.fill(1.0); +- num_obs_.fill(0); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d /*s0*/, // FIXME - unused +- vgl_point_3d /*s1*/, // FIXME - unused +- boxm_inf_line_sample::obs_datatype> &cell_value, +- T_aux /*aux_val*/) +- { +- //std::cout<< cell_value.residual_<<' '; +-#if 0 +- if (cell_value.residual_ cell_value.residual_) +- expected_(i,j) = cell_value.residual_; +- } +-#endif +- if (cell_value.residual_ cell_value.residual_) { +- double u1,v1,u2,v2; +- vgl_point_3d p1=cell_value.line_clipped_.point1(); +- vgl_point_3d p2=cell_value.line_clipped_.point2(); +- cam_->project(p1.x(),p1.y(),p1.z(),u1,v1); +- cam_->project(p2.x(),p2.y(),p2.z(),u2,v2); +- vgl_point_2d img_p1(u1,v1); +- vgl_point_2d img_p2(u2,v2); +- double dist = length(img_p1-img_p2); +- if (dist > 1.0) // for img lines shorter than a pixel don't bother +- { +- double dist_to_seg = vgl_distance_to_linesegment(u1, v1, u2, v2, i, j); +- if (dist_to_seg <= 0.5) { // if the current pixel is less than 0.5 pixels closer to the projected line then mark it +- expected_(i,j)=cell_value.residual_; +- } +- } +- } +- } +-#if 0 +- if (cell_value.num_obs_>2 && cell_value.residual_num_obs_(i,j)) +- { +- num_obs_(i,j)=cell_value.num_obs_; +- double u1,v1,u2,v2; +- vgl_point_3d p1=cell_value.line_clipped_.point1(); +- vgl_point_3d p2=cell_value.line_clipped_.point2(); +- cam_->project(p1.x(),p1.y(),p1.z(),u1,v1); +- cam_->project(p2.x(),p2.y(),p2.z(),u2,v2); +- if ((u1-u2)==0 && v1-v2==0) +- { +- expected_(i,j,0)=-1; +- expected_(i,j,1)=-1; +- expected_(i,j,2)=-1; +- } +- else +- { +- expected_(i,j,0)=float(u1+u2)/2; +- expected_(i,j,1)=float(v1+v2)/2; +- expected_(i,j,2)=float(vnl_math::angle_0_to_2pi(std::atan2(v2-v1,u2-u1))); +- } +- } +-#endif // 0 +- return true; +- } +- +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view &expected_; +- vil_image_view num_obs_; +- vpgl_camera_double_sptr cam_; +- float residual; +-}; +- +-template +-void boxm_render_edge_tangent_image_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected) +- // float n_normal, // FIXME - unused +- // unsigned int num_samples, // FIXME - unused +- // float threshold) // degrees of freedom +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::LOAD); +- typedef boxm_render_expected_edge_tangent_image_functor expfunctor; +- boxm_raytrace_function raytracer(scene, cam.ptr(),expected.ni(),expected.nj()); +- expfunctor exp_functor(expected,cam,/*threshold,*/expected.ni(),expected.nj(),true,false); +- raytracer.run(exp_functor); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h +deleted file mode 100644 +index 51a2c930ce..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h ++++ /dev/null +@@ -1,103 +0,0 @@ +-#ifndef boxm_render_expected_image_functor_h +-#define boxm_render_expected_image_functor_h +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-template +-class boxm_render_expected_image_functor +-{ +- public: +- //: "default" constructor +- boxm_render_expected_image_functor(vil_image_view::obs_datatype> &expected, +- vil_image_view &mask_vis, +- unsigned int ni,unsigned nj, +- bool scene_read_only=false,bool is_aux=true) +- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj, 1) +- { +- alpha_integral_.fill(0.0f); +- typename boxm_apm_traits::obs_datatype nil(0); +- expected_.fill(nil); +- vis_img_.fill(1.0f); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, +- T_aux /*aux_val*/) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- const float exp = boxm_apm_traits::apm_processor::expected_color(cell_value.appearance()); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update expected image +- expected_(i,j) += exp* Omega; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- +- return true; +- } +- +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> &expected_; +- vil_image_view &vis_img_; +- vil_image_view alpha_integral_; +-}; +- +- +-//: Functor class to normalize expected image +-template +-class normalize_expected_functor_rt +-{ +- public: +- normalize_expected_functor_rt(bool use_black_background) : use_black_background_(use_black_background) {} +- +- void operator()(float mask, typename T_data::obs_datatype &pix) const +- { +- if (!use_black_background_) { +- pix += mask*0.5f; +- } +- } +- bool use_black_background_; +-}; +- +- +-template +-void boxm_render_image_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected, +- vil_image_view & mask, +- int /*bin*/ = -1, +- bool use_black_background = false) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene > aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene >::LOAD); +- typedef boxm_render_expected_image_functor > expfunctor; +- boxm_raytrace_function > raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj()); +- expfunctor exp_functor(expected,mask,expected.ni(),expected.nj(),true,false); +- raytracer.run(exp_functor); +- +- normalize_expected_functor_rt norm_fn(use_black_background); +- vil_transform2 >(mask,expected,norm_fn); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h +deleted file mode 100644 +index acbde275c3..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h ++++ /dev/null +@@ -1,120 +0,0 @@ +-#ifndef boxm_render_expected_shadow_image_functor_h +-#define boxm_render_expected_shadow_image_functor_h +-//: +-// \file +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_render_expected_shadow_image_functor +-{ +- public: +- typedef typename boxm_aux_traits::sample_datatype T_aux; +- //: "default" constructor +- boxm_render_expected_shadow_image_functor(vil_image_view::obs_datatype> &expected, +- vil_image_view &mask_vis, +- unsigned int ni,unsigned nj, +- bool scene_read_only=false,bool is_aux=true) +- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj, 1) +- { +- alpha_integral_.fill(0.0f); +- typename boxm_apm_traits::obs_datatype nil(0); +- expected_.fill(nil); +- vis_img_.fill(1.0f); +- scene_read_only_=scene_read_only; +- is_aux_=is_aux; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample &cell_value, +- T_aux& aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- const float exp = boxm_apm_traits::apm_processor::expected_color(cell_value.appearance()); +- +- //compute sun visibility +- float length_sum = aux_val.seg_len_; +- float avg_sun_vis = 1.0f; +- if (length_sum>0.0f) +- avg_sun_vis = aux_val.vis_/length_sum; +- +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // and update expected image +- expected_(i,j) += exp * Omega * avg_sun_vis; +- // update visibility probability +- vis_img_(i,j) = vis_prob_end; +- return true; +- } +- +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> &expected_; +- vil_image_view &vis_img_; +- vil_image_view alpha_integral_; +-}; +- +- +-//: Functor class to normalize expected image +-template +-class normalize_shadow_functor +-{ +- public: +- +- normalize_shadow_functor(bool use_black_background) +- {use_black_background_ = use_black_background;} +- +- void operator()(float mask, typename T_data::obs_datatype &pix) const +- { +- if (!use_black_background_) { +- pix += mask*0.5f; +- } +- } +- bool use_black_background_; +-}; +- +- +-template +-void boxm_render_shadow_image_rt(boxm_scene > > &scene, +- std::string const& aux_scene_id, +- vpgl_camera_double_sptr cam, +- vil_image_view::obs_datatype> &expected, +- vil_image_view & mask, +- bool use_black_background = false) +-{ +- typedef boxm_sample T_data; +- typedef typename boxm_aux_traits::sample_datatype T_aux; +- boxm_aux_scene aux_scene(&scene, aux_scene_id, boxm_aux_scene::LOAD); +- +- typedef boxm_render_expected_shadow_image_functor exp_funct; +- +- boxm_raytrace_function raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj()); +- exp_funct expf(expected,mask,expected.ni(),expected.nj(),true,true); +- raytracer.run(expf); +- +- normalize_shadow_functor norm_fn(use_black_background); +- vil_transform2 >(mask,expected,norm_fn); +- +- // aux_scene.clean_scene(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h b/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h +deleted file mode 100644 +index 78df79d9c4..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h ++++ /dev/null +@@ -1,447 +0,0 @@ +-#ifndef boxm_rpc_registration_h_ +-#define boxm_rpc_registration_h_ +-//: +-// \file +-// This part contains the correction rpc camera parameters using the expected +-// edge image obtained from the world (scene) and edge map of the current image. +-// if the camera parameters are manually corrected by the user, this part should +-// be omitted by setting the "rpc_correction_flag" parameter to 0 (false) in the +-// boxm_rpc_registration_process. +-// +-// \author Ibrahim Eden +-// \date Jan, 2009 +-// +-// \verbatim +-// Modifications +-// Feb 1st, 2010 Gamze Tunali +-// This piece of code is moved from bvxm_rpc_registration process to this file +-// as a standalone function to be used in boxm/opt/boxm_rpc_registration_process +-// \endverbatim +- +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-int convert_uncertainty_from_meters_to_pixels(float uncertainty, +- vpgl_lvcs lvcs, +- vpgl_camera_double_sptr camera) +-{ +- // estimate the offset search size in the image space +- vgl_box_3d box_uncertainty(-uncertainty,-uncertainty,-uncertainty,uncertainty,uncertainty,uncertainty); +- std::vector > box_uncertainty_corners = boxm_utils::corners_of_box_3d(box_uncertainty); +- vgl_box_2d roi_uncertainty; +- +- for (auto curr_corner : box_uncertainty_corners) { +- vgl_point_3d curr_pt; +- if (camera->type_name()=="vpgl_local_rational_camera") { +- curr_pt.set(curr_corner.x(),curr_corner.y(),curr_corner.z()); +- } +- else if (camera->type_name()=="vpgl_rational_camera") { +- double lon, lat, gz; +- lvcs.local_to_global(curr_corner.x(), curr_corner.y(), curr_corner.z(), +- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- curr_pt.set(lon, lat, gz); +- } +- else // dummy initialisation, to avoid compiler warning +- curr_pt.set(-1e99, -1e99, -1.0); +- +- double curr_u,curr_v; +- camera->project(curr_pt.x(),curr_pt.y(),curr_pt.z(),curr_u,curr_v); +- vgl_point_2d p2d_uncertainty(curr_u,curr_v); +- roi_uncertainty.add(p2d_uncertainty); +- } +- +- return vnl_math::ceil(0.5*std::max(roi_uncertainty.width(),roi_uncertainty.height())); +-} +- +-template +-bool boxm_rpc_registration(boxm_scene_base_sptr scene_base,// &scene, +- vil_image_view edge_image, +- vil_image_view expected_edge_image, +- vpgl_camera_double_sptr camera, +- vpgl_camera_double_sptr camera_out, +- bool rpc_shift_3d_flag, +- float uncertainty, +- float n_normal, // FIXME - unused +- unsigned num_observations) +-{ +- double max_prob = std::numeric_limits::min(); +- unsigned int best_offset_u = 0, best_offset_v = 0; +- +- typedef boct_tree tree_type; +- boxm_scene *scene = dynamic_cast*>(scene_base.ptr()); +- +- int offset_search_size = convert_uncertainty_from_meters_to_pixels(uncertainty, scene->lvcs(), camera); +- int ni = edge_image.ni(); +- int nj = edge_image.nj(); +- +- // this is the two level offset search algorithm +- int offset_lower_limit_u = -offset_search_size; +- int offset_lower_limit_v = -offset_search_size; +- int offset_upper_limit_u = offset_search_size; +- int offset_upper_limit_v = offset_search_size; +- std::cout << "Estimating image offsets:" << std::endl; +- for (int u=offset_lower_limit_u; u<=offset_upper_limit_u; u++) { +- std::cout << '.'; +- for (int v=offset_lower_limit_v; v<=offset_upper_limit_v; v++) { +- // for each offset pair (u,v) +- double prob = 0.0; +- double norm = 0.0; +- // find the total probability of the edge image given the expected edge image +- for (int m=offset_search_size; m0.0) +- prob/=norm; +- +- // if maximum is found +- if (prob > max_prob) { +- max_prob = prob; +- best_offset_u = u; +- best_offset_v = v; +- } +- } +- } +- std::cout << std::endl; +- +- std::cout << "Estimated changes in offsets (u,v)=(" << best_offset_u << ',' << best_offset_v << ')' << std::endl; +- // local variables +- std::ifstream file_inp; +- std::ofstream file_out; +- file_out.clear(); +- file_out.open("offsets.txt",std::ofstream::app); +- file_out << best_offset_u << ' ' << best_offset_v << '\n'; +- file_out.close(); +- +- double nlx=0.f,nly=0.f,nlz=0.f; +- double motion_mult = 0.0; +- if (rpc_shift_3d_flag) +- { +- vpgl_local_rational_camera *cam_input_temp = dynamic_cast*>(camera.ptr()); +- +- vgl_point_3d origin_3d(0.0,0.0,0.0); +- vgl_point_2d origin_2d = cam_input_temp->project(origin_3d); +- +- vgl_plane_3d curr_plane(0.0,0.0,1.0,-0.001); +- vgl_point_3d init_point(0.0,0.0,0.001); +- vgl_point_3d world_point; +- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d,curr_plane,init_point,world_point); +- +- vgl_vector_3d motion_plane_normal = world_point - origin_3d; +- motion_plane_normal = normalize(motion_plane_normal); +- vgl_plane_3d motion_plane(motion_plane_normal,origin_3d); +- +- init_point.set(origin_3d.x(),origin_3d.y(),origin_3d.z()); +- vgl_point_3d moved_origin; +- vgl_point_2d origin_2d_shift(origin_2d.x()+best_offset_u,origin_2d.y()+best_offset_v); +- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d_shift,motion_plane,init_point,moved_origin); +- +- vgl_vector_3d motion = moved_origin - origin_3d; +- +- motion_mult = 1.0/((double)(num_observations+1)); +- motion = motion*motion_mult; +- +- double lx,ly,lz; +- vgl_point_3d rpc_origin = scene->rpc_origin(); +- lx = rpc_origin.x(); +- ly = rpc_origin.y(); +- lz = rpc_origin.z(); +- +- lx = lx*(1.0f-(double)motion_mult); +- ly = ly*(1.0f-(double)motion_mult); +- lz = lz*(1.0f-(double)motion_mult); +- +- vgl_point_3d pt_3d_est_vec(lx,ly,lz); +- vgl_point_3d pt_3d_updated = pt_3d_est_vec + motion; +- +- nlx = (double)pt_3d_updated.x(); +- nly = (double)pt_3d_updated.y(); +- nlz = (double)pt_3d_updated.z(); +- +- vgl_point_3d new_rpc_origin(nlx,nly,nlz); +- scene->set_rpc_origin(new_rpc_origin); +- } +- +- // correct the output for (local) rational camera using the estimated offset pair (max_u,max_v) +- // the following block of code takes care of different input camera types +- // e.g., vpgl_local_rational_camera and vpgl_rational_camera +- bool is_local_cam = true; +- bool is_rational_cam = true; +- vpgl_local_rational_camera *cam_inp_local; +- if (!(cam_inp_local = dynamic_cast*>(camera.ptr()))) { +- is_local_cam = false; +- } +- vpgl_rational_camera *cam_inp_rational; +- if (!(cam_inp_rational = dynamic_cast*>(camera.ptr()))) { +- is_rational_cam = false; +- } +- +- if (is_local_cam) { +- vpgl_local_rational_camera cam_out_local(*cam_inp_local); +- double offset_u,offset_v; +- cam_out_local.image_offset(offset_u,offset_v); +- offset_u += (best_offset_u*(1.0-motion_mult)); +- offset_v += (best_offset_v*(1.0-motion_mult)); +- cam_out_local.set_image_offset(offset_u,offset_v); +- camera_out = new vpgl_local_rational_camera(cam_out_local); +- } +- else if (is_rational_cam) { +- vpgl_rational_camera cam_out_rational(*cam_inp_rational); +- double offset_u,offset_v; +- cam_out_rational.image_offset(offset_u,offset_v); +- offset_u += (best_offset_u*(1.0-motion_mult)); +- offset_v += (best_offset_v*(1.0-motion_mult)); +- cam_out_rational.set_image_offset(offset_u,offset_v); +- camera_out = new vpgl_rational_camera(cam_out_rational); +- } +- else { +- std::cerr << "error: process expects camera to be a vpgl_rational_camera or vpgl_local_rational_camera.\n"; +- return false; +- } +- +- return true; +-} +- +- +-template +-bool boxm_rpc_registration(boxm_scene_base_sptr scene_base,// &scene, +- vil_image_view edge_image, +- vil_image_view expected_edge_image, +- vpgl_camera_double_sptr camera, +- vpgl_camera_double_sptr camera_out, +- bool rpc_shift_3d_flag, +- float uncertainty, +- unsigned num_observations) +-{ +- double max_cost = std::numeric_limits::max(); +- unsigned int best_offset_u = 0, best_offset_v = 0; +- double subpixel_best_offset_u = 0.0, subpixel_best_offset_v = 0.0; +- +- typedef boct_tree tree_type; +- boxm_scene *scene = dynamic_cast*>(scene_base.ptr()); +- +- int offset_search_size = convert_uncertainty_from_meters_to_pixels(uncertainty, scene->lvcs(), camera); +- int ni = edge_image.ni(); +- int nj = edge_image.nj(); +- +- std::cout<-1 && edge_image(m,n,1)>-1 && edge_image(m,n,2)>-1) { +- if (expected_edge_image(m-u,n-v,0)>0 && expected_edge_image(m-u,n-v,1)>0 && expected_edge_image(m-u,n-v,2)>0) { +- //std::cout<<'.'; +- float sintheta1=std::sin(edge_image(m,n,2)); +- float costheta1=std::cos(edge_image(m,n,2)); +- +- float sintheta2=std::sin(expected_edge_image(m-u,n-v,2)); +- float costheta2=std::cos(expected_edge_image(m-u,n-v,2)); +-#if 0 +- float dx=expected_edge_image(m-u,n-v,0)+u-edge_image(m,n,0); +- float dy=expected_edge_image(m-u,n-v,1)+v-edge_image(m,n,1); +- +- float dist=std::sqrt(dx*dx+dy*dy); +- if (dist0.0) +- cost/=norm; +- +- //std::cout<::max(); +- for (double u=-subpixel_offset_limit; u<=subpixel_offset_limit; ) { +- std::cout << '.'; +- for (double v=-subpixel_offset_limit; v<=subpixel_offset_limit; ) { +- // for each offset pair (u,v) +- double cost = 0.0; +- // find the total probability of the edge image given the expected edge image +- for (int m=offset_search_size; m0 && expected_edge_image(m-best_offset_u,n-best_offset_v,1)>0 && expected_edge_image(m-best_offset_u,n-best_offset_v,2)>0) { +- double dx=expected_edge_image(m-best_offset_u,n-best_offset_v,0)+best_offset_u+u-edge_image(m,n,0); +- double dy=expected_edge_image(m-best_offset_u,n-best_offset_v,1)+best_offset_v+v-edge_image(m,n,1); +- double dist=std::sqrt(dx*dx+dy*dy); +- cost += dist; +- } +- } +- } +- } +- //std::cout< *cam_input_temp = dynamic_cast*>(camera.ptr()); +- +- vgl_point_3d origin_3d(0.0,0.0,0.0); +- vgl_point_2d origin_2d = cam_input_temp->project(origin_3d); +- +- vgl_plane_3d curr_plane(0.0,0.0,1.0,-0.001); +- vgl_point_3d init_point(0.0,0.0,0.001); +- vgl_point_3d world_point; +- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d,curr_plane,init_point,world_point); +- +- vgl_vector_3d motion_plane_normal = world_point - origin_3d; +- motion_plane_normal = normalize(motion_plane_normal); +- vgl_plane_3d motion_plane(motion_plane_normal,origin_3d); +- +- init_point.set(origin_3d.x(),origin_3d.y(),origin_3d.z()); +- vgl_point_3d moved_origin; +- vgl_point_2d origin_2d_shift(origin_2d.x()+best_offset_u,origin_2d.y()+best_offset_v); +- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d_shift,motion_plane,init_point,moved_origin); +- +- vgl_vector_3d motion = moved_origin - origin_3d; +- +- motion_mult = 1.0/((double)(num_observations+1)); +- motion = motion*motion_mult; +- +- double lx,ly,lz; +- vgl_point_3d rpc_origin = scene->rpc_origin(); +- lx = rpc_origin.x(); +- ly = rpc_origin.y(); +- lz = rpc_origin.z(); +- +- lx = lx*(1.0f-(double)motion_mult); +- ly = ly*(1.0f-(double)motion_mult); +- lz = lz*(1.0f-(double)motion_mult); +- +- vgl_point_3d pt_3d_est_vec(lx,ly,lz); +- vgl_point_3d pt_3d_updated = pt_3d_est_vec + motion; +- +- nlx = (double)pt_3d_updated.x(); +- nly = (double)pt_3d_updated.y(); +- nlz = (double)pt_3d_updated.z(); +- +- vgl_point_3d new_rpc_origin(nlx,nly,nlz); +- scene->set_rpc_origin(new_rpc_origin); +- } +- +- // correct the output for (local) rational camera using the estimated offset pair (max_u,max_v) +- // the following block of code takes care of different input camera types +- // e.g., vpgl_local_rational_camera and vpgl_rational_camera +- bool is_local_cam = true; +- bool is_rational_cam = true; +- vpgl_local_rational_camera *cam_inp_local; +- if (!(cam_inp_local = dynamic_cast*>(camera.ptr()))) { +- is_local_cam = false; +- } +- vpgl_rational_camera *cam_inp_rational; +- if (!(cam_inp_rational = dynamic_cast*>(camera.ptr()))) { +- is_rational_cam = false; +- } +- +- if (is_local_cam) { +- vpgl_local_rational_camera cam_out_local(*cam_inp_local); +- double offset_u,offset_v; +- cam_out_local.image_offset(offset_u,offset_v); +- offset_u += (best_offset_u*(1.0-motion_mult)); +- offset_v += (best_offset_v*(1.0-motion_mult)); +- cam_out_local.set_image_offset(offset_u,offset_v); +- camera_out = new vpgl_local_rational_camera(cam_out_local); +- } +- else if (is_rational_cam) { +- vpgl_rational_camera cam_out_rational(*cam_inp_rational); +- double offset_u,offset_v; +- cam_out_rational.image_offset(offset_u,offset_v); +- offset_u += (best_offset_u*(1.0-motion_mult)); +- offset_v += (best_offset_v*(1.0-motion_mult)); +- cam_out_rational.set_image_offset(offset_u,offset_v); +- camera_out = new vpgl_rational_camera(cam_out_rational); +- } +- else { +- std::cerr << "error: process expects camera to be a vpgl_rational_camera or vpgl_local_rational_camera.\n"; +- return false; +- } +- +- return true; +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h +deleted file mode 100644 +index 0d4d93d05d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h ++++ /dev/null +@@ -1,45 +0,0 @@ +-#ifndef boxm_shadow_app_initializer_h_ +-#define boxm_shadow_app_initializer_h_ +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_shadow_app_initializer +-{ +-public: +- +- boxm_shadow_app_initializer(boxm_scene > > &scene, +- std::vector image_ids, +- float min_app_sigma, +- float shadow_prior, +- float shadow_mean, float shadow_sigma, +- bool verbose=false); +- +- ~boxm_shadow_app_initializer()= default; +- +- bool initialize(); +- +-protected: +- +- std::vector image_ids_; +- +- boxm_scene > > &scene_; +- +- float min_app_sigma_; +- float shadow_prior_; +- float shadow_mean_; +- float shadow_sigma_; +- bool verbose_; +-}; +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx +deleted file mode 100644 +index 22c469ec72..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx ++++ /dev/null +@@ -1,122 +0,0 @@ +-#ifndef boxm_shadow_app_initializer_hxx_ +-#define boxm_shadow_app_initializer_hxx_ +- +-#include +-#include +-#include +-#include +-#include "boxm_shadow_app_initializer.h" +-#include "boxm_shadow_appearance_estimator.h" +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_shadow_app_initializer::boxm_shadow_app_initializer( +- boxm_scene > > &scene, +- std::vector image_ids, float min_app_sigma, +- float shadow_prior, float shadow_mean, float shadow_sigma, +- bool verbose) +- : image_ids_(std::move(image_ids)), scene_(scene), min_app_sigma_(min_app_sigma), +- shadow_prior_(shadow_prior), shadow_mean_(shadow_mean), +- shadow_sigma_(shadow_sigma),verbose_(verbose) +-{} +- +- +-template +-bool boxm_shadow_app_initializer::initialize() +-{ +- // get auxiliary scenes associated with each input image +- typedef typename boxm_aux_traits::sample_datatype aux_type; +- +- typedef boct_tree > tree_type; +- +- std::vector, aux_type> > aux_scenes; +- for (unsigned int i=0; i, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene, aux_type>::LOAD); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector::obs_datatype> > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector* > aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_sample data = cell->data(); +- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl; +- for (unsigned j=0; j temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().seg_len_ > 0.0f) { +- aux_samples.push_back(temp_cell.data()); +- } +- } +- typedef typename boxm_apm_traits::obs_datatype obs_type; +- std::vector obs_vector; +- for (unsigned int s=0; s 1e-5 && (obs > obs_type(0)) ){ +- obs_vector.push_back(obs / seg_len); +- } +- } +- unsigned n_obs = obs_vector.size(); +- if(n_obs>1){ +- std::vector pre_vector(n_obs, 0.0f); +- std::vector vis_vector(n_obs, 1.0f); +- boxm_compute_shadow_appearance(obs_vector, pre_vector, +- vis_vector, data.appearance_, +- min_app_sigma_, shadow_prior_, +- shadow_mean_, shadow_sigma_, +- verbose_); +- cell->set_data(data); +- } +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- iter++; +- } +- // clear the aux scenes +- for (unsigned i=0; i +- +-#endif // boxm_shadow_app_initializer_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h +deleted file mode 100644 +index 15dd5763ba..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h ++++ /dev/null +@@ -1,114 +0,0 @@ +-#ifndef boxm_shadow_appearance_estimator_h_ +-#define boxm_shadow_appearance_estimator_h_ +- +-#include +-#include +-#include +-#include +-#if 1 +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-template +-void boxm_compute_shadow_appearance(std::vector::obs_datatype> const& obs, +- std::vector const& pre, +- std::vector const& vis, +- typename boxm_apm_traits::apm_datatype &model, +- float min_app_sigma, +- float shadow_prior, +- float shadow_mean, float shadow_sigma, +- bool verbose = false) +-{ +- std::vector obs_weights(vis.size(), 0.0f); +- std::vector sh_density(vis.size(), 0.0f); +- //assume that the initial appearance distribution is uniform on [0 1] +- //thus a reasonable initialization for weights is +- // +- // vis(1-Psh)/( (1-Psh) + Psh psh(obs) ) +- // +- //, where Psh is shadow_prior and psh(x) is the shadow density function, +- // sh_density. vis is the visibilty probability +- // +- boxm_simple_grey shadow_dist(shadow_mean, shadow_sigma); +- for(unsigned n = 0; n initial_weights = obs_weights; +- // initial estimate for the illuminated appearance model +- boxm_apm_traits::apm_processor::compute_appearance(obs,obs_weights,model,min_app_sigma); +- double initial_mean = model.color(); +- double initial_sigma = model.sigma(); +-#if 1 +- // use EM to refine estimate until convergence. +- unsigned int nobs= obs.size(); +- if (nobs == 0) { +- // nothing to do. +- return; +- } +- const float epsilon = 1e-4f; +- constexpr unsigned int max_its = 100; +- const float min_weight_change = 1e-5f; +- unsigned int i=0; +- for (; i::apm_processor::prob_density(model,obs[n]); +- float neu = PI*(1-shadow_prior); +- float den = (PI + pre[n])*(1-shadow_prior) + shadow_prior*sh_density[n]; +- float new_obs_weight = 0; +- if (den > epsilon) { +- new_obs_weight = neu / den; +- } +- // compute delta weight for convergence check +- float weight_delta = std::fabs(obs_weights[n] - new_obs_weight); +- if (weight_delta > max_weight_change) { +- max_weight_change = weight_delta; +- } +- obs_weights[n] = new_obs_weight; +- } +- // check for convergence +- if (max_weight_change < min_weight_change) +- break; +- // MAXIMIZATION - determine the parameters of the appearance distribution +- boxm_apm_traits::apm_processor::update_appearance(obs,obs_weights,model,min_app_sigma); +- } +- if(verbose) { +- bool print = false; +- for(unsigned n = 0; n0) print = true; +- if(i::apm_processor::finalize_appearance(obs,obs_weights,model); +-#endif +- return; +-} +- +-#endif // boxm_shadow_appearance_estimator_h_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h +deleted file mode 100644 +index beaa3b2c7d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h ++++ /dev/null +@@ -1,51 +0,0 @@ +-#ifndef boxm_shadow_bayes_optimizer_h_ +-#define boxm_shadow_bayes_optimizer_h_ +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_shadow_bayes_optimizer +-{ +-public: +- +- boxm_shadow_bayes_optimizer(boxm_scene > > &scene, +- std::vector image_ids, +- float min_app_sigma, +- float shadow_prior, +- float shadow_mean, float shadow_sigma, +- bool verbose=false, +- vgl_point_3d debug_pt = +- vgl_point_3d(0,0,0) +- ); +- +- ~boxm_shadow_bayes_optimizer()= default; +- +- bool optimize_cells(double damping_factor); +- +-protected: +- +- std::vector image_ids_; +- +- boxm_scene > > &scene_; +- +- const float max_cell_P_; +- const float min_cell_P_; +- float min_app_sigma_; +- float shadow_prior_; +- float shadow_mean_; +- float shadow_sigma_; +- bool verbose_; +- vgl_point_3d debug_pt_; +-}; +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx +deleted file mode 100644 +index a2d24ee683..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx ++++ /dev/null +@@ -1,195 +0,0 @@ +-#ifndef boxm_shadow_bayes_optimizer_hxx_ +-#define boxm_shadow_bayes_optimizer_hxx_ +- +-#include +-#include +-#include +-#include +-#include "boxm_shadow_bayes_optimizer.h" +-#include "boxm_shadow_appearance_estimator.h" +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_shadow_bayes_optimizer::boxm_shadow_bayes_optimizer(boxm_scene > > &scene, +- std::vector image_ids, float min_app_sigma, +- float shadow_prior, float shadow_mean, float shadow_sigma, +- bool verbose, vgl_point_3d debug_pt) +- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f), +- min_app_sigma_(min_app_sigma), shadow_prior_(shadow_prior), +- shadow_mean_(shadow_mean), shadow_sigma_(shadow_sigma), +- verbose_(verbose), debug_pt_(debug_pt) +-{} +- +- +-template +-bool boxm_shadow_bayes_optimizer::optimize_cells(double damping_factor) +-{ +- // get auxiliary scenes associated with each input image +- typedef typename boxm_aux_traits::sample_datatype aux_type; +- +- typedef boct_tree > tree_type; +- +- std::vector, aux_type> > aux_scenes; +- for (unsigned int i=0; i, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene, aux_type>::LOAD); +- aux_scenes.push_back(aux_scene); +- } +- +- std::vector::obs_datatype> > aux_samples; +- +- // for each block +- boxm_block_iterator iter(&scene_); +- iter.begin(); +- while (!iter.end()) +- { +- scene_.load_block(iter.index()); +- boxm_block* block = *iter; +- boct_tree >* tree = block->get_tree(); +- boct_tree_cell >* debug_cell = nullptr; +- if (verbose_) +- debug_cell = tree->locate_point_global(debug_pt_); +- std::vector >*> cells = tree->leaf_cells(); +- +- // get a vector of incremental readers for each aux scene. +- std::vector* > aux_readers(aux_scenes.size()); +- for (unsigned int i=0; i >* cell = cells[i]; +- boxm_sample data = cell->data(); +- for (unsigned j=0; j temp_cell; +- +- if (!aux_readers[j]->next(temp_cell)) { +- std::cerr << "error: incremental reader returned false.\n"; +- return false; +- } +- if (!temp_cell.code_.isequal(&(cell->code_))) { +- std::cerr << "error: temp_cell idx does not match cell idx.\n"; +- return false; +- } +- if (temp_cell.data().seg_len_ > 0.0f) { +- aux_samples.push_back(temp_cell.data()); +- } +- } +- unsigned n_samp = aux_samples.size(); +- std::vector pre_vector(n_samp); +- std::vector vis_vector(n_samp); +- // new discrete probability code +- float log_sum = 0.0f; +- float total_length_sum = 0.0f; +- //=== +- typedef typename boxm_apm_traits::obs_datatype obs_type; +- std::vector obs_vector(n_samp); +-//#if 0 // old beta calculation +- double Beta = 1.0; +-//#endif +- if (verbose_&&cell == debug_cell){ +- std::cout << "Contents of Debug Cell\n" +- << "s vis[s] pre[s] beta[s]\n"; +- } +- double vis_sum = 0; +- for (unsigned int s=0; s 1e-5) { +- obs_vector[s] = obs / seg_len_sum; +- float pre = aux_samples[s].pre_ / seg_len_sum; +- float vis = aux_samples[s].vis_ / seg_len_sum; +- pre_vector[s] = pre; +- vis_vector[s] = vis; +- +-//#if 0 // old beta calculation +- double beta_s = (aux_samples[s].Beta_ / seg_len_sum); +- Beta *= beta_s; +-//#else // New discrete prob code +- log_sum += aux_samples[s].log_sum_; +- total_length_sum += seg_len_sum; +-//#endif +- // ==== +- if (cell == debug_cell) +- { +- std::cout << s << ' ' << vis << ' ' << pre << ' ' +- << beta_s << '\n'; +- } +- } +- else { +- pre_vector[s] = 0.0f; +- vis_vector[s] = 0.0f; +- obs_vector[s] = typename boxm_apm_traits::obs_datatype(0); +- } +- } +- vis_sum /= n_samp; +- +-#if 0 // old beta calculation +- double damped_Beta = 1.0; +- if (n_samp>1.0){ +- damped_Beta = std::pow(Beta, 1.0/n_samp); +- } +-#else +- double damped_Beta = (Beta + damping_factor)/(damping_factor*Beta + 1.0); +- +- if ((damped_Beta < 0.00000001) && (damped_Beta > -0.00000001)) +- std::cout << "ERROR: damped_Beta is:" << damped_Beta << std::endl; +- +- data.alpha *= static_cast(damped_Beta); +- +- float alpha_post = data.alpha; +- if (total_length_sum > 0.0f) alpha_post = log_sum/total_length_sum; +- data.alpha = alpha_post; +-#endif +- // do bounds check on new alpha value +- vgl_box_3d cell_bb = tree->cell_bounding_box(cell); +- const float cell_len = float(cell_bb.width()); +- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len; +- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len; +- if (data.alpha > max_alpha) { +- data.alpha = max_alpha; +- } +- if (data.alpha < min_alpha) { +- data.alpha = min_alpha; +- } +- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){ +- std::cerr << "\nerror: data.alpha = " << data.alpha << std::endl; +- } +- // update with new appearance +- bool print_p = false; +- if (verbose_&&cell == debug_cell){ +- std::cout << "Cell Level = " << cell->level() +- << " AlphaPosterior = " << data.alpha << '\n'; +- print_p = true; +- } +- boxm_compute_shadow_appearance(obs_vector, pre_vector, vis_vector, data.appearance_, min_app_sigma_, shadow_prior_, shadow_mean_, shadow_sigma_, print_p); +- cell->set_data(data); +- } +- scene_.write_active_block(); +- for (unsigned int i=0; iclose(); +- } +- ++iter; +- } +- +- // clear the aux scenes so that its starts with the refined scene next time +- for (unsigned i=0; i +- +-#endif // boxm_shadow_bayes_optimizer_hxx_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h +deleted file mode 100644 +index 798aac81a9..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h ++++ /dev/null +@@ -1,103 +0,0 @@ +-#ifndef boxm_sun_vis_prob_functor_h +-#define boxm_sun_vis_prob_functor_h +-//: +-//\file +-#include +-#include +-#include +-#include +-#include +-#include +-#include "boxm_pre_infinity_functor.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-template +-class boxm_sun_vis_prob_functor +-{ +- public: +- //: "default" constructor +- boxm_sun_vis_prob_functor(unsigned sun_ni, unsigned sun_nj) +- : sun_ni_(sun_ni), sun_nj_(sun_nj) +- { +- alpha_integral_ = vil_image_view(sun_ni_, sun_nj_); +- alpha_integral_.fill(0.0f); +- +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- +- // accumulate segment length +- aux_val.seg_len_ += seg_len; +- +- // current sun visibility +- const float sun_vis = std::exp(-alpha_integral_(i,j)); +- +- // update sun vis +- aux_val.vis_ += sun_vis * seg_len; +- +- // update alpha integral along sun ray i, j +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- unsigned sun_ni_; +- unsigned sun_nj_; +- vil_image_view alpha_integral_; +-}; +- +-template +-void boxm_sun_vis_prob(boxm_scene > &scene, +- vgl_vector_3d sun_angle, +- std::string sun_occ_name) +-{ +- // scene bounding box +- vgl_box_3d world_bb = scene.get_world_bbox(); +- unsigned max_level = scene.max_level(); +- unsigned sun_ni = 1< sun_cam = +- bpgl_camera_from_box::affine_camera_from_box(world_bb, -sun_angle, sun_ni, sun_nj); +- +- vpgl_camera_double_sptr cam = new vpgl_affine_camera (sun_cam); +- +- typedef typename boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene aux_scene(&scene,sun_occ_name, boxm_aux_scene::CLONE); +- +- std::cout<<"Sun visibility"< sun_vis; +- +- // set up the raytrace function +- boxm_raytrace_function raytracer_vis(scene,aux_scene,cam.ptr(),sun_ni,sun_nj); +- +- // construct the sun visibility functor need only sun ray space dimensions +- sun_vis sun_vis_functor(sun_ni, sun_nj); +- +- // run the functor over the octree +- raytracer_vis.run(sun_vis_functor); +- std::cout<<"Sun Occlusion Done."< +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_update_image_functor_pass_2 +-{ +- public: +- //: "default" constructor +- boxm_update_image_functor_pass_2(vil_image_view::obs_datatype> const& image, +- vil_image_view const& normalizing_img) +- : obs_(image), norm_(normalizing_img), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1) +- { +- alpha_integral_.fill(0.0f); +- pre_img_.fill(0.0f); +- vis_img_.fill(1.0f); +- //only reads info from the scene +- scene_read_only_=true; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, boxm_sample &cell_value, T_aux & aux_val) +- { +- // compute segment length +- const float seg_len = (float)(s1 - s0).length(); +- // compute appearance probability of observation +- float mean_obs= aux_val.obs_/aux_val.seg_len_; +- const float PI = boxm_apm_traits::apm_processor::prob_density(cell_value.appearance(), mean_obs); +- // update alpha integral +- alpha_integral_(i,j) += cell_value.alpha * seg_len; +- +- // compute new visibility probability with updated alpha_integral +- const float vis_prob_end = std::exp(-alpha_integral_(i,j)); +- // compute weight for this cell +- const float Omega = vis_img_(i,j) - vis_prob_end; +- // update vis and pre +- pre_img_(i,j) += PI * Omega; +- vis_img_(i,j) = vis_prob_end; +- aux_val.vis_+=seg_len*vis_img_(i,j); +- +- if(norm_(i,j)>1e-10f) +- aux_val.updatefactor_+=(((pre_img_(i,j)+vis_img_(i,j)*PI)/norm_(i,j))* seg_len); +- +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> const& obs_; +- vil_image_view const& norm_; +- //vil_image_view const& pre_inf_; +- vil_image_view vis_img_; +- vil_image_view pre_img_; +- vil_image_view alpha_integral_; +-}; +- +-template +-class boxm_update_image_functor_pass_3 +-{ +- public: +- //: default constructor +- boxm_update_image_functor_pass_3() +- { +- //only reads info from the scene +- scene_read_only_=false; +- //needs to write aux +- is_aux_=true; +- } +- +- inline bool step_cell(boxm_sample &cell_value, T_aux & aux_val) +- { +- if (aux_val.seg_len_>1e-10) +- { +- boxm_apm_traits::apm_processor::update(cell_value.appearance(), +- aux_val.obs_/aux_val.seg_len_, +- aux_val.vis_/aux_val.seg_len_); +- cell_value.alpha*=(aux_val.updatefactor_/aux_val.seg_len_); +- aux_val.seg_len_=0; +- aux_val.obs_=0; +- aux_val.vis_=0; +- aux_val.updatefactor_=0.0; +- } +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +-}; +- +-template +-void boxm_update_image_rt(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &obs, +- bool black_background = false) +-{ +- typedef boxm_aux_traits::sample_datatype sample_datatype; +- boxm_aux_scene aux_scene(&scene,boxm_aux_traits::storage_subdir(), boxm_aux_scene::CLONE); +- typedef boxm_seg_length_functor pass_0; +- boxm_raytrace_function raytracer_0(scene, aux_scene, cam.ptr(),obs.ni(),obs.nj()); +- std::cerr << "PASS 0\n"; +- pass_0 pass_0_functor(obs,obs.ni(),obs.nj()); +- raytracer_0.run(pass_0_functor); +- +- vil_image_view pre_inf(obs.ni(),obs.nj(),1); +- vil_image_view vis_inf(obs.ni(),obs.nj(),1); +- +- typedef boxm_pre_infinity_functor pass_1; +- boxm_raytrace_function raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- std::cerr << "PASS 1\n"; +- pass_1 pass_1_functor(obs,pre_inf,vis_inf); +- raytracer_1.run(pass_1_functor); +- +- vil_image_view PI_inf(obs.ni(), obs.nj(),1); +- +- typename T_data::apm_datatype background_apm; +- +- if (black_background) { +- std::cerr << "using black background model\n"; +- for (unsigned int i=0; i<4; ++i) { +- T_data::apm_processor::update(background_apm, 0.0f, 1.0f); +- float peak=T_data::apm_processor::prob_density(background_apm,0.0f); +- std::cout<<"Peak: "<::const_iterator img_it = obs.begin(); +- typename vil_image_view::iterator PI_it = PI_inf.begin(); +- for (; img_it != obs.end(); ++img_it, ++PI_it) { +- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it); +- } +- } +- else { +- PI_inf.fill(0.5f); +- } +- +- vil_image_view inf_term(obs.ni(), obs.nj()); +- vil_math_image_product(vis_inf,PI_inf,inf_term); +- vil_image_view norm_img(obs.ni(), obs.nj()); +- vil_math_image_sum(pre_inf,inf_term,norm_img); +- std::cerr << "PASS 2\n"; +- typedef boxm_update_image_functor_pass_2::sample_datatype> pass_2; +- boxm_raytrace_function::sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- pass_2 pass_2_functor(obs,norm_img); +- raytracer_2.run(pass_2_functor); +- std::cerr << "PASS 3\n"; +- typedef boxm_update_image_functor_pass_3::sample_datatype> pass_3; +- boxm_iterate_cells_function::sample_datatype> cell_tracer_3(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj()); +- +- pass_3 pass_3_functor; +- cell_tracer_3.run(pass_3_functor); +- +- aux_scene.clean_scene(); +- std::cerr << "DONE.\n"; +-} +- +-#endif // boxm_update_image_functor_h +diff --git a/contrib/brl/bseg/boxm/algo/rt/dummy.cxx b/contrib/brl/bseg/boxm/algo/rt/dummy.cxx +deleted file mode 100644 +index e69de29bb2..0000000000 +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt +deleted file mode 100644 +index 112a19f789..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt ++++ /dev/null +@@ -1,29 +0,0 @@ +-# boxm's Process Library +- +-# bprb depends on expat and boxm_pro depends on bprb primarily +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +-if(EXPAT_FOUND) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg ) +- # include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) +- # include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- +- set(boxm_algo_rt_pro_sources +- boxm_algo_rt_processes.h +- boxm_algo_rt_register.h boxm_algo_rt_register.cxx +- ) +- +- #aux_source_directory(Templates boxm_algo_rt_pro_sources) +- aux_source_directory(processes boxm_algo_rt_pro_sources) +- +- vxl_add_library(LIBRARY_NAME boxm_algo_rt_pro LIBRARY_SOURCES ${boxm_algo_rt_pro_sources} ) +- +- target_link_libraries(boxm_algo_rt_pro boxm_algo_rt boxm_algo_pro boxm boxm_sample boxm_sample_algo boct bprb brdb brip sdet ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl) +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +-endif() +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h +deleted file mode 100644 +index 1ec223e9d5..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h ++++ /dev/null +@@ -1,29 +0,0 @@ +-#ifndef boxm_algo_rt_processes_h_ +-#define boxm_algo_rt_processes_h_ +- +-#include +-#include +- +-//the init functions +-DECLARE_FUNC_CONS(boxm_opt_bayesian_update_process); +-DECLARE_FUNC_CONS(boxm_update_rt_process); +-DECLARE_FUNC_CONS(boxm_render_expected_rt_process); +-DECLARE_FUNC_CONS(boxm_render_expected_depth_rt_process); +-DECLARE_FUNC_CONS(boxm_generate_opt_samples_process); +-DECLARE_FUNC_CONS(boxm_generate_edge_samples_process); +-DECLARE_FUNC_CONS(boxm_edge_update_process); +-DECLARE_FUNC_CONS(boxm_render_expected_edge_process); +-DECLARE_FUNC_CONS(boxm_rpc_registration_process); +-DECLARE_FUNC_CONS(boxm_line_backproject_process); +-DECLARE_FUNC_CONS(boxm_generate_opt2_samples_process); +-DECLARE_FUNC_CONS(boxm_opt2_update_process); +-DECLARE_FUNC_CONS(boxm_generate_opt3_samples_process); +-DECLARE_FUNC_CONS(boxm_opt3_update_process); +-DECLARE_FUNC_CONS(boxm_render_expected_edge_vrml_process); +-DECLARE_FUNC_CONS(boxm_ray_statistics_process); +-DECLARE_FUNC_CONS(boxm_change_probability_process); +-DECLARE_FUNC_CONS(boxm_estimate_camera_process); +-DECLARE_FUNC_CONS(boxm_edge_refine_updates_process); +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx +deleted file mode 100644 +index d0ebc7375e..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx ++++ /dev/null +@@ -1,33 +0,0 @@ +-#include "boxm_algo_rt_register.h" +- +-#include +-#include +-#include +- +-#include "boxm_algo_rt_processes.h" +- +-void boxm_algo_rt_register::register_datatype() +-{ +-} +- +-void boxm_algo_rt_register::register_process() +-{ +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt_bayesian_update_process,"boxmOptBayesianUpdateProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_update_rt_process,"boxmUpdateRTProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_rt_process, "boxmRenderExpectedRTProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_depth_rt_process, "boxmRenderExpectedDepthRTProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt_samples_process, "boxmGenerateOptSamplesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_edge_samples_process, "boxmGenerateEdgeSamplesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_edge_update_process, "boxmEdgeUpdateProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_edge_process, "boxmRenderExpectedEdgeProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_rpc_registration_process, "boxmRPCRegistrationProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_line_backproject_process, "boxmLineBackprojectProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt2_update_process,"boxmOpt2UpdateProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt3_update_process,"boxmOpt3UpdateProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt2_samples_process,"boxmGenerateOpt2SamplesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt3_samples_process,"boxmGenerateOpt3SamplesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_ray_statistics_process,"boxmRayStatisticsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_change_probability_process,"boxmChangeProbabilityProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_estimate_camera_process,"boxmEstimateCameraProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_edge_refine_updates_process, "boxmEdgeRefineUpdatesProcess"); +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h +deleted file mode 100644 +index c060c1220f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-#ifndef boxm_algo_rt_register_h_ +-#define boxm_algo_rt_register_h_ +- +-class boxm_algo_rt_register +-{ +- public: +- static void register_datatype(); +- static void register_process(); +-}; +- +-#endif // boxm_algo_rt_register_h_ +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx +deleted file mode 100644 +index d7d9002e0c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx ++++ /dev/null +@@ -1,120 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for obtaining expected depth map for the world +-// +-// \author Vishal Jain +-// \date Aug 26, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_change_probability_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 2; +-} +- +-bool boxm_change_probability_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_change_probability_process_globals; +- +- //process takes 4 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vil_image_view_base_sptr"; +- input_types_[2] = "vpgl_camera_double_sptr"; +- //input_types_[3] = "unsigned"; +- //input_types_[4] = "unsigned"; +- +- // process has 2 outputs: +- // output[0]: rendered image +- // output[0]: mask +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- output_types_[1] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_change_probability_process(bprb_func_process& pro) +-{ +- using namespace boxm_change_probability_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vil_image_view_base_sptr input_img_ptr=pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- +- unsigned ni=input_img_ptr->ni(); +- unsigned nj=input_img_ptr->nj(); +- vil_image_view_base_sptr img; +- vil_image_view_base_sptr img_mask; +- +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- vil_image_view mask(ni,nj,1); +- vil_image_view expected(ni,nj,1); +- +- auto *img_byte +- = dynamic_cast*>(input_img_ptr.ptr()); +- vil_image_view::obs_datatype> img_in(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img_in, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_change_prob_rt >(*scene,img_in, camera, expected, mask); +- img_mask = new vil_image_view(mask); +- img = new vil_image_view(expected); +- } +- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- vil_image_view mask(ni,nj,1); +- vil_image_view expected(ni,nj,1); +- auto *img_byte +- = dynamic_cast*>(input_img_ptr.ptr()); +- vil_image_view::obs_datatype> img_in(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img_in, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_change_prob_rt >(*scene,img_in, camera, expected, mask); +- img_mask = new vil_image_view(mask); +- img = new vil_image_view(expected); +- } +- else { +- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl; +- return false; +- } +- +- unsigned j = 0; +- pro.set_output_val(j++, img); +- pro.set_output_val(j++, img_mask); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx +deleted file mode 100644 +index 1593ab6590..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx ++++ /dev/null +@@ -1,280 +0,0 @@ +-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for updating a boxm_scene with a set of edge images +-// \author Gamze Tunali +-// \date Jan, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_edge_update_process_globals +-{ +- constexpr unsigned int n_inputs_ = 6; +- constexpr unsigned int n_outputs_ = 0; +- //Define parameters here +-} +- +- +-//: set input and output types +-bool boxm_edge_update_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_edge_update_process_globals; +- +- // process takes 6 inputs: +- //input[0]: The scene +- //input[1]: Image list filename +- //input[2]: Use ransac? +- //input[3]: consensus cnt, param of ransac algo, value depends on number of training images +- // unless planes from this number of images agree at a voxel on a hypothesis, a 3D edge won't be formed, +- // there should be at least this number of training images during the update for any kind of consensus to be met at any voxel +- // (if consensus cnt < training img cnt --> edge world will be empty) +- //input[4]: orthogonality threshold, a good value 0.01, param of ransac algo, would see more 3D edges as this value gets bigger, but they would be less and less good +- //input[5]: volume ratio denominator: a good value 128 , param of ransac algo, would see more 3D edges as this value gets bigger, but they would be less and less good +- // algo checks whether a current plane is within cell_volume/denominator radius of current hypothesis +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "bool"; +- input_types_[3] = "int"; +- input_types_[4] = "float"; +- input_types_[5] = "float"; +- // process has 0 outputs: +- std::vector output_types_(n_outputs_); +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool boxm_edge_update_process(bprb_func_process& pro) +-{ +- using namespace boxm_edge_update_process_globals; +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the parameters +- // (none) +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string image_list_fname = pro.get_input(1); +- bool use_ransac=pro.get_input(2); +- int consensus_cnt = pro.get_input(3); +- auto ortho_thres = pro.get_input(4); +- auto vol_ratio = pro.get_input(5); +- +- // extract list of image_ids from file +- std::ifstream ifs(image_list_fname.c_str()); +- if (!ifs.good()) { +- std::cerr << "error opening file " << image_list_fname << '\n'; +- return false; +- } +- std::vector image_ids; +- unsigned int n_images = 0; +- ifs >> n_images; +- std::cout << "using image ids: "; +- for (unsigned int i=0; i> img_id; +- std::cout << img_id << std::endl; +- image_ids.push_back(img_id); +- std::cout << img_id << ' '; +- } +- ifs.close(); +- std::cout << std::endl; +- +- if (scene_base->appearence_model() == BOXM_EDGE_FLOAT) { +- std::cout << "appearance model EDGE_FLOAT\n"; +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_edge_updater updater(*scene, image_ids); +- updater.add_cells(); +- } +- if (scene_base->appearence_model() == BOXM_EDGE_LINE) { +- std::cout << "appearance model EDGE_LINE\n"; +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- +- boxm_edge_tangent_updater updater(*scene, image_ids, use_ransac, ortho_thres, vol_ratio, consensus_cnt); +- updater.add_cells(); +- } +- //store output +- // (none) +- +- return true; +-} +- +-//: set input and output types +-bool boxm_edge_refine_updates_process_cons(bprb_func_process& pro) +-{ +- // process takes 3 inputs: +- //input[0]: The scene +- //input[1]: Image list filename +- //input[2]: camera list filename +- //input[3]: consensus cnt, +- std::vector input_types_(4); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "int"; +- // process has 0 outputs: +- std::vector output_types_(0); +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool boxm_edge_refine_updates_process(bprb_func_process& pro) +-{ +- using namespace boxm_edge_update_process_globals; +- +- // check number of inputs +- if (pro.n_inputs() != 4) +- { +- std::cout << pro.name() << "The number of inputs should be " << 4 << std::endl; +- return false; +- } +- +- // get the parameters +- // (none) +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string image_list_fname = pro.get_input(1); +- std::string cam_list_fname = pro.get_input(2); +- int consensus_cnt = pro.get_input(3); +- +- // extract list of image_ids from file +- std::ifstream ifs(image_list_fname.c_str()); +- if (!ifs.good()) { +- std::cerr << "error opening file " << image_list_fname << '\n'; +- return false; +- } +- std::vector > images; +- unsigned int n_images = 0; +- ifs >> n_images; +- std::cout << "using image ids: "; +- for (unsigned int i=0; i> img_id; +- std::cout << "loading: " << img_id << std::endl; +- +- vil_image_view_base_sptr loaded_image = vil_load(img_id.c_str() ); +- if ( !loaded_image || loaded_image->pixel_format() != VIL_PIXEL_FORMAT_FLOAT) { +- std::cerr << "Failed to load image file: " << img_id << " or format is not FLOAT img!\n"; +- return false; +- } +- vil_image_view img(loaded_image); +- images.push_back(img); +- } +- ifs.close(); +- +- // extract list of image_ids from file +- std::ifstream ifsc(cam_list_fname.c_str()); +- if (!ifsc.good()) { +- std::cerr << "error opening file " << cam_list_fname << '\n'; +- return false; +- } +- +- std::vector cameras; +- unsigned int n_cameras = 0; +- ifsc >> n_cameras; +- if (n_cameras != n_images) { +- std::cerr << "camera file and image file do not contain equal numbers of items!\n"; +- return false; +- } +- +- std::cout << "using cameras: "; +- for (unsigned int i=0; i> img_id; +- std::cout << "loading camera: " << img_id << std::endl; +- +- vpgl_camera_double_sptr ratcam = read_local_rational_camera(img_id); +- if ( !ratcam.as_pointer() ) { +- std::cerr << "Rational camera isn't local... trying global\n"; +- ratcam = read_rational_camera(img_id); +- if ( !ratcam.as_pointer() ) { +- std::cout << " camera: " << img_id << " is not local or global rational camera, not supporting any other type for now!\n"; +- return false; +- } +- } +- +- cameras.push_back(ratcam); +- } +- ifsc.close(); +- std::cout << std::endl; +- +- if (scene_base->appearence_model() == BOXM_EDGE_FLOAT) { +- std::cout << "appearance model EDGE_FLOAT\n"; +- std::cerr << "this process is not defined for this type of scene!\n"; +- return false; +- } +- if (scene_base->appearence_model() == BOXM_EDGE_LINE) { +- std::cout << "appearance model EDGE_LINE\n"; +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- +- boxm_edge_tangent_refine_updates refiner(*scene, consensus_cnt, images, cameras); +- refiner.refine_cells(); +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx +deleted file mode 100644 +index d1010864dd..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx ++++ /dev/null +@@ -1,199 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-#include +- +-//: globals +-namespace boxm_estimate_camera_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 3; +- +- // parameter strings +- const std::string theta_range_ = "theta_range"; +- const std::string theta_step_ = "theta_step"; +- const std::string phi_range_ = "phi_range"; +- const std::string phi_step_ = "phi_step"; +- const std::string rot_range_ = "rot_range"; +- const std::string rot_step_ = "rot_step"; +- const std::string max_iter_rot_angle_ = "max_iter_rot_angle"; +- const std::string max_iter_cam_center_ = "max_iter_cam_center"; +-} +- +-//: set input and output types +-bool boxm_estimate_camera_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_estimate_camera_process_globals; +- +- // process takes 3 inputs: +- //input[0]: The scene +- //input[1]: Initial camera +- //input[2]: Edge image +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "vpgl_camera_double_sptr"; +- input_types_[i++] = "vil_image_view_base_sptr"; +- if (!pro.set_input_types(input_types_)) +- return false; +- +- // process has 3 outputs: +- // output[0]: The optimized camera +- // output[1]: Expected edge image (after camera correction) +- // output[2]: Expected edge image (before camera correction) +- +- std::vector output_types_(n_outputs_); +- unsigned j = 0; +- output_types_[j++] = "vpgl_camera_double_sptr"; +- output_types_[j++] = "vil_image_view_base_sptr"; +- output_types_[j++] = "vil_image_view_base_sptr"; +- return pro.set_output_types(output_types_); +-} +- +-//: optimizes camera parameters based on edges +-bool boxm_estimate_camera_process(bprb_func_process& pro) +-{ +- using namespace boxm_estimate_camera_process_globals; +- +- //check number of inputs +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- // get the inputs +- unsigned i = 0; +- +- // scene +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- +- // camera +- vpgl_camera_double_sptr cam_inp = pro.get_input(i++); +- auto *cam_init = dynamic_cast*>(cam_inp.ptr()); +- +- // image +- vil_image_view_base_sptr img_e_sptr = pro.get_input(i++); +- vil_image_view img_e_vb(img_e_sptr); +- +- vil_image_view img_e; +- brip_vil_float_ops::normalize_to_interval(img_e_vb,img_e,0.0f,1.0f); +- +- unsigned ni = img_e.ni(); +- unsigned nj = img_e.nj(); +- +- double deg2rad = vnl_math::pi_over_180; +- +- // parameters are in degrees +- double theta_range = 12.0, theta_step = 0.05, phi_range = 12.0, phi_step = 0.05, rot_range = 10.0, rot_step = 1.0; +- int max_iter_rot_angle = 5, max_iter_cam_center = 50; +- +- pro.parameters()->get_value(theta_range_, theta_range); +- pro.parameters()->get_value(theta_step_, theta_step); +- pro.parameters()->get_value(phi_range_, phi_range); +- pro.parameters()->get_value(phi_step_, phi_step); +- pro.parameters()->get_value(rot_range_, rot_range); +- pro.parameters()->get_value(rot_step_, rot_step); +- pro.parameters()->get_value(max_iter_rot_angle_, max_iter_rot_angle); +- pro.parameters()->get_value(max_iter_cam_center_, max_iter_cam_center); +- +-#if 0 +- std::cout << "printing boxm_estimate_camera_process parameters:\n" +- << "theta_range: " << theta_range << '\n' +- << "theta_step: " << theta_step << '\n' +- << "phi_range: " << phi_range << '\n' +- << "phi_step: " << phi_step << '\n' +- << "rot_range: " << rot_range << '\n' +- << "rot_step: " << rot_step << '\n' +- << "max_iter_rot_angle: " << max_iter_rot_angle << '\n' +- << "max_iter_cam_center: " << max_iter_cam_center << '\n'; +-#endif +- +- // change the parameters into radians +- theta_range *= deg2rad; theta_step *= deg2rad; phi_range *= deg2rad; phi_step *= deg2rad; rot_range *= deg2rad; rot_step *= deg2rad; +- +- auto *img_eei = new vil_image_view(ni,nj,1); +- img_eei->fill(0.0f); +- +- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- if (!scene) { +- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n"; +- return false; +- } +- +- // create the functor that finds edges +- typedef boxm_expected_edge_functor > func_type; +- func_type func(*scene); +- bpgl_camera_estimator cam_estimator(func); +- cam_estimator.set_estimation_params(theta_range,theta_step,phi_range,phi_step,rot_range,rot_step,max_iter_rot_angle); +- +- func.apply(cam_inp,img_eei); +- +- auto *img_eei_before_correction = new vil_image_view(ni,nj,1); +- brip_vil_float_ops::normalize_to_interval(*img_eei,*img_eei_before_correction,0.0f,255.0f); +- +- bpgl_camera_estimator_amoeba cost_ftn(cam_estimator,img_e,cam_inp); +- vnl_vector x(2,1.0); +- vnl_amoeba amoeba(cost_ftn); +- amoeba.verbose = 1; +- amoeba.default_verbose = true; +- amoeba.set_relative_diameter(3.0); +- amoeba.set_max_iterations(max_iter_cam_center); +- amoeba.minimize(x); +- auto *cam_est = new vpgl_perspective_camera(*cam_init); +- cost_ftn.get_result(x,cam_est); +- +- vpgl_camera_double_sptr cam_ptr = new vpgl_perspective_camera(*cam_est); +- func.apply(cam_ptr,img_eei); +- +- auto *img_eei_vb = new vil_image_view(ni,nj,1); +- brip_vil_float_ops::normalize_to_interval(*img_eei,*img_eei_vb,0.0f,255.0f); +- +- delete cam_est; +- delete img_eei; +- +- // output +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, cam_ptr); +- // update the edge image after update and store +- pro.set_output_val(j++, img_eei_vb); +- // update the edge image before update and store +- pro.set_output_val(j++, img_eei_before_correction); +- +- return true; +- } +- else +- { +- std::cerr << "boxm_estimate_camera_process: Multibin version not yet implemented\n"; +- return false; +- } +- } +- else { +- std::cerr << "boxm_estimate_camera_process: undefined APM type\n"; +- return false; +- } +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx +deleted file mode 100644 +index bb10974eef..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx ++++ /dev/null +@@ -1,139 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx +-//: +-// \file +-// \brief Process to update the scene from an image and camera pair +-// +-// \author Gamze Tunali +-// \date Sep 15, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#include +- +-namespace boxm_generate_edge_samples_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_generate_edge_samples_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_generate_edge_samples_process_globals; +- +- //process takes 5 inputs +- //input[0]: The cropped edge image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: image name for saving scene +- //input[4]: n_normal +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "float"; +- +- //output +- unsigned j = 0; +- std::vector output_types_(n_outputs_); +- output_types_[j++] = "float"; // new n_normal value +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_generate_edge_samples_process(bprb_func_process& pro) +-{ +- using namespace boxm_generate_edge_samples_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << "boxm_generate_edge_samples_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr edge_image = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- std::string img_name = pro.get_input(i++); +- auto n_normal = pro.get_input(i++); +- +- // get parameters +- int edge_prob_mask_size = 21; +- pro.parameters()->get_value("edge_prob_mask_size",edge_prob_mask_size); +- float edge_prob_mask_sigma = 1.0f; +- pro.parameters()->get_value("edge_prob_mask_sigma",edge_prob_mask_sigma); +- +- // check the input validity +- if ((edge_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_generate_edge_samples_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- float new_n_normal=0.0; +- +- +- if (scene->appearence_model() == BOXM_EDGE_FLOAT) { +- vil_image_view edge_prob_image; +- sdet_img_edge::estimate_edge_prob_image(edge_image, edge_prob_image, edge_prob_mask_size, edge_prob_mask_sigma); +- float edge_prob_image_mean; +- vil_math_mean(edge_prob_image_mean,edge_prob_image,0); +- vil_image_view img(edge_prob_image); +- new_n_normal = n_normal + edge_prob_image_mean; +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_edge_sample_rt > (*s, camera, img, img_name); +- } +- else +- { +- std::cout<<"boxm_generate_edge_samples_process: Multibin -- Not yet implemented"<appearence_model() == BOXM_EDGE_LINE) { +- // get the edges as an image with 3 planes (a,b,c) +- if (!scene->multi_bin()) +- { +- typedef boxm_inf_line_sample sample_type; +- typedef boct_tree tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- // for this case, the image should be with 4 planes, representing plane definitions +- vil_image_view img(edge_image); +- boxm_generate_edge_tangent_sample_rt (*s, camera, img, img_name); +- } +- else +- { +- std::cout<<"boxm_generate_edge_samples_process: Multibin -- Not yet implemented"<(0, float(new_n_normal)); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx +deleted file mode 100644 +index 06261e8d44..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx ++++ /dev/null +@@ -1,142 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx +-//: +-// \file +-// \brief Process to generate samples needed for boxm_opt2_optimizer_process from a given image/camera pair +-// +-// \author Daniel Crispell +-// \date Feb 17, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_generate_opt2_samples_process_globals +-{ +- constexpr unsigned n_inputs_ = 7; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_generate_opt2_samples_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt2_samples_process_globals; +- +- // process takes 7 inputs and no output +- //input[0]: The observation image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: image name for saving scene +- //input[4]: shadow prior +- //input[5]: shadow sigma +- //input[6]: use black background +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "float"; +- input_types_[5] = "float"; +- input_types_[6] = "bool"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_generate_opt2_samples_process(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt2_samples_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_generate_opt2_samples_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- vil_image_view_base_sptr input_image = pro.get_input(0); +- vpgl_camera_double_sptr camera = pro.get_input(1); +- boxm_scene_base_sptr scene = pro.get_input(2); +- std::string img_name = pro.get_input(3); // TODO - unused!! +- auto shadow_prior = pro.get_input(4); +- auto shadow_sigma = pro.get_input(5); +- bool use_black_background = pro.get_input(6); +- +- // check the input validity +- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_generate_opt2_samples_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- switch (scene->appearence_model()) +- { +- case BOXM_APM_SIMPLE_GREY: +- { +- auto *img_byte = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- // create alternate appearance models +- std::vector alt_appearance_priors; +- std::vector::apm_datatype> alt_appearance_models; +- if (shadow_prior > 0.0f) { +- boxm_apm_traits::apm_datatype shadow_model(0.0f, shadow_sigma); +- alt_appearance_priors.push_back(shadow_prior); +- alt_appearance_models.push_back(shadow_model); +- } +- if (!scene->multi_bin()) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_opt2_samples, BOXM_AUX_OPT2_GREY >(*s, camera, img, img_name, alt_appearance_priors, alt_appearance_models, use_black_background); +- } +- else { +- std::cerr << "error: multi-bin scenes not supported\n"; +- } +- break; +- } +- case BOXM_APM_MOG_GREY: +- { +- auto *img_byte = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- // create alternate appearance models +- std::vector alt_appearance_priors; +- std::vector::apm_datatype> alt_appearance_models; +- if (shadow_prior > 0.0f) { +- boxm_apm_traits::apm_datatype shadow_model; +- // insert a single mode with mean at 0 +- bsta_gauss_sf1 single_mode(0.0f, shadow_sigma*shadow_sigma); +- shadow_model.insert(bsta_num_obs(single_mode), 1.0f); +- alt_appearance_priors.push_back(shadow_prior); +- alt_appearance_models.push_back(shadow_model); +- } +- if (!scene->multi_bin()) { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_opt2_samples, BOXM_AUX_OPT2_GREY >(*s, camera, img, img_name, alt_appearance_priors, alt_appearance_models, use_black_background); +- } +- else { +- std::cerr << "error: multi-bin scenes not supported\n"; +- } +- break; +- } +- default: +- std::cout << "boxm_generate_opt2_samples_process: unsupported APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx +deleted file mode 100644 +index 0eb591c79c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx ++++ /dev/null +@@ -1,114 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx +-//: +-// \file +-// \brief Process to generate samples needed for boxm_opt3_optimizer_process from a given image/camera pair +-// +-// \author Daniel Crispell +-// \date Feb 17, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_generate_opt3_samples_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_generate_opt3_samples_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt3_samples_process_globals; +- +- // process takes 5 inputs and no output +- //input[0]: The observation image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: image name for saving scene +- //input[4]: use black background +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "bool"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_generate_opt3_samples_process(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt3_samples_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_generate_opt3_samples_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr input_image = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- std::string img_name = pro.get_input(i++); // TODO - unused!! +- bool use_black_background = pro.get_input(i++); +- +- // check the input validity +- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_generate_opt3_samples_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- switch (scene->appearence_model()) +- { +- case BOXM_APM_SIMPLE_GREY: +- { +- auto *img_byte = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_opt3_sample, BOXM_AUX_OPT3_MOG_GREY>(*s, camera,img, img_name, use_black_background); +- } +- break; +- } +- case BOXM_APM_MOG_GREY: +- { +- auto *img_byte = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_opt3_sample, BOXM_AUX_OPT3_MOG_GREY>(*s, camera,img, img_name, use_black_background); +- } +- break; +- } +- default: +- std::cout << "boxm_generate_opt3_samples_process: unsupported APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx +deleted file mode 100644 +index fac0d9d3ae..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx ++++ /dev/null +@@ -1,102 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx +-//: +-// \file +-// \brief Process to update the scene from an image and camera pair +-// +-// \author Gamze Tunali +-// \date Sep 15, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_generate_opt_samples_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_generate_opt_samples_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt_samples_process_globals; +- +- // process takes 5 inputs and no output +- //input[0]: The observation image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: image name for saving scene +- //input[4]: use black background +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "bool"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_generate_opt_samples_process(bprb_func_process& pro) +-{ +- using namespace boxm_generate_opt_samples_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_generate_opt_samples_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr input_image = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- std::string img_name = pro.get_input(i++); // TODO - unused!! +- bool use_black_background = pro.get_input(i++); +- +- // check the input validity +- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_generate_opt_samples_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- auto *img_byte +- = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_generate_opt_sample_rt(*s, camera,img,img_name,use_black_background); +- } +- else +- { +- std::cout<<"Not yet implemented"< +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for updating a boxm_scene with a set of images. No damping parameter is required +-// \author Daniel Crispell +-// \date February 17, 2010 +-// +-// \verbatim +-// Modifications +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +- +-namespace boxm_opt2_update_process_globals +-{ +- constexpr unsigned int n_inputs_ = 2; +- constexpr unsigned int n_outputs_ = 0; +- //Define parameters here +-} +- +- +-//: set input and output types +-bool boxm_opt2_update_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_opt2_update_process_globals; +- +- // process takes 2 inputs: +- //input[0]: The scene +- //input[1]: The filename of the text file containing list of image names +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- +- // process has 0 outputs: +- std::vector output_types_(n_outputs_); +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool boxm_opt2_update_process(bprb_func_process& pro) +-{ +- using namespace boxm_opt2_update_process_globals; +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the parameters +- // (none) +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- boxm_apm_type apm_type = scene_base->appearence_model(); +- +- std::string image_list_fname = pro.get_input(1); +- +- // extract list of image_ids from file +- std::ifstream ifs(image_list_fname.c_str()); +- if (!ifs.good()) { +- std::cerr << "error opening file " << image_list_fname << '\n'; +- return false; +- } +- std::vector image_ids; +- unsigned int n_images = 0; +- ifs >> n_images; +- for (unsigned int i=0; i> img_id; +- image_ids.push_back(img_id); +- } +- ifs.close(); +- +- switch (apm_type) +- { +- case BOXM_APM_SIMPLE_GREY: +- { +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt2_optimizer optimizer(*scene, image_ids); +- optimizer.update(); +- +- break; +- } +- case BOXM_APM_MOG_GREY: +- { +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt2_optimizer optimizer(*scene, image_ids); +- optimizer.update(); +- +- break; +- } +-#if 0 // commented out +- case BOXM_APM_SIMPLE_RGB: +- { +- boxm_scene *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt_rt_bayesian_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(damping_factor); +- +- break; +- } +-#endif // 0 +- default: +- std::cerr << "error - boxm_opt2_update_process: unsupported appearance model type " << apm_type << '\n'; +- return false; +- } +- +- //store output +- // (none) +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx +deleted file mode 100644 +index 47f40dd19a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx ++++ /dev/null +@@ -1,153 +0,0 @@ +-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for updating a boxm_scene with a set of images. No damping parameter is required +-// \author Daniel Crispell +-// \date February 17, 2010 +-// +-// \verbatim +-// Modifications +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +- +-namespace boxm_opt3_update_process_globals +-{ +- constexpr unsigned int n_inputs_ = 2; +- constexpr unsigned int n_outputs_ = 0; +- //Define parameters here +-} +- +- +-//: set input and output types +-bool boxm_opt3_update_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_opt3_update_process_globals; +- +- // process takes 2 inputs: +- //input[0]: The scene +- //input[1]: The filename of the text file containing list of image names +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- +- // process has 0 outputs: +- std::vector output_types_(n_outputs_); +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool boxm_opt3_update_process(bprb_func_process& pro) +-{ +- using namespace boxm_opt3_update_process_globals; +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the parameters +- // (none) +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- boxm_apm_type apm_type = scene_base->appearence_model(); +- +- std::string image_list_fname = pro.get_input(1); +- +- // extract list of image_ids from file +- std::ifstream ifs(image_list_fname.c_str()); +- if (!ifs.good()) { +- std::cerr << "error opening file " << image_list_fname << '\n'; +- return false; +- } +- std::vector image_ids; +- unsigned int n_images = 0; +- ifs >> n_images; +- for (unsigned int i=0; i> img_id; +- image_ids.push_back(img_id); +- } +- ifs.close(); +- +- switch (apm_type) +- { +- case BOXM_APM_SIMPLE_GREY: +- { +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt3_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(); +- +- break; +- } +- case BOXM_APM_MOG_GREY: +- { +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt3_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(); +- +- break; +- } +-#if 0 // commented out +- case BOXM_APM_SIMPLE_RGB: +- { +- boxm_scene *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt_rt_bayesian_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(damping_factor); +- +- break; +- } +-#endif // 0 +- default: +- std::cerr << "error - boxm_opt3_update_process: unsupported appearance model type " << apm_type << '\n'; +- return false; +- } +- +- //store output +- // (none) +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx +deleted file mode 100644 +index 56d4d9051d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx ++++ /dev/null +@@ -1,145 +0,0 @@ +-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for updating a boxm_scene with a set of images, using a damped version of Bayes' rule +-// \author Daniel Crispell +-// \date April 2, 2009 +-// +-// \verbatim +-// Modifications +-// Aug 3, 2009 Gamze Tunali - Moved from lemsvxl/psm_opt to vxl +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +- +-namespace boxm_opt_bayesian_update_process_globals +-{ +- constexpr unsigned int n_inputs_ = 3; +- constexpr unsigned int n_outputs_ = 0; +- //Define parameters here +-} +- +- +-//: set input and output types +-bool boxm_opt_bayesian_update_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_opt_bayesian_update_process_globals; +- +- // process takes 3 inputs: +- //input[0]: The scene +- //input[1]: The damping value +- //input[2]: The filename of the text file containing list of image names +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "float"; +- input_types_[2] = "vcl_string"; +- +- // process has 0 outputs: +- std::vector output_types_(n_outputs_); +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool boxm_opt_bayesian_update_process(bprb_func_process& pro) +-{ +- using namespace boxm_opt_bayesian_update_process_globals; +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the parameters +- // (none) +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- boxm_apm_type apm_type = scene_base->appearence_model(); +- +- auto damping_factor = pro.get_input(1); +- +- std::string image_list_fname = pro.get_input(2); +- +- // extract list of image_ids from file +- std::ifstream ifs(image_list_fname.c_str()); +- if (!ifs.good()) { +- std::cerr << "error opening file " << image_list_fname << std::endl; +- return false; +- } +- std::vector image_ids; +- unsigned int n_images = 0; +- ifs >> n_images; +- for (unsigned int i=0; i> img_id; +- image_ids.push_back(img_id); +- } +- ifs.close(); +- +- switch (apm_type) +- { +- case BOXM_APM_SIMPLE_GREY: +- { +- typedef boct_tree > tree_type; +- auto *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt_rt_bayesian_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(damping_factor); +- +- break; +- } +-#if 0 // commented out +- case BOXM_APM_SIMPLE_RGB: +- { +- boxm_scene *scene = dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- boxm_opt_rt_bayesian_optimizer optimizer(*scene, image_ids); +- optimizer.optimize_cells(damping_factor); +- +- break; +- } +-#endif // 0 +- default: +- std::cerr << "error - boxm_opt_bayesian_update_process: unsupported appearance model type " << apm_type << std::endl; +- return false; +- } +- +- //store output +- // (none) +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx +deleted file mode 100644 +index 5507b5b55b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx ++++ /dev/null +@@ -1,107 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx +-#include +-//: +-// \file +-// \brief A process for describing the attributes of a scene +-// +-// \author J.L. Mundy +-// \date January 24, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_ray_statistics_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_ray_statistics_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_ray_statistics_process_globals; +- +- //process takes 2 input +- //input[0]: scene binary file +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; //ni +- input_types_[3] = "unsigned"; //nj +- +- // process has 1 output: +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bsta_histogram_sptr"; // No of rays per cell Histogram +- //output_types_[1] = "bsta_histogram_sptr"; // Sigma Histogram +- //output_types_[2] = "bsta_histogram_sptr"; // Level Histogram +- //output_types_[3] = "unsigned"; // Number of leaves +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//: This process produces one output: +-// * The distribution of "Omega" values where Omega = 1-e^( alpha x length ) +-// The following three outputs are no longer present: +-// * The distribution of "Sigma" values where Sigma is the std_dev of +-// the appearance model. (currently implemented only for simple grey) +-// * The histogram of levels for leaves in the octree +-// * The number of leaves in the tree +-// +-bool boxm_ray_statistics_process(bprb_func_process& pro) +-{ +- using namespace boxm_ray_statistics_process_globals; +- +- if ( !pro.verify_inputs() ) { +- std::cerr << pro.name() << ": invalid inputs\n"; +- return false; +- } +- // assign tree type +- boxm_scene_base_sptr scene_ptr = pro.get_input(0); +- vpgl_camera_double_sptr cam_ptr = pro.get_input(1); +- auto ni = pro.get_input(2); +- auto nj = pro.get_input(3); +- +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = dynamic_cast *> (scene_ptr.as_pointer()); +- +- bsta_histogram num_rays_hist; +- if (!compute_ray_statistics >(*scene, cam_ptr,num_rays_hist,ni,nj)) +- return false; +- pro.set_output_val(0, new bsta_histogram(num_rays_hist)); } +- else +- { +- std::cerr<<"boxm_ray_statistics_process not yet implemented for multi-bin/Gaussian mixture\n"; +- return false; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) +- { +- if (!scene_ptr->multi_bin()) { +- typedef boct_tree > tree_type; +- auto* scene = dynamic_cast *> (scene_ptr.as_pointer()); +- +- bsta_histogram num_rays_hist; +- if (!compute_ray_statistics >(*scene, cam_ptr,num_rays_hist,ni,nj)) +- return false; +- pro.set_output_val(0, new bsta_histogram(num_rays_hist)); +- } +- else { +- std::cerr<<"boxm_ray_statistics_process not yet implemented for multi-bin/simple_grey\n"; +- return false; +- } +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx +deleted file mode 100644 +index 5af8acd7f8..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx ++++ /dev/null +@@ -1,114 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for obtaining expected depth map for the world +-// +-// \author Vishal Jain +-// \date Aug 26, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_render_expected_depth_rt_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 2; +-} +- +-bool boxm_render_expected_depth_rt_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_depth_rt_process_globals; +- +- //process takes 4 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- +- // process has 2 outputs: +- // output[0]: rendered image +- // output[0]: mask +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- output_types_[1] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_render_expected_depth_rt_process(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_depth_rt_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- auto ni = pro.get_input(i++); +- auto nj = pro.get_input(i++); +- vil_image_view_base_sptr img; +- vil_image_view_base_sptr img_mask; +- +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- vil_image_view mask(ni,nj,1); +- vil_image_view expected(ni,nj,1); +- +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_depth_rt >(*scene, camera, expected, mask); +- img_mask = new vil_image_view(mask); +- img = new vil_image_view(expected); +- } else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) { +- vil_image_view mask(ni,nj,1); +- vil_image_view expected(ni,nj,1); +- +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_depth_rt >(*scene, camera, expected, mask); +- img_mask = new vil_image_view(mask); +- img = new vil_image_view(expected); +- } else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- vil_image_view mask(ni,nj,1); +- vil_image_view expected(ni,nj,1); +- +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_depth_rt >(*scene, camera, expected, mask); +- img_mask = new vil_image_view(mask); +- img = new vil_image_view(expected); +- } else { +- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl; +- return false; +- } +- +- unsigned j = 0; +- pro.set_output_val(j++, img); +- pro.set_output_val(j++, img_mask); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx +deleted file mode 100644 +index 74ee8c9a88..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx ++++ /dev/null +@@ -1,162 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for obtaining roc curve from change detection results. +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-namespace boxm_render_expected_edge_process_globals +-{ +- constexpr unsigned n_inputs_ = 7; +- constexpr unsigned n_outputs_ = 2; +-} +- +-bool boxm_render_expected_edge_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_edge_process_globals; +- +- //process takes 7 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- //input[4]: n_normal +- //input[5]: num samples used for update +- //input[6]: Threshold for edges +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "float"; +- input_types_[5] = "unsigned"; +- input_types_[6] = "float"; +- +- // process has 2 outputs: +- // output[0]: rendered image +- // output[1]: mask +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- output_types_[1] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_render_expected_edge_process(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_edge_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cerr << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- auto ni = pro.get_input(i++); +- auto nj = pro.get_input(i++); +- auto n_normal = pro.get_input(i++); +- // number of updates +- auto num_updates = pro.get_input(i++); +- //float threshold = pro.get_input(i++); // FIXME: unused; see line 138 +- vil_image_view_base_sptr img; +- vil_image_view_base_sptr img_mask; +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) { +- vil_image_view::obs_datatype> expected(ni,nj); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- if (!scene) { +- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n"; +- return false; +- } +- boxm_render_edge_image_rt >(*scene, camera, expected, mask,n_normal,num_updates); +- } +- else +- { +- std::cerr << "Ray tracing version not yet implemented\n"; +- return false; +- } +- img_mask = new vil_image_view(mask); +- +- auto *expected_byte = new vil_image_view(ni,nj,expected.nplanes()); +- for (unsigned i=0; i(255.0*(expected(i,j))); +- } +- } +- img = expected_byte; +- img_mask = new vil_image_view(mask); +- +- auto *ex = new vil_image_view(ni,nj,expected.nplanes()); +- for (unsigned i=0; i(255.0*(expected(i,j))); +- } +- } +- img = ex; +- unsigned j = 0; +- pro.set_output_val(j++, img); +- pro.set_output_val(j++, img_mask); +- return true; +- } +- +- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) { +- vil_image_view expected(ni,nj,1); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- if (!scene) { +- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n"; +- return false; +- } +- boxm_render_edge_tangent_image_rt >(*scene, camera, expected);//, n_normal,num_updates, threshold); +- +- auto *edge_image=new vil_image_view(ni,nj,1); +- *edge_image=expected; +- +- unsigned j = 0; +- pro.set_output_val(j++,edge_image); +- pro.set_output_val(j++,edge_image); +- return true; +- } +- else +- { +- std::cerr << "Ray tracing version not yet implemented\n"; +- return false; +- } +- } +- else { +- std::cerr << "boxm_render_expected_edge_process: undefined APM type\n"; +- return false; +- } +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx +deleted file mode 100644 +index f92621784d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx ++++ /dev/null +@@ -1,143 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A class for rendering an expected image of a given scene and camera. +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-namespace boxm_render_expected_rt_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 2; +-} +- +-bool boxm_render_expected_rt_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_rt_process_globals; +- +- //process takes 5 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- //input[4]: black background? +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "bool"; +- +- // process has 2 outputs: +- // output[0]: rendered image +- // output[0]: mask +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- output_types_[1] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_render_expected_rt_process(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_rt_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- auto ni = pro.get_input(i++); +- auto nj = pro.get_input(i++); +- bool use_black_background = pro.get_input(i++); +- +- vil_image_view_base_sptr img; +- vil_image_view_base_sptr img_mask; +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- vil_image_view::obs_datatype> expected(ni,nj); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_image_rt >(*scene, camera, expected, mask,-1,use_black_background); +- } +- else +- { +- std::cout<<"Ray tracing version not yet implemented"<(mask); +- +- auto *expected_byte = new vil_image_view(expected.ni(),expected.nj(),expected.nplanes()); +- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f); +- img = expected_byte; +- } else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- vil_image_view::obs_datatype> expected(ni,nj); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_image_rt >(*scene, camera, expected, mask,-1,use_black_background); +- } +- else +- { +- std::cout<<"Ray tracing version not yet implemented"<::obs_datatype>(expected); +- img_mask = new vil_image_view(mask); +- +- auto *expected_byte = new vil_image_view(expected.ni(),expected.nj(),expected.nplanes()); +- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f); +- img = expected_byte; +- } else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) { +- vil_image_view::obs_datatype> expected(ni,nj); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_image_rt >(*scene, camera, expected, mask,-1,use_black_background); +- } +- img_mask = new vil_image_view(mask); +- +- auto *expected_byte = new vil_image_view(expected.ni(),expected.nj(),expected.nplanes()); +- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f); +- img = expected_byte; +- } else { +- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl; +- return false; +- } +- +- unsigned j = 0; +- pro.set_output_val(j++, img); +- pro.set_output_val(j++, img_mask); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx +deleted file mode 100644 +index b3c1ee031e..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx ++++ /dev/null +@@ -1,119 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for registering the RPC camera based on the edges in the world +-// \author Gamze Tunali +-// \date Feb 1st, 2010 +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//: globals +-namespace boxm_rpc_registration_process_globals +-{ +- constexpr unsigned n_inputs_ = 8; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: set input and output types +-bool boxm_rpc_registration_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_rpc_registration_process_globals; +- +- // process takes 8 inputs: +- // input[0]: The scene +- // input[1]: The current camera +- // input[2]: The current edge image +- // input[3]: The expected edge image +- // input[4]: The flag indicating whether to align the 3D voxel world along with image +- // input[5]: Uncertainty in meters +- // input[6]: n_normal +- // input[7]: num_observation +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "vpgl_camera_double_sptr"; +- input_types_[i++] = "vil_image_view_base_sptr"; +- input_types_[i++] = "vil_image_view_base_sptr"; +- input_types_[i++] = "bool"; +- input_types_[i++] = "float"; +- input_types_[i++] = "float"; +- input_types_[i++] = "unsigned"; +- +- // process has 1 output: +- // output[0]: The optimized camera +- std::vector output_types_(n_outputs_); +- unsigned j = 0; +- output_types_[j++] = "vpgl_camera_double_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//: optimizes rpc camera parameters based on edges +-bool boxm_rpc_registration_process(bprb_func_process& pro) +-{ +- using namespace boxm_rpc_registration_process_globals; +- +- //check number of inputs +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- // get the inputs +- unsigned i = 0; +- +- // scene +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- // camera +- vpgl_camera_double_sptr camera_inp = pro.get_input(i++); +- +- // image +- vil_image_view_base_sptr edge_image_sptr = pro.get_input(i++); +- +- vil_image_view_base_sptr expected_edge_image_sptr = pro.get_input(i++); +- +- // boolean parameter specifying the voxel world alignment state +- bool rpc_shift_3d_flag = pro.get_input(i++); +- +- // uncertainty in meters +- auto uncertainty = pro.get_input(i++); +- +- // n_normal +- auto n_normal = pro.get_input(i++); +- +- // number of observations +- auto num_observation = pro.get_input(i++); +- +- std::string edge_type="subpixel";//pro.get_input(i++); +- +- vpgl_camera_double_sptr camera_out; +- +- if (edge_type=="subpixel") +- { +- vil_image_view expected_edge_image(expected_edge_image_sptr); +- vil_image_view edge_image(edge_image_sptr); +- boxm_rpc_registration >(scene,edge_image,expected_edge_image,camera_inp, camera_out, rpc_shift_3d_flag,uncertainty, num_observation); +- } +- else { +- vil_image_view expected_edge_image(expected_edge_image_sptr); +- vil_image_view edge_image(edge_image_sptr); +- boxm_rpc_registration >(scene,edge_image,expected_edge_image,camera_inp, camera_out, rpc_shift_3d_flag,uncertainty,n_normal, num_observation); +- } +- +- // output +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, camera_out); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx +deleted file mode 100644 +index 128496aee8..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx ++++ /dev/null +@@ -1,136 +0,0 @@ +-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief Process to update the scene from an image and camera pair +-// +-// \author Gamze Tunali +-// \date Apr 21, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include // for BOXM_APM_MOG_GREY +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_update_rt_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_update_rt_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_update_rt_process_globals; +- +- // process takes 5 inputs and no output +- //input[0]: The observation image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: The bin index to be updated +- //input[4]: Use black background? +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "bool"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_update_rt_process(bprb_func_process& pro) +-{ +- using namespace boxm_update_rt_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_update_rt_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr input_image = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- /* unsigned bin_index = */ pro.get_input(i++); +- bool use_black_background = pro.get_input(i++); +- +- // check the input validity +- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_update_rt_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- // Mixture of Gaussians +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- auto *img_byte +- = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_update_image_rt >(*s, camera,img, use_black_background); +- } +- else +- { +- std::cout<<"Not yet implemented"<appearence_model() == BOXM_APM_MOB_GREY) { +- auto *img_byte +- = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_update_image_rt >(*s, camera,img, use_black_background); +- } +- else +- { +- std::cout<<"Not yet implemented"<appearence_model() == BOXM_APM_SIMPLE_GREY) { +- auto *img_byte +- = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_update_image_rt(*s, camera,img, use_black_background); +- } +- else +- { +- std::cout<<"Not yet implemented"< +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt +deleted file mode 100644 +index 73a8978f93..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt ++++ /dev/null +@@ -1,16 +0,0 @@ +-add_executable( boxm_algo_rt_test_all +- test_driver.cxx +- test_bayesian_optimizer.cxx +- test_edges.cxx +- test_shadow_appearance.cxx +- ) +- +-target_link_libraries( boxm_algo_rt_test_all boxm_algo_rt boxm boxm_util boxm_sample boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul) +- +-add_test( NAME boxm_algo_rt_test_bayesian_optimizer COMMAND $ test_bayesian_optimizer ) +-add_test( NAME boxm_algo_rt_test_edges COMMAND $ test_edges ) +-add_test( NAME boxm_algo_rt_test_shadow_appearance COMMAND $ test_shadow_appearance ) +-add_executable( boxm_algo_rt_test_include test_include.cxx ) +-target_link_libraries( boxm_algo_rt_test_include boxm_algo_rt) +-add_executable( boxm_algo_rt_test_template_include test_template_include.cxx ) +-target_link_libraries( boxm_algo_rt_test_template_include boxm_algo_rt) +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx +deleted file mode 100644 +index 5ec14a4181..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx ++++ /dev/null +@@ -1,102 +0,0 @@ +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-static void test_bayesian_optimizer() +-{ +- typedef boxm_sample data_type; +- typedef boxm_rt_sample aux_type; +- +- // create the main scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene > scene(lvcs, origin, block_dim, world_dim); +- scene.set_octree_levels(3,2); +- scene.set_paths("./boxm_scene", "block"); +- scene.set_appearance_model(BOXM_APM_SIMPLE_GREY); +- x_write(std::cout, scene, "scene"); +- vul_file::make_directory("./boxm_scene"); +- scene.write_scene(); +- //vsl_b_ofstream os("scene.bin"); +- //scene.b_write(os); +- //os.close(); +- +- boxm_block_iterator > iter(&scene); +- // default model +- boxm_simple_grey apm(0.3f, 0.4f, 0.5f); +- +- boxm_sample default_sample; +- default_sample.alpha=0.001f; +- default_sample.set_appearance(apm); +- +- // sample 1 +- boxm_sample s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(apm); +- +- // sample 2 +- boxm_sample s2_sample; +- s2_sample.alpha=0.6f; +- s2_sample.set_appearance(apm); +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > * block=scene.get_active_block(); +- boct_tree * tree= block->get_tree();//new boct_tree(3,2); +- boct_tree_cell* cel11=tree->locate_point(vgl_point_3d(0.01,0.01,0.01)); +- cel11->set_data(s2_sample); +- boct_tree_cell* cell2=tree->locate_point(vgl_point_3d(0.51,0.51,0.01)); +- cell2->set_data(s1_sample); +- block->init_tree(tree); +- block->get_tree()->print(); +- scene.write_active_block(); +- iter++; +- } +- +- // create the auxiliary scenes for each image +- std::vector image_names; +- image_names.emplace_back("image1"); +- image_names.emplace_back("image2"); +- image_names.emplace_back("image3"); +- std::vector >*> aux_scenes(image_names.size()); +- +- // create aux scenes +- for (unsigned i=0; i >(scene.lvcs(), scene.origin(), scene.block_dim(), scene.world_dim()); +- aux_scenes[i]->set_path(scene.path(), image_names[i]); +- iter.begin(); +- while (!iter.end()) { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > * block=scene.get_active_block(); +- boct_tree* tree=block->get_tree(); +- boct_tree* aux_tree = tree->clone_to_type(); +- boct_tree_cell* cell1=aux_tree->locate_point(vgl_point_3d(0.01,0.01,0.01)); +- boxm_rt_sample rt; +- rt.seg_len_=1.0; +- cell1->set_data(rt); +- boct_tree_cell* cell2=aux_tree->locate_point(vgl_point_3d(0.51,0.51,0.01)); +- rt.seg_len_=0.5; +- cell2->set_data(rt); +- aux_scenes[i]->set_block(iter.index(), new boxm_block >(block->bounding_box(), aux_tree)); +- aux_scenes[i]->write_active_block(); +- ++iter; +- } +- } +- +- boxm_opt_rt_bayesian_optimizer opt(scene, image_names); +- opt.optimize_cells(0.01); +- +- for (unsigned i=0; i +- +-DECLARE( test_bayesian_optimizer ); +-DECLARE( test_edges ); +-DECLARE( test_shadow_appearance ); +- +-void register_tests() +-{ +- REGISTER( test_bayesian_optimizer ); +- REGISTER( test_edges ); +- REGISTER( test_shadow_appearance ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx +deleted file mode 100644 +index 6f6a62f9c6..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx ++++ /dev/null +@@ -1,26 +0,0 @@ +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-static void test_edges() +-{ +- typedef boxm_inf_line_sample data_type; +- // create the main scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene > scene(lvcs, origin, block_dim, world_dim); +- // create the auxiliary scenes for each image +- std::vector image_names; +- image_names.emplace_back("image1"); +- image_names.emplace_back("image2"); +- image_names.emplace_back("image3"); +- //boxm_edge_tangent_updater u(scene,imgs); +-} +- +-TESTMAIN(test_edges); +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx +deleted file mode 100644 +index 6b1edbffb5..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx ++++ /dev/null +@@ -1,30 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx +deleted file mode 100644 +index f97877bc43..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx ++++ /dev/null +@@ -1,72 +0,0 @@ +-#include +- +-#include +-#include +-#include +-#include +- +-namespace test_shadow_appearance_globals +-{ +- typedef boxm_apm_traits::obs_datatype obs_type; +- typedef boxm_apm_traits::apm_datatype app_type; +-} +- +- +-static void test_shadow_appearance() +-{ +- using namespace test_shadow_appearance_globals; +- //normalized observations square building (I-A)/(mu+ - A), partly in shadow +- double obs_arr[] = {0.600555,0.7,0.061111,0.748335,0.77611,0.68611, +- 0.148889,0.855555,0.664445,0.651665,0.101111, +- 0.0272222,0.67278,0.70389,0.1733335,0.77111, +- 0.701665,0.64778,0.65111,0.72611,0.82889,0.735, +- 0.077222,0.0816665,0.051111,0.71722,0.61722, +- 0.065,0.095,0.0866665,0.58611,0.665555}; +- std::vector obs; +- std::vector pre, vis; +- for (double i : obs_arr) { +- obs.push_back(static_cast(i)); +- pre.push_back(0.0f); +- vis.push_back(1.0f); +- } +- float min_app_sigma = 0.05f; +- float shadow_prior = 0.5f; +- float shadow_mean = 0.0f; +- float shadow_sigma = 0.05f; +- bool verbose = true; +- app_type model; +- boxm_compute_shadow_appearance(obs, pre, vis, +- model, +- min_app_sigma, +- shadow_prior, +- shadow_mean, +- shadow_sigma, +- verbose); +- double er = std::fabs(0.70034355-model.color())+ +- std::fabs(model.sigma()- 1.0/11.954589); +- TEST_NEAR("test shadow appearance EM", er, 0.0, 1e-6); +- // normalized observations for dark road surface +-double dark_obs_arr[] ={0.0477778,0.0666665,0.0072222,0.175,0.12, +- 0.162778,0.003333335,0.188889,0.233889, +- 0.0605555,0.0077778,0.004444445,0.0883335, +- 0.15,0.0716665,0.1233335,0.1983335,0.15, +- 0.0883335,0.03944445,0.122222,0.125,0.25, +- 0.005,0.0122222,0.1,0.1166665,0.03166665, +- 0.015,0.01,0.1016665,0.167222}; +- std::vector dark_obs; +- for (double i : dark_obs_arr) +- dark_obs.push_back(static_cast(i)); +- app_type dark_model; +- boxm_compute_shadow_appearance(dark_obs, pre, vis, +- dark_model, +- min_app_sigma, +- shadow_prior, +- shadow_mean, +- shadow_sigma, +- verbose); +- double dark_er = std::fabs(0.14765342-dark_model.color()) +- + std::fabs(dark_model.sigma()- 1.0/16.097824); +- TEST_NEAR("test dark surface shadow appearance EM", dark_er, 0.0, 1e-6); +-} +- +-TESTMAIN(test_shadow_appearance); +diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx +deleted file mode 100644 +index 03c12cb61b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt +deleted file mode 100644 +index 16a9fc1839..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt ++++ /dev/null +@@ -1,22 +0,0 @@ +-# brl/bseg/boxm/algo/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_algo_sp_sources +- boxm_compute_volume_visibility.h +- boxm_depth_image_triangle.h +- boxm_render_image.h +- boxm_render_image_triangle.h +- boxm_update.h +- boxm_update_triangle.h +- dummy.cxx +- ) +- +-vxl_add_library(LIBRARY_NAME boxm_algo_sp LIBRARY_SOURCES ${boxm_algo_sp_sources}) +- +-#processes +-add_subdirectory(pro) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-target_link_libraries(boxm_algo_sp boxm boxm_util boxm_sample boxm_sample_algo boxm_basic bsta imesh ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl) +diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h b/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h +deleted file mode 100644 +index 1f1bbbd6c9..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h ++++ /dev/null +@@ -1,172 +0,0 @@ +-#ifndef boxm_compute_volume_visibility_h +-#define boxm_compute_volume_visibility_h +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-float boxm_compute_point_visibility(vgl_point_3d point, +- boxm_scene > & scene, +- vpgl_camera_double_sptr & camera ) +-{ +- typedef boct_tree tree_type; +- // locate the cells corresponding to query volume. +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- // make a test for vertices for behind-front case +- vpgl_perspective_camera* cam = static_cast*>(camera.ptr()); +- +- std::cout<<"The point is "<is_behind_camera(vgl_homg_point_3d(point))) +- return 1.0f; +- // first block of intersection +- +- // case 1 : when the camera lies inside the scene +- vgl_homg_point_3d cam_center_homg = cam->camera_center(); +- vgl_point_3d cam_center(cam_center_homg); +- vgl_point_3d curr_block_index; +- +- vgl_vector_3d dir=(point-cam_center); +- double lambda0=dir.length(); +- dir/=lambda0; +- +- boxm_block * curr_block=scene.get_block(cam_center); +- vgl_point_3d entry_point=cam_center; +- double lambda=0; +- +- // case 2: camera lies outside the scene +- if (!curr_block) +- { +- vgl_box_3d world_bb=scene.get_world_bbox(); +- boct_face_idx face_id; +- if (!boxm_utils::cube_entry_point(world_bb,cam_center,dir,entry_point,lambda,face_id)) +- return 1.0f; +- if (!scene.get_block_index(entry_point,curr_block_index)) +- return 1.0f; +- } +- else +- { +- scene.get_block_index(cam_center,curr_block_index); +- } +- +- scene.load_block(curr_block_index); +- curr_block=scene.get_active_block(); +- bool continue_flag=true; +- +- tree_type * tree=curr_block->get_tree(); +- +- vgl_point_3d exit_point; +- boct_face_idx face_id=NONE; +- double alpha_int=0; +- boct_tree_cell * curr_cell=tree->locate_point_global(entry_point); +- while (continue_flag) +- { +- // do processing in the block +- if (curr_cell) +- { +- if (boxm_utils::cube_exit_point(tree->cell_bounding_box(curr_cell), +- cam_center,dir,exit_point,lambda,face_id)) +- { +- if (lambda>lambda0) +- continue_flag=false; +- else +- { +- std::vector * > neighbors; +- curr_cell->find_neighbors(face_id,neighbors,tree->root_level()); +- +- vgl_vector_3d len(exit_point-entry_point); +- T_data data=curr_cell->data(); +- alpha_int-=data.alpha*len.length(); +- curr_cell=nullptr; +-#if 0 +- std::cout<<"Lambda= "< bbox=tree->cell_bounding_box(neighbors[i]); +- double dist=0; +- if (exit_point.x()bbox.max_x()) +- dist+=std::fabs(exit_point.x()-bbox.max_x()); +- if (exit_point.y()bbox.max_y()) +- dist+=std::fabs(exit_point.y()-bbox.max_y()); +- if (exit_point.z()bbox.max_z()) +- dist+=std::fabs(exit_point.z()-bbox.max_z()); +- +- if (dist=0) +- curr_cell=neighbors[min_i]; +- else if (neighbors.size()>0) +- { +- std::cout<<"ERROR"<get_tree(); +- curr_cell=tree->locate_point_global(entry_point); +- } +- else +- { +- continue_flag=false; +- } +- } +- } +- return (float)std::exp(alpha_int); +- } +- else +- { +- std::cout<<"Not a perspective camera"< +-float boxm_compute_volume_visibility(vgl_box_3d bbox, +- boxm_scene > & scene, +- vpgl_camera_double_sptr & cam ) +-{ +- // locate the cells corresponding to query volume. +- return boxm_compute_point_visibility(bbox.centroid(),scene,cam); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h b/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h +deleted file mode 100644 +index bb07d38325..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h ++++ /dev/null +@@ -1,127 +0,0 @@ +-#ifndef boxm_depth_image_triangle_h_ +-#define boxm_depth_image_triangle_h_ +-//: +-// \file +-#include +-#include +-#include "boxm_render_image.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +- +-template +-void boxm_depth_image_splatting_triangle(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected, +- vil_image_view &mask) +-{ +- unsigned ni=expected.ni(); +- unsigned nj=expected.nj(); +- expected.fill(0.0f); +- vgl_plane_3d projection_plane; +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- vil_image_view vis(expected.ni(),expected.nj(),1); +- vis.fill(1.0f); +- vil_image_view alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f); +- vil_image_view alpha_img_(expected.ni(),expected.nj(),1); +- vul_timer t; +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > +- block_vis_iter(cam, &scene, expected.ni(), expected.nj()); +- +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) // code for each block +- { +- t.mark(); +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- std::cout<<"The time taken to read a block is "< * curr_block=scene.get_active_block(); +- t.mark(); +- // project vertices to the image determine which faces of the cell are visible +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- std::cout<<"The time taken to build the vis graph is "<get_tree(); +- vil_image_view vis_end(expected.ni(),expected.nj(),1); +- vil_image_view temp_depth(expected.ni(),expected.nj(),1); +- vil_image_view temp_weights(expected.ni(),expected.nj(),1); +- vil_image_view pix_weights_(expected.ni(),expected.nj(),1); +- normalize_expected_functor norm_fn; +- +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- while (frontier_it.next()) +- { +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- vis_end.fill(0.0f); +- temp_depth.fill(0.0f); +- temp_weights.fill(0.0f); +- alpha_img_.fill(0.0f); +- +- std::cout<<'.'; +- +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- //if (sample.alpha>0.001) +- { +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (dynamic_cast *>(cam.ptr())) +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- // get alpha +- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_); +- boxm_depth_fill(xverts, yverts, vertdists, vis_face_ids,temp_depth); +- } +- } +- abs_functor abs_fun; +- vil_transform(alpha_img_,alpha_img_,abs_fun); +- +- // compute visibility +- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,pix_weights_); +- +- // scale cell expected image by weighting function.. +- vil_math_image_product( temp_depth,pix_weights_, temp_depth); +- // ..and use result to update final expected image +- vil_math_image_sum(temp_depth,expected,expected); +- +- vis.deep_copy(vis_end); +- } +- } +- } +- std::cout<<"\nThe time taken is"<< t.all()< +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-class normalize_expected_functor +-{ +- public: +- normalize_expected_functor() = default; +- +- void operator()(float norm, float & val) const +- { +- if (norm>0) +- val/=norm; +- } +-}; +- +-class image_exp_functor +-{ +- public: +- float operator()(float x) const { return x<0?std::exp(x):1.0f; } +-}; +- +- +-template +-void boxm_render_image_splatting(boxm_scene >& scene, +- vpgl_camera_double_sptr cam, +- vil_image_view& expected, +- vil_image_view& /*mask*/, // TODO: use this param +- int bin=-1, +- bool /*use_black_background*/ = false) // TODO: use this param +-{ +- unsigned ni=expected.ni(); +- unsigned nj=expected.nj(); +- expected.fill(0.0f); +- +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- vil_image_view vis(expected.ni(),expected.nj(),1); +- vis.fill(1.0f); +- vil_image_view alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f); +- +- vul_timer t; +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > +- block_vis_iter(cam, &scene, expected.ni(), expected.nj()); +- +- int cnt=0; +- while (block_vis_iter.next()) { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) { // code for each block +- +- t.mark(); +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- std::cout<<"The time taken to read a block is "< * curr_block=scene.get_active_block(); +- std::cout<<"Block: "<bounding_box()<get_tree()->number_levels() +- << " #of leaf cells "<get_tree()->leaf_cells().size()< frontier_it(cam,curr_block->get_tree(),ni,nj); +- std::cout<<"The time taken to build the vis graph is "<get_tree(); +- vil_image_view front_xyz(expected.ni(),expected.nj(),3); +- vil_image_view back_xyz(expected.ni(),expected.nj(),3); +- vil_image_view alphas(expected.ni(),expected.nj(),1); +- vil_image_view vis_end(expected.ni(),expected.nj(),1); +- vil_image_view temp_expected(expected.ni(),expected.nj(),1); +- vil_image_view temp_weights(expected.ni(),expected.nj(),1); +- normalize_expected_functor norm_fn; +- +- double xverts[8]; +- double yverts[8]; +- +- while (frontier_it.next()) +- { +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- front_xyz.fill(0.0f); +- back_xyz.fill(0.0f); +- alphas.fill(0.0f); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- temp_weights.fill(0.0f); +- std::cout<<'.'; +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- //if (sample.alpha>0.001) +- { +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam,xverts,yverts); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts); +- // get expected color of cell +- typename T_data::obs_datatype cell_expected =T_data::apm_processor::expected_color(sample.appearance(bin)); +- // get alpha +- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts); +- // fill expected value image +- //boxm_utils::project_cube_fill_val( vis_face_ids,temp_expected,(float)cell_expected, xverts,yverts); +- boxm_utils::project_cube_fill_val_aa( vis_face_ids,temp_expected,temp_weights,(float)cell_expected, xverts,yverts); +- } +- } +- // compute the length of ray segment at each pixel +- vil_image_view len_seg(expected.ni(),expected.nj(),1); +- +- len_seg.fill(0.0f); +- std::stringstream s,s1; +- +- vil_math_image_difference(back_xyz,front_xyz,back_xyz); +- vil_math_sum_sqr(back_xyz,len_seg); +- vil_math_sqrt(len_seg); +- vil_math_image_product(len_seg,alphas, alphas); +- vil_transform2(temp_weights,temp_expected,norm_fn); +- ++cnt; +- +- // compute visibility +- vil_math_image_difference(alpha_integral, alphas, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,vis); +- // scale cell expected image by weighting function.. +- vil_math_image_product( temp_expected,vis, temp_expected); +- // ..and use result to update final expected image +- vil_math_image_sum(temp_expected,expected,expected); +- +- vis.deep_copy(vis_end); +- } +- scene.write_active_block(); +- } +- } +- std::cout<<"\nThe time taken is"<< t.all()< +-#include +-#include "boxm_render_image.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +- +-//: Functor class to normalize expected image +-template +-class normalize_expected_functor_splatting +-{ +- public: +- normalize_expected_functor_splatting(bool use_black_background) : use_black_background_(use_black_background) {} +- +- void operator()(float mask, typename T_data::obs_datatype &pix) const +- { +- if (!use_black_background_) { +- pix += mask*0.5f; +- } +- } +- bool use_black_background_; +-}; +- +-template +-void boxm_render_image_splatting_triangle(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &expected, +- vil_image_view &/*mask*/, // FIXME: use this param +- int bin=-1, +- bool use_black_background = false) +-{ +- unsigned ni=expected.ni(); +- unsigned nj=expected.nj(); +- expected.fill(0.0f); +- vgl_plane_3d projection_plane; +- if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- vgl_box_3d bbox=scene.get_world_bbox(); +- vgl_plane_3d top(0,0,1,-bbox.max_z()); +- vgl_plane_3d bottom(0,0,1,-bbox.min_z()); +- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,expected.ni(),expected.nj()); +- } +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- vil_image_view vis(expected.ni(),expected.nj(),1); +- vis.fill(1.0f); +- vil_image_view alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f); +- vil_image_view alpha_img_(expected.ni(),expected.nj(),1); +- vul_timer t; +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > +- block_vis_iter(cam, &scene, expected.ni(), expected.nj()); +- +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) // code for each block +- { +- t.mark(); +- //if (block_indices[i].x()!=2 || block_indices[i].z()!=0) +- // continue; +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- std::cout<<"The time taken to read a block is "< * curr_block=scene.get_active_block(); +- t.mark(); +- // project vertices to the image determine which faces of the cell are visible +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- std::cout<<"The time taken to build the vis graph is "<get_tree(); +- vil_image_view vis_end(expected.ni(),expected.nj(),1); +- vil_image_view temp_expected(expected.ni(),expected.nj(),1); +- vil_image_view temp_weights(expected.ni(),expected.nj(),1); +- vil_image_view pix_weights_(expected.ni(),expected.nj(),1); +- normalize_expected_functor norm_fn; +- +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- while (frontier_it.next()) +- { +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- temp_weights.fill(0.0f); +- alpha_img_.fill(0.0f); +- +- std::cout<<'.'; +- +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- //if (sample.alpha>0.001) +- { +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (dynamic_cast *>(cam.ptr())) +- { +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- } +- else if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists); +- } +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts); +- // get expected color of cell +- typename T_data::obs_datatype cell_expected =T_data::apm_processor::expected_color(sample.appearance(bin)); +- // get alpha +- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_); +- +- cube_fill_value(xverts, yverts, vis_face_ids, temp_expected, cell_expected); // fill expected value image +- //boxm_utils::project_cube_fill_val( vis_face_ids,temp_expected,(float)cell_expected, xverts,yverts); +- //boxm_utils::project_cube_fill_val_aa( vis_face_ids,temp_expected,temp_weights,(float)cell_expected, xverts,yverts); +- } +- } +- abs_functor abs_fun; +- vil_transform(alpha_img_,alpha_img_,abs_fun); +- +- // compute visibility +- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,pix_weights_); +- +- // scale cell expected image by weighting function.. +- vil_math_image_product( temp_expected,pix_weights_, temp_expected); +- // ..and use result to update final expected image +- vil_math_image_sum(temp_expected,expected,expected); +- +- vis.deep_copy(vis_end); +- } +- } +- } +- normalize_expected_functor_splatting norm_fn(use_black_background); +- vil_transform2 >(vis,expected,norm_fn); +- +- std::cout<<"\nThe time taken is"<< t.all()< +-#include "boxm_render_image.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-//: functor used for normalizing cell_expected image +-template +-void boxm_update_pass1(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &img, +- vil_image_view &norm_img, +- typename T_data::apm_datatype background_model, int bin) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- unsigned ni=img.ni(); +- unsigned nj=img.nj(); +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- +- vil_image_view pre(ni,nj,1); pre.fill(0.0f); +- vil_image_view vis(ni,nj,1); vis.fill(1.0f); +- vil_image_view alpha_integral(ni,nj,1); alpha_integral.fill(0.0f); +- vil_image_view PI_img(ni,nj,1); PI_img.fill(0.0f); +- +-#if 0 // TODO: vgl_plane_3d has no constructor with 3 double params....???!!! +- // and projection_plane is unused ..!! +- if (vpgl_rational_camera const* rcam = dynamic_cast const*>(cam.as_pointer())) { +- vgl_box_3d bbox=scene.get_world_bbox(); +- vgl_plane_3d top(bbox.min_x(),bbox.min_y(),bbox.max_z()); +- vgl_plane_3d bottom(bbox.min_x(),bbox.min_y(),bbox.min_z()); +- vgl_plane_3d projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj()); +- } +-#endif // 0 +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > block_vis_iter(cam, &scene, ni,nj); +- while (block_vis_iter.next()) { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) { // code for each block +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- boxm_block * curr_block=scene.get_active_block(); +- // project vertices to the image determine which faces of the cell are visible +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- +- // for each frontier layer of each block +- tree_type * tree=curr_block->get_tree(); +- vil_image_view front_xyz(ni,nj,1); +- vil_image_view back_xyz(ni,nj,1); +- vil_image_view alphas(ni,nj,1); +- vil_image_view vis_end(ni,nj,1); +- vil_image_view temp_expected(ni,nj,1); +- int cnt=0; +- while (frontier_it.next()) +- { +- ++cnt; +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- front_xyz.fill(0.0f); +- back_xyz.fill(0.0f); +- alphas.fill(0.0f); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- PI_img.fill(0.0f); +- std::cout<data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (vpgl_camera_double_sptr pcam = dynamic_cast*>(cam.as_pointer())) +- { +- boxm_utils::project_corners(corners,pcam,xverts,yverts,vertdists); +- } +- else if (vpgl_rational_camera* rcam = dynamic_cast*>(cam.as_pointer())) { +- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,vgl_plane_3d(),xverts,yverts,vertdists); +- // TODO: 3rd argument should most likely be a "real" plane!!! +- } +- +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists); +- // get alpha +- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts); +- } +- // compute the length of ray segment at each pixel +- vil_image_view len_seg(ni,nj,1);len_seg.fill(0.0f); +- vil_math_image_difference(back_xyz,front_xyz,len_seg); +- //vil_math_sum_sqr(back_xyz,len_seg); +- //vil_math_sqrt(len_seg); +- +- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++) +- { +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam,xverts,yverts); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- +- typename T_data::obs_datatype cell_mean_obs; +- if (boxm_utils::cube_weighted_mean(vis_face_ids, img, len_seg,cell_mean_obs,xverts,yverts)) { +- // get probability density of mean observation +- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs); +- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) { +- std::cout << "\ncell_PI = " << cell_PI << '\n' +- << " cell_obs = " << cell_mean_obs << '\n' +- << " cell id = " << *cell_it << std::endl; +- } +- // fill obs probability density image +- boxm_utils::project_cube_fill_val(vis_face_ids,PI_img,cell_PI, xverts,yverts); +- } +- } +- vil_math_image_product(len_seg,alphas, alphas); +- // compute visibility +- vil_math_image_difference(alpha_integral, alphas, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,vis); +- // scale cell expected image by weighting function.. +- vil_math_image_product( PI_img,vis, PI_img); +- // ..and use result to update final expected image +- vil_math_image_sum(PI_img,pre,pre); +- +- vis.deep_copy(vis_end); +-#if 0 +- if (cnt == 70) { +- std::cout << "saving debug images" << std::endl; +- std::string output_dir = "D:/vj/scripts/boxm/exp1/"; +- vil_save(len_seg,(output_dir + "len_seg.tiff").c_str()); +- vil_save(alphas,(output_dir + "alphas.tiff").c_str()); +- vil_save(alpha_integral,(output_dir + "alpha_integral.tiff").c_str()); +- vil_save(pre,(output_dir + "pre_img.tiff").c_str()); +- vil_save(PI_img,(output_dir + "PI_img.tiff").c_str()); +- vil_save(vis,(output_dir + "vis.tiff").c_str()); +- vil_save(vis_end,(output_dir + "vis_end.tiff").c_str()); +- vil_save(img,(output_dir + "obs.tiff").c_str()); +- } +-#endif +- } +- +- scene.write_active_block(); +- } +- } +- vil_image_view PI_background(norm_img.ni(),norm_img.nj(),1); +- for (unsigned int j=0; j +-void boxm_update_pass2(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &img, +- vil_image_view &norm_img, int bin) +-{ +- unsigned ni=img.ni(); +- unsigned nj=img.nj(); +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- vil_image_view pre_img(ni,nj,1); pre_img.fill(0.0f); +- vil_image_view vis(ni,nj,1); vis.fill(1.0f); +- vil_image_view alpha_integral(ni,nj,1); alpha_integral.fill(0.0f); +- vil_image_view PI_img(ni,nj,1); PI_img.fill(0.0f); +- vil_image_view pix_weights(ni,nj,1); +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- +- vul_timer t; t.mark(); +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > block_vis_iter(cam, &scene, ni,nj); +- while (block_vis_iter.next()) { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) { // code for each block +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- boxm_block * curr_block=scene.get_active_block(); +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- +- // for each frontier layer of each block +- tree_type * tree=curr_block->get_tree(); +- vil_image_view front_xyz(ni,nj,1); +- vil_image_view back_xyz(ni,nj,1); +- vil_image_view alphas(ni,nj,1); +- vil_image_view vis_end(ni,nj,1); +- vil_image_view temp_expected(ni,nj,1); +- vil_image_view update_factor(ni,nj,1); +- unsigned count=0; +- while (frontier_it.next()) +- { +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- front_xyz.fill(0.0f); +- back_xyz.fill(0.0f); +- alphas.fill(0.0f); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- PI_img.fill(0.0f); +- +- std::cout<<'.'; +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists); +- // get alpha +- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts); +- } +- // compute the length of ray segment at each pixel +- vil_image_view len_seg(ni,nj,1);len_seg.fill(0.0f); +- vil_math_image_difference(back_xyz,front_xyz,len_seg); +- +- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists); +- //// get alpha +- //boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts); +- typename T_data::obs_datatype cell_mean_obs; +- if (boxm_utils::cube_weighted_mean(vis_face_ids, img,len_seg, cell_mean_obs,xverts,yverts)) { +- // get probability density of mean observation +- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs); +-#if 0 +- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) { +- std::cout << "\ncell_PI = " << cell_PI << '\n' +- << " cell_obs = " << cell_mean_obs << '\n' +- << " cell id = " << *cell_it << std::endl; +- } +-#endif // 0 +- // fill obs probability density image +- boxm_utils::project_cube_fill_val(vis_face_ids,PI_img,(float)cell_PI, xverts,yverts); +- } +- float cell_mean_vis = 0.0f; +- if (boxm_utils::cube_weighted_mean(vis_face_ids, vis, len_seg,cell_mean_vis,xverts,yverts)) { +- // update appearance model +- if (cell_mean_vis > 1e-6) { +- T_data::apm_processor::update(sample.appearance(bin), cell_mean_obs, cell_mean_vis); +- } +- } +- (*cell_it)->set_data(sample); +- } +-#if 0 +- // compute the length of ray segment at each pixel +- vil_image_view len_seg(ni,nj,1);len_seg.fill(0.0f); +- vil_math_image_difference(back_xyz,front_xyz,len_seg); +- vil_math_sum_sqr(back_xyz,len_seg); +- vil_math_sqrt(len_seg); +-#endif // 0 +- vil_math_image_product(len_seg,alphas, alphas); +- // compute visibility +- vil_math_image_difference(alpha_integral, alphas, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,pix_weights); +- // multiply PI by vis.. +- vil_math_image_product(PI_img, vis, update_factor); +- // ..add preX to get numerator term for update.. +- vil_math_image_sum(pre_img, update_factor, update_factor); +- //.. and normalize +- vil_math_image_product(norm_img, update_factor, update_factor); +- +- float max_cell_P=0.99f; +- float min_cell_P=0.001f; +- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam,xverts,yverts); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts); +- float mean_update_factor = 0.0f; +- if (boxm_utils::cube_weighted_mean(vis_face_ids, update_factor,len_seg, mean_update_factor,xverts,yverts)) +- { // update alpha value +- sample.alpha *= mean_update_factor; +- // do bounds check on new alpha value +- float cell_len = float(cell_bb.max_x() - cell_bb.min_x()); +- float max_alpha = -std::log(1.0f - max_cell_P)/cell_len; +- float min_alpha = -std::log(1.0f - min_cell_P)/cell_len; +- if (sample.alpha > max_alpha) +- sample.alpha = max_alpha; +- +- if (sample.alpha < min_alpha) +- sample.alpha = min_alpha; +- +- if (!((sample.alpha >= min_alpha) && (sample.alpha <= max_alpha))) { +- std::cerr << "\nerror: cell.alpha = " << sample.alpha << '\n' +- << "mean_update_factor = " << mean_update_factor << '\n'; +- } +- (*cell_it)->set_data(sample); +- } +- } +- // multiply cell_PI by cell weights +- vil_math_image_product(pix_weights, PI_img, PI_img); +- // update pre_img +- vil_math_image_sum(PI_img, pre_img, pre_img); +- +- vis.deep_copy(vis_end); +- } +- scene.write_active_block(); +- } +- } +-} +- +-template +-void boxm_update(boxm_scene > &scene, +- vil_image_view &img, +- vpgl_camera_double_sptr cam, int bin=-1, +- bool black_background = false) +-{ +- typename T_data::apm_datatype background_apm; +- +- if (black_background) { +- std::cout << "using black background model" << std::endl; +- for (unsigned int i=0; i<4; ++i) { +- T_data::apm_processor::update(background_apm, 0.0f, 1.0f); +- T_data::apm_processor::prob_density(background_apm,0.0f); +- } +- } +- vil_image_view norm_img(img.ni(), img.nj(), 1); +- boxm_update_pass1(scene, cam,img,norm_img,background_apm,bin); +- std::cout << "update: pass1 completed" << std::endl; +- vil_save(norm_img,"D:/vj/scripts/boxm/exp1/norm.tiff"); +- boxm_update_pass2(scene, cam,img,norm_img,bin); +- std::cout << "update: pass2 completed" << std::endl; +- +- return; +-} +- +-#endif // boxm_update_h_ +diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h b/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h +deleted file mode 100644 +index 723284ff3b..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h ++++ /dev/null +@@ -1,356 +0,0 @@ +-#ifndef boxm_update_triangle_h_ +-#define boxm_update_triangle_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//: functor used for normalizing cell_expected image +-template +-void boxm_update_triangle_pass1(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &img, +- vil_image_view &norm_img, +- typename T_data::apm_datatype background_model, int bin) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- unsigned ni=img.ni(); +- unsigned nj=img.nj(); +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- +- vil_image_view pre(ni,nj,1); +- vil_image_view vis(ni,nj,1); +- vil_image_view alpha_integral(ni,nj,1); +- vil_image_view PI_img(ni,nj,1); +- vil_image_view pix_weights_(ni,nj,1); +- vil_image_view alpha_img_(ni,nj,1); +- +- alpha_integral.fill(0.0f); +- pre.fill(0.0f); +- vis.fill(1.0f); +- +- vgl_plane_3d projection_plane; +- if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- vgl_box_3d bbox=scene.get_world_bbox(); +- vgl_plane_3d top(0,0,1,-bbox.max_z()); +- vgl_plane_3d bottom(0,0,1,-bbox.min_z()); +- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj()); +- } +- +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > block_vis_iter(cam, &scene, ni,nj); +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) // code for each block +- { +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- boxm_block * curr_block=scene.get_active_block(); +- // project vertices to the image determine which faces of the cell are visible +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- +- // for each frontier layer of each block +- tree_type * tree=curr_block->get_tree(); +- vil_image_view front_xyz(ni,nj,1); +- vil_image_view back_xyz(ni,nj,1); +- vil_image_view alphas(ni,nj,1); +- vil_image_view vis_end(ni,nj,1); +- vil_image_view temp_expected(ni,nj,1); +- int cnt=0; +- +- while (frontier_it.next()) +- { +- ++cnt; +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- alpha_img_.fill(0.0f); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- PI_img.fill(0.0f); +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (dynamic_cast *>(cam.ptr())) +- { +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- } +- else if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists); +- } +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists); +- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_); +- +- +- typename T_data::obs_datatype cell_mean_obs; +- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,img,cell_mean_obs)) { +- // get probability density of mean observation +- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs); +- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) { +- std::cout << "\ncell_PI = " << cell_PI << '\n' +- << " cell_obs = " << cell_mean_obs << '\n' +- << " cell id = " << *cell_it << std::endl; +- } +- // fill obs probability density image +- cube_fill_value(xverts, yverts, vis_face_ids, PI_img, cell_PI); +- } +- } +- abs_functor abs_fun; +- vil_transform(alpha_img_,alpha_img_,abs_fun); +- // compute visibility +- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral); +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,pix_weights_); +- // scale cell expected image by weighting function.. +- vil_math_image_product( pix_weights_,PI_img, PI_img); +- // ..and use result to update final expected image +- vil_math_image_sum(PI_img,pre,pre); +- vis.deep_copy(vis_end); +-#if 0 +- if (cnt == 10) { +- std::cout << "saving debug images" << std::endl; +- std::string output_dir = "D:/vj/scripts/boxm/exp1/"; +- vil_save(alpha_img_,(output_dir + "alpha_img.tiff").c_str()); +- vil_save(alpha_integral,(output_dir + "alpha_integral.tiff").c_str()); +- vil_save(pre,(output_dir + "pre_img.tiff").c_str()); +- vil_save(PI_img,(output_dir + "PI_img.tiff").c_str()); +- vil_save(vis,(output_dir + "vis.tiff").c_str()); +- vil_save(vis_end,(output_dir + "vis_end.tiff").c_str()); +- vil_save(img,(output_dir + "obs.tiff").c_str()); +- } +-#endif +- } +- scene.write_active_block(); +- } +- } +- vil_image_view PI_background(norm_img.ni(),norm_img.nj(),1); +- for (unsigned int j=0; j +-void boxm_update_triangle_pass2(boxm_scene > &scene, +- vpgl_camera_double_sptr cam, +- vil_image_view &img, +- vil_image_view &norm_img, int bin) +-{ +- unsigned ni=img.ni(); +- unsigned nj=img.nj(); +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- vil_image_view pre_img(ni,nj,1); pre_img.fill(0.0f); +- vil_image_view vis(ni,nj,1); vis.fill(1.0f); +- vil_image_view alpha_integral(ni,nj,1); +- vil_image_view PI_img(ni,nj,1); PI_img.fill(0.0f); +- vil_image_view pix_weights(ni,nj,1); +- alpha_integral.fill(0.0f); +- pre_img.fill(0.0f); +- vis.fill(1.0f); +- +- double xverts[8]; +- double yverts[8]; +- float vertdists[8]; +- vgl_plane_3d projection_plane; +- if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- vgl_box_3d bbox=scene.get_world_bbox(); +- vgl_plane_3d top(0,0,1,-bbox.max_z()); +- vgl_plane_3d bottom(0,0,1,-bbox.min_z()); +- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj()); +- } +- vul_timer t; t.mark(); +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator > block_vis_iter(cam, &scene, ni,nj); +- while (block_vis_iter.next()) { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) { // code for each block +- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z()); +- boxm_block * curr_block=scene.get_active_block(); +- boxm_cell_vis_graph_iterator frontier_it(cam,curr_block->get_tree(),ni,nj); +- +- // for each frontier layer of each block +- tree_type * tree=curr_block->get_tree(); +- vil_image_view alpha_img_(ni,nj,1); +- vil_image_view vis_end(ni,nj,1); +- vil_image_view temp_expected(ni,nj,1); +- vil_image_view update_factor(ni,nj,1); +- +- while (frontier_it.next()) +- { +- std::vector vis_cells=frontier_it.frontier(); +- typename std::vector::iterator cell_it=vis_cells.begin(); +- vis_end.fill(0.0f); +- temp_expected.fill(0.0f); +- PI_img.fill(0.0f); +- alpha_img_.fill(0.0f); +- +- std::cout<<'.'; +- for (;cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (dynamic_cast *>(cam.ptr())) +- { +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- } +- else if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists); +- } +- +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_); +- typename T_data::obs_datatype cell_mean_obs; +- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,img,cell_mean_obs)) { +- // get probability density of mean observation +- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs); +-#if 0 +- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) { +- std::cout << "\ncell_PI = " << cell_PI << '\n' +- << " cell_obs = " << cell_mean_obs << '\n' +- << " cell id = " << *cell_it << std::endl; +- } +-#endif // 0 +- // fill obs probability density image +- cube_fill_value(xverts, yverts, vis_face_ids, PI_img, cell_PI); +- } +- float cell_mean_vis = 0.0f; +- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,vis,cell_mean_vis)) { +- // update appearance model +- if (cell_mean_vis > 1e-6) { +- T_data::apm_processor::update(sample.appearance(bin), cell_mean_obs, cell_mean_vis); +- } +- } +- (*cell_it)->set_data(sample); +- } +- abs_functor abs_fun; +- vil_transform(alpha_img_,alpha_img_,abs_fun); +- +- // compute visibility +- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral); +- +- // compute new vis image +- image_exp_functor exp_fun; +- vil_transform(alpha_integral,vis_end,exp_fun); +- // compute weights for each pixel +- vil_math_image_difference(vis,vis_end,pix_weights); +- // multiply PI by vis.. +- vil_math_image_product(PI_img, vis, update_factor); +- // ..add preX to get numerator term for update.. +- vil_math_image_sum(pre_img, update_factor, update_factor); +- //.. and normalize +- vil_math_image_product(norm_img, update_factor, update_factor); +- +- +- float max_cell_P=0.99f; +- float min_cell_P=0.001f; +- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++) +- { +- // for each cell +- T_data sample=(*cell_it)->data(); +- // get vertices of cell in the form of a bounding box (cells are always axis-aligned)) +- vgl_box_3d cell_bb = tree->cell_bounding_box(*cell_it); +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- if (dynamic_cast *>(cam.ptr())) +- { +- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists); +- } +- else if (vpgl_rational_camera * rcam = dynamic_cast *>(cam.ptr())) { +- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists); +- } +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts); +- +- float mean_update_factor = 0.0f; +- if (cube_mean(xverts,yverts,vertdists,vis_face_ids, update_factor, mean_update_factor)) +- { +- // update alpha value +- sample.alpha *= mean_update_factor; +- // do bounds check on new alpha value +- float cell_len = float(cell_bb.max_x() - cell_bb.min_x()); +- float max_alpha = -std::log(1.0f - max_cell_P)/cell_len; +- float min_alpha = -std::log(1.0f - min_cell_P)/cell_len; +- if (sample.alpha > max_alpha) +- sample.alpha = max_alpha; +- +- if (sample.alpha < min_alpha) +- sample.alpha = min_alpha; +- +- if (!((sample.alpha >= min_alpha) && (sample.alpha <= max_alpha))) { +- std::cerr << "\nerror: cell.alpha = " << sample.alpha << '\n' +- << "mean_update_factor = " << mean_update_factor << '\n'; +- } +- (*cell_it)->set_data(sample); +- } +- } +- // multiply cell_PI by cell weights +- vil_math_image_product(pix_weights, PI_img, PI_img); +- // update pre_img +- vil_math_image_sum(PI_img, pre_img, pre_img); +- vis.deep_copy(vis_end); +- } +- scene.write_active_block(); +- } +- } +-} +- +-template +-void boxm_update_triangle(boxm_scene > &scene, +- vil_image_view &img, +- vpgl_camera_double_sptr cam, int bin=-1, +- bool black_background = false) +-{ +- typename T_data::apm_datatype background_apm; +- +- if (black_background) { +- std::cout << "using black background model" << std::endl; +- for (unsigned int i=0; i<4; ++i) { +- T_data::apm_processor::update(background_apm, 0.0f, 1.0f); +- T_data::apm_processor::prob_density(background_apm,0.0f); +- } +- } +- vil_image_view norm_img(img.ni(), img.nj(), 1); +- boxm_update_triangle_pass1(scene, cam,img,norm_img,background_apm,bin); +- std::cout << "update: pass1 completed" << std::endl; +- boxm_update_triangle_pass2(scene, cam,img,norm_img,bin); +- std::cout << "update: pass2 completed" << std::endl; +- +- return; +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/sp/dummy.cxx b/contrib/brl/bseg/boxm/algo/sp/dummy.cxx +deleted file mode 100644 +index e69de29bb2..0000000000 +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt +deleted file mode 100644 +index 41fe3f9dbd..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt ++++ /dev/null +@@ -1,27 +0,0 @@ +-# boxm's Process Library +- +-# bprb depends on expat and bvxm_prodepends on bprb primarily +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +-if(EXPAT_FOUND) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- +- set(boxm_algo_sp_pro_sources +- boxm_algo_sp_processes.h +- boxm_algo_sp_register.h boxm_algo_sp_register.cxx +- ) +- aux_source_directory(Templates boxm_algo_sp_pro_sources) +- aux_source_directory(processes boxm_algo_sp_pro_sources) +- +- vxl_add_library(LIBRARY_NAME boxm_algo_sp_pro LIBRARY_SOURCES ${boxm_algo_sp_pro_sources} ) +- target_link_libraries(boxm_algo_sp_pro boxm boxm_algo_sp boxm_util bprb brdb brip sdet vsol vil_pro ${VXL_LIB_PREFIX}vil_io ${VXL_LIB_PREFIX}vil) +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +-endif() +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx +deleted file mode 100644 +index 5339909524..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +- +-#include +-#include +- +-#include +- +-typedef vil_image_view_base_sptr img_sptr; +- +-BRDB_VALUE_INSTANTIATE(img_sptr, "vil_image_view_base_sptr"); +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h +deleted file mode 100644 +index 24cdc3672a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h ++++ /dev/null +@@ -1,14 +0,0 @@ +-#ifndef boxm_algo_sp_processes_h_ +-#define boxm_algo_sp_processes_h_ +- +-#include +-#include +- +-//the init functions +-DECLARE_FUNC_CONS(boxm_volume_visibility_process); +-DECLARE_FUNC_CONS(boxm_update_process); +-DECLARE_FUNC_CONS(boxm_render_expected_process); +- +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx +deleted file mode 100644 +index 8acaac16c3..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx ++++ /dev/null +@@ -1,18 +0,0 @@ +-#include "boxm_algo_sp_register.h" +- +-#include +-#include +-#include +- +-#include "boxm_algo_sp_processes.h" +- +-void boxm_algo_sp_register::register_datatype() +-{ +-} +- +-void boxm_algo_sp_register::register_process() +-{ +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_update_process,"boxmUpdateSPProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_process, "boxmRenderExpectedProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_volume_visibility_process, "boxmVolumeVisibilityProcess"); +-} +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h +deleted file mode 100644 +index 5b7f15d213..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-#ifndef boxm_algo_sp_register_h_ +-#define boxm_algo_sp_register_h_ +- +-class boxm_algo_sp_register +-{ +- public: +- static void register_datatype(); +- static void register_process(); +-}; +- +-#endif // boxm_algo_sp_register_h_ +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx +deleted file mode 100644 +index 6ffd752df2..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx ++++ /dev/null +@@ -1,117 +0,0 @@ +-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx +- +-//: +-// \file +-// \brief A class for obtaining roc curve from change detection results. +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_render_expected_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 2; +-} +- +-bool boxm_render_expected_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_process_globals; +- +- //process takes 5 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- //input[4]: bin number +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "unsigned"; +- +- // process has 2 outputs: +- // output[0]: rendered image +- // output[0]: mask +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- output_types_[1] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_render_expected_process(bprb_func_process& pro) +-{ +- using namespace boxm_render_expected_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- auto ni = pro.get_input(i++); +- auto nj = pro.get_input(i++); +- +- vil_image_view_base_sptr img; +- vil_image_view_base_sptr img_mask; +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- vil_image_view::obs_datatype> expected(ni,nj); +- vil_image_view mask(ni,nj); +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_image_splatting_triangle >(*scene, camera, expected, mask,-1,true); +- } +- else +- { +- auto bin = pro.get_input(i++); +- std::cout<<"Multi Bin"< > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- boxm_render_image_splatting_triangle >(*scene, camera, expected, mask,bin,true); +- } +- +- //img = new vil_image_view::obs_datatype>(expected); +- img_mask = new vil_image_view(mask); +- +- auto *expected_byte = new vil_image_view(expected.ni(),expected.nj(),expected.nplanes()); +- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f); +- img = expected_byte; +- } +- else { +- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl; +- return false; +- } +- +- unsigned j = 0; +- pro.set_output_val(j++, img); +- pro.set_output_val(j++, img_mask); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx +deleted file mode 100644 +index bf3d27ab6d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx ++++ /dev/null +@@ -1,107 +0,0 @@ +-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx +-//: +-// \file +-// \brief Process to update the scene from an image and camera pair +-// +-// \author Gamze Tunali +-// \date Apr 21, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-namespace boxm_update_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +-bool boxm_update_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_update_process_globals; +- +- // process takes 5 inputs and no output +- //input[0]: The observation image +- //input[1]: The camera of the observation +- //input[2]: The scene +- //input[3]: The bin index to be updated +- //input[4]: ??? +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "boxm_scene_base_sptr"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "bool"; +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_update_process(bprb_func_process& pro) +-{ +- using namespace boxm_update_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_update_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr input_image = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- auto bin_index = pro.get_input(i++); +- bool use_black_background = pro.get_input(i++); +- +- // check the input validity +- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) { +- std::cout << "boxm_update_process: null input value, cannot run" << std::endl; +- return false; +- } +- +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- auto *img_byte +- = dynamic_cast*>(input_image.ptr()); +- vil_image_view::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1); +- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f); +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- //boxm_update >(*s, img, camera, false); +- boxm_update_triangle >(*s, img, camera, use_black_background); +- } +- else +- { +- std::cout<<"Multi Bin Update"< > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_update_triangle >(*s, img, camera, bin_index,use_black_background); +- } +- //vil_image_view image = *vil_convert_cast(float(), input_image); +- } +- else { +- std::cout << "boxm_update_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx +deleted file mode 100644 +index 34ecc27c3f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx ++++ /dev/null +@@ -1,129 +0,0 @@ +-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx +-//: +-// \file +-// \brief A class for obtaining visibility of a volume +-// +-// \author Vishal Jain +-// \date Apr 30, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_volume_visibility_process_globals +-{ +- constexpr unsigned n_inputs_ = 10; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_volume_visibility_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_volume_visibility_process_globals; +- +- //process takes 10 inputs +- //input[0]: scene binary file +- //input[1]: camera +- //input[2]: ni of the expected image +- //input[3]: nj of the expected image +- //input[4-9]: bounding box +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vpgl_camera_double_sptr"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "unsigned"; +- input_types_[4] = "float"; +- input_types_[5] = "float"; +- input_types_[6] = "float"; +- input_types_[7] = "float"; +- input_types_[8] = "float"; +- input_types_[9] = "float"; +- +- // process has 1 output: +- // output[0]: rendered image +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vil_image_view_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_volume_visibility_process(bprb_func_process& pro) +-{ +- using namespace boxm_volume_visibility_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- boxm_scene_base_sptr scene_ptr = pro.get_input(i++); +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- auto ni = pro.get_input(i++); +- auto nj = pro.get_input(i++); +- +- auto min_x=pro.get_input(i++); +- auto min_y=pro.get_input(i++); +- auto min_z=pro.get_input(i++); +- +- auto max_x=pro.get_input(i++); +- auto max_y=pro.get_input(i++); +- auto max_z=pro.get_input(i++); +- +- vgl_box_3d query(min_x,min_y,min_z, +- max_x,max_y,max_z); +- +- double xverts[8]; +- double yverts[8]; +- +- boxm_utils::project_corners(boxm_utils::corners_of_box_3d(query),camera,xverts,yverts); +- boct_face_idx face_id=boxm_utils::visible_faces(query,camera,xverts,yverts); +- vil_image_view_base_sptr img; +- +- // check the scene's app model +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- float val=1.0; +- +- if (!scene_ptr->multi_bin()){ +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- val=boxm_compute_volume_visibility >(query,*scene, camera); +- } +- else +- { +- typedef boct_tree > type; +- auto* scene = dynamic_cast*> (scene_ptr.as_pointer()); +- val=boxm_compute_volume_visibility >(query,*scene, camera); +- } +- vil_image_view img_vol(ni,nj);img_vol.fill(0.0); +- boxm_utils::project_cube_fill_val(face_id,img_vol,val,xverts,yverts); +- auto *vol_vis = new vil_image_view(img_vol.ni(),img_vol.nj(),img_vol.nplanes()); +- vil_convert_stretch_range_limited(img_vol,*vol_vis, 0.0f, 1.0f); +- img = vol_vis; +- +- std::cout<<"\n Visibility is "<(j++, img); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt +deleted file mode 100644 +index bc15f419d9..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( boxm_algo_sp_pro_test_include test_include.cxx ) +-target_link_libraries( boxm_algo_sp_pro_test_include boxm_algo_sp_pro) +diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx +deleted file mode 100644 +index bfdbc4ffa3..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt +deleted file mode 100644 +index 99806c193d..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt ++++ /dev/null +@@ -1,19 +0,0 @@ +-add_executable( boxm_algo_sp_test_all +- test_driver.cxx +- test_compute_visibility.cxx +- test_render_image.cxx +- test_update.cxx +- test_update_multi_bin.cxx +- ) +- +-target_link_libraries( boxm_algo_sp_test_all boxm_algo_sp boxm_algo boxm boxm_util boxm_sample boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul) +- +-add_test( NAME boxm_algo_sp_test_compute_visibility COMMAND $ test_compute_visibility ) +-add_test( NAME boxm_algo_sp_test_render_image COMMAND $ test_render_image ) +-if( VXL_RUN_FAILING_TESTS ) +-add_test( NAME boxm_algo_sp_test_update COMMAND $ test_update ) +-endif() +-add_test( NAME boxm_algo_sp_test_update_multi_bin COMMAND $ test_update_multi_bin ) +- +-add_executable( boxm_algo_sp_test_include test_include.cxx ) +-target_link_libraries( boxm_algo_sp_test_include boxm_algo_sp) +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx +deleted file mode 100644 +index 69c019a479..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx ++++ /dev/null +@@ -1,90 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-static void test_compute_visibility() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,3); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- scene.set_paths("./boxm_scene1", "block"); +- vul_file::make_directory("./boxm_scene1"); +- std::ofstream os("scene1.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- // sample 1 +- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f); +- bsta_num_obs s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s1_simple_mix_gauss_val_sf1; +- +- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s1_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1); +- +- boxm_sample s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1); +- +- boxm_block_iterator > > iter(&scene); +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(3,2); +- if (iter.index().z()==1) +- { +- std::vector > * > leaf_cells=tree->leaf_cells(); +- s1_sample.alpha=0.6f; +- +- for (auto & leaf_cell : leaf_cells) +- { +- leaf_cell->set_data(s1_sample); +- } +- block->init_tree(tree); +- scene.write_active_block(); +- } +- else +- { +- std::vector > * > leaf_cells= tree->leaf_cells(); +- s1_sample.alpha=0.01f; +- +- for (auto & leaf_cell : leaf_cells) +- { +- leaf_cell->set_data(s1_sample); +- } +- block->init_tree(tree); +- scene.write_active_block(); +- } +- +- iter++; +- } +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+block_dim.x()*world_dim.x(), +- origin.y()+block_dim.y()*world_dim.y(), +- origin.z()+block_dim.z()*world_dim.z())); +- vpgl_camera_double_sptr camera = generate_camera_top(world); +- +- double X=5,Y=5,Z; +- for (Z=40; Z>-10; --Z) +- { +- boxm_compute_point_visibility >(vgl_point_3d(X,Y,Z),scene, camera); +- } +- vpl_rmdir("./boxm_scene1"); +- vpl_unlink("./scene1.xml"); +-} +- +-TESTMAIN(test_compute_visibility); +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx +deleted file mode 100644 +index 2ea0124c63..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +- +-DECLARE( test_compute_visibility ); +-DECLARE( test_render_image ); +-DECLARE( test_update ); +-DECLARE( test_update_multi_bin ); +- +-void register_tests() +-{ +- REGISTER( test_compute_visibility ); +- REGISTER( test_render_image ); +- REGISTER( test_update ); +- REGISTER( test_update_multi_bin ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx +deleted file mode 100644 +index 85e7588707..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx +deleted file mode 100644 +index c36e76f0dd..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx ++++ /dev/null +@@ -1,103 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-static void test_render_image() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,3); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- scene.set_paths("./boxm_scene1", "block"); +- vul_file::make_directory("./boxm_scene1"); +- std::ofstream os("scene1.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- boxm_block_iterator > > iter(&scene); +- // default model +- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- +- boxm_sample default_sample; +- default_sample.alpha=0.001f; +- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1); +- +- // sample 1 +- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f); +- bsta_num_obs s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s1_simple_mix_gauss_val_sf1; +- +- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s1_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1); +- +- boxm_sample s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1); +- +- // sample 2 +- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f); +- bsta_num_obs s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s2_simple_mix_gauss_val_sf1; +- +- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s2_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1); +- +- boxm_sample s2_sample; +- s2_sample.alpha=0.6f; +- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1); +- +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(3,2); +- boct_tree_cell >* cel11=tree->locate_point(vgl_point_3d(0.01,0.01,0.01)); +- cel11->set_data(s2_sample); +- boct_tree_cell >* cell2=tree->locate_point(vgl_point_3d(0.51,0.51,0.01)); +- cell2->set_data(s1_sample); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- } +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+world_dim.x(), origin.y()+world_dim.y(), origin.z()+world_dim.z())); +- vpgl_camera_double_sptr camera = generate_camera_top(world); +- +- vil_image_view::obs_datatype> expected(IMAGE_U,IMAGE_V); +- expected.fill(0.0); +- vil_image_view::obs_datatype> mask(IMAGE_U,IMAGE_V); +- mask.fill(0.0); +- +- boxm_render_image_splatting >(scene,camera,expected,mask); +- vpl_rmdir("boxm_scene1"); +- vpl_unlink("scene1.xml"); +-} +- +-TESTMAIN(test_render_image); +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx +deleted file mode 100644 +index 9e530c4af6..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx ++++ /dev/null +@@ -1,259 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#if 0 +-#include +-#endif +- +-std::vector generate_cameras_z(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_point_3d centroid = world.centroid(); +- double alpha = (vnl_math::pi_over_180)*65; // was: (vnl_math::pi/8.) * 3; +- double delta_alpha = vnl_math::pi/36.; +- std::vector > centers; +- for (unsigned i=0; i<11; i++) { +- // double x = boxm_camera_dist*std::cos(alpha)/10; +- double z = boxm_camera_dist*std::sin(alpha); +- centers.emplace_back(centroid.x(), centroid.y(), centroid.z()+z); +- std::cout << centers[i] << std::endl; +- alpha += delta_alpha; +- } +- +- vgl_box_2d bb; +- std::vector rat_cameras; +- for (unsigned i=0; i > corners = boxm_utils::corners_of_box_3d(world); +- for (auto c : corners) { +- double u,v, u2, v2; +- vpgl_perspective_camera persp_cam; +- persp_cam.project(c.x(), c.y() ,c.z(), u, v); +- rat_cam->project(c.x(), c.y() ,c.z(), u2, v2); +- bb.add(vgl_point_2d (u,v)); +- +- if (verbose) +- { +- std::cout << "Perspective [" << u << ',' << v << "]\n" +- << "Rational [" << u2 << ',' << v2 << "]\n\n"; +- } +- } +- std::cout << bb << std::endl; +- } +- return rat_cameras; +-} +- +-std::vector generate_cameras_yz(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_point_3d centroid = world.centroid(); +- std::cout << "centroid: " << centroid << std::endl; +- double alpha = (vnl_math::pi/8.) * 3; +- double delta_alpha = vnl_math::pi/40.; +- std::vector > centers; +- +- for (unsigned i=0; i bb; +- std::vector persp_cameras; +- for (unsigned i=0; i camera_center = centers[i]; +- vpgl_perspective_camera persp_cam; +- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam); +- persp_cam.look_at(vgl_homg_point_3d(centroid)); +- persp_cameras.push_back(new vpgl_perspective_camera(persp_cam)); +- +- //save the camera to file +- std::stringstream cam_file; +- vul_file::make_directory("./cams"); +- cam_file << "./cams/cam_" << i << ".txt"; +- std::ofstream cam_out(cam_file.str().c_str()); +- cam_out << persp_cam; +- +- if (verbose) { +- std::vector > corners = boxm_utils::corners_of_box_3d(world); +- for (auto c : corners) { +- double u,v; +- persp_cam.project(c.x(), c.y() ,c.z(), u, v); +- bb.add(vgl_point_2d (u,v)); +- std::cout << "Perspective [" << u << ',' << v << "]\n"<< std::endl; +- } +- std::cout << bb << std::endl; +- } +- } +- return persp_cameras; +-} +- +- +-static void test_update() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,1); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +-#ifdef SET_APPEARENCE_MODEL_EXISTS +- scene.set_appearence_model(BOXM_APM_MOG_GREY); +-#endif +- scene.set_paths("boxm_scene2", "block"); +- vul_file::make_directory("boxm_scene2"); +- std::ofstream os("scene2.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- boxm_block_iterator > > iter(&scene); +- // default model +- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- +- boxm_sample default_sample; +- default_sample.alpha=0.001f; +- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1); +- +- // sample 1 +- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f); +- bsta_num_obs s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s1_simple_mix_gauss_val_sf1; +- +- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s1_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1); +- +- boxm_sample s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1); +- +- // sample 2 +- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f); +- bsta_num_obs s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s2_simple_mix_gauss_val_sf1; +- +- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s2_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1); +- +- boxm_sample s2_sample; +- s2_sample.alpha=0.6f; +- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1); +- +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(4,3); +- boct_tree_cell >* cel11=tree->locate_point(vgl_point_3d(0.01,0.01,0.01)); +- cel11->set_data(s2_sample); +- boct_tree_cell >* cell2=tree->locate_point(vgl_point_3d(0.51,0.51,0.01)); +- cell2->set_data(s1_sample); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- } +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+block_dim.x()*world_dim.x(), +- origin.y()+block_dim.y()*world_dim.y(), +- origin.z()+block_dim.z()*world_dim.z())); +-#if 0 +- vpgl_camera_double_sptr camera = generate_camera_top(world); +-#endif +- std::vector cameras = generate_cameras_z(world); +- +- vil_image_view::obs_datatype> expected(IMAGE_U,IMAGE_V); +- vil_image_view::obs_datatype> mask(IMAGE_U,IMAGE_V); +- +- for (unsigned i=0; i >(scene,cameras[i],expected,mask); +- std::stringstream ss; +- ss << "./boxm_scene2/img" << i << ".tif"; +-#if 0 +- vil_image_view expected_byte(expected.ni(),expected.nj(),expected.nplanes()); +- vil_convert_stretch_range_limited(expected,expected_byte, 0.0f, 1.0f); +-#endif +- +- vil_save(expected, ss.str().data()); +- } +-#if 0 +- vpl_rmdir("./boxm_scene1"); +- vpl_unlink("./scene1.xml"); +-#endif +- boxm_scene > > scene_new(lvcs, origin, +- block_dim, world_dim, 4U, 3U); +- scene_new.set_appearance_model(BOXM_APM_MOG_GREY); +- scene_new.set_paths("./boxm_scene_update", "block"); +- vul_file::make_directory("./boxm_scene_update"); +- std::ofstream os1("./boxm_scene_update/scene.xml"); +- x_write(os1, scene_new, "scene"); +- os1.close(); +- +- // update the world, with all the generated images and cameras +- for (unsigned i=0; i >(scene_new, expected, cameras[i] ); +- } +- +- // regenerate the images from world +- for (unsigned i=0; i expected_new(IMAGE_U,IMAGE_V); +- boxm_render_image_splatting >(scene_new,cameras[i],expected_new,mask); +- vil_image_view expected_byte(expected_new.ni(),expected_new.nj(),expected_new.nplanes()); +- vil_convert_stretch_range_limited(expected_new,expected_byte, 0.0f, 1.0f); +- +- vil_save(expected_byte, ss.str().data()); +- } +-} +- +-TESTMAIN(test_update); +diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx +deleted file mode 100644 +index 27c310aea1..0000000000 +--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx ++++ /dev/null +@@ -1,262 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#ifdef CLEANUP +-#include +-#endif +- +-std::vector generate_cameras_z_multi_bin(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_point_3d centroid = world.centroid(); +- double alpha = (vnl_math::pi_over_180)*65; // was: (vnl_math::pi/8.) * 3; +- double delta_alpha = vnl_math::pi/36.; +- std::vector > centers; +- for (unsigned i=0; i<11; i++) { +- double z = boxm_camera_dist*std::sin(alpha); +- centers.emplace_back(centroid.x(), centroid.y(), centroid.z()+z); +- std::cout << centers[i] << std::endl; +- alpha += delta_alpha; +- } +- +- vgl_box_2d bb; +- std::vector rat_cameras; +- for (unsigned i=0; i > corners = boxm_utils::corners_of_box_3d(world); +- for (auto c : corners) { +- double u,v, u2, v2; +- vpgl_perspective_camera persp_cam; +- persp_cam.project(c.x(), c.y() ,c.z(), u, v); +- rat_cam->project(c.x(), c.y() ,c.z(), u2, v2); +- bb.add(vgl_point_2d (u,v)); +- +- if (verbose) +- { +- std::cout << "Perspective [" << u << ',' << v << "]\n" +- << "Rational [" << u2 << ',' << v2 << "]\n\n"; +- } +- } +- std::cout << bb << std::endl; +- } +- return rat_cameras; +-} +- +-std::vector generate_cameras_yz_multi_bin(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_point_3d centroid = world.centroid(); +- std::cout << "centroid: " << centroid << std::endl; +- double alpha = (vnl_math::pi/8.) * 3; +- double delta_alpha = vnl_math::pi/40.; +- std::vector > centers; +- +- for (unsigned i=0; i bb; +- std::vector persp_cameras; +- for (unsigned i=0; i camera_center = centers[i]; +- vpgl_perspective_camera persp_cam; +- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam); +- persp_cam.look_at(vgl_homg_point_3d(centroid)); +- persp_cameras.push_back(new vpgl_perspective_camera(persp_cam)); +- +- //save the camera to file +- std::stringstream cam_file; +- vul_file::make_directory("./cams"); +- cam_file << "./cams/cam_" << i << ".txt"; +- std::ofstream cam_out(cam_file.str().c_str()); +- cam_out << persp_cam; +- +- if (verbose) { +- std::vector > corners = boxm_utils::corners_of_box_3d(world); +- for (auto c : corners) { +- double u,v; +- persp_cam.project(c.x(), c.y() ,c.z(), u, v); +- bb.add(vgl_point_2d (u,v)); +- std::cout << "Perspective [" << u << ',' << v << ']' << std::endl << std::endl; +- } +- std::cout << bb << std::endl; +- } +- } +- return persp_cameras; +-} +- +- +-static void test_update_multi_bin() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,1); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +-#ifdef SET_APPEARENCE_MODEL_EXISTS +- scene.set_appearence_model(BOXM_APM_MOG_GREY); +-#endif +- scene.set_paths("boxm_scene2_mb", "block"); +- vul_file::make_directory("boxm_scene2_mb"); +- std::ofstream os("scene2.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- boxm_block_iterator > > iter(&scene); +- // default model +- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- +- boxm_sample_multi_bin default_sample; +- default_sample.alpha=0.001f; +- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1,5); +- +- // sample 1 +- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f); +- bsta_num_obs s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s1_simple_mix_gauss_val_sf1; +- +- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s1_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1); +- +- boxm_sample_multi_bin s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1,5); +- +- // sample 2 +- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f); +- bsta_num_obs s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s2_simple_mix_gauss_val_sf1; +- +- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s2_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1); +- +- boxm_sample_multi_bin s2_sample; +- s2_sample.alpha=0.6f; +- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1,3); +- +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(4,3); +- boct_tree_cell >* cel11=tree->locate_point(vgl_point_3d(0.01,0.01,0.01)); +- cel11->set_data(s2_sample); +- boct_tree_cell >* cell2=tree->locate_point(vgl_point_3d(0.51,0.51,0.01)); +- cell2->set_data(s1_sample); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- } +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+block_dim.x()*world_dim.x(), +- origin.y()+block_dim.y()*world_dim.y(), +- origin.z()+block_dim.z()*world_dim.z())); +-#if 0 +- vpgl_camera_double_sptr camera = generate_camera_top(world); +-#endif +- std::vector cameras = generate_cameras_z_multi_bin(world); +- +- vil_image_view::obs_datatype> expected(IMAGE_U,IMAGE_V); +- vil_image_view::obs_datatype> mask(IMAGE_U,IMAGE_V); +- +- for (unsigned i=0; i >(scene,cameras[i],expected,mask,3); +- std::stringstream ss; +- ss << "./boxm_scene2_mb/img3" << i << ".tif"; +- vil_save(expected, ss.str().data()); +- +- expected.fill(0.0); +- boxm_render_image_splatting_triangle >(scene,cameras[i],expected,mask,5); +- std::stringstream ss1; +- ss1 << "./boxm_scene2_mb/img5" << i << ".tif"; +- vil_save(expected, ss1.str().data()); +- } +-#ifdef CLEANUP +- vpl_rmdir("./boxm_scene1"); +- vpl_unlink("./scene1.xml"); +-#endif +- boxm_scene > > scene_new(lvcs, origin, +- block_dim, world_dim, 4U, 3U); +- scene_new.set_appearance_model(BOXM_APM_MOG_GREY); +- scene_new.set_paths("./boxm_scene_update", "block"); +- vul_file::make_directory("./boxm_scene_update"); +- std::ofstream os1("./boxm_scene_update/scene.xml"); +- x_write(os1, scene_new, "scene"); +- os1.close(); +- +- // update the world, with all the generated images and cameras +- for (unsigned i=0; i >(scene_new, expected, cameras[i],3 ); +- std::stringstream ss1; +- ss1 << "./boxm_scene2_mb/img5" << i << ".tif"; +- expected = vil_load(ss1.str().data()); +- boxm_update_triangle >(scene_new, expected, cameras[i],5 ); +- } +- +- // regenerate the images from world +- for (unsigned i=0; i expected_new(IMAGE_U,IMAGE_V); +- boxm_render_image_splatting_triangle >(scene_new,cameras[i],expected_new,mask,3); +- vil_image_view expected_byte(expected_new.ni(),expected_new.nj(),expected_new.nplanes()); +- vil_convert_stretch_range_limited(expected_new,expected_byte, 0.0f, 1.0f); +- +- vil_save(expected_byte, ss.str().data()); +- } +-} +- +-TESTMAIN(test_update_multi_bin); +diff --git a/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt +deleted file mode 100644 +index 5e823166ae..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt ++++ /dev/null +@@ -1,31 +0,0 @@ +-add_executable( boxm_algo_test_all +- test_driver.cxx +- test_fill_in_mesh.cxx +- test_save_scene_raw.cxx +- test_upload_mesh.cxx +- test_boxm_fill_internal_cells.cxx +- test_boxm_scene_crop.cxx +- test_linear_operations.cxx +- test_remove_level0.cxx +- +- ) +- +-set(boxm_algo_test_all_sources +- test_utils.h test_utils.cxx +- ) +- +-vxl_add_library(LIBRARY_NAME boxm_algo_tests LIBRARY_SOURCES ${boxm_algo_test_all_sources}) +- +-target_link_libraries( boxm_algo_tests boxm_algo boxm boxm_sample boxm_util boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vpgl imesh ${VXL_LIB_PREFIX}vcl) +-target_link_libraries( boxm_algo_test_all boxm_algo_tests boxm_algo boxm boxm_sample boxm_util boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vpgl imesh ${VXL_LIB_PREFIX}vcl) +- +-add_test( NAME boxm_algo_test_fill_in_mesh COMMAND $ test_fill_in_mesh ) +-add_test( NAME boxm_algo_test_save_scene_raw COMMAND $ test_save_scene_raw ) +-add_test( NAME boxm_algo_test_upload_mesh COMMAND $ test_upload_mesh ) +-add_test( NAME boxm_algo_test_fill_internal_cells COMMAND $ test_boxm_fill_internal_cells ) +-add_test( NAME boxm_algo_test_scene_crop COMMAND $ test_boxm_scene_crop ) +-add_test( NAME boxm_algo_test_linear_operations COMMAND $ test_linear_operations ) +-add_test( NAME boxm_algo_remove_level0 COMMAND $ test_remove_level0 ) +- +-add_executable( boxm_algo_test_include test_include.cxx ) +-target_link_libraries( boxm_algo_test_include boxm_algo) +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx b/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx +deleted file mode 100644 +index 509f828fb6..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx ++++ /dev/null +@@ -1,112 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date February 4, 2010 +- +-#include +-#include +-#include +- +-const bool debug = false; +- +-void build_tree(boct_tree* tree) +-{ +- std::cout << "Creating Octree" << std::endl; +- +- // Create tree +- tree->split(); +- { +- std::vector*> leaves = tree->leaf_cells(); +- leaves[1]->set_data(0.1f); +- leaves[1]->split(); +- for (auto & leave : leaves) +- leave->set_data(0.1f); +- } +- +- if (debug) +- { +- std::cout << "All Levels" << std::endl; +- std::vector*> leaves = tree->all_cells(); +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->get_code().level << ',' +- << leave->data() << std::endl; +- } +- } +-} +- +-static void test_boxm_fill_internal_cells() +-{ +- //Create a dummy scene +- typedef boct_tree tree_type; +- auto *tree = new boct_tree(3); +- build_tree(tree); +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0.0,0.0,0.0); +- +- //world coordinate dimensions of a block +- vgl_vector_3d block_dim(10.0,10.0,10.0); +- +- //number of blocks in a scene +- vgl_vector_3d world_dim(1,1,1); +- +- auto *scene= new boxm_scene(lvcs, origin, block_dim, world_dim,true); +- std::string scene_path="."; +- scene->set_paths(scene_path, "in_block"); +- scene->set_appearance_model(BOXM_FLOAT); +- scene->clean_scene(); +- +- boxm_block_iterator iter =scene->iterator(); +- iter.begin(); +- scene->load_block(iter.index()); +- boxm_block *block = scene->get_active_block(); +- block->init_tree(tree); +- scene->write_active_block(); +- +- vgl_box_3d bbox(vgl_point_3d(5, 0, 0), vgl_point_3d(9, 4, 4)); +- +- boxm_fill_internal_cells filler; +- boxm_scene *scene_out = filler.traverse_and_fill(scene); +- +- //check that output scene is correct +- boxm_block_iterator iter_out =scene_out->iterator(); +- iter_out.begin(); +- scene_out->load_block(iter_out.index()); +- boxm_block *block_out = scene_out->get_active_block(); +- boct_tree *tree_out= block_out->get_tree(); +- std::vector*> cells = tree_out->all_cells(); +- bool result = true; +- for (auto & cell : cells) +- { +- if (!cell->is_leaf()) +- { +- boct_tree_cell* children = cell->children(); +- float avg =0; +- for (unsigned c=0; c<8; c++) +- { +- avg+=children[c].data(); +- } +- result = result && (cell->data()==(avg/8.f)); +- } +- } +- TEST("Valid average cells", result, true); +- +- if (debug) { +- std::cout << "Printing Output Tree" << std::endl; +- for (auto & cell : cells) { +- std::cout<< cell->get_code().x_loc_ << ',' +- << cell->get_code().y_loc_ << ',' +- << cell->get_code().z_loc_ << ',' +- << cell->get_code().level << ',' +- << cell->data() << std::endl; +- } +- } +- +- scene->clean_scene(); +- scene_out->clean_scene(); +-} +- +-TESTMAIN(test_boxm_fill_internal_cells); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx b/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx +deleted file mode 100644 +index 73eff00099..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx ++++ /dev/null +@@ -1,129 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date Nov. 16, 2009. +- +-#include +-#include +-#include +- +-const bool debug = true; +- +-void fill_sample_octree(boct_tree* tree) +-{ +- std::cout << "Creating Octree" << std::endl; +- +- //Create tree +- tree->init_cells(0.1f); +- tree->split(); +- std::cout << "Level 1" << std::endl; +- +- { +- std::vector*> leaves = tree->leaf_cells(); +- tree->init_cells(0.1f); +- leaves[1]->set_data(0.5f); +- if (debug) +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->data() << std::endl; +- } +- +- leaves[1]->split(); +- } +- +- if (debug) +- { +- std::cout << "Level 0" << std::endl; +- std::vector*> leaves = tree->cells_at_level((short)0); +- for (auto & leave : leaves) { +- leave->set_data(0.9f); +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->get_code().level << ',' +- << leave->data() << std::endl; +- } +- } +- +- if (debug) +- { +- std::cout << "All Levels" << std::endl; +- std::vector*> leaves = tree->all_cells(); +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->get_code().level << ',' +- << leave->data() << std::endl; +- } +- } +-} +- +-static void test_boxm_scene_crop() +-{ +- //Create a dummy scene +- typedef boct_tree tree_type; +- auto *tree = new boct_tree(3); +- fill_sample_octree(tree); +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0.0,0.0,0.0); +- +- //world coordinate dimensions of a block +- vgl_vector_3d block_dim(10.0,10.0,10.0); +- +- //number of blocks in a scene +- vgl_vector_3d world_dim(1,1,1); +- +- auto *scene= new boxm_scene(lvcs, origin, block_dim, world_dim,true); +- std::string scene_path="."; +- scene->set_paths(scene_path, "in_block"); +- scene->set_appearance_model(BOXM_FLOAT); +- scene->clean_scene(); +- +- boxm_block_iterator iter =scene->iterator(); +- iter.begin(); +- scene->load_block(iter.index()); +- boxm_block *block = scene->get_active_block(); +- block->init_tree(tree); +- scene->write_active_block(); +- +- vgl_box_3d bbox(vgl_point_3d(5, 0, 0), vgl_point_3d(9, 4, 4)); +- +- boxm_scene *scene_out = boxm_crop_scene(scene, bbox); +- +- //check that output scene is correct +- boxm_block_iterator iter_out =scene_out->iterator(); +- iter_out.begin(); +- scene_out->load_block(iter_out.index()); +- boxm_block *block_out = scene_out->get_active_block(); +- boct_tree *tree_out= block_out->get_tree(); +- +- std::vector*> leaves_out = tree_out->leaf_cells(); +- bool result = true; +- for (auto & i : leaves_out) +- { +- result = result && (std::abs(i->data() - 0.9)< 1e-5); +- } +- +- TEST("Valid cropped tree", result, true); +- +- std::vector*> leaves = tree_out->all_cells(); +- if (debug) { +- std::cout << "Printing Output Tree" << std::endl; +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->get_code().level << ',' +- << leave->data() << std::endl; +- } +- } +- +- scene->clean_scene(); +- scene_out->clean_scene(); +-} +- +-TESTMAIN(test_boxm_scene_crop); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx b/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx +deleted file mode 100644 +index 299ce36aab..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx ++++ /dev/null +@@ -1,23 +0,0 @@ +-#include +- +-DECLARE( test_fill_in_mesh ); +-DECLARE( test_save_scene_raw ); +-DECLARE( test_upload_mesh ); +-DECLARE( test_boxm_fill_internal_cells ); +-DECLARE( test_boxm_scene_crop ); +-DECLARE( test_linear_operations ); +-DECLARE( test_remove_level0 ); +- +-void register_tests() +-{ +- REGISTER( test_fill_in_mesh ); +- REGISTER( test_save_scene_raw ); +- REGISTER( test_upload_mesh ); +- REGISTER( test_boxm_fill_internal_cells ); +- REGISTER( test_boxm_scene_crop ); +- REGISTER( test_linear_operations ); +- REGISTER( test_remove_level0 ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx b/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx +deleted file mode 100644 +index 564a5c4359..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx ++++ /dev/null +@@ -1,121 +0,0 @@ +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-static void test_fill_in_mesh() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- scene.set_paths("./boxm_fill_in", "block"); +- vul_file::make_directory("./boxm_fill_in"); +- std::ofstream os("scene.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- //// create a mesh +- unsigned int num_faces=6; +- std::unique_ptr > verts(new imesh_vertex_array<3>(8)); +- std::unique_ptr faces(new imesh_face_array(num_faces)); +- imesh_vertex<3>& vert0 = (*verts)[0]; imesh_vertex<3>& vert4 = (*verts)[4]; +- vert0[0]=2; vert4[0]=2; +- vert0[1]=2; vert4[1]=2; +- vert0[2]=4; vert4[2]=8; +- imesh_vertex<3>& vert1 = (*verts)[1]; imesh_vertex<3>& vert5 = (*verts)[5]; +- vert1[0]=4; vert5[0]=4; +- vert1[1]=2; vert5[1]=2; +- vert1[2]=4; vert5[2]=8; +- imesh_vertex<3>& vert2 = (*verts)[2]; imesh_vertex<3>& vert6 = (*verts)[6]; +- vert2[0]=4; vert6[0]=4; +- vert2[1]=4; vert6[1]=4; +- vert2[2]=4; vert6[2]=8; +- +- imesh_vertex<3>& vert3 = (*verts)[3]; imesh_vertex<3>& vert7 = (*verts)[7]; +- vert3[0]=2; vert7[0]=2; +- vert3[1]=4; vert7[1]=4; +- vert3[2]=4; vert7[2]=8; +- +- std::vector face(4,0); +- face[0]=4;face[1]=5;face[2]=6;face[3]=7; +- (*faces)[0]=face; +- face[0]=3;face[1]=2;face[2]=1;face[3]=0; +- (*faces)[1]=face; +- face[0]=0;face[1]=4;face[2]=7;face[3]=3; +- (*faces)[2]=face; +- face[0]=1;face[1]=2;face[2]=6;face[3]=5; +- (*faces)[3]=face; +- face[0]=1;face[1]=5;face[2]=4;face[3]=0; +- (*faces)[4]=face; +- face[0]=3;face[1]=7;face[2]=6;face[3]=2; +- (*faces)[5]=face; +- +- +- imesh_mesh mesh; +-#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) +- std::unique_ptr tempv(std::move(verts)); +- mesh.set_vertices(std::move(tempv)); +- std::unique_ptr tempf(std::move(faces)); +- mesh.set_faces(std::move(tempf)); +-#else +- mesh.set_vertices(std::unique_ptr(verts)); +- mesh.set_faces(std::unique_ptr(faces)); +-#endif +- +- typedef boct_tree > tree_type; +- boxm_block_iterator > > iter(&scene); +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(7,6); +- boxm_sample s; +- s.alpha=std::numeric_limits::max(); +- tree->init_cells(s); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- } +- +- boxm_sample val; +- val.alpha=0; +- std::vector meshes; meshes.push_back(mesh); +- boxm_fill_in_mesh_into_scene >(scene, meshes, false, val); +- +- std::vector fnames; +- boxm_block_iterator it(&scene); +- +- // check the first block +- scene.load_block(it.index().x(),it.index().y(),it.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- boct_tree > * tree=block->get_tree(); +- +- +- boct_tree_cell >* cell0 = tree->locate_point_global(vgl_point_3d(3,3,6)); +- TEST("Centroid of the mesh is in the octree", cell0->data().alpha, 0.0f); +- +- +- vpl_rmdir("boxm_fill_in"); +- vpl_unlink("scene.xml"); +-} +- +-TESTMAIN(test_fill_in_mesh); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/tests/test_include.cxx +deleted file mode 100644 +index c59d7e8540..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_include.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx b/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx +deleted file mode 100644 +index 0e4fe4f91c..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx ++++ /dev/null +@@ -1,82 +0,0 @@ +-//: +-// \file +-// \brief Test linear combinations of blocks +-// \author Isabel Restrepo +-// \date 2-Feb-2011 +- +-#include +-#include +-#include "test_utils.h" +- +-void test_linear_operations() +-{ +- clean_up(); +- //create scene +- boxm_scene > *scene1 = create_scene(2,2,2,true, "test_scene1"); +- boxm_scene > *scene2 = create_scene(2,2,2,true, "test_scene2"); +- +- float s1 = 2.0, s2=3.0; +- for (unsigned i = 0; i< 2; i++) +- for (unsigned j = 0; j < 2; j++) +- for (unsigned k = 0; k< 2; k++) +- { +- scene1->load_block(i,j,k); +- scene2->load_block(i,j,k); +- +- boxm_block > *block1 = scene1->get_block(i,j,k); +- boxm_block > *block2 = scene2->get_block(i,j,k); +- +- //The result is block1 = s1*block1+ s2*block2 +- boxm_linear_combination(block1, block2, s1, s2); +- +- //make sure to write the block back to disk +- scene1->write_active_block(); +- +- //clean memory +- scene1->unload_active_blocks(); +- scene2->unload_active_blocks(); +- } +- +- +- //Test the output scene. Scene1 should contain the result i.e (2*0.8 + 3*0.8) and scene2 should be unchanged +- boxm_cell_iterator > it1 = +- scene1->cell_iterator(&boxm_scene >::load_block, true); +- +- boxm_cell_iterator > it2 = +- scene2->cell_iterator(&boxm_scene >::load_block, true); +- +- it1.begin(); +- it2.begin(); +- bool result = true; +- +- while ( !(it1.end() || it2.end()) ) { +- +- boct_tree_cell *cell1 = *it1; +- boct_tree_cell *cell2 = *it2; +- +- if (std::abs(cell1->data()- 4.0f) > 1.0e-7){ +- std::cerr << "Data1 is incorrect: "<< cell1->data() <<"Error: " << std::abs(cell1->data()- 4.0f) << '\n'; +- result = false; +- break; +- } +- +- if (std::abs(cell2->data()- 0.8f) > 1.0e-7){ +- std::cerr << "Data2 is incorrect: " << cell2->data()<<'\n'; +- result = false; +- break; +- } +- +- ++it1; +- ++it2; +- } +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks at test_linear_operations " << boct_tree_cell::nleaks() << std::endl; +-#endif +- +- TEST("Output data is correct", result, true); +- clean_up(); +-} +- +- +-TESTMAIN(test_linear_operations); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx b/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx +deleted file mode 100644 +index 1243faf34f..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx ++++ /dev/null +@@ -1,54 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date Nov 23 2011 +- +-#include +-#include "test_utils.h" +- +-#include +- +- +-void test_remove_level0() +-{ +- clean_up(); +- //create scene +- boxm_scene > *scene1 = create_scene(2,2,2,true, "test_scene1"); +- +- //clone the input scene +- boxm_scene > *scene2 = new boxm_scene >(scene1->lvcs(), scene1->origin(), scene1->block_dim(), +- scene1->world_dim(), scene1->max_level(), scene1->init_level(), +- scene1->load_all_blocks(), scene1->save_internal_nodes()); +- +- std::stringstream block_pref; +- block_pref << scene1->block_prefix() << "_max_level_" << (scene1->max_level() - 1); +- scene2->set_paths(scene1->path(), block_pref.str()); +- scene2->set_appearance_model(scene1->appearence_model()); +- +- std::cout << "Cloning\n"; +- scene1->clone_blocks(*scene2); +- std::cout << "Restructuring\n"; +- boxm_remove_level_0_leaves(scene2); +- std::cout << "Done\n"; +- +- //Show contents of the scenes scene +- boxm_block_iterator > it1 = scene1->iterator(); +- boxm_block_iterator > it2 = scene2->iterator(); +- for (it1.begin(), it2.begin(); !it1.end() && !it2.end(); ++it1, ++it2) +- { +- scene1->load_block(it1.index()); +- scene2->load_block(it2.index()); +- +- boxm_block > *block1 = scene1->get_active_block(); +- boxm_block > *block2 = scene2->get_active_block(); +- +- block1->get_tree()->print(); +- block2->get_tree()->print(); +- } +- +- scene1->unload_active_blocks(); +- scene2->unload_active_blocks(); +-} +- +- +-TESTMAIN(test_remove_level0); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx b/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx +deleted file mode 100644 +index 62b425171a..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx ++++ /dev/null +@@ -1,122 +0,0 @@ +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-static int test_save_scene_raw() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(5,5,5); +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- scene.set_paths("boxm_scene1", "block"); +- vul_file::make_directory("boxm_scene1"); +- std::ofstream os("scene1.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- unsigned max_level=10, init_level=3; +- +- boxm_block_iterator > > iter(&scene); +- // default model +- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- +- boxm_sample default_sample; +- default_sample.alpha=0.001f; +- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1); +- +- // sample 1 +- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f); +- bsta_num_obs s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s1_simple_mix_gauss_val_sf1; +- +- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s1_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1); +- +- +- boxm_sample s1_sample; +- s1_sample.alpha=0.6f; +- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1); +- +- // sample 2 +- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f); +- bsta_num_obs s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> s2_simple_mix_gauss_val_sf1; +- +- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1); +- +- typedef bsta_mixture_fixed,3> s2_simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1); +- +- +- boxm_sample s2_sample; +- s2_sample.alpha=0.6f; +- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1); +- +- +- float count=0.1f; +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- boct_tree > * tree; +- if (iter.index().x()==0 && iter.index().y()==0 && iter.index().z()==0) { +- tree = new boct_tree >(max_level,init_level); +- } +- else { +- tree=new boct_tree >(max_level,init_level-1); +- } +- boct_tree_cell >* cel11=tree->locate_point(vgl_point_3d(0.01,0.01,0.9)); +- s2_sample.alpha=count; +- +- cel11->set_data(s2_sample); +- //boct_tree_cell >* cell2=tree->locate_point(vgl_point_3d(0.51,0.51,0.51)); +- //cell2->set_data(s2_sample); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- count+=0.1f; +- } +- +- +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+world_dim.x(), origin.y()+world_dim.y(), origin.z()+world_dim.z())); +- +- float thresh=0.02f; +- bool reset=false; +- for (unsigned i=0; i<10; i++) { +- boxm_refine_scene >(scene, thresh, reset); +- boxm_save_scene_raw >(scene, "scene.raw", 0); +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks at test_save_scene_raw " << boct_tree_cell::nleaks() << std::endl; +-#endif +- } +- +- SUMMARY(); +-} +- +-TESTMAIN(test_save_scene_raw); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx b/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx +deleted file mode 100644 +index ced456755e..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx ++++ /dev/null +@@ -1,127 +0,0 @@ +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-static void test_upload_mesh() +-{ +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,1); +- boxm_scene > > scene(lvcs, origin, block_dim, world_dim); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- +-#if 0 +- if (vul_file_is_directory("./boxm_upload")) +- { +- vul_file_iterator fiter("./boxm_upload/*"); +- while (!fiter) +- { +- vpl_unlink(fiter()); +- fiter++; +- } +- vpl_rmdir("./boxm_upload"); +- } +-#endif // 0 +- +- scene.set_paths("./boxm_upload", "block"); +- vul_file::make_directory("./boxm_upload"); +- std::ofstream os("scene.xml"); +- x_write(os, scene, "scene"); +- os.close(); +- +- // create a mesh +- unsigned int num_faces=1; +- std::unique_ptr > verts(new imesh_vertex_array<3>(3)); +- std::unique_ptr faces(new imesh_face_array(num_faces)); +- imesh_vertex<3>& vert0 = (*verts)[0]; +- vert0[0]=2; +- vert0[1]=2; +- vert0[2]=4; +- imesh_vertex<3>& vert1 = (*verts)[1]; +- vert1[0]=8; +- vert1[1]=2; +- vert1[2]=4; +- imesh_vertex<3>& vert2 = (*verts)[2]; +- vert2[0]=8; +- vert2[1]=8; +- vert2[2]=4; +- +- for (unsigned int f=0; f& face = (*faces)[f]; +- unsigned int cnt=3; +- face.resize(cnt,0); +- for (unsigned int v=0; v= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) +- std::unique_ptr tempv(std::move(verts)); +- mesh.set_vertices(std::move(tempv)); +- std::unique_ptr tempf(std::move(faces)); +- mesh.set_faces(std::move(tempf)); +-#else +- mesh.set_vertices(std::unique_ptr(verts)); +- mesh.set_faces(std::unique_ptr(faces)); +-#endif +- +- typedef boct_tree > tree_type; +- boxm_block_iterator > > iter(&scene); +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(6,5); +- boxm_sample s; +- s.alpha=std::numeric_limits::max(); +- tree->init_cells(s); +- block->init_tree(tree); +- scene.write_active_block(); +- iter++; +- } +- +- boxm_sample val; +- val.alpha=0; +- boxm_upload_mesh_into_scene >(scene, mesh, false, val); +- +- std::vector fnames; +- boxm_block_iterator it(&scene); +- it.begin(); +- // check the first block +- scene.load_block(it.index().x(),it.index().y(),it.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- boct_tree > * tree=block->get_tree(); +- +- boct_tree_cell >* cell0 = tree->locate_point_global(vert0.operator vgl_point_3d()); +- TEST("Vertex 0 is in the octree", cell0->data().alpha, 0.0f); +- +- boct_tree_cell >* cell1 = tree->locate_point_global(vert1.operator vgl_point_3d()); +- TEST("Vertex 1 is in the octree", cell1->data().alpha, 0.0f); +- +- boct_tree_cell >* cell2 = tree->locate_point_global(vert2.operator vgl_point_3d()); +- TEST("Vertex 2 is in the octree", cell2->data().alpha, 0.0f); +- +- boct_tree_cell >* cell = tree->locate_point_global(vgl_point_3d(1,1,1)); +- TEST_NEAR("A non-polygon point should be non-zero", cell->data().alpha, std::numeric_limits::max(), 1e-6); +- +- vpl_rmdir("./boxm_upload"); +- vpl_unlink("./scene.xml"); +-} +- +-TESTMAIN(test_upload_mesh); +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx b/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx +deleted file mode 100644 +index f286501eee..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx ++++ /dev/null +@@ -1,71 +0,0 @@ +-#include "test_utils.h" +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Aug-2010 +- +-#include +-#include +-#include +- +-#include +- +-void init_tree(boct_tree *tree, unsigned i) +-{ +- tree-> split(); //now we have 8 cells +- //tree->print(); +- std::vector*> leaves = tree->leaf_cells(); +- leaves[i]->set_data(0.8f); +- leaves[i]->split(); +-} +- +-boxm_scene >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz, bool uniform, std::string scene_name) +-{ +- //crete the input scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- +- vgl_vector_3d block_dim(10, 10, 10); //world coordinate dimensions of a block +- +- vgl_vector_3d world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene +- +- auto *scene = new boxm_scene >(lvcs, origin, block_dim, world_dim); +- std::string scene_path("./"); +- scene->set_paths(scene_path, std::move(scene_name)); +- +- unsigned cell_index = 7; +- boxm_block_iterator > iter=scene->iterator(); +- iter.begin(); +- while (!iter.end()) +- { +- scene->load_block(iter.index()); +- boxm_block > *block = scene->get_active_block(); +- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0 +- +- float init_val = 0.5f; +- if (uniform) +- init_val = 0.8f; +- +- auto *tree = new boct_tree(init_val, 3, 1); +- //tree->print(); +- init_tree(tree, cell_index); +- //tree->print(); +- block->init_tree(tree); +- scene->write_active_block(); +- if (cell_index == 0) cell_index = 7; +- cell_index--; +- ++iter; +- } +- return scene; +-} +- +-void clean_up() +-{ +- //clean temporary files +- vul_file_iterator file_it("./*.bin"); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it()); +- vul_file::delete_file_glob(file_it()); +- } +-} +diff --git a/contrib/brl/bseg/boxm/algo/tests/test_utils.h b/contrib/brl/bseg/boxm/algo/tests/test_utils.h +deleted file mode 100644 +index f646d0b390..0000000000 +--- a/contrib/brl/bseg/boxm/algo/tests/test_utils.h ++++ /dev/null +@@ -1,18 +0,0 @@ +-#ifndef boxm_algo_test_utils_h_ +-#define boxm_algo_test_utils_h_ +-//: +-// \file +-// \brief A file containing utility functions for other tests +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include +- +-void init_tree(boct_tree *tree, unsigned i); +- +-boxm_scene >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2, +- bool uniform = false, std::string scene_name = "test_scene"); +- +-void clean_up(); +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/CMakeLists.txt b/contrib/brl/bseg/boxm/basic/CMakeLists.txt +deleted file mode 100644 +index a5e13d6975..0000000000 +--- a/contrib/brl/bseg/boxm/basic/CMakeLists.txt ++++ /dev/null +@@ -1,21 +0,0 @@ +-# brl/bseg/boxm/basic/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_basic_sources +- boxm_block_vis_graph_iterator.h boxm_block_vis_graph_iterator.hxx +- boxm_block_vis_graph_node.h +- boxm_cell_vis_graph_iterator.h boxm_cell_vis_graph_iterator.hxx +- boxm_raytrace_function.h +- boxm_seg_length_functor.h +- boxm_num_rays_functor.h +- boxm_util_data_types.h boxm_util_data_types.cxx +- ) +- +-aux_source_directory(Templates boxm_basic_sources) +- +-vxl_add_library(LIBRARY_NAME boxm_basic LIBRARY_SOURCES ${boxm_basic_sources}) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-target_link_libraries(boxm_basic boxm boxm_util boxm_sample boxm_sample_algo boct ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl) +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx +deleted file mode 100644 +index b4bce045ed..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree tree_type; +- +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx +deleted file mode 100644 +index 4129f1a830..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx +deleted file mode 100644 +index 450ee3e72c..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index 2cd39a3534..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx +deleted file mode 100644 +index 60ef86952b..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx +deleted file mode 100644 +index d4a5a0384f..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +- +-typedef boct_tree > aux_tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(aux_tree_type); +- +-typedef boct_tree aux_tree_type2; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(aux_tree_type2); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx +deleted file mode 100644 +index 10b6aa91a5..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 72ebcd47fb..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx +deleted file mode 100644 +index 0fcf5fd35c..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 3ad032ddf2..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index 9ee11b98ea..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx +deleted file mode 100644 +index c2743dff25..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_VIS_GRAPH_NODE_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx +deleted file mode 100644 +index fb158b16d1..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_edge_sample); +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_aux_edge_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index b561f8e125..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_edge_tangent_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx +deleted file mode 100644 +index 343941bf71..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_inf_line_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx +deleted file mode 100644 +index 69a4394c0b..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 2bf0739edf..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx +deleted file mode 100644 +index 29aadb8cb1..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index ed5b966521..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample_multi_bin); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx +deleted file mode 100644 +index c961518029..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,vgl_point_3d); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx b/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx +deleted file mode 100644 +index 84a7a2e75f..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(boxm_array_1d_float_sptr,"boxm_array_1d_float_sptr"); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx b/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx +deleted file mode 100644 +index d887b99938..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(boxm_array_1d_float); +diff --git a/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx b/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx +deleted file mode 100644 +index 2a77fe6767..0000000000 +--- a/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(boxm_array_1d_float); +diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h +deleted file mode 100644 +index 70f36b1047..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h ++++ /dev/null +@@ -1,53 +0,0 @@ +-#ifndef boxm_block_vis_graph_iterator_h_ +-#define boxm_block_vis_graph_iterator_h_ +-//: +-// \file +-#include +-#include +-#include +-#include "boxm_block_vis_graph_node.h" +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_block_vis_graph_iterator +-{ +- public: +- boxm_block_vis_graph_iterator(vpgl_camera_double_sptr cam, boxm_scene* scene, +- unsigned img_ni, unsigned img_nj, bool rev_iter=false); +- +- ~boxm_block_vis_graph_iterator()= default; +- +- bool next(); +- +- std::vector*> frontier_blocks(); +- +- std::vector > frontier_indices() const {return to_process_indices_; } +- +- void set_reverse_iter(bool reverse) { reverse_it_ = reverse; } +- +- private: +- +- typedef std::map, boxm_block_vis_graph_node, vgl_point_3d_cmp > vis_graph_type; +- +- //: visibility graph, indexed by the block indices +- vis_graph_type vis_graph_; +- +- //: blocks that can be seen by the camera unoccluded +- std::vector curr_blocks_; +- +- std::vector > to_process_indices_; +- +- //: the camera +- vpgl_camera_double_sptr camera_; +- +- boxm_scene* scene_; +- +- bool reverse_it_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx +deleted file mode 100644 +index 4baa6d8992..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx ++++ /dev/null +@@ -1,173 +0,0 @@ +-#ifndef boxm_block_vis_graph_iterator_hxx_ +-#define boxm_block_vis_graph_iterator_hxx_ +- +-#include "boxm_block_vis_graph_iterator.h" +-#include "boxm_block_vis_graph_node.h" +-#include +-#include +- +-template +-boxm_block_vis_graph_iterator::boxm_block_vis_graph_iterator(vpgl_camera_double_sptr cam, +- boxm_scene* scene, +- unsigned img_ni, +- unsigned img_nj, +- bool rev_iter) +- : camera_(cam), scene_(scene), reverse_it_(rev_iter) +-{ +- // compute the visibility graph +- boxm_block_iterator iter = scene->iterator(); +- for (; !iter.end(); iter++) { +- boxm_block* block = *iter; +- if (boxm_utils::is_visible(block->bounding_box(), cam, img_ni, img_nj)) +- vis_graph_.insert(std::make_pair,boxm_block_vis_graph_node >(iter.index(),boxm_block_vis_graph_node())); +- } +- +- typename vis_graph_type::iterator vis_iter; +- for (vis_iter=vis_graph_.begin(); vis_iter!=vis_graph_.end(); vis_iter++) { +- vgl_point_3d idx = vis_iter->first; +- boxm_block* block = scene->get_block(idx); +- boct_face_idx vis_faces = boxm_utils::visible_faces(block->bounding_box(), cam); +- +- vgl_point_3d neighbor_idx = vis_iter->first; +- bool face_in = false; +- if (vis_faces & X_HIGH) { +- // check for neighbor on X_HIGH face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(-1,0,0); +- else +- neighbor_idx += vgl_vector_3d(1,0,0); +- face_in = true; +- } else if (vis_faces & X_LOW) { +- // check for neighbor on X_LOW face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(1,0,0); +- else +- neighbor_idx += vgl_vector_3d(-1,0,0); +- face_in = true; +- } +- +- if (face_in) { +- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx); +- if (nit == vis_graph_.end()) { +- vis_iter->second.in_count++; +- curr_blocks_.push_back(vis_iter); +- } else { +- vis_iter->second.in_count++; +- nit->second.out_links.push_back(vis_iter); +- } +- } +- +- face_in = false; +- neighbor_idx = vis_iter->first; +- if (vis_faces & Y_HIGH) { +- // check for neighbor on Y_HIGH face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(0,-1,0); +- else +- neighbor_idx += vgl_vector_3d(0,1,0); +- face_in = true; +- } else if (vis_faces & Y_LOW) { +- // check for neighbor on Y_LOW face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(0,1,0); +- else +- neighbor_idx += vgl_vector_3d(0,-1,0); +- face_in = true; +- } +- +- if (face_in) { +- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx); +- if (nit == vis_graph_.end()) { +- vis_iter->second.in_count++; +- curr_blocks_.push_back(vis_iter); +- } else { +- vis_iter->second.in_count++; +- nit->second.out_links.push_back(vis_iter); +- } +- } +- +- face_in=false; +- neighbor_idx = vis_iter->first; +- if (vis_faces & Z_HIGH) { +- // check for neighbor on Z_HIGH face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(0,0,-1); +- else +- neighbor_idx += vgl_vector_3d(0,0,1); +- face_in = true; +- }else if (vis_faces & Z_LOW) { +- // check for neighbor on Y_LOW face +- if (reverse_it_) +- neighbor_idx += vgl_vector_3d(0,0,1); +- else +- neighbor_idx += vgl_vector_3d(0,0,-1); +- face_in = true; +- } +- +- if (face_in) { +- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx); +- if (nit == vis_graph_.end()) { +- vis_iter->second.in_count++; +- curr_blocks_.push_back(vis_iter); +- } +- else { +- vis_iter->second.in_count++; +- nit->second.out_links.push_back(vis_iter); +- } +- } +- } +-} +- +-template +-bool boxm_block_vis_graph_iterator::next() +-{ +- typename std::vector::iterator block_iter = curr_blocks_.begin(); +- std::vector to_process; +- +- for (; block_iter != curr_blocks_.end(); block_iter++) { +- //std::cout << (*block_iter)->first; +- //std::cout << (*block_iter)->second.in_count << std::endl; +- if (--((*block_iter)->second.in_count) == 0) +- to_process.push_back(*block_iter); +- } +- +- if (to_process.size() == 0) { +- to_process_indices_.resize(0); +- return false; +- } +- to_process_indices_.resize(to_process.size()); +- +- std::vector >::iterator to_proc_it = to_process_indices_.begin(); +- for (block_iter = to_process.begin(); block_iter != to_process.end(); ++block_iter, ++to_proc_it) { +- *to_proc_it = (*block_iter)->first; +- } +- +- // add linked blocks to list for next iteration +- curr_blocks_.clear(); +- for (block_iter = to_process.begin(); block_iter != to_process.end(); ++block_iter) { +- std::vector &links = (*block_iter)->second.out_links; +- typename std::vector::iterator neighbor_it = links.begin(); +- for (; neighbor_it != links.end(); ++neighbor_it) { +- curr_blocks_.push_back(*neighbor_it); +- } +- } +- return true; +-} +- +-template +-std::vector*> boxm_block_vis_graph_iterator::frontier_blocks() +-{ +- std::vector*> frontier; +- +- std::vector > blocks = to_process_indices_; +- for (auto index : blocks) { +- frontier.push_back(scene_->get_block(index)); //.x(), index.y(), index.z()); +- } +- +- return frontier; +-} +- +-#define BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(T) \ +-template class boxm_block_vis_graph_iterator +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h +deleted file mode 100644 +index 1d615b1477..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h ++++ /dev/null +@@ -1,52 +0,0 @@ +-#ifndef boxm_block_vis_graph_node_h_ +-#define boxm_block_vis_graph_node_h_ +-//: +-// \file +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//: A comparison functor for vgl_point_3d's. Needed to create a std::set of vgl_point_3d's. +-template +-class vgl_point_3d_cmp +-{ +- public: +- vgl_point_3d_cmp() = default; +- +- bool operator()(vgl_point_3d const& v0, vgl_point_3d const& v1) const +- { +- if (v0.z() != v1.z()) +- return v0.z() < v1.z(); +- else if (v0.y() != v1.y()) +- return v0.y() < v1.y(); +- else +- return v0.x() < v1.x(); +- } +-}; +- +-template +-class boxm_block_vis_graph_node +-{ +- public: +- typedef std::map, boxm_block_vis_graph_node, vgl_point_3d_cmp > vis_graph_type; +- +- boxm_block_vis_graph_node() : in_count(0) {} +- ~boxm_block_vis_graph_node()= default; +- +- int dec_in_count() { return --in_count; } +- +- //: the number of incoming edges to this node +- int in_count; +- +- //: graph links to the outgoing blocks +- std::vector out_links; +-}; +- +-#define BOXM_BLOCK_VIS_GRAPH_NODE_INSTANTIATE(T) \ +-template class boxm_block_vis_graph_node +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h b/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h +deleted file mode 100644 +index 6bc8372e16..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-#ifndef boxm_cell_vis_graph_iterator_h_ +-#define boxm_cell_vis_graph_iterator_h_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_cell_vis_graph_iterator +-{ +- public: +- boxm_cell_vis_graph_iterator(vpgl_camera_double_sptr cam, +- boct_tree* tree, +- unsigned img_ni, +- unsigned img_nj); +- +- ~boxm_cell_vis_graph_iterator() = default; +- +- bool next(); +- +- std::vector*> frontier() { return frontier_; } +- +- void set_reverse_iter(bool reverse) { reverse_iter_ = reverse; } +- +- private: +- //: the camera +- vpgl_camera_double_sptr camera_; +- +- //: blocks that can be seen by the camera unoccluded +- std::vector*> frontier_; +- std::vector*> curr_cells_; +- bool reverse_iter_; +- +- unsigned img_ni_; +- unsigned img_nj_; +- +- //: recursive function +- void check_cell_visibility(boct_tree* tree, +- boct_tree_cell* tree_cell); +- +- void form_graph_per_cell(boct_tree_cell* cell, +- boct_face_idx face_idx, +- boct_tree* tree); +- +- std::vector* > list_of_vis_nodes_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx b/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx +deleted file mode 100644 +index 4108982a68..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx ++++ /dev/null +@@ -1,131 +0,0 @@ +-#ifndef boxm_cell_vis_graph_iterator_hxx_ +-#define boxm_cell_vis_graph_iterator_hxx_ +- +-#include "boxm_cell_vis_graph_iterator.h" +-#include +- +-template +-boxm_cell_vis_graph_iterator::boxm_cell_vis_graph_iterator(vpgl_camera_double_sptr cam, +- boct_tree* tree, +- unsigned img_ni, +- unsigned img_nj) : camera_(cam),img_ni_(img_ni), img_nj_(img_nj) +-{ +- if (!tree) +- { +- std::cout<<"No Tree found"<root()); +- // compute the visibility graph +- for (unsigned i=0;icell_bounding_box(list_of_vis_nodes_[i]), cam); +- if (vis_faces & ::X_HIGH) { +- form_graph_per_cell(list_of_vis_nodes_[i],X_HIGH,tree); +- } +- else if (vis_faces & ::X_LOW) { +- form_graph_per_cell(list_of_vis_nodes_[i],X_LOW,tree); +- } +- if (vis_faces & ::Y_HIGH) { +- form_graph_per_cell(list_of_vis_nodes_[i],Y_HIGH,tree); +- } +- else if (vis_faces & ::Y_LOW) { +- form_graph_per_cell(list_of_vis_nodes_[i],Y_LOW,tree); +- } +- if (vis_faces & ::Z_HIGH) { +- form_graph_per_cell(list_of_vis_nodes_[i],Z_HIGH,tree); +- } +- else if (vis_faces & ::Z_LOW) { +- form_graph_per_cell(list_of_vis_nodes_[i],Z_LOW,tree); +- } +- } +- list_of_vis_nodes_.clear(); +- } +-} +- +-template +-bool boxm_cell_vis_graph_iterator::next() +-{ +- std::vector* > to_process; +- std::vector* > to_process_refine; +- +- typename std::vector* >::iterator cell_it = curr_cells_.begin(); +- for (; cell_it != curr_cells_.end(); ++cell_it) { +- // decrement each cell's count in list. if count == 0, add to list of nodes to process +- if (--((*cell_it)->vis_node()->incoming_count) == 0) { +- to_process.push_back(*cell_it); +- } +- } +- if (to_process.size() == 0) { +- return false; +- } +- frontier_.clear(); +- +- for (cell_it = to_process.begin(); cell_it != to_process.end(); ++cell_it) { +- frontier_.push_back((*cell_it)); +- } +- // add linked cells to list for next iteration +- curr_cells_.clear(); +- for (cell_it = to_process.begin(); cell_it != to_process.end(); ++cell_it) { +- std::vector* > links = (*cell_it)->vis_node()->outgoing_links; +- typename std::vector* >::iterator neighbor_it = links.begin(); +- for (; neighbor_it != links.end(); ++neighbor_it) { +- curr_cells_.push_back(*neighbor_it); +- } +- } +- return true; +-} +- +-template +-void boxm_cell_vis_graph_iterator::check_cell_visibility(boct_tree* tree, +- boct_tree_cell* tree_cell) +-{ +- vgl_box_3d bbox=tree->cell_bounding_box(tree_cell); +- if (boxm_utils::is_visible(bbox, camera_,img_ni_, img_nj_, true)) +- { +- // base case for recursion +- if (tree_cell->is_leaf()) +- { +- boct_cell_vis_graph_node * node=new boct_cell_vis_graph_node(); +- node->visible=true; +- tree_cell->set_vis_node(node); +- list_of_vis_nodes_.push_back(tree_cell); +- } +- else +- { +- boct_tree_cell* children = tree_cell->children(); +- for (unsigned i=0; i<8; i++) +- check_cell_visibility(tree,&children[i]); +- } +- } +-} +- +-template +-void boxm_cell_vis_graph_iterator::form_graph_per_cell(boct_tree_cell* cell,boct_face_idx face_idx,boct_tree* tree) +-{ +- boct_cell_vis_graph_node* vis_node=cell->vis_node(); +- std::vector*> neighbors; +- cell->find_neighbors(face_idx, neighbors,tree->root_level()); +- typename std::vector*>::iterator neighbor_it = neighbors.begin(); +- bool visible_neighbors=false; +- for (; neighbor_it != neighbors.end(); ++neighbor_it) { +- boct_cell_vis_graph_node* neighbor_vis_node=(*neighbor_it)->vis_node(); +- if (neighbor_vis_node) { +- vis_node->incoming_count++; +- neighbor_vis_node->outgoing_links.push_back(cell); +- visible_neighbors=true; +- } +- } +- if (!visible_neighbors) { +- vis_node->incoming_count++; +- curr_cells_.push_back(cell); +- } +-} +- +-#define BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(T1,T2) \ +-template class boxm_cell_vis_graph_iterator +- +-#endif // boxm_cell_vis_graph_iterator_hxx_ +diff --git a/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h b/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h +deleted file mode 100644 +index 98703eec22..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h ++++ /dev/null +@@ -1,44 +0,0 @@ +-#ifndef boxm_num_rays_functor_h +-#define boxm_num_rays_functor_h +-//: +-// \file +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include "boxm_raytrace_function.h" +- +-//: this functor is to compute no of rays passing through a cell +-// Works for boxm_scalar_sample +-template +-class boxm_num_rays_functor +-{ +- public: +- boxm_num_rays_functor() +- { +- scene_read_only_=true; +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int /*i*/, unsigned int /*j*/, // FIXME: both unused! +- vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample & /*cell_value*/, // FIXME: unused... +- T_aux &aux_val) +- { +- const float seg_len = (float)(s1 - s0).length(); +- +- aux_val.scalar_sum_+=1; +- //std::cout< +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template::sample_datatype> +-class boxm_raytrace_function +-{ +- // null scene used as placeholder for operations that don't require an auxiliary scene +- boxm_aux_scene::sample_datatype> null_scene_; +- +- public: +- typedef boct_tree tree_type; +- typedef boct_tree aux_tree_type; +- typedef boct_tree_cell cell_type; +- +- //: constructor for functions with no auxiliary scene needed +- boxm_raytrace_function(boxm_scene &scene, +- vpgl_camera_double_sptr cam, +- unsigned int ni, unsigned int nj, +- bool reverse_traversal = false, +- unsigned int i0 = 0, unsigned int j0 = 0 +- ) +- : scene_(scene), aux_scene_(null_scene_), reverse_traversal_(reverse_traversal), cam_(cam), img_i0_(i0), img_j0_(j0), img_ni_(ni), img_nj_(nj), debug_lvl_(0) {} +- +- //: constructor for functions using an auxiliary scene +- boxm_raytrace_function(boxm_scene &scene, +- boxm_aux_scene &aux_scene, +- vpgl_camera_double_sptr cam, +- unsigned int ni, unsigned int nj, +- bool reverse_traversal = false, +- unsigned int i0 = 0, unsigned int j0 = 0) +- : scene_(scene), aux_scene_(aux_scene), reverse_traversal_(reverse_traversal), cam_(cam), img_i0_(i0), img_j0_(j0), img_ni_(ni), img_nj_(nj), debug_lvl_(0) {} +- +- bool run_single_ray(F& step_functor,float i, float j) +- { +- vil_image_view continue_trace(img_ni_, img_nj_); +- continue_trace.fill(true); +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator block_vis_iter(cam_, &scene_, img_ni_,img_nj_); +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (unsigned i=0; i * curr_block=scene_.get_active_block(); +- boxm_block * curr_aux_block=NULL; +- if (step_functor.is_aux_) +- curr_aux_block=aux_scene_.get_block(block_indices[i]); +- +- if (debug_lvl_ > 0) +- std::cout << "processing block at index (" < block_bb = curr_block->bounding_box(); +- +- if (!boxm_utils::is_visible(block_bb,cam_,img_ni_,img_nj_)) +- continue; +- +- +- vgl_box_2d img_bb; +- +- // initialize ray_origin() function for this block +- if (!generate_ray_init(block_bb, img_bb)) { +- continue; +- } +- tree_type * tree=curr_block->get_tree(); +- +- aux_tree_type * aux_tree=NULL; +- if (step_functor.is_aux_) +- { +- aux_tree=curr_aux_block->get_tree(); +- } +- +- // get direction of vector and enter point - this depends on which camera type we have +- vgl_point_3d ray_origin; +- vgl_vector_3d direction; +- vgl_point_3d enter_pt(0.0,0.0,0.0); +- std::vector > plane_intersections(6); +- // add 0.5 to get center of pixel +- generate_ray(i , j, block_bb, ray_origin, direction); +- +- // compute intersection of each plane with ray +- double lambda[6]; +- lambda[0] = (block_bb.min_x() - ray_origin.x())/direction.x(); +- lambda[1] = (block_bb.max_x() - ray_origin.x())/direction.x(); +- lambda[2] = (block_bb.min_y() - ray_origin.y())/direction.y(); +- lambda[3] = (block_bb.max_y() - ray_origin.y())/direction.y(); +- lambda[4] = (block_bb.min_z() - ray_origin.z())/direction.z(); +- lambda[5] = (block_bb.max_z() - ray_origin.z())/direction.z(); +- +- if (block_bb.contains(ray_origin)) +- enter_pt=ray_origin; +- else +- { +- for (unsigned int face=0; face<6; ++face) { +- plane_intersections[face] = ray_origin + (direction * lambda[face]); +- } +- +- // determine which point is the entrance point based on direction +- const double epsilon = 1e-6; // use in place of zero to avoid badly conditioned lambdas +- if ( (plane_intersections[5].x() >= block_bb.min_x()) && (plane_intersections[5].x() <= block_bb.max_x()) && +- (plane_intersections[5].y() >= block_bb.min_y()) && (plane_intersections[5].y() <= block_bb.max_y()) && +- (direction.z() < -epsilon) ) +- { +- // ray intersects the zmax plane +- // check zmax first since it is probably the most common +- enter_pt = plane_intersections[5]; +- } +- else if ( (plane_intersections[0].y() >= block_bb.min_y()) && (plane_intersections[0].y() <= block_bb.max_y()) && +- (plane_intersections[0].z() >= block_bb.min_z()) && (plane_intersections[0].z() <= block_bb.max_z()) && +- (direction.x() > epsilon) ) +- { +- // ray intersects the xmin plane +- enter_pt = plane_intersections[0]; +- } +- else if ( (plane_intersections[1].y() >= block_bb.min_y()) && (plane_intersections[1].y() <= block_bb.max_y()) && +- (plane_intersections[1].z() >= block_bb.min_z()) && (plane_intersections[1].z() <= block_bb.max_z()) && +- (direction.x() < -epsilon) ) +- { +- // ray intersects the xmax plane +- enter_pt = plane_intersections[1]; +- } +- else if ( (plane_intersections[2].x() >= block_bb.min_x()) && (plane_intersections[2].x() <= block_bb.max_x()) && +- (plane_intersections[2].z() >= block_bb.min_z()) && (plane_intersections[2].z() <= block_bb.max_z()) && +- (direction.y() > epsilon) ) +- { +- // ray intersects the ymin plane +- enter_pt = plane_intersections[2]; +- } +- else if ( (plane_intersections[3].x() >= block_bb.min_x()) && (plane_intersections[3].x() <= block_bb.max_x()) && +- (plane_intersections[3].z() >= block_bb.min_z()) && (plane_intersections[3].z() <= block_bb.max_z()) && +- (direction.y() < -epsilon) ) +- { +- // ray intersects the ymax plane +- enter_pt = plane_intersections[3]; +- } +- else if ( (plane_intersections[4].x() >= block_bb.min_x()) && (plane_intersections[4].x() <= block_bb.max_x()) && +- (plane_intersections[4].y() >= block_bb.min_y()) && (plane_intersections[4].y() <= block_bb.max_y()) && +- (direction.z() > epsilon) ) +- { +- // ray intersects the zmin plane +- enter_pt = plane_intersections[4]; +- } +- else { +- // no entry point into this block found +- continue; +- } +- } +- boct_tree_cell * curr_cell=tree->locate_point_global(enter_pt); +- while (true) +- { +- boct_loc_code cell_code(curr_cell->get_code()); +- +- boct_tree_cell * curr_aux_cell=NULL; +- if (step_functor.is_aux_) +- curr_aux_cell=aux_tree->get_cell(cell_code); +- vgl_box_3d cell_bb = tree->cell_bounding_box(curr_cell); +- // find exit point of cell +- vgl_point_3d exit_pt; +- double lambda=0; +- boct_face_idx face_id=NONE; +- bool found_exit =boxm_utils::cube_exit_point(cell_bb,enter_pt,direction, exit_pt,lambda,face_id); +- if (!found_exit) { +- std::cerr << "error: could not find cell exit point\n" +- << " enter_pt = [" << enter_pt.x() << ", " << enter_pt.y() << ", " << enter_pt.z() << "]\n" +- << " direction = [" << direction.x() << ", " << direction.y() << ", " << direction.z() << "]\n" +- << " cell_bb = [" << cell_bb.min_x() <<", " << cell_bb.max_x() << "] [" << cell_bb.min_y() +- << ", " << cell_bb.max_y() << "] [" << cell_bb.min_z() << ", " << cell_bb.max_z() <<"]\n"; +- assert(found_exit); +- break; +- } +- T_data cell_val=curr_cell->data(); +- T_aux aux_val; +- if (step_functor.is_aux_) +- aux_val=curr_aux_cell->data(); +- continue_trace(i-img_i0_, j-img_j0_) = step_functor.step_cell(enter_pt, exit_pt, cell_val,aux_val); +- curr_cell->set_data(cell_val); +- if (step_functor.is_aux_) +- curr_aux_cell->set_data(aux_val); +- // normalize the point to [0-1]to obtain the index. +- vgl_point_3d exit_pt_norm((exit_pt.x()-block_bb.min_x())/block_bb.width(), +- (exit_pt.y()-block_bb.min_y())/block_bb.height(), +- (exit_pt.z()-block_bb.min_z())/block_bb.depth()); +- // obtain the code for the exit point +- boct_loc_code exit_loc_code(exit_pt_norm,tree->root_level()); +- cell_type *neighborcell=NULL; +- if (curr_cell->find_neighbor(face_id,neighborcell,tree->root_level())) +- curr_cell=neighborcell->traverse_force(exit_loc_code); +- else +- { +- std::cerr << "NO NEIGHBORS FOUND!\n"; +- break; +- } +- enter_pt=exit_pt; +- } +- if (!step_functor.scene_read_only_) +- scene_.write_active_block(); +- if (step_functor.is_aux_) +- aux_scene_.write_active_block(); +- } +- } +- scene_.unload_active_blocks(); +- aux_scene_.unload_active_blocks(); +- return true; +- } +- +- bool run(F& step_functor) +- { +- vul_timer timer; +- float total_load_time = 0.0f; +- float total_compute_time = 0.0f; +- float total_save_time = 0.0f; +- vil_image_view continue_trace(img_ni_, img_nj_); +- continue_trace.fill(true); +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator block_vis_iter(cam_, &scene_, img_ni_,img_nj_); +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) // code for each block +- { +- timer.mark(); +- scene_.load_block(block_indice); +- boxm_block * curr_block=scene_.get_active_block(); +- +- if (debug_lvl_ > 0) +- std::cout << "processing block at index (" < block_bb = curr_block->bounding_box(); +- +- if (!boxm_utils::is_visible(block_bb,cam_,img_ni_,img_nj_)) +- continue; +- vgl_box_2d img_bb; +- // initialize ray_origin() function for this block +- if (!generate_ray_init(block_bb, img_bb)) { +- continue; +- } +- +- tree_type * tree=curr_block->get_tree(); +- +- boxm_block * curr_aux_block=nullptr; +- aux_tree_type * aux_tree=nullptr; +- if (step_functor.is_aux_) +- { +- curr_aux_block=aux_scene_.get_block(block_indice); +- aux_tree=curr_aux_block->get_tree(); +- } +- float load_time = (float)timer.all() / 1e3f; +- total_load_time += load_time; +- timer.mark(); +- // for each image pixel +- for (unsigned int i = int(img_bb.min_x()+0.99); i <= img_bb.max_x(); ++i) +- { +- if (debug_lvl_ > 1) { +- if (!(i % 10)) +- std::cout << '.'; +- } +- for (unsigned int j = int(img_bb.min_y()+0.99); j <= img_bb.max_y(); ++j) +- { +- if (!continue_trace(i - img_i0_ , j - img_j0_)) { +- continue; +- } +- // get direction of vector and enter point - this depends on which camera type we have +- vgl_point_3d ray_origin; +- vgl_vector_3ddirection; +- vgl_point_3d enter_pt(0.0,0.0,0.0); +- vgl_point_3d exit_pt; +- // add 0.5 to get center of pixel +- generate_ray((float)i + 0.5f, (float)j + 0.5f, block_bb, ray_origin, direction); +- if (!entry_point(block_bb,ray_origin,direction,enter_pt)) +- continue; +- // normalize the entry point to [0,1] +- vgl_point_3d enter_pt_norm((enter_pt.x()-block_bb.min_x())/block_bb.width(), +- (enter_pt.y()-block_bb.min_y())/block_bb.height(), +- (enter_pt.z()-block_bb.min_z())/block_bb.depth()); +- boct_loc_code curr_cell_code(enter_pt_norm,tree->root_level()); +- boct_tree_cell * curr_cell=tree->root()->traverse_force(curr_cell_code); +- +- boct_tree_cell::sample_datatype> aux_cell_null; +- +- while (continue_trace(i-img_i0_, j-img_j0_)) +- { +- boct_tree_cell *curr_aux_cell= reinterpret_cast*>(&aux_cell_null); +- if (step_functor.is_aux_) +- { +- boct_loc_code cell_code(curr_cell->get_code()); +- curr_aux_cell=aux_tree->get_cell(cell_code); +- } +- // get the canonical bounding box +- vgl_box_3d cell_bb = tree->cell_bounding_box(curr_cell); +- // find exit point of cell +- +- double lambda=0; +- boct_face_idx face_id=NONE; +- bool found_exit =boxm_utils::cube_exit_point(cell_bb,enter_pt,direction, exit_pt,lambda,face_id); +- if (!found_exit) { +- std::cerr << "error: could not find cell exit point\n" +- << " enter_pt = [" << enter_pt.x() << ", " << enter_pt.y() << ", " << enter_pt.z() << "]\n" +- << " direction = [" << direction.x() << ", " << direction.y() << ", " << direction.z() << "]\n" +- << " cell_bb = [" << cell_bb.min_x() <<", " << cell_bb.max_x() << "] [" << cell_bb.min_y() +- << ", " << cell_bb.max_y() << "] [" << cell_bb.min_z() << ", " << cell_bb.max_z() <<"]\n"; +- assert(found_exit); +- break; +- } +- T_data cell_val=curr_cell->data(); +- T_aux aux_val=curr_aux_cell->data(); +- +- +- continue_trace(i-img_i0_, j-img_j0_) = step_functor.step_cell(i,j, enter_pt, exit_pt, cell_val,aux_val); +- +- curr_cell->set_data(cell_val); +- if (step_functor.is_aux_) +- curr_aux_cell->set_data(aux_val); +- vgl_point_3d exit_pt_norm((exit_pt.x()-block_bb.min_x())/block_bb.width(), +- (exit_pt.y()-block_bb.min_y())/block_bb.height(), +- (exit_pt.z()-block_bb.min_z())/block_bb.depth()); +- +- // obtain the code for the exit point +- boct_loc_code exit_loc_code(exit_pt_norm,tree->root_level(), tree->max_val()); +- cell_type *neighborcell=nullptr; +- if (curr_cell->find_neighbor(face_id,neighborcell,tree->root_level())) +- curr_cell=neighborcell->traverse_force(exit_loc_code); +- else +- break; +- enter_pt=exit_pt; +- } +- } +- } +- float compute_time = (float)timer.all() / 1e3f; +- total_compute_time += compute_time; +- timer.mark(); +- +- if (!step_functor.scene_read_only_) +- scene_.write_active_block(); +- if (step_functor.is_aux_) +- aux_scene_.write_active_block(); +- +- float save_time = (float)timer.all() / 1e3f; +- total_save_time += save_time; +- //std::cout << "load: " << load_time << "s compute: " << compute_time << "s save: " << save_time << 's' << std::endl; +- } +- } +- scene_.unload_active_blocks(); +- aux_scene_.unload_active_blocks(); +- +- //std::cout << "total load: " << total_load_time << "s total compute: " << total_compute_time << "s total save: " << total_save_time << 's' << std::endl; +- return true; +- } +- +- protected: +- +- bool generate_ray_init(vgl_box_3d const& block_bb, vgl_box_2d &img_bb) +- { +- // determine intersection of block bounding box projection and image bounds +- vgl_box_2d img_bounds; +- img_bounds.add(vgl_point_2d(img_i0_,img_j0_)); +- img_bounds.add(vgl_point_2d(img_i0_ + img_ni_ - 1, img_j0_ + img_nj_ - 1)); +- +- vgl_box_2d block_projection; +- double u,v; +- cam_->project(block_bb.min_x(),block_bb.min_y(),block_bb.min_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.min_x(),block_bb.min_y(),block_bb.max_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.min_x(),block_bb.max_y(),block_bb.min_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.min_x(),block_bb.max_y(),block_bb.max_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.max_x(),block_bb.min_y(),block_bb.min_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.max_x(),block_bb.min_y(),block_bb.max_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.max_x(),block_bb.max_y(),block_bb.min_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- cam_->project(block_bb.max_x(),block_bb.max_y(),block_bb.max_z(),u,v); +- block_projection.add(vgl_point_2d(u,v)); +- +- img_bb=vgl_intersection(img_bounds,block_projection); +- +- if (img_bb.is_empty()) +- return false; +- else +- return true; +- } +- +- void generate_ray(float i, float j, vgl_box_3d const& /*block_bb*/, vgl_point_3d &ray_origin, vgl_vector_3d &norm_direction) +- { +- if (cam_->type_name() == "vpgl_perspective_camera") { +- vpgl_perspective_camera const* pcam = +- static_cast const*>(cam_.ptr()); +- // backproject image point to a ray +- ray_origin = pcam->camera_center(); +- vgl_line_3d_2_points cam_ray = pcam->backproject(vgl_point_2d((double)i,(double)j)); +- norm_direction=cam_ray.direction(); +- normalize(norm_direction); +- return; +- } +- if (cam_->type_name() == "vpgl_proj_camera") { +- vpgl_proj_camera const* prcam = +- static_cast const*>(cam_.ptr()); +- ray_origin = prcam->camera_center(); +- vgl_homg_line_3d_2_points cam_ray = +- prcam->backproject(vgl_homg_point_2d((double)i,(double)j)); +- vgl_homg_point_3d hp = cam_ray.point_infinite(); +- vgl_vector_3d direction(hp.x(), hp.y(), hp.z()); +- norm_direction=direction; +- normalize(norm_direction); +- return; +- } +- if (cam_->type_name() == "vpgl_affine_camera") { +- vgl_homg_point_2d ph(i, j); +- vpgl_affine_camera const * afcam = +- static_cast const*>(cam_.ptr()); +- vgl_homg_line_3d_2_points cam_ray = +- afcam->backproject(ph); +- vgl_homg_point_3d hpinf = cam_ray.point_infinite(); +- vgl_homg_point_3d hpfin = cam_ray.point_finite(); +- vgl_vector_3d direction(hpinf.x(), hpinf.y(), hpinf.z()); +- norm_direction=direction; +- normalize(norm_direction); +- vgl_point_3d temp(hpfin); +- ray_origin = temp; +- return; +- } +- if (cam_->type_name() == "vpgl_local_rational_camera") { +- vpgl_local_rational_camera const* lrcam = +- static_cast const*>(cam_.ptr()); +- vpgl_ray::ray(*lrcam,(double)i, (double)j, ray_origin, norm_direction); +- return; +- } +- else { +- std::cerr << "In boxm_raytrace_function: camera type not handled\n"; +- assert(false); +- } +- } +- +- bool entry_point(vgl_box_3d & block_bb, vgl_point_3d &ray_origin, +- vgl_vector_3d &direction, vgl_point_3d & enter_pt) +- { +- double lambda[6]; +- std::vector > plane_intersections(6); +- +- lambda[0] = (block_bb.min_x() - ray_origin.x())/direction.x(); +- lambda[1] = (block_bb.max_x() - ray_origin.x())/direction.x(); +- lambda[2] = (block_bb.min_y() - ray_origin.y())/direction.y(); +- lambda[3] = (block_bb.max_y() - ray_origin.y())/direction.y(); +- lambda[4] = (block_bb.min_z() - ray_origin.z())/direction.z(); +- lambda[5] = (block_bb.max_z() - ray_origin.z())/direction.z(); +- +- if (block_bb.contains(ray_origin)) +- enter_pt=ray_origin; +- else +- { +- for (unsigned int face=0; face<6; ++face) { +- plane_intersections[face] = ray_origin + (direction * lambda[face]); +- } +- +- // determine which point is the entrance point based on direction +- const double epsilon = 1e-6; // use in place of zero to avoid badly conditioned lambdas +- if ( (plane_intersections[5].x() >= block_bb.min_x()) && (plane_intersections[5].x() <= block_bb.max_x()) && +- (plane_intersections[5].y() >= block_bb.min_y()) && (plane_intersections[5].y() <= block_bb.max_y()) && +- (direction.z() < -epsilon) ) +- { +- // ray intersects the zmax plane +- // check zmax first since it is probably the most common +- enter_pt = plane_intersections[5]; +- } +- else if ( (plane_intersections[0].y() >= block_bb.min_y()) && (plane_intersections[0].y() <= block_bb.max_y()) && +- (plane_intersections[0].z() >= block_bb.min_z()) && (plane_intersections[0].z() <= block_bb.max_z()) && +- (direction.x() > epsilon) ) +- { +- // ray intersects the xmin plane +- enter_pt = plane_intersections[0]; +- } +- else if ( (plane_intersections[1].y() >= block_bb.min_y()) && (plane_intersections[1].y() <= block_bb.max_y()) && +- (plane_intersections[1].z() >= block_bb.min_z()) && (plane_intersections[1].z() <= block_bb.max_z()) && +- (direction.x() < -epsilon) ) +- { +- // ray intersects the xmax plane +- enter_pt = plane_intersections[1]; +- } +- else if ( (plane_intersections[2].x() >= block_bb.min_x()) && (plane_intersections[2].x() <= block_bb.max_x()) && +- (plane_intersections[2].z() >= block_bb.min_z()) && (plane_intersections[2].z() <= block_bb.max_z()) && +- (direction.y() > epsilon) ) +- { +- // ray intersects the ymin plane +- enter_pt = plane_intersections[2]; +- } +- else if ( (plane_intersections[3].x() >= block_bb.min_x()) && (plane_intersections[3].x() <= block_bb.max_x()) && +- (plane_intersections[3].z() >= block_bb.min_z()) && (plane_intersections[3].z() <= block_bb.max_z()) && +- (direction.y() < -epsilon) ) +- { +- // ray intersects the ymax plane +- enter_pt = plane_intersections[3]; +- } +- else if ( (plane_intersections[4].x() >= block_bb.min_x()) && (plane_intersections[4].x() <= block_bb.max_x()) && +- (plane_intersections[4].y() >= block_bb.min_y()) && (plane_intersections[4].y() <= block_bb.max_y()) && +- (direction.z() > epsilon) ) +- { +- // ray intersects the zmin plane +- enter_pt = plane_intersections[4]; +- } +- else { +- // no entry point into this block found +- return false;; +- } +- } +- return true; +- } +- +- boxm_scene &scene_; +- boxm_aux_scene &aux_scene_; +- +- bool reverse_traversal_; +- +- const vpgl_camera_double_sptr cam_; +- unsigned int img_i0_; +- unsigned int img_j0_; +- unsigned int img_ni_; +- unsigned int img_nj_; +- +- unsigned int debug_lvl_; +-}; +- +-template +-class boxm_iterate_cells_function +-{ +- public: +- typedef boct_tree tree_type; +- typedef boct_tree aux_tree_type; +- typedef boct_tree_cell cell_type; +- typedef boct_tree_cell aux_cell_type; +- //: constructor +- boxm_iterate_cells_function(boxm_scene &scene, +- boxm_aux_scene &aux_scene, +- vpgl_camera_double_sptr cam, +- unsigned int ni, unsigned int nj ) +- : scene_(scene), aux_scene_(aux_scene), img_ni_(ni), img_nj_(nj), cam_(cam) +- {} +- +- +- bool run(F& step_functor) +- { +- // code to iterate over the blocks in order of visibility +- boxm_block_vis_graph_iterator block_vis_iter(cam_, &scene_, img_ni_,img_nj_); +- while (block_vis_iter.next()) +- { +- std::vector > block_indices = block_vis_iter.frontier_indices(); +- for (auto & block_indice : block_indices) // code for each block +- { +- scene_.load_block(block_indice); +- boxm_block * curr_block=scene_.get_active_block(); +- boxm_block * curr_aux_block=aux_scene_.get_block(block_indice); +- tree_type * tree=curr_block->get_tree(); +- aux_tree_type * aux_tree=curr_aux_block->get_tree(); +- +- std::vector leaves=tree->leaf_cells(); +- for (unsigned i=0;idata(); +- boct_loc_code cell_code(leaves[i]->get_code()); +- aux_cell_type * aux_cell=aux_tree->get_cell(cell_code); +- T_aux aux_val=aux_cell->data(); +- step_functor.step_cell(cell_val,aux_val); +- leaves[i]->set_data(cell_val); +- aux_cell->set_data(aux_val); +- } +- scene_.write_active_block(); +- aux_scene_.write_active_block(); +- } +- } +- return true; +- } +- +- protected: +- boxm_scene &scene_; +- boxm_aux_scene &aux_scene_; +- bool reverse_traversal_; +- +- unsigned img_ni_; +- unsigned img_nj_; +- +- const vpgl_camera_double_sptr cam_; +-}; +- +-#endif // boxm_raytrace_function_h_ +diff --git a/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h b/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h +deleted file mode 100644 +index ea44cd7eed..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h ++++ /dev/null +@@ -1,46 +0,0 @@ +-#ifndef boxm_seg_length_functor_h +-#define boxm_seg_length_functor_h +-//: +-// \file +-#include +-#include +-#include "boxm_raytrace_function.h" +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class boxm_seg_length_functor +-{ +- public: +- boxm_seg_length_functor(vil_image_view::obs_datatype> &observation, +- unsigned int /*ni*/=0, unsigned /*nj*/=0) +- : obs_(observation) +- { +- scene_read_only_=true; +- is_aux_=true; +- } +- +- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d s0, vgl_point_3d s1, +- boxm_sample & /*cell_value*/, // FIXME: unused... +- T_aux &aux_val) +- { +- const float seg_len = (float)(s1 - s0).length(); +- aux_val.obs_ += obs_(i,j) * seg_len; +- aux_val.seg_len_ += seg_len; +- return true; +- } +- +- public: +- bool scene_read_only_; +- bool is_aux_; +- +- private: +- vil_image_view::obs_datatype> &obs_; +-}; +- +-#endif // boxm_seg_length_functor_h +diff --git a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx b/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx +deleted file mode 100644 +index a6f2af30f1..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include "boxm_util_data_types.h" +- +-// Binary write boxm_render_probe_manager scene to stream +-// DUMMY IMPLEMENTATION: does nothing! +-void vsl_b_write(vsl_b_ostream &, boxm_array_1d_float const&) {} +- +-// Binary load boxm_render_probe_manager scene from stream. +-// DUMMY IMPLEMENTATION: does nothing! +-void vsl_b_read(vsl_b_istream &, boxm_array_1d_float &) {} +- +-// Binary load boxm_render_probe_manager scene from stream. +-// DUMMY IMPLEMENTATION: does nothing! +-void vsl_b_read(vsl_b_istream&, boxm_array_1d_float*) {} +- +-// Binary write scene pointer to stream +-// DUMMY IMPLEMENTATION: does nothing! +-void vsl_b_write(vsl_b_ostream&, const boxm_array_1d_float* &) {} +diff --git a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h b/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h +deleted file mode 100644 +index 827e172bbc..0000000000 +--- a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-#ifndef boxm_util_data_types_h +-#define boxm_util_data_types_h +-//: +-// \file +-#include +-#include +-#include +-#include +- +-class boxm_array_1d_float: public vbl_ref_count +-{ +- public: +- boxm_array_1d_float(unsigned n):data_array(n,-1.0f){} +- vbl_array_1d data_array; +-}; +- +-typedef vbl_smart_ptr boxm_array_1d_float_sptr; +- +-//: Binary write boxm_render_probe_manager scene to stream +-void vsl_b_write(vsl_b_ostream & os, boxm_array_1d_float const& a); +- +-//: Binary load boxm_render_probe_manager scene from stream. +-void vsl_b_read(vsl_b_istream & is, boxm_array_1d_float &a); +- +-void vsl_b_read(vsl_b_istream& is, boxm_array_1d_float* b); +- +-//: Binary write scene pointer to stream +-void vsl_b_write(vsl_b_ostream& os, const boxm_array_1d_float* &b); +- +-#endif +diff --git a/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt +deleted file mode 100644 +index 96c61fe483..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt ++++ /dev/null +@@ -1,15 +0,0 @@ +-add_executable( boxm_basic_test_all +- test_driver.cxx +- test_block_vis_graph.cxx +- test_cell_vis_graph.cxx +- ) +- +-target_link_libraries( boxm_basic_test_all boxm_basic boxm boxm_util ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul) +- +-add_test( NAME boxm_basic_test_block_vis_graph COMMAND $ test_block_vis_graph ) +-add_test( NAME boxm_basic_test_cell_vis_graph COMMAND $ test_cell_vis_graph ) +- +-add_executable( boxm_basic_test_include test_include.cxx ) +-target_link_libraries( boxm_basic_test_include boxm_basic) +-add_executable( boxm_basic_test_template_include test_template_include.cxx ) +-target_link_libraries( boxm_basic_test_template_include boxm_basic) +diff --git a/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx b/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx +deleted file mode 100644 +index 70a87b0476..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx ++++ /dev/null +@@ -1,48 +0,0 @@ +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-static void test_block_vis_graph() +-{ +- // create scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(2,2,3); +- boxm_scene scene(lvcs, origin, block_dim, world_dim); +- vul_file::make_directory("boxm_scene"); +- scene.set_paths("boxm_scene", "block"); +- +- +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+block_dim.x()*world_dim.x(), +- origin.y()+block_dim.y()*world_dim.y(), +- origin.z()+block_dim.z()*world_dim.z())); +- vpgl_camera_double_sptr camera = generate_camera_top(world); +- boxm_block_vis_graph_iterator block_vis_iter(camera, &scene, IMAGE_U, IMAGE_V); +- +- int vis_count = -1; +- std::vector*> blocks; +- int counts[] = {4,4,4}; +- while (block_vis_iter.next()) { +- int block_count = 0; +- ++vis_count; +- std::cout << "Frontier\n"; +- blocks = block_vis_iter.frontier_blocks(); +- for (unsigned i=0; ibounding_box() << std::endl; +- ++block_count; +- } +- TEST("block count", block_count, counts[vis_count]); +- } +- vpl_rmdir("boxm_scene"); +- TEST("vis count", ++vis_count, 3); +-} +- +-TESTMAIN(test_block_vis_graph); +diff --git a/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx b/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx +deleted file mode 100644 +index d9e2da00f7..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx ++++ /dev/null +@@ -1,54 +0,0 @@ +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-static void test_cell_vis_graph() +-{ +- // create scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene scene(lvcs, origin, block_dim, world_dim); +- scene.set_paths("boxm_scene_cell", "block"); +- vul_file::make_directory("boxm_scene_cell"); +- +- vgl_box_3d world; +- world.add(origin); +- world.add(vgl_point_3d(origin.x()+block_dim.x()*world_dim.x(), +- origin.y()+block_dim.y()*world_dim.y(), +- origin.z()+block_dim.z()*world_dim.z())); +- +- vpgl_camera_double_sptr camera = generate_camera_top(world); +- boxm_block_iterator > > iter(&scene); +- +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=scene.get_active_block(); +- auto * tree=new boct_tree >(3,2); +- block->init_tree(tree); +- boxm_cell_vis_graph_iterator > cell_iterator(camera,tree,IMAGE_U, IMAGE_V); +- double cnt=30; +- while (cell_iterator.next()){ +- std::cout<<"Frontier\n"; +- std::vector > *> vis_cells=cell_iterator.frontier(); +- for (auto & vis_cell : vis_cells) +- { +- vgl_box_3d box=tree->cell_bounding_box(vis_cell); +- TEST("Returns correct frontier",cnt,box.max_z()); +- } +- cnt-=5; +- } +- +- scene.write_active_block(); +- iter++; +- } +- vpl_rmdir("boxm_scene_cell"); +-} +- +-TESTMAIN(test_cell_vis_graph); +diff --git a/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx b/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx +deleted file mode 100644 +index 1e4f60a571..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +- +-DECLARE( test_block_vis_graph ); +-DECLARE( test_cell_vis_graph ); +- +-void register_tests() +-{ +- REGISTER( test_block_vis_graph ); +- REGISTER( test_cell_vis_graph ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/basic/tests/test_include.cxx b/contrib/brl/bseg/boxm/basic/tests/test_include.cxx +deleted file mode 100644 +index cbaeca0acc..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/test_include.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx +deleted file mode 100644 +index 131baa9347..0000000000 +--- a/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/boxm_apm_traits.cxx b/contrib/brl/bseg/boxm/boxm_apm_traits.cxx +deleted file mode 100644 +index 1d3c646178..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_apm_traits.cxx ++++ /dev/null +@@ -1,86 +0,0 @@ +-#include "boxm_apm_traits.h" +- +-const char* boxm_apm_types::app_model_strings[] = { "apm_mog_grey", +- "apm_mog_rgb", +- "apm_simple_grey", +- "apm_simple_rgb", +- "apm_mob_grey", +- "float", +- "int", +- "short", +- "char", +- "bool", +- "vnl_double_10", +- "vnl_float_10", +- "vnl_float_3", +- "bsta_mog_f1", +- "bsta_gauss_f1", +- "bvpl_sample_float", +- "bvpl_sample_gauss_f1", +- "bvpl_pca_basis_sample_10", +- "edge_float", +- "edge_line", +- "edge_tangent_line", +- "scalar_float", +- "dbrec3d_part_instance", +- "dbrec3d_pair_composite_instance", +- "apm_na", +- "apm_unknown" }; +- +- +-boxm_apm_type boxm_apm_types::str_to_enum(const char* s) +-{ +- for (int i=0; i < int(BOXM_APM_UNKNOWN); i++) +- { +- if (std::strcmp(s, boxm_apm_types::app_model_strings[i]) == 0) +- return (boxm_apm_type) i; +- } +- return BOXM_APM_UNKNOWN; +-} +- +-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.color_); +- vsl_b_write(os, sample.one_over_sigma_); +- //vsl_b_write(os, sample.gauss_weight_); +-} +- +-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.color_); +- vsl_b_read(is, sample.one_over_sigma_); +- //vsl_b_read(is, sample.gauss_weight_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-std::ostream& operator<<(std::ostream &os, boxm_simple_grey const& apm) +-{ +- os << "color: " << apm.color() << ", one_over_sigma: " << apm.one_over_sigma() << std::endl; +- return os; +-} +diff --git a/contrib/brl/bseg/boxm/boxm_apm_traits.h b/contrib/brl/bseg/boxm/boxm_apm_traits.h +deleted file mode 100644 +index 17f80b5a70..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_apm_traits.h ++++ /dev/null +@@ -1,206 +0,0 @@ +-#ifndef boxm_appearance_model_traits_h_ +-#define boxm_appearance_model_traits_h_ +-//: +-// \file +-// \brief A class for appearance model traits +-// +-// \author Daniel Crispell +-// \date April 03, 2009 +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include "boxm_export.h" +- +-class boxm_mog_grey_processor; +-class boxm_mog_rgb_processor; +-class boxm_simple_grey_processor; +-class boxm_mob_grey_processor; +- +-enum boxm_apm_type +-{ +- BOXM_APM_MOG_GREY = 0, +- BOXM_APM_MOG_RGB, +- BOXM_APM_SIMPLE_GREY, +- BOXM_APM_SIMPLE_RGB, +- BOXM_APM_MOB_GREY, +- BOXM_FLOAT, +- BOXM_INT, +- BOXM_SHORT, +- BOXM_CHAR, +- BOXM_BOOL, +- VNL_DOUBLE_10, +- VNL_FLOAT_10, +- VNL_FLOAT_3, +- BSTA_MOG_F1, +- BSTA_GAUSS_F1, +- BVPL_SAMPLE_FLOAT, +- BVPL_SAMPLE_BSTA_GAUSS_F1, +- BVPL_PCA_BASIS_SAMPLE_10, +- BOXM_EDGE_FLOAT, +- BOXM_EDGE_LINE, +- BOXM_EDGE_TANGENT_LINE, +- BOXM_SCALAR_FLOAT, +- DBREC3D_PART_INSTANCE, +- DBREC3D_PAIR_COMPOSITE_INSTANCE, +- BOXM_APM_NA, +- BOXM_APM_UNKNOWN +-}; +- +-class boxm_apm_types +-{ +- public: +- static boxm_EXPORT_DATA const char* app_model_strings[]; +- static boxm_apm_type str_to_enum(const char* s); +-}; +- +-//: Pixel properties for templates. +-template +-class boxm_apm_traits; +- +- +-//: traits for a mixture of gaussian appearance model of gray-scale images +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int n_gaussian_modes_ = 3; +- +- typedef bsta_num_obs gauss_type_sf1; +- typedef bsta_num_obs > mix_gauss_sf1_type; +- +- public: +- static const unsigned int obs_dim = 1; +- typedef mix_gauss_sf1_type apm_datatype; +- typedef float obs_datatype; +- typedef float obs_mathtype; +- typedef boxm_mog_grey_processor apm_processor; +-}; +- +- +-//: traits for a mixture of gaussian appearance model of rgb images +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int n_gaussian_modes_ = 3; +- +- typedef bsta_num_obs gauss_type_if3; +- typedef bsta_num_obs > mix_gauss_if3_type; +- +- public: +- static const unsigned int obs_dim = 3; +- typedef mix_gauss_if3_type apm_datatype; +- typedef vil_rgb obs_datatype; +- typedef float obs_mathtype; +- typedef boxm_mog_rgb_processor apm_processor; +-}; +- +- +-//: traits for a simple one-valued appearance model of grey-scale images +-class boxm_simple_grey +-{ +- public: +- boxm_simple_grey() : color_(0.5f), one_over_sigma_(1.0f),gauss_weight_(1.0f) {} +- boxm_simple_grey(float colour, float std_dev, float gauss_wght=1.0f) : color_(colour), one_over_sigma_(1/std_dev), gauss_weight_(gauss_wght) { check_vals(); } +- boxm_simple_grey(vnl_vector_fixed const& params) : color_(params[0]), one_over_sigma_(1.0f/params[1]) { check_vals(); } +- static short version_no() { return 1; } +- inline float color() const { return color_; } +- inline float sigma() const { return 1.0f/one_over_sigma_; } +- inline float gauss_weight() const { return gauss_weight_; } +- inline float one_over_sigma() const { return one_over_sigma_; } +- +- protected: +- inline void check_vals() +- { +- if (!(color_ > 0.0f)) +- color_ = 0.0f; +- if (!(color_ < 1.0f)) +- color_ = 1.0f; +- if (!(one_over_sigma_ < 1e4)) +- one_over_sigma_ = 1e4f; +- if (!(one_over_sigma_ > 1e-4)) +- one_over_sigma_ = 1e-4f; +- } +- +- public: +- float color_; +- float one_over_sigma_; +- float gauss_weight_; +-}; +- +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int n_gaussian_modes_ = 1; +- static const unsigned int obs_dim = 1; +- static const unsigned int n_params = 3; +- typedef boxm_simple_grey apm_datatype; +- typedef float obs_datatype; +- typedef float obs_mathtype; +- typedef boxm_simple_grey_processor apm_processor; +-}; +- +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int n_beta_modes_ = 3; +- +- typedef bsta_num_obs beta_type; +- typedef bsta_num_obs > mix_beta_type; +- +- public: +- static const unsigned int obs_dim = 1; +- typedef mix_beta_type apm_datatype; +- typedef float obs_datatype; +- typedef float obs_mathtype; +- typedef boxm_mob_grey_processor apm_processor; +-}; +- +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int obs_dim = 1; +- static const unsigned int n_params = 2; +- typedef boxm_edge_sample apm_datatype; +- typedef float obs_datatype; +- typedef float obs_mathtype; +-#if 0 +- typedef boxm_edge_processor apm_processor; +-#endif +-}; +- +-template<> +-class boxm_apm_traits +-{ +- public: +- static const unsigned int obs_dim = 1; +- static const unsigned int n_params = 2; +- typedef boxm_inf_line_sample apm_datatype; +- typedef float obs_datatype; +- typedef float obs_mathtype; +-}; +- +-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const &sample); +-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const * &sample); +-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey &sample); +-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey *&sample); +-std::ostream& operator << (std::ostream& os, const boxm_simple_grey& sample); +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_aux_scene.h b/contrib/brl/bseg/boxm/boxm_aux_scene.h +deleted file mode 100644 +index 40a2a56914..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_aux_scene.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-#ifndef boxm_aux_scene_h_ +-#define boxm_aux_scene_h_ +-//: +-// \file +-// \brief an auxiliary scene keeps a set of octrees for a given main scene +-// +-// \author Gamze Tunali +-// \date July 31, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#include +- +-template +-class boxm_aux_scene +-{ +- public: +- typedef enum {EMPTY=0, CLONE, LOAD, UNDEFINED } tree_creation_type ; +- typedef boct_tree tree_type; +- typedef boct_tree aux_tree_type; +- boxm_aux_scene() : aux_scene_(nullptr), aux_storage_dir_("") {} +- boxm_aux_scene(boxm_scene* scene, std::string suffix, +- tree_creation_type type, boxm_apm_type app_model=BOXM_APM_UNKNOWN); +- +- ~boxm_aux_scene(){ /*delete aux_scene_;*/ } +- +- void init_scene(){} +- +- +- boxm_block > * get_block(vgl_point_3d index){ +- aux_scene_->load_block(index); +- return aux_scene_->get_active_block(); +- } +- +- //: get an incremental reader for a scene block +- boct_tree_cell_reader* get_block_incremental(vgl_point_3d block_idx); +- +- void write_active_block() { aux_scene_->write_active_block(); } +- void unload_active_blocks() { aux_scene_->unload_active_blocks(); } +- void clean_scene(); +- +- private: +- boxm_scene* aux_scene_; +- std::string aux_storage_dir_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_aux_scene.hxx b/contrib/brl/bseg/boxm/boxm_aux_scene.hxx +deleted file mode 100644 +index d3ceaf9c84..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_aux_scene.hxx ++++ /dev/null +@@ -1,121 +0,0 @@ +-#ifndef boxm_aux_scene_hxx_ +-#define boxm_aux_scene_hxx_ +- +-#include "boxm_aux_scene.h" +-#include +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-boxm_aux_scene::boxm_aux_scene(boxm_scene* scene, +- std::string storage_suffix, +- tree_creation_type type, +- boxm_apm_type app_model) +-: aux_scene_(nullptr) +-{ +- std::string aux_storage_dir; +- aux_storage_dir_ = scene->path(); +- aux_scene_ = new boxm_scene(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->load_all_blocks(),scene->save_internal_nodes(), scene->save_platform_independent()); +- aux_scene_->set_path(aux_storage_dir_, storage_suffix); +- aux_scene_->set_appearance_model(app_model); +- aux_scene_->set_octree_levels(scene->max_level(),scene->init_level()); +- if (type != EMPTY) +- { +- // loop through valid blocks and init same blocks in aux scene +- boxm_block_iterator iter(scene); +- iter.begin(); +- while (!iter.end()) { +- if (scene->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) { +- if (type == LOAD) { +- if (aux_scene_->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) { +-#if 0 +- // auxiliary block file exist +- aux_scene_->load_block(iter.index()); +- boxm_block > * block=aux_scene_->get_active_block(); +- assert(block->get_tree() != 0); +-#endif +- } +- } +- else if (type==CLONE) { //clone from the primary block +- scene->load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > * block=scene->get_active_block(); +- boct_tree* tree=block->get_tree(); +- aux_tree_type *aux_tree = tree->template clone_to_type(); +- boxm_block* aux_block = new boxm_block(block->bounding_box(),aux_tree ); +- aux_scene_->set_block(iter.index(), aux_block); +- aux_scene_->write_active_block(); +- } +- } +- ++iter; +- } +- aux_scene_->write_scene(storage_suffix+".xml"); +- scene->unload_active_blocks(); +- aux_scene_->unload_active_blocks(); +- } +-} +- +- +-template +-boct_tree_cell_reader* boxm_aux_scene::get_block_incremental(vgl_point_3d block_idx) +-{ +- if (aux_scene_) { +- std::string path=aux_scene_->gen_block_path(block_idx.x(), block_idx.y(), block_idx.z()); +- boct_tree_cell_reader* reader = new boct_tree_cell_reader(path); +- reader->begin(); +- return reader; +- } +- else { +- return nullptr; +- } +-} +- +-template +-void boxm_aux_scene::clean_scene() +-{ +- std::cout<<"Clean AUX scene "<unload_active_blocks(); +- boxm_block_iterator > iter(aux_scene_); +- iter.begin(); +- if (!aux_scene_->load_all_blocks()) +- { +- while (!iter.end()) { +- if (aux_scene_->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) { +- std::string filename=aux_scene_->gen_block_path(iter.index().x(),iter.index().y(),iter.index().z()); +- vpl_unlink(filename.c_str()); +- } +- iter++; +- } +- } +- else +- { +- while (!iter.end()) { +- if (iter->get_tree()!=nullptr) +- { +- iter->delete_tree(); +- iter->set_tree(nullptr); +- } +- iter++; +- } +- } +-} +- +-#if 0 // commented out +-template +-boct_tree_cell_reader* boxm_aux_scene::save_scene() +-{ +- boxm_block_iterator > iter(&aux_scene); +- iter.begin(); +- while (!iter.end()) { +- // body +- } +-} +-#endif // 0 +- +-#define BOXM_AUX_SCENE_INSTANTIATE(T1,T2,T3) \ +-template class boxm_aux_scene +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_aux_traits.h b/contrib/brl/bseg/boxm/boxm_aux_traits.h +deleted file mode 100644 +index 4e4c5113da..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_aux_traits.h ++++ /dev/null +@@ -1,74 +0,0 @@ +-#ifndef boxm_aux_traits_h_ +-#define boxm_aux_traits_h_ +-//: +-// \file +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-enum boxm_aux_type +-{ +- BOXM_AUX_VIS_IMPLICIT, +- BOXM_AUX_UPDATE, +- BOXM_AUX_OPT_GREY, +- BOXM_AUX_OPT_RT_GREY, +- BOXM_AUX_OPT_RGB, +- BOXM_AUX_OPT_RT_RGB, +- BOXM_AUX_NULL, +- BOXM_AUX_UNKNOWN, +- BOXM_AUX_OPT2_GREY, +- BOXM_AUX_OPT2_RGB, +- BOXM_AUX_OPT3_MOG_GREY, +- BOXM_AUX_OPT3_MOG_RGB, +- BOXM_AUX_SCALAR_SAMPLE +-}; +- +-//: sample properties for templates. +-template +-class boxm_aux_traits; +- +-//: traits for a visibility-based implicit surface sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_vis_implicit_sample sample_datatype; +- +- static std::string storage_subdir() { return "vis_implicit"; } +-}; +- +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_update_sample sample_datatype; +- +- static std::string storage_subdir() { return "update_work";} +-}; +- +-//: traits for a null sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef float sample_datatype; +- +- static std::string storage_subdir() { return "null"; } +-}; +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef float sample_datatype; +- +- static std::string storage_subdir() { return "scalar"; } +-}; +- +- +- +-#endif // boxm_aux_traits_h_ +diff --git a/contrib/brl/bseg/boxm/boxm_block.h b/contrib/brl/bseg/boxm/boxm_block.h +deleted file mode 100644 +index 6bda381539..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_block.h ++++ /dev/null +@@ -1,58 +0,0 @@ +-#ifndef boxm_block_h_ +-#define boxm_block_h_ +-//: +-// \file +-// \brief a block is a smallest area that is going to be processed with an octree +-// +-// \author Gamze Tunali +-// \date Apr 01, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-template +-class boxm_block +-{ +- public: +- //: Default Constructor +- boxm_block(): octree_(nullptr) {} +- //: Destructor +- ~boxm_block() { if (octree_) delete octree_; } +- //: Constructor from boundinf box +- boxm_block(vgl_box_3d bbox): bbox_(bbox), octree_(nullptr) {} +- //: Constructor from bounding box and octree +- boxm_block(vgl_box_3d bbox, T* tree) : bbox_(bbox), octree_(tree) {octree_->set_bbox(bbox_);} +- //: Returns the number of leaf cells in the tree +- unsigned int size(); +- //: Initializes octree and bounding-box +- void init_tree(T * octree); +- //: Sets the current octree +- void set_tree(T * octree); +- +- // Accessors +- vgl_box_3d bounding_box() const { return bbox_; } +- T* get_tree() { return octree_; } +- +- //: Releases memory +- void delete_tree() { delete octree_; octree_ = nullptr; } +- +- // IO +- void b_read(vsl_b_istream &s); +- void b_write(vsl_b_ostream &s, const bool save_internal_nodes_, const bool platform_independent = true); +- static short version_no() { return 1; } +- +- bool operator==(boxm_block const& other) const { +- return bbox_ == other.bounding_box() +- && octree_ == other.octree_; +- } +- +- private: +- vgl_box_3d bbox_; +- T* octree_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_block.hxx b/contrib/brl/bseg/boxm/boxm_block.hxx +deleted file mode 100644 +index a8f27f2bfe..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_block.hxx ++++ /dev/null +@@ -1,80 +0,0 @@ +-#ifndef boxm_block_hxx_ +-#define boxm_block_hxx_ +- +-#include +-#include "boxm_block.h" +- +-#include +-template +-void boxm_block::init_tree(T * octree) +-{ +- if(octree_){ +- //release old memory unless the same tree +- if(octree!=octree_) +- delete octree_; +- } +- octree_=octree; +- octree->set_bbox(bbox_); +-} +- +-template +-void boxm_block::set_tree(T * octree) +-{ +- if(octree_) //release old memory +- delete octree_; +- octree_=octree; +-} +- +-template +-unsigned int boxm_block::size() +-{ +- if (octree_) { +- return octree_->size(); +- } +- else { +- return 0; +- } +-} +- +-template +-void boxm_block::b_read(vsl_b_istream &is) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case (1): +- vsl_b_read(is, bbox_); +- // if already allocated, destroy it and read from the file +- if (octree_ != nullptr) { +- delete octree_; +- } +- octree_ = new T(); +- octree_->b_read(is); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_block&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- return; +- } +-} +- +- +-template +-void boxm_block::b_write(vsl_b_ostream &os, const bool save_internal_nodes, const bool platform_independent) +-{ +- vsl_b_write(os, version_no()); +- vsl_b_write(os, bbox_); +-#if 0 +- std::cout << "Internal Nodes 3: " << save_internal_nodes << std::endl; +-#endif +- octree_->b_write(os, save_internal_nodes, platform_independent); +-} +- +-#define BOXM_BLOCK_INSTANTIATE(T) \ +-template class boxm_block +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_export.h b/contrib/brl/bseg/boxm/boxm_export.h +deleted file mode 100644 +index 7827178bdf..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_export.h ++++ /dev/null +@@ -1,23 +0,0 @@ +-#ifndef BOXM_EXPORT_H +-#define BOXM_EXPORT_H +- +-#include // get BUILD_SHARED_LIBS +- +-#ifndef BUILD_SHARED_LIBS // if not a shared build +-# define boxm_EXPORT_DATA +-#else // this is a shared build +-# ifdef boxm_EXPORTS // if building this library +-# if defined(_WIN32) || defined(WIN32) +-# define boxm_EXPORT_DATA __declspec(dllexport) +-# else +-# define boxm_EXPORT_DATA +-# endif +-# else // we are using this library and it is built shared +-# if defined(_WIN32) || defined(WIN32) +-# define boxm_EXPORT_DATA __declspec(dllimport) +-# else +-# define boxm_EXPORT_DATA +-# endif +-# endif +-#endif +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx b/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx +deleted file mode 100644 +index b1415333d6..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx ++++ /dev/null +@@ -1,25 +0,0 @@ +-#include "boxm_io_scene_base.h" +-//: +-// \file +- +- +-//: Binary write boxm scene to stream +-void vsl_b_write(vsl_b_ostream& /*os*/, boxm_scene_base const& /*scene_base*/) +-{ +-} +- +- +-//: Binary load boxm scene from stream. +-void vsl_b_read(vsl_b_istream& /*is*/, boxm_scene_base& /*scene_base*/) +-{ +-} +- +-//: Binary write boxm scene pointer to stream +-void vsl_b_read(vsl_b_istream& /*is*/, boxm_scene_base* /*ph*/) +-{ +-} +- +-//: Binary write boxm scene pointer to stream +-void vsl_b_write(vsl_b_ostream& /*os*/, boxm_scene_base* const& /*ph*/) +-{ +-} +diff --git a/contrib/brl/bseg/boxm/boxm_io_scene_base.h b/contrib/brl/bseg/boxm/boxm_io_scene_base.h +deleted file mode 100644 +index 1abc4fa90c..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_io_scene_base.h ++++ /dev/null +@@ -1,21 +0,0 @@ +-#ifndef boxm_io_scene_base_h_ +-#define boxm_io_scene_base_h_ +-//: +-// \file +-#include +-#include +- +-//: Binary write boxm scene to stream +-void vsl_b_write(vsl_b_ostream & os, boxm_scene_base const& scene_base); +- +-//: Binary load boxm scene from stream. +-void vsl_b_read(vsl_b_istream & is, boxm_scene_base &scene_base); +- +-//: Binary load boxm scene pointer from stream. +-void vsl_b_read(vsl_b_istream& is, boxm_scene_base* p); +- +-//: Binary write boxm scene pointer to stream +-void vsl_b_write(vsl_b_ostream& os, const boxm_scene_base* &p); +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_scene.h b/contrib/brl/bseg/boxm/boxm_scene.h +deleted file mode 100644 +index 8d1bd207d3..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene.h ++++ /dev/null +@@ -1,559 +0,0 @@ +-#ifndef boxm_scene_h_ +-#define boxm_scene_h_ +-//: +-// \file +-// \brief The main class to keep the 3D world data. It is a grid of boxm_blocks containing octrees. +-// +-// \author Gamze Tunali +-// \date Apr 03, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-class boxm_scene_parser; +-template class boxm_block_iterator; +-template class boxm_cell_iterator; +- +-template +-class boxm_scene :public boxm_scene_base +-{ +- public: +- typedef typename T::loc_type loc_type; +- typedef typename T::datatype datatype; +- +- //: Default constructor +- boxm_scene() : active_block_(vgl_point_3d(-1,-1,-1)), save_internal_nodes_(false), save_platform_independent_(true) {} +- +- //: Constructor from lvcs, world origin, dimension of the block (in world coordinates) and number of blocks(world_dim) +- boxm_scene(const vpgl_lvcs& lvcs, +- const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- const bool load_all_blocks=false, +- const bool save_internal_nodes_ = false, +- const bool save_platform_independent_ = true); +- +- //: Constructor from lvcs, world origin, dimension of the block, number of blocks and initialization level +- boxm_scene(const vpgl_lvcs& lvcs, +- const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- unsigned max_level, unsigned init_level, +- const bool load_all_blocks=false, +- const bool save_internal_nodes_ = false, +- const bool save_platform_independent_ = true); +- +- //: Constructor when lvcs is not available. World origin, block dimensions and number of blocks +- boxm_scene( const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- const bool load_all_blocks=false, +- const bool save_internal_nodes_ = false, +- const bool save_platform_independent_ = true); +- +- //: Copy constructor +- boxm_scene(const boxm_scene& scene); +- +- //: Constructor from base_scene +- boxm_scene(const boxm_scene_base& scene_base): +- boxm_scene_base(scene_base),active_block_(vgl_point_3d(-1,-1,-1)), save_internal_nodes_(false), save_platform_independent_(true) {} +- +- //: Destructor +- ~boxm_scene() override; +- +- bool discover_block(vgl_point_3d index) { return discover_block(index.x(),index.y(),index.z()); } +- +- bool discover_block(unsigned i, unsigned j, unsigned k); +- +- //: Loads block into memory. +- // Returns true if the block bin file is found on disc, otherwise returns false and creates a new tree for the block +- bool load_block(unsigned i, unsigned j, unsigned k); +- +- // Load block into memory without using global variables +- bool load_block_thread_safe(unsigned i, unsigned j, unsigned k); +- +- //: Loads block into memory. +- bool load_block(vgl_point_3d i) { return load_block(i.x(), i.y(), i.z()); } +- +- //: Loads a block and all its neighboring(adjacent) blocks +- bool load_block_and_neighbors(unsigned i, unsigned j, unsigned k); +- +- //: Loads a block and all its neighboring(adjacent) blocks +- bool load_block_and_neighbors(vgl_point_3d i) { return load_block_and_neighbors(i.x(), i.y(), i.z()); } +- +- //: Reads and loads all blocks into memorty +- bool read_all_blocks(); +- +- //: Write the active block to disk +- void write_active_block(bool unload_block=true); +- +- //: Write the active block to disk +- void write_active_block(bool unload_block=false) const; +- +- //: Write the active blocks to disk +- void write_active_blocks(bool unload_block=true); +- +- //: Write the active blocks to disk +- void write_active_blocks(bool unload_block=false) const; +- +- //: Write the specified block to disk without changing global variables +- void write_block_thread_safe(unsigned i, unsigned j, unsigned k); +- +- //: Returns the active block(in memory) +- boxm_block* get_active_block(); +- +- //: Returns the index of active block +- vgl_point_3d active_block() const { return active_block_; } +- +- //: Returns the indices of active neighbors; +- std::set, bvgl_point_3d_cmp >& active_blocks() { return active_blocks_; } +- +- vpgl_lvcs lvcs() const { return lvcs_; } +- +- vgl_point_3d origin() const { return origin_; } +- +- void set_origin(vgl_point_3d o) { origin_=o; } +- +- vgl_vector_3d block_dim() const { return block_dim_; } +- +- bool save_internal_nodes() const { return save_internal_nodes_; } +- +- bool save_platform_independent() const { return save_platform_independent_; } +- +- bool load_all_blocks() const { return load_all_blocks_; } +- +- void block_num(int &x, int &y, int &z) const { +- x=(int) blocks_.get_row1_count(); +- y=(int) blocks_.get_row2_count(); +- z=(int) blocks_.get_row3_count(); +- } +- +- vgl_vector_3d world_dim() const override { +- unsigned x=(unsigned) blocks_.get_row1_count(); +- unsigned y=(unsigned) blocks_.get_row2_count(); +- unsigned z=(unsigned) blocks_.get_row3_count(); +- return {x,y,z}; +- } +- +- std::string path() const { return scene_path_; } +- +- std::string block_prefix() const { return block_pref_; } +- +- void set_path(std::string path, std::string block_prefix) { scene_path_=path; block_pref_= block_prefix; } +- +- void b_read(vsl_b_istream & s); +- +- void b_write(vsl_b_ostream& s) const; +- +- //: Returns the block this point resides in +- boxm_block* get_block(vgl_point_3d const& p) const; +- +- //: Returns the index of the block containing this point +- bool get_block_index(vgl_point_3d const& p, vgl_point_3d& index); +- +- //: Returns a block, assumes block is in memory - if not it returns null +- boxm_block* get_block(unsigned i, unsigned j, unsigned k) const { return blocks_(i,j,k); } +- +- //: Returns a block, assumes block is in memory - if not it returns null +- boxm_block* get_block(const vgl_point_3d& idx) { return blocks_(idx.x(), idx.y(), idx.z()); } +- +- //: Returns a read-only block, assumes block is in memory - if not it returns null +- const boxm_block* get_block_read_only(unsigned i, unsigned j, unsigned k) { return blocks_(i,j,k); } +- +- //: Return all leaf cells in a region +- void leaves_in_region(vgl_box_3d, std::vector* >& cells); +- +- //: Return the level of the smallest cell entirely containing the 3d region +- short level_region(vgl_box_3d box); +- +- //: Return all leaf_data in a region - data is copied to new memory location +- void leaves_data_in_region(vgl_box_3d box, std::vector > &cell_data); +- +- //: Returns the data of all cells at a given level, that are contained in the specified region +- void cell_data_in_region(vgl_box_3d box, std::vector > &cell_data, unsigned level); +- +- //: Return all leaf cells between an inner box and an outter box +- void leaves_in_hollow_region(vgl_box_3d outer_box, vgl_box_3d inner_box, std::vector* >& cells); +- +- //: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates +- void change_leaves_in_region(vgl_box_3d box, const datatype &cell_data); +- void change_leaves_in_regions(std::vector > boxes, const std::vector &all_data); +- +- //: Locate point in scene coordinates. Assumes that the block containing the point is already loaded into memory +- boct_tree_cell* locate_point_in_memory(vgl_point_3d &p, unsigned level = 0); +- +- void set_block(vgl_point_3d const& idx, boxm_block* block) +- { +- if (blocks_(idx.x(),idx.y(),idx.z())) // release memory +- delete blocks_(idx.x(),idx.y(),idx.z()); +- +- blocks_(idx.x(),idx.y(),idx.z()) = block; active_block_=idx; +- } +- +- void set_block(int i, int j, int k , boxm_block* block) { set_block(vgl_point_3d(i,j,k), block); } +- +- //: Write scene xml file at the scenes' path +- void write_scene(std::string filename = "scene.xml"); +- +- //: Write scene xml file at the location indicated by path +- void write_scene(std::string path, std::string filename); +- +- void load_scene(std::string filename); +- +- void load_scene(boxm_scene_parser& parser); +- +- void force_write_blocks(); +- +- static short version_no() { return 1; } +- +- boxm_block_iterator iterator() { return boxm_block_iterator(this); } +- +- boxm_block_iterator const_iterator() const { return boxm_block_iterator(this); } +- +- boxm_cell_iterator cell_iterator(bool (boxm_scene::*block_loading_func)(unsigned,unsigned, unsigned), bool read_only = false) +- { +- boxm_cell_iterator cell_iter(this->iterator(), block_loading_func, read_only); +- return cell_iter; +- } +- +- boxm_cell_iterator cell_iterator(bool (boxm_scene::*block_loading_func)(unsigned,unsigned, unsigned) const, bool read_only) +- { +- assert (read_only); +- boxm_cell_iterator cell_iter(this->const_iterator(), block_loading_func, read_only); +- return cell_iter; +- } +- +- vgl_box_3d get_world_bbox() const override; +- +- //: Return the dimensions of the scene along each axis - this are equivalent to bbox width, length and depth +- void axes_length(double &x_length,double &y_length, double &z_length) const; +- +- //: Return true if the block index is valid +- bool valid_index(vgl_point_3d const& idx) const { return valid_index(idx.x(), idx.y(), idx.z()); } +- +- +- //: Return true if the block index is valid +- inline bool valid_index(int const& x, int const& y, int const& z) const { +- return x >= (int)0 && x < (int)blocks_.get_row1_count() && +- y >= (int)0 && y < (int)blocks_.get_row2_count() && +- z >= (int)0 && z < (int)blocks_.get_row3_count(); +- } +- +- void set_pinit(float pinit) { pinit_=pinit; } +- +- float pinit() const { return pinit_; } +- +- vgl_box_3d get_block_bbox(vgl_point_3d const& idx) const { return get_block_bbox(idx.x(), idx.y(), idx.z()); } +- +- vgl_box_3d get_block_bbox(int x, int y, int z) const; +- +- //: generates a name for the block binary file based on the 3D vector index +- std::string gen_block_path(int x, int y, int z) const; +- +- void clean_scene(); +- +- //: Returns a scene with the same structure and initialized with given value +- void clone_blocks(boxm_scene &scene_out, datatype data); +- +- //: Returns a scene with the same structure and data +- void clone_blocks(boxm_scene &scene_out); +- +- //: Returns a scene of a different type with the same structure and initialized with given value +- template +- void clone_blocks_to_type(boxm_scene &scene_out, typename boxm_scene::datatype data ) +- { +- std::cout << "Clone blocks to type\n"; +- boxm_block_iterator iter(this); +- boxm_block_iterator iter_out = scene_out.iterator(); +- iter.begin(); +- iter_out.begin(); +- while (!iter.end()) +- { +- load_block(iter.index()); +- scene_out.load_block(iter.index()); +- T_out *tree_out =(*iter)->get_tree()->template clone_to_type::datatype>(); +- (*iter_out)->init_tree(tree_out); +- tree_out->init_cells(data); +- scene_out.write_active_block(); +- ++iter; +- ++iter_out; +- } +- } +- +- //: Returns a scene of a vector type with the same structure and vector initialized to the the same data +- template +- void clone_blocks_to_vector(boxm_scene > > &scene_out) +- { +- typedef boct_tree > type_tree_out; +- std::cout << "Clone blocks to type\n"; +- boxm_block_iterator iter(this); +- boxm_block_iterator iter_out = scene_out.iterator(); +- iter.begin(); +- iter_out.begin(); +- while (!iter.end()) +- { +- load_block(iter.index()); +- scene_out.load_block(iter.index()); +- type_tree_out *tree_out =(*iter)->get_tree()->template clone_to_vector(); +- (*iter_out)->init_tree(tree_out); +- scene_out.write_active_block(); +- ++iter; +- ++iter_out; +- } +- } +- +- //: Unload active blocks +- void unload_active_blocks() const; +- +- //: Print out the trees in the scene +- void print(); +- +- //: Return the finest level in the scene +- short finest_level(); +- +- //: Return the length of finest-level cell in the scene +- double finest_cell_length(); +- +- //: Return the length of cells at a given level in the scene +- double cell_length(unsigned level); +- +- //: Return the length of finest-level cell in the scene. Iterates through blocks assuming they are all in memory +- double finest_cell_length_in_memory() const; +- +- //: Return the finest level in the scene. Iterates through blocks assuming they are all in memory +- short finest_level_in_memory() const; +- +- //: Return the number of leaf nodes in the scene +- unsigned long size(); +- +- vgl_point_3d rpc_origin() const { return rpc_origin_; } +- +- void set_rpc_origin(vgl_point_3d& new_rpc_origin) { +- vgl_point_3d old_origin = origin(); +- vgl_point_3d new_origin( +- old_origin.x() + new_rpc_origin.x() - rpc_origin_.x(), +- old_origin.y() + new_rpc_origin.y() - rpc_origin_.y(), +- old_origin.z() + new_rpc_origin.z() - rpc_origin_.z()); +- set_origin(new_origin); +- rpc_origin_ = new_rpc_origin; +- } +- +- protected: +- vpgl_lvcs lvcs_; +- vgl_point_3d origin_; +- vgl_point_3d rpc_origin_; +- +- //: World dimensions of a block .e.g 1 meter x 1 meter x 1 meter +- vgl_vector_3d block_dim_; +- +- vbl_array_3d*> blocks_; +- +- //: index of the blocks (3D array) that is active; only one active block at a time +- mutable vgl_point_3d active_block_; +- +- //: if neighbors of the active block are loaded into memory, their indices are stored in this set +- mutable std::set, bvgl_point_3d_cmp > active_blocks_; +- +- float pinit_; +- +- //: Flag that indicates whether internal nodes of the trees should be saved +- bool save_internal_nodes_; +- +- //: Flag that indicates whether the octree data should be saved in a platform-independent way (slower) +- bool save_platform_independent_; +- +- //: Flag to load all the blocks in the memory +- bool load_all_blocks_; +- +- // ************** private methods ******************* +- +- void create_block(unsigned i, unsigned j, unsigned k); +- +- void create_blocks(const vgl_vector_3d& block_dim, const vgl_vector_3d& world_dim); +- bool parse_config(boxm_scene_parser& parser); +- +- bool parse_xml_string(std::string xml, boxm_scene_parser& parser); +- +- //: Load all blocks in between min-max indices. This method is private and the user needs to take care of unloading the blocks +- bool load_blocks(vgl_point_3d min_idx, vgl_point_3d max_idx); +- +- //: Unload all blocks in between min-max indices. +- bool unload_blocks(vgl_point_3d min_idx, vgl_point_3d max_idx); +- +- +- //: A helper function to generate the indices of neighboring blocks +- std::set, bvgl_point_3d_cmp > neighboring_blocks(vgl_point_3d idx) +- { +- std::set, bvgl_point_3d_cmp > neighbors; +- for (int i = -1; i <= 1; i++) +- { +- int active_i = idx.x() + i; +- if (active_i >= 0 && active_i < int(blocks_.get_row1_count())) +- for (int j = -1; j <= 1; j++) +- { +- int active_j = idx.y() + j; +- if (active_j >= 0 && active_j < int(blocks_.get_row2_count()) ) +- for (int k = -1; k <= 1; k++) +- { +- int active_k = idx.z() + k; +- if (active_k >= 0 && active_k < int(blocks_.get_row3_count())) +- neighbors.insert(vgl_point_3d(active_i, active_j, active_k)); +- } +- } +- } +- return neighbors; +- } +-}; +- +-template +-class boxm_block_iterator +-{ +- friend class boxm_cell_iterator; +- +- public: +- boxm_block_iterator(boxm_scene const* scene): i_(0), j_(0), k_(0), scene_(scene) {} +- +- //: Copy constructor +- boxm_block_iterator(boxm_block_iterator const& other): i_(other.i_), j_(other.j_), k_(other.k_), scene_(other.scene_) {} +- +- ~boxm_block_iterator() = default; +- +- boxm_block_iterator& begin(); +- +- bool end(); +- +- boxm_block_iterator& operator=(const boxm_block_iterator& that); +- +- bool operator==(const boxm_block_iterator& that); +- +- bool operator!=(const boxm_block_iterator& that); +- +- boxm_block_iterator& operator++(); // pre-inc +- +- boxm_block_iterator operator++(int); // post-inc +- +- boxm_block_iterator& operator--(); +- +- boxm_block* operator*(); +- +- boxm_block* operator->(); +- +- vgl_point_3d index() const { return vgl_point_3d(i_,j_,k_); } +- +- private: +- int i_; +- int j_; +- int k_; +- +- boxm_scene const* scene_; +-}; +- +- +-//: A class to iterate through all -or only leaf- cells in a boxm_scene +-template +-class boxm_cell_iterator +-{ +- public: +- typedef bool (boxm_scene::*ptr2func)(unsigned, unsigned, unsigned); +- typedef bool (boxm_scene::*ptr2constfunc)(unsigned, unsigned, unsigned) const; +- typedef typename T::loc_type loc_type; +- typedef typename T::datatype datatype; +- +- //: Copy constructor +- boxm_cell_iterator(boxm_cell_iterator const& other) +- : block_iterator_(other.block_iterator_), cells_(other.cells_), +- block_loading_func_(other.block_loading_func_), read_only_(other.read_only_) {} +- +- //: Constructor from a block iterator and function pointer to loading mechanism i.e load_block() or load_block_and_neighbors() +- boxm_cell_iterator(boxm_block_iterator iter, ptr2func block_loading_func, bool read_only = false, bool use_internal_cells = false) +- : block_iterator_(iter), block_loading_func_((ptr2constfunc)block_loading_func), read_only_(read_only), use_internal_cells_(use_internal_cells) {} +- +- //: "Const" constructor from a block iterator and function pointer to loading mechanism i.e load_block() or load_block_and_neighbors() +- boxm_cell_iterator(boxm_block_iterator iter, ptr2constfunc block_loading_func, bool read_only, bool use_internal_cells = false) +- : block_iterator_(iter), block_loading_func_(block_loading_func), read_only_(read_only), use_internal_cells_(use_internal_cells) { assert(read_only); } +- +- //: Destructor +- ~boxm_cell_iterator() = default; +- +- //: Iterator begin +- boxm_cell_iterator& begin(bool use_internal_cells=false); +- +- //: Iterator end +- bool end(); +- +- /*************** Operators ****************/ +- +- boxm_cell_iterator& operator=( const boxm_cell_iterator& that); +- +- bool operator==(const boxm_cell_iterator& that); +- +- bool operator!=(const boxm_cell_iterator& that); +- +- //: Prefix increment. When the end of the block is reached, it writes the block to disk and loads the next one +- boxm_cell_iterator& operator++(); +- +- //: Increment. When the end of the block is reached, it writes the block to disk and loads the next one +- boxm_cell_iterator operator+=(unsigned const &rhs); +- +- boct_tree_cell* operator*(); +- +- boct_tree_cell* operator->(); +- +- /*************** Data accessor *************/ +- //: Return the global origin of the current cell +- vgl_point_3d global_origin(); +- +- //: Return the global centroid of the current cell - use only if cells are cubical +- vgl_point_3d global_centroid(); +- +- //: Return the global length of this cell +- double length(); +- +- private: +- +- boxm_block_iterator block_iterator_; +- std::vector* > cells_; +- typename std::vector< boct_tree_cell* >::const_iterator cells_iterator_; +- ptr2constfunc block_loading_func_; +- bool read_only_; +- bool use_internal_cells_; +-}; +- +- +-//: generates an XML file from the member variables +-template +-void x_write(std::ostream &os, boxm_scene& scene, std::string name="boxm_scene"); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scene const &scene); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scene const * &scene); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scene &scene); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scene *&scene); +- +- +-#endif // boxm_scene_h_ +diff --git a/contrib/brl/bseg/boxm/boxm_scene.hxx b/contrib/brl/bseg/boxm/boxm_scene.hxx +deleted file mode 100644 +index b398bcc2ad..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene.hxx ++++ /dev/null +@@ -1,1764 +0,0 @@ +-#ifndef boxm_scene_hxx_ +-#define boxm_scene_hxx_ +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include "boxm_scene.h" +-// +-#include "boxm_apm_traits.h" +-#include "boxm_scene_parser.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-template +-boxm_scene::boxm_scene(const vpgl_lvcs& lvcs, +- const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- const bool load_all_blocks, +- const bool save_internal_nodes, +- const bool save_platform_independent) +-: lvcs_(lvcs), +- origin_(origin), +- block_dim_(block_dim), +- active_block_(vgl_point_3d(-1,-1,-1)), +- save_internal_nodes_(save_internal_nodes), +- save_platform_independent_(save_platform_independent), +- load_all_blocks_(load_all_blocks) +-{ +- create_blocks(block_dim, world_dim); +-} +- +-template +-boxm_scene::boxm_scene( const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- const bool load_all_blocks, +- const bool save_internal_nodes, +- const bool save_platform_independent) +-: origin_(origin), +- block_dim_(block_dim), +- active_block_(vgl_point_3d(-1,-1,-1)), +- save_internal_nodes_(save_internal_nodes), +- save_platform_independent_(save_platform_independent), +- load_all_blocks_(load_all_blocks) +-{ +- create_blocks(block_dim, world_dim); +-} +- +-template +-boxm_scene::boxm_scene(const boxm_scene& scene) +-: boxm_scene_base(scene), +- lvcs_(scene.lvcs()), +- origin_(scene.origin()), +- block_dim_(scene.block_dim()), +- active_block_(vgl_point_3d(-1,-1,-1)), +- save_internal_nodes_(scene.save_internal_nodes()), +- save_platform_independent_(scene.save_platform_independent()), +- load_all_blocks_(scene.load_all_blocks()) +-{ +- int x,y,z; +- scene.block_num(x,y,z); +- create_blocks(block_dim_, vgl_vector_3d(x,y,z)); +-} +- +- +-template +-void boxm_scene::create_blocks(const vgl_vector_3d& /*block_dim*/, +- const vgl_vector_3d& world_dim) +-{ +- // compute the dimensions of 3D array +- unsigned x_dim = world_dim.x(); // = static_cast(std::floor(world_dim.x()/block_dim.x())); +- unsigned y_dim = world_dim.y(); // = static_cast(std::floor(world_dim.y()/block_dim.y())); +- unsigned z_dim = world_dim.z(); // = static_cast(std::floor(world_dim.z()/block_dim.z())); +- +- // pointers are initialized to NULL +- blocks_ = vbl_array_3d*>(x_dim, y_dim, z_dim, (boxm_block*)nullptr); +- for (unsigned i=0; i +-boxm_scene::boxm_scene(const vpgl_lvcs& lvcs, +- const vgl_point_3d& origin, +- const vgl_vector_3d& block_dim, +- const vgl_vector_3d& world_dim, +- unsigned max_level, unsigned init_level, +- const bool load_all_blocks, +- const bool save_internal_nodes, +- const bool save_platform_independent) +-: lvcs_(lvcs), +-origin_(origin), +-block_dim_(block_dim), +-active_block_(vgl_point_3d(-1,-1,-1)), +-save_internal_nodes_(save_internal_nodes), +-save_platform_independent_(save_platform_independent), +-load_all_blocks_(load_all_blocks) +-{ +- create_blocks(block_dim, world_dim); +- set_octree_levels(max_level, init_level); +-} +- +-template +-void boxm_scene::create_block(unsigned i, unsigned j, unsigned k) +-{ +- if (blocks_(i,j,k) == NULL) { +- vgl_box_3d bbox = get_block_bbox(i,j,k); +- blocks_(i,j,k) = new boxm_block(bbox); +- } +-} +- +-template +-boxm_scene::~boxm_scene() +-{ +- // delete the blocks +- int x_dim, y_dim, z_dim; +- block_num(x_dim, y_dim, z_dim); +- for (int i=0; i +-void boxm_scene::clone_blocks(boxm_scene &scene_out, datatype data) +-{ +- boxm_block_iterator iter(this); +- boxm_block_iterator iter_out = scene_out.iterator(); +- iter.begin(); +- iter_out.begin(); +- while (!iter.end()) +- { +- load_block(iter.index()); +- scene_out.load_block(iter_out.index()); +- T *tree_out = (*iter)->get_tree()->clone_all(); +- tree_out->init_cells(data); +- (*iter_out)->init_tree(tree_out); +- scene_out.write_active_block(); +- ++iter; +- ++iter_out; +- } +-} +- +-//: Returns a scene with the same structure and data +-template +-void boxm_scene::clone_blocks(boxm_scene &scene_out) +-{ +- boxm_block_iterator iter(this); +- boxm_block_iterator iter_out = scene_out.iterator(); +- iter.begin(); +- iter_out.begin(); +- while (!iter.end()) +- { +- load_block(iter.index()); +- T *tree_out = (*iter)->get_tree()->clone_all(); +- (*iter_out)->init_tree(tree_out); +- scene_out.write_active_block(); +- ++iter; +- ++iter_out; +- } +-} +- +-template +-void boxm_scene::write_active_block(bool unload_block) +-{ +- if (valid_index(active_block_)&& (!load_all_blocks_)) +- { +- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z(); +- std::string path = gen_block_path(x,y,z); +- vsl_b_ofstream os(path); +-#ifdef DEBUG +- std::cout << "block path: " << path << '\n' +- << "Load All blocks " << load_all_blocks_ << '\n' +- << "Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl; +-#endif +- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_); +- +- // delete the block's data +- if (unload_block) +- { +- boxm_block* block = blocks_(x,y,z); +- block->delete_tree(); +- block->set_tree(nullptr); +- active_block_.set(-1,-1,-1); +- } +- os.close(); +- } +-} +- +-template +-void boxm_scene::write_active_block(bool unload_block) const +-{ +- assert(!unload_block); // use the "non-const" method ::write_active_block if you want to delete the block's data +- +- if (valid_index(active_block_)&& (!load_all_blocks_)) +- { +- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z(); +- std::string path = gen_block_path(x,y,z); +- vsl_b_ofstream os(path); +-#ifdef DEBUG +- std::cout << "block path: " << path << '\n' +- << "Load All blocks " << load_all_blocks_ << '\n' +- << "Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl; +-#endif +- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_); +- os.close(); +- } +-} +- +- +-template +-void boxm_scene::write_active_blocks(bool unload_block) +-{ +- std::set, bvgl_point_3d_cmp >::iterator it = active_blocks_.begin(); +- for (; it!=active_blocks_.end(); it++) +- { +- vgl_point_3d bidx = *it; +- if (valid_index(bidx)&& (!load_all_blocks_)) +- { +- int x=bidx.x(), y=bidx.y(), z=bidx.z(); +- std::string path = gen_block_path(x,y,z); +- vsl_b_ofstream os(path); +- #ifdef DEBUG +- std::cout<<"Load All blocks "<b_write(os, save_internal_nodes_, save_platform_independent_); +- +- // delete the block's data +- if (unload_block) +- { +- boxm_block* block = blocks_(x,y,z); +- block->delete_tree(); +- block->set_tree(nullptr); +- active_block_.set(-1,-1,-1); +- } +- os.close(); +- } +- } +-} +- +-template +-void boxm_scene::write_active_blocks(bool unload_block) const +-{ +- assert(!unload_block); // use the "non-const" method ::write_active_blocks if you want to delete the block's data +- std::set, bvgl_point_3d_cmp >::iterator it = active_blocks_.begin(); +- for (; it!=active_blocks_.end(); it++) +- { +- vgl_point_3d bidx = *it; +- if (valid_index(bidx)&& (!load_all_blocks_)) +- { +- int x=bidx.x(), y=bidx.y(), z=bidx.z(); +- std::string path = gen_block_path(x,y,z); +- vsl_b_ofstream os(path); +- #ifdef DEBUG +- std::cout<<"Load All blocks "<b_write(os, save_internal_nodes_, save_platform_independent_); +- os.close(); +- } +- } +-} +- +-//: Writes and unloads the specified block. It doesn't modify global variables +-template +-void boxm_scene::write_block_thread_safe(unsigned i, unsigned j, unsigned k) +-{ +- if (valid_index(i,j,k)&& (!load_all_blocks_)) +- { +- std::string path = gen_block_path(i,j,k); +- vsl_b_ofstream os(path); +- +- if (blocks_(i,j,k)) +- blocks_(i,j,k)->b_write(os, save_internal_nodes_, save_platform_independent_); +- +- // delete the block's data +- boxm_block* block = blocks_(i,j,k); +- block->delete_tree(); +- block->set_tree(nullptr); +- +- os.close(); +- } +-} +- +-template +-void boxm_scene::force_write_blocks() +-{ +- boxm_block_iterator iter(this); +- iter.begin(); +- while (!iter.end()) +- { +- int x=iter.index().x(), y=iter.index().y(), z=iter.index().z(); +- if (blocks_(x,y,z)->get_tree()!=nullptr) +- { +- std::cout<<" ? "; +- std::string path = gen_block_path(x,y,z); +- vsl_b_ofstream os(path); +- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_); +- os.close(); +- } +- iter++; +- } +-} +- +-//: Returns the block this point resides in +-template +-boxm_block* boxm_scene::get_block(vgl_point_3d const& p) const +-{ +- vgl_box_3d world(get_world_bbox()); +- if (world.contains(p)) { +- // find the block index +- unsigned i = static_cast((p.x()-origin_.x())/block_dim_.x()); +- unsigned j = static_cast((p.y()-origin_.y())/block_dim_.y()); +- unsigned k = static_cast((p.z()-origin_.z())/block_dim_.z()); +- return blocks_(i,j,k); +- } +- else { +-#ifdef DEBUG +- std::cerr << "Point " << p << " is out of world " << world << '\n'; +-#endif +- return nullptr; +- } +-} +- +- +-//: Returns the index of the block containing this point +-template +-bool boxm_scene::get_block_index(vgl_point_3d const& p, vgl_point_3d& index) +-{ +- vgl_box_3d world(get_world_bbox()); +- if (world.contains(p)) { +- // find the block index +- unsigned i = static_cast((p.x()-origin_.x())/block_dim_.x()); +- unsigned j = static_cast((p.y()-origin_.y())/block_dim_.y()); +- unsigned k = static_cast((p.z()-origin_.z())/block_dim_.z()); +- // boundary case +- double tol = 1e-9; +- if (std::abs(p.x()-world.max_x())(i,j,k); +- return true; +- } +- else { +-#ifdef DEBUG +- std::cerr << "Point " << p << " is out of world " << world << '\n'; +-#endif +- return false; +- } +-} +- +-template +-boxm_block* boxm_scene::get_active_block() +-{ +- if (valid_index(active_block_)) { +- boxm_block* block = blocks_(active_block_.x(),active_block_.y(),active_block_.z()); +- if (block->get_tree() == nullptr) +- load_block(active_block_.x(),active_block_.y(),active_block_.z()); +- return block; +- } +- else { +- std::cerr << "index"< +-vgl_box_3d boxm_scene::get_world_bbox() const +-{ +- vgl_point_3d min_p(origin_.x(), origin_.y(), origin_.z()); +- vgl_point_3d max_p(min_p.x()+block_dim_.x()*blocks_.get_row1_count(), +- min_p.y()+block_dim_.y()*blocks_.get_row2_count(), +- min_p.z()+block_dim_.z()*blocks_.get_row3_count()); +- +- vgl_box_3d bbox(min_p, max_p); +- return bbox; +-} +- +-template +-void boxm_scene::axes_length(double &x_length,double &y_length, double &z_length) const +-{ +- x_length = block_dim_.x()*blocks_.get_row1_count(); +- y_length = block_dim_.y()*blocks_.get_row2_count(); +- z_length = block_dim_.z()*blocks_.get_row3_count(); +-} +- +- +-template +-vgl_box_3d boxm_scene::get_block_bbox(int x, int y, int z) const +-{ +- vgl_point_3d min_p(block_dim_.x()*x+origin_.x(), block_dim_.y()*y+origin_.y(), block_dim_.z()*z+origin_.z()); +- vgl_point_3d max_p(min_p.x()+block_dim_.x(), min_p.y()+block_dim_.y(), min_p.z()+block_dim_.z()); +- +- vgl_box_3d bbox(min_p, max_p); +- return bbox; +-} +- +-template +-std::string boxm_scene::gen_block_path(int x, int y, int z) const +-{ +- std::stringstream strm; +- +- strm << scene_path_ << '/' << block_pref_ << '_' << x << '_' << y << '_' << z << ".bin"; +- +- return strm.str(); +-} +- +-template +-bool boxm_scene::discover_block(unsigned i, unsigned j, unsigned k) +-{ +- if (!valid_index(vgl_point_3d(i,j,k))) +- return false; +- std::string block_path = gen_block_path(i,j,k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found, return "false" +- return !os == false; +-} +- +-//: returns true if the block bin file is found on disc, false otherwise. +-// If false, a new tree is create for the block +-template +-bool boxm_scene::load_block(unsigned i, unsigned j, unsigned k) +-{ +- if (!valid_index(vgl_point_3d(i,j,k))) +- return false; +- +- if (!load_all_blocks_) +- { +- // this does not save the active block so make sure to save it first +- if (valid_index(active_block_)) { +- if (!(active_block_ == vgl_point_3d(i,j,k))) +- { +- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z(); +- boxm_block* block = blocks_(x,y,z); +- block->delete_tree(); +- block->set_tree(nullptr); +- } +- } +- } +- +- active_block_.set(i,j,k); +- +- if (blocks_(i,j,k)->get_tree()==nullptr) // read it from file +- { +- std::string block_path = gen_block_path(i,j,k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found +- if (!os) { +- if (blocks_(i,j,k)->get_tree()==nullptr) { +- T* tree= new T(max_tree_level_,init_tree_level_); +- blocks_(i,j,k)->init_tree(tree); +- } +- return false; +- } +- blocks_(i,j,k)->b_read(os); +- os.close(); +- } +- +- return true; +-} +- +- +-//: Load block into memory - this doesn't use global variables so user is responsible for unloading it +-template +-bool boxm_scene::load_block_thread_safe(unsigned i, unsigned j, unsigned k) +-{ +- if (!valid_index(vgl_point_3d(i,j,k))) +- return false; +- +- if (blocks_(i,j,k)->get_tree()==nullptr) // read it from file +- { +- std::string block_path = gen_block_path(i,j,k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found +- if (!os) { +- if (blocks_(i,j,k)->get_tree()==nullptr) { +- T* tree= new T(max_tree_level_,init_tree_level_); +- blocks_(i,j,k)->init_tree(tree); +- } +- return false; +- } +- blocks_(i,j,k)->b_read(os); +- os.close(); +- } +- +- return true; +-} +- +-//: Reads and loads all blocks into memorty +-template +-bool boxm_scene::read_all_blocks() +-{ +- load_all_blocks_ = true; +- this->unload_active_blocks(); +- +- for (unsigned block_i = 0; block_i < blocks_.get_row1_count(); block_i++){ +- for (unsigned block_j = 0; block_j < blocks_.get_row2_count(); block_j++){ +- for (unsigned block_k = 0; block_k < blocks_.get_row3_count(); block_k++){ +- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) // read it from file +- { +- std::string block_path = gen_block_path(block_i,block_j,block_k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found +- if (!os) { +- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) { +- T* tree= new T(max_tree_level_,init_tree_level_); +- blocks_(block_i,block_j,block_k)->init_tree(tree); +- } +- } +- else +- blocks_(block_i,block_j,block_k)->b_read(os); +- +- active_blocks_.insert(vgl_point_3d(block_i, block_j, block_k)); +- os.close(); +- } +- } +- } +- } +- +- return true; +-} +- +-template +-bool boxm_scene::load_block_and_neighbors(unsigned i, unsigned j, unsigned k) +-{ +- if (!valid_index(vgl_point_3d(i,j,k))) +- return false; +- +- active_block_.set(i,j,k); +- // Set unused blocks to null and load new blocks +- // this is to avoid rereading blocks that are already in memory +- std::set, bvgl_point_3d_cmp > new_active_blocks = neighboring_blocks(vgl_point_3d(i,j,k)); +- new_active_blocks.insert(vgl_point_3d(i,j,k)); +- std::set, bvgl_point_3d_cmp > blocks_to_unload; +- std::set, bvgl_point_3d_cmp > blocks_to_load; +- bvgl_point_3d_cmp cmp; +- std::set_difference(active_blocks_.begin(), active_blocks_.end(), +- new_active_blocks.begin(), new_active_blocks.end(), +- std::insert_iterator, bvgl_point_3d_cmp > >(blocks_to_unload, blocks_to_unload.begin()), +- cmp); +- +- std::set_difference(new_active_blocks.begin(), new_active_blocks.end(), +- active_blocks_.begin(), active_blocks_.end(), +- std::insert_iterator , bvgl_point_3d_cmp > > (blocks_to_load, blocks_to_load.begin()), +- cmp); +- +- active_blocks_.clear(); +- active_blocks_ = new_active_blocks; +- +- std::set, bvgl_point_3d_cmp >::iterator unload_it = blocks_to_unload.begin(); +- +- for (; unload_it!=blocks_to_unload.end(); unload_it++) +- { +- boxm_block* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z()); +- block->delete_tree(); +- block->set_tree(nullptr); +- } +- +- std::set, bvgl_point_3d_cmp >::iterator load_it = blocks_to_load.begin(); +- +- for (; load_it!=blocks_to_load.end(); load_it++) +- { +- int block_i = (*load_it).x(); +- int block_j = (*load_it).y(); +- int block_k = (*load_it).z(); +- +- if (blocks_(block_i,block_j,block_k)->get_tree() == nullptr)// read it from file +- { +- std::string block_path = gen_block_path(block_i,block_j,block_k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found +- if (!os) { +- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) { +- T* tree= new T(max_tree_level_,init_tree_level_); +- blocks_(block_i,block_j,block_k)->init_tree(tree); +- } +- return false; +- } +- blocks_(block_i,block_j,block_k)->b_read(os); +- assert(blocks_(block_i,block_j,block_k)!=NULL); +- assert(blocks_(block_i,block_j,block_k)->get_tree()!=nullptr); +- +- os.close(); +- } +- } +- +- return true; +-} +- +-//: Return the finest level in the scene +-template +-short boxm_scene::finest_level() +-{ +- // iterate through the blocks requesting the finest level +- boxm_block_iterator iter=this->const_iterator(); +- iter.begin(); +- short finest_level = this->max_tree_level_; +- while (!iter.end()) { +- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z())) { +- short this_level = get_active_block()->get_tree()->finest_level(); +- if (this_level < finest_level) +- finest_level = this_level; +- } +- iter++; +- } +- +- return finest_level; +-} +- +- +-//: Return the finest level in the scene. Iterates through blocks assuming they are all in memory +-template +-short boxm_scene::finest_level_in_memory() const +-{ +- if (!load_all_blocks_) +- return -1; +- +- // iterate through the blocks requesting the finest level +- short finest_level = this->max_tree_level_; +- for (unsigned block_i = 0; block_i < blocks_.get_row1_count(); block_i++){ +- for (unsigned block_j = 0; block_j < blocks_.get_row2_count(); block_j++){ +- for (unsigned block_k = 0; block_k < blocks_.get_row3_count(); block_k++){ +- if (blocks_(block_i,block_j,block_k)) { +- short this_level = blocks_(block_i,block_j,block_k)->get_tree()->finest_level(); +- if (this_level < finest_level) +- finest_level = this_level; +- } +- } +- } +- } +- +- return finest_level; +-} +- +-//: Return the length of finest-level cell in the scene +-template +-double boxm_scene::finest_cell_length() +-{ +- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - finest_level())); +- +- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7)){ +- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n" +- << block_dim_.x() <<", " << block_dim_.y()<< ", " << block_dim_.x() << '\n'; +- } +- +- return local_cell_length * block_dim_.x(); +-} +- +-//: Return the length of cells at a given level in the scene +-template +-double boxm_scene::cell_length(unsigned level) +-{ +- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - level)); +- +- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7)){ +- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n" +- << block_dim_.x() <<", " << block_dim_.y()<< ", " << block_dim_.x() << '\n'; +- } +- +- return local_cell_length * block_dim_.x(); +-} +- +-//: Return the length of finest-level cell in the scene. Iterates through blocks assuming they are all in memory +-template +-double boxm_scene::finest_cell_length_in_memory() const +-{ +- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - finest_level_in_memory())); +- +- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7)) +- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n"; +- +- return local_cell_length * block_dim_.x(); +-} +- +-//: Return the number of leaf nodes in the scene +-template +-unsigned long boxm_scene::size() +-{ +- // iterate through the blocks requesting the finest level +- boxm_block_iterator iter=this->const_iterator(); +- iter.begin(); +- unsigned long size = 0; +- while (!iter.end()) { +- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z())) +- { +- size += get_active_block()->get_tree()->size(); +- } +- +- iter++; +- } +- +- return size; +-} +- +-template +-void boxm_scene::b_read(vsl_b_istream & is) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- std::string xml=""; +- vsl_b_read(is, xml); +- std::cout << xml << std::endl; +- boxm_scene_parser parser; +- parse_xml_string(xml, parser); +- break; +-#if 0 +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_scene&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- return; +-#endif +- } +-} +- +-template +-void boxm_scene::b_write(vsl_b_ostream & s) const +-{ +- // create an XML stream for the parameters +- std::stringstream strm; +- boxm_scene scene(this->lvcs(), this->origin(), this->block_dim(), this->world_dim()); +- x_write(strm, scene, "scene"); +- std::string str(strm.str()); +- +- short v = boxm_scene::version_no(); +- vsl_b_write(s, v); +- // write the XML as char stream +- vsl_b_write(s, str); +-} +- +-template +-void boxm_scene::write_scene(std::string filename) +-{ +- std::string fullpath=scene_path_+ "/" + filename; +- std::ofstream os(fullpath.c_str()); +- x_write(os, *this, "boxm_scene"); +- this->filename_ = fullpath; +- os.close(); +-} +- +-template +-void boxm_scene::write_scene(std::string path, std::string filename) +-{ +- std::string fullpath= path+ "/" + filename; +- std::ofstream os(fullpath.c_str()); +- x_write(os, *this, "boxm_scene"); +- this->filename_ = fullpath; +- os.close(); +-} +- +-template +-void boxm_scene::load_scene(std::string filename) +-{ +- boxm_scene_parser parser; +- boxm_scene_base::load_scene(filename, parser); +- this->filename_ = filename; +- parse_config(parser); +-} +- +-template +-void boxm_scene::load_scene(boxm_scene_parser& parser) +-{ +- parse_config(parser); +-} +- +-template +-void x_write(std::ostream &os, boxm_scene& scene, std::string name) +-{ +- vsl_basic_xml_element scene_elm(name); +- scene_elm.x_write_open(os); +- +- vsl_basic_xml_element app_model(APP_MODEL_TAG); +- app_model.add_attribute("type", boxm_apm_types::app_model_strings[scene.appearence_model()]); +- app_model.x_write(os); +- +- vsl_basic_xml_element bin(MULTI_BIN_TAG); +- bin.add_attribute("value", scene.multi_bin()? 1 : 0); +- bin.x_write(os); +- +- vsl_basic_xml_element save_nodes(SAVE_INTERNAL_NODES_TAG); +- save_nodes.add_attribute("value", scene.save_internal_nodes()? 1 : 0); +- save_nodes.x_write(os); +- +- vsl_basic_xml_element save_platform_independent(SAVE_PLATFORM_INDEPENDENT_TAG); +- save_platform_independent.add_attribute("value", scene.save_platform_independent()? 1 : 0); +- save_platform_independent.x_write(os); +- +- vsl_basic_xml_element load_all_blocks(LOAD_ALL_BLOCKS_TAG); +- load_all_blocks.add_attribute("value", scene.load_all_blocks()? 1 : 0); +- load_all_blocks.x_write(os); +- +- vpgl_lvcs lvcs=scene.lvcs(); +- x_write(os, lvcs, LVCS_TAG); +- x_write(os, scene.origin(), LOCAL_ORIGIN_TAG); +- x_write(os, scene.block_dim(), BLOCK_DIMENSIONS_TAG); +- +- vsl_basic_xml_element blocks(BLOCK_NUM_TAG); +- int x_dim, y_dim, z_dim; +- scene.block_num(x_dim, y_dim, z_dim); +- blocks.add_attribute("x_dimension", x_dim); +- blocks.add_attribute("y_dimension", y_dim); +- blocks.add_attribute("z_dimension", z_dim); +- blocks.x_write(os); +- +- vsl_basic_xml_element paths(SCENE_PATHS_TAG); +- paths.add_attribute("path", scene.path()); +- paths.add_attribute("block_prefix", scene.block_prefix()); +- paths.x_write(os); +- +- vsl_basic_xml_element tree(OCTREE_LEVELS_TAG); +- tree.add_attribute("max", (int) scene.max_level()); +- tree.add_attribute("init", (int) scene.init_level()); +- tree.x_write(os); +- +- scene_elm.x_write_close(os); +-} +- +-template +-bool boxm_scene::parse_config(boxm_scene_parser& parser) +-{ +- vpgl_lvcs lvcs; +- parser.lvcs(lvcs); +- vgl_vector_3d dims = parser.block_nums(); +- +- lvcs_ = lvcs; +- origin_ = parser.origin(); +- block_dim_ = parser.block_dim(); +- create_blocks(block_dim_, dims); +- +- parser.paths(scene_path_, block_pref_); +- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data()); +- multi_bin_ = parser.multi_bin(); +- save_internal_nodes_ =parser.save_internal_nodes(); +- save_platform_independent_ = parser.save_platform_independent(); +- load_all_blocks_ = parser.load_all_blocks(); +- pinit_=parser.p_init(); +-#if 0 +- std::cout << "Internal Nodes 1: " << save_internal_nodes_ << std::endl; +-#endif +- parser.levels(max_tree_level_, init_tree_level_); +- return true; +-} +- +-template +-bool boxm_scene::parse_xml_string(std::string xml, boxm_scene_parser& parser) +-{ +- if (xml.size() == 0) { +- std::cerr << "XML string is empty\n"; +- return false; +- } +- if (!parser.parseString(xml.data())) { +- std::cerr << XML_ErrorString(parser.XML_GetErrorCode()) << " at line " +- << parser.XML_GetCurrentLineNumber() << '\n'; +- +- return false; +- } +- +- vpgl_lvcs lvcs; +- parser.lvcs(lvcs); +- vgl_vector_3d nums = parser.block_nums(); +- +- lvcs_ = lvcs; +- origin_ = parser.origin(); +- block_dim_ = parser.block_dim(); +- create_blocks(block_dim_, nums); +- +- parser.paths(scene_path_, block_pref_); +- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data()); +- multi_bin_ = parser.multi_bin(); +- pinit_=parser.p_init(); +- load_all_blocks_ = parser.load_all_blocks(); +- +- return true; +-} +- +-template +-void boxm_scene::clean_scene() +-{ +- boxm_block_iterator iter=this->iterator(); +- iter.begin(); +- while (!iter.end()) { +- if (this->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) { +- std::string filename=this->gen_block_path(iter.index().x(),iter.index().y(),iter.index().z()); +- vpl_unlink(filename.c_str()); +- } +- iter++; +- } +-} +- +-template +-void boxm_scene::print() +-{ +- boxm_block_iterator iter=this->const_iterator(); +- iter.begin(); +- while (!iter.end()) { +- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z())) { +- std::cout << "Printing Block : " << iter.index() << std::endl; +- get_active_block()->get_tree()->print(); +- } +- ++iter; +- } +-} +- +-//: Load all blocks in between min-max indices. +-template +-bool boxm_scene::load_blocks(vgl_point_3d min_idx, vgl_point_3d max_idx) +-{ +- if (!valid_index(min_idx) || !valid_index(max_idx)) +- return false; +- +- std::set, bvgl_point_3d_cmp > new_active_blocks; +- +- for (int i = min_idx.x(); i <= max_idx.x(); i++) +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- new_active_blocks.insert(vgl_point_3d(i,j,k)); +- +- // Set unused blocks to null and load new blocks +- // this is to avoid rereading blocks that are already in memory +- std::set, bvgl_point_3d_cmp > blocks_to_unload; +- std::set, bvgl_point_3d_cmp > blocks_to_load; +- bvgl_point_3d_cmp cmp; +- std::set_difference(active_blocks_.begin(), active_blocks_.end(), +- new_active_blocks.begin(), new_active_blocks.end(), +- std::insert_iterator, bvgl_point_3d_cmp > >(blocks_to_unload, blocks_to_unload.begin()), +- cmp); +- +- std::set_difference(new_active_blocks.begin(), new_active_blocks.end(), +- active_blocks_.begin(), active_blocks_.end(), +- std::insert_iterator , bvgl_point_3d_cmp > > (blocks_to_load, blocks_to_load.begin()), +- cmp); +- +- active_blocks_.clear(); +- active_blocks_ = new_active_blocks; +- +- std::set, bvgl_point_3d_cmp >::iterator unload_it = blocks_to_unload.begin(); +- +- for (; unload_it!=blocks_to_unload.end(); unload_it++) +- { +- boxm_block* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z()); +- block->delete_tree(); +- block->set_tree(nullptr); +- } +- +- std::set, bvgl_point_3d_cmp >::iterator load_it = blocks_to_load.begin(); +- +- for (; load_it!=blocks_to_load.end(); load_it++) +- { +- int block_i = (*load_it).x(); +- int block_j = (*load_it).y(); +- int block_k = (*load_it).z(); +- +- if (blocks_(block_i,block_j,block_k)->get_tree() == nullptr)// read it from file +- { +- std::string block_path = gen_block_path(block_i,block_j,block_k); +- vsl_b_ifstream os(block_path); +- +- // if the binary block file is not found +- if (!os) { +- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) { +- T* tree= new T(max_tree_level_,init_tree_level_); +- blocks_(block_i,block_j,block_k)->init_tree(tree); +- } +- return false; +- } +- blocks_(block_i,block_j,block_k)->b_read(os); +- os.close(); +- } +- } +- +- return true; +-} +- +-//: Unload all blocks in between min-max indices. +-template +-bool boxm_scene::unload_blocks(vgl_point_3d min_idx, vgl_point_3d max_idx) +-{ +- if (!valid_index(min_idx) || !valid_index(max_idx)) +- return false; +- +- for (int i = min_idx.x(); i <= max_idx.x(); i++) +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- boxm_block* block = blocks_(i,j,k); +- block->delete_tree(); +- block->set_tree(nullptr); +- } +- return true; +-} +- +-//: Unload active blocks. +-template +-void boxm_scene::unload_active_blocks() const +-{ +- // unload active block +- if (valid_index(active_block_)) +- { +- boxm_block* block = blocks_(active_block_.x(), active_block_.y(),active_block_.z()); +- block->delete_tree(); +- block->set_tree(nullptr); +- active_block_ = vgl_point_3d(-1,-1,-1); +- } +- +- if (active_blocks_.size()==0) +- return; +- +- std::set, bvgl_point_3d_cmp >::iterator unload_it = active_blocks_.begin(); +- +- for (; unload_it!=active_blocks_.end(); unload_it++) +- { +- boxm_block* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z()); +- block->delete_tree(); +- block->set_tree(nullptr); +- } +- active_blocks_.clear(); +- +- return; +-} +- +- +-//: Locate all cells within a 3d region, which coordinates are given in scene coordinates. +-// Use with care --- blocks need to be unloaded by user to not create memory leaks +-template +-void boxm_scene::leaves_in_region(vgl_box_3d box, std::vector* > &cells) +-{ +- vgl_box_3d valid_box = vgl_intersection(get_world_bbox(),box); +- cells.clear(); +- +- if (valid_box.is_empty()) { +- std::cout << "Warning in boxm_scene::leaves_in_region: Region does not intersect scene\n"; +- return; +- } +- +- vgl_point_3d min_point = valid_box.min_point(); +- vgl_point_3d max_point = valid_box.max_point(); +- +- // load blocks intersecting the region +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +-#ifdef DEBUG +- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl; +-#endif +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- std::vector* > temp_cells; +- temp_cells.clear(); +- tree->locate_region_leaves_global(local_box_exclusive, temp_cells); +- cells.insert(cells.end(), temp_cells.begin(), temp_cells.end()); +- } +- } +- } +- +- // FIXME: I should unload the blocks +- return; +-} +- +-//: Level of the cell containing a 3d region, which coordinates are given in scene coordinates. +-template +-short boxm_scene::level_region(vgl_box_3d box) +-{ +- vgl_box_3d valid_box = vgl_intersection(get_world_bbox(),box); +- +- if (valid_box.is_empty()) { +- std::cout << "Warning in boxm_scene::level_region: Region does not intersect scene\n"; +- return -1; +- } +- +- vgl_point_3d min_point = valid_box.min_point(); +- vgl_point_3d max_point = valid_box.max_point(); +- +- // load blocks intersecting the region +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +-//#ifdef DEBUG +- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl; +-//#endif +- if (!load_blocks(min_idx, max_idx)) +- return -1; +- +- short level = -1; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- std::cout << ".....In tree with box dimension: " << get_block_bbox(i,j,k).width() << ", " << get_block_bbox(i,j,k).depth() << ", " << get_block_bbox(i,j,k).height() +- << "looking for box with dim: " << box.width() << ", " << box.depth() << ", " < local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- +- boct_tree_cell* region_cell = tree->locate_region_global(local_box_exclusive); +- if (region_cell->level() > level) +- level = region_cell->level(); +- +- std::cout << "level: " << level << box <unload_active_blocks(); +- return level; +-} +- +- +- +- +-//: Return all leaf cells between an inner box and an outter box +-template +-void boxm_scene::leaves_data_in_region(vgl_box_3d box, std::vector > &cell_data) +-{ +- vgl_box_3d valid_box = vgl_intersection(get_world_bbox(),box); +- cell_data.clear(); +- +- if (valid_box.is_empty()) { +- std::cout << "Warning in boxm_scene::leaves_in_region: Region does not intersect scene\n"; +- return; +- } +- +- vgl_point_3d min_point = valid_box.min_point(); +- vgl_point_3d max_point = valid_box.max_point(); +- +- // load blocks intersecting the region +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +-#ifdef DEBUG +- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl; +-#endif +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- std::vector* > temp_cells; +- temp_cells.clear(); +- tree->locate_region_leaves_global(local_box_exclusive, temp_cells); +- +- typename std::vector* >::iterator temp_cell_it = temp_cells.begin(); +- for(; temp_cell_it!=temp_cells.end(); temp_cell_it++){ +- cell_data.push_back(boct_cell_data(tree->global_centroid(*temp_cell_it), +- (*temp_cell_it)->level(), (*temp_cell_it)->data())); +- } +- } +- } +- } +- unload_active_blocks(); +- return; +-} +- +-//: Returns the data of all cells at a given level, that are contained in the specified region +-template +-void boxm_scene::cell_data_in_region(vgl_box_3d box, std::vector > &cell_data, unsigned level) +-{ +- vgl_box_3d valid_box = vgl_intersection(get_world_bbox(),box); +- cell_data.clear(); +- +- if (valid_box.is_empty()) { +- std::cout << "Warning in boxm_scene::leaves_in_region: Region does not intersect scene\n"; +- return; +- } +- +- vgl_point_3d min_point = valid_box.min_point(); +- vgl_point_3d max_point = valid_box.max_point(); +- +- // load blocks intersecting the region +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +-#ifdef DEBUG +- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl; +-#endif +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- std::vector* > temp_cells; +- temp_cells.clear(); +- tree->locate_region_cells_global(local_box_exclusive, temp_cells, level); +- +- typename std::vector* >::iterator temp_cell_it = temp_cells.begin(); +- for(; temp_cell_it!=temp_cells.end(); temp_cell_it++){ +- cell_data.push_back(boct_cell_data(tree->global_centroid(*temp_cell_it), +- (*temp_cell_it)->level(), (*temp_cell_it)->data())); +- } +- } +- } +- } +- unload_active_blocks(); +- return; +-} +- +-//: Return all leaf cells between an inner box and an outter box. Use with care --- blocks need to be unloaded by user +-template +-void boxm_scene::leaves_in_hollow_region(vgl_box_3d outer_box, vgl_box_3d inner_box, std::vector* >& cells) +-{ +- if (!outer_box.contains(inner_box)) +- return; +- +- // load blocks intersecting the region +- vgl_point_3d min_point = outer_box.min_point(); +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_point = outer_box.max_point(); +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +- +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),outer_box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_outer_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- +- vgl_box_3d local_inner_box_exclusive = vgl_intersection(local_outer_box_exclusive,inner_box); +- +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- std::vector* > temp_cells; +- temp_cells.clear(); +- tree->locate_leaves_in_hollow_region_global(local_outer_box_exclusive, local_inner_box_exclusive, temp_cells); +- cells.insert(cells.end(), temp_cells.begin(), temp_cells.end()); +- } +- } +- } +- +- // FIXME: I should unload the blocks +- return; +-} +- +-//: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates +-template +-void boxm_scene::change_leaves_in_region(vgl_box_3d box, const typename T::datatype &cell_data) +-{ +- // load blocks intersecting the region +- vgl_point_3d min_point = box.min_point(); +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_point = box.max_point(); +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +- +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- +- tree->change_leaves_in_global_region_leaves_global(local_box_exclusive, cell_data); +- +- std::string path = gen_block_path(i,j,k); +- vsl_b_ofstream os(path); +- block->b_write(os, save_internal_nodes_, save_platform_independent_); +- } +- } +- } +- +- unload_active_blocks(); +- return; +-} +- +-//: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates +-template +-void boxm_scene::change_leaves_in_regions(std::vector > boxes, const std::vector &all_data) +-{ +- if (boxes.size()!= all_data.size()) { +- std::cerr << "Error in boxm_scene::change_leaves_in_regions --> Input vectors don't have the same size\n"; +- return; +- } +- +- for (unsigned bi = 0; bi < boxes.size(); bi++) +- { +- const vgl_box_3d &box = boxes[bi]; +- const datatype &cell_data=all_data[bi]; +- // load blocks intersecting the region +- vgl_point_3d min_point = box.min_point(); +- vgl_point_3d min_idx; +- get_block_index(min_point, min_idx); +- +- vgl_point_3d max_point = box.max_point(); +- vgl_point_3d max_idx; +- get_block_index(max_point, max_idx); +- +- if (!load_blocks(min_idx, max_idx)) +- return; +- +- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block +- for (int k = min_idx.z(); k <= max_idx.z(); k++) +- { +- for (int j = min_idx.y(); j <= max_idx.y(); j++) +- { +- for (int i = min_idx.x(); i <= max_idx.x();i++) +- { +- boxm_block* block = blocks_(i,j,k); +- vgl_box_3d local_box = vgl_intersection(get_block_bbox(i,j,k),box); +- +- // subtract a little from the max point because octree cell are give by a half-closed interval [...). +- // if this is not done, the endpoint may be out of bounds +- vgl_box_3d local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(), +- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7); +- T *tree = block->get_tree(); +- if (!tree) +- continue; +- +- tree->change_leaves_in_global_region_leaves_global(local_box_exclusive, cell_data); +- +- std::string path = gen_block_path(i,j,k); +- vsl_b_ofstream os(path); +- block->b_write(os, save_internal_nodes_, save_platform_independent_); +- } +- } +- } +- } +- +- unload_active_blocks(); +- return; +-} +- +- +-//: Locate point +-template +-boct_tree_cell* boxm_scene::locate_point_in_memory(vgl_point_3d &p, unsigned level) +-{ +- // get the indices for the block containing this point +- vgl_point_3d block_idx; +- if (!get_block_index(p, block_idx)) +- return nullptr; +- +-#ifdef DEBUG +- std::cout << "Requesting blocks : "<< block_idx<< '\n' +- << "Active blocks :" << std::endl; +- std::set, bvgl_point_3d_cmp >::iterator it = active_blocks_.begin(); +- for (; it!=active_blocks_.end(); it++) { +- std::cout << *it << std::endl; +- boxm_block *block = get_block(*it); +- if (!block) +- std::cerr << " NULL block\n"; +- T *tree = block->get_tree(); +- if (!tree) +- std::cerr << " NULL tree\n"; +- } +-#endif +- +- // get the block, if block is not already in memory, return null +- boxm_block* block = blocks_(block_idx.x(), block_idx.y(), block_idx.z()); +- if (!block) { +- std::cerr << "In locate_point_in_memory: NULL block\n"; +- return nullptr; +- } +- T *tree = block->get_tree(); +- if (!tree) { +- std::cerr << "In locate_point_in_memory: NULL tree\n"; +- return nullptr; +- } +- return tree->locate_point_global(p, (short)level); +-} +- +-/************************************************ BOXM_BLOCK_ITERATOR *******************************************/ +- +-template +-boxm_block_iterator& boxm_block_iterator::begin() +-{ +- i_=j_=k_=0; +- return *this; +-} +- +-template +-bool boxm_block_iterator::end() +-{ +- int x,y,z; +- scene_->block_num(x,y,z); +- +- // if ((i_==x-1) && (j_==y-1) && (k_==z-1)) +- bool end = (k_==z || k_ == -1); +- +- //:If end, release memory +- if (end) +- scene_->unload_active_blocks(); +- +- return end; +-} +- +-template +-boxm_block_iterator& boxm_block_iterator::operator=(const boxm_block_iterator& that) +-{ +- this->i_ = that.i_; +- this->j_ = that.j_; +- this->k_ = that.k_; +- return *this; +-} +- +-template +-bool boxm_block_iterator::operator==(const boxm_block_iterator& that) +-{ +- return (this->i_ == that.i_) && (this->j_ == that.j_) && (this->k_ == that.k_) && (this->scene_ == that.scene_); +-} +- +-template +-bool boxm_block_iterator::operator!=(const boxm_block_iterator& that) +-{ +- return (this->i_ != that.i_) || (this->j_ != that.j_) == (this->k_ != that.k_) || (this->scene_ != that.scene_); +-} +- +-template +-boxm_block_iterator& boxm_block_iterator::operator++() +-{ +- int x,y,z; +- scene_->block_num(x,y,z); +- +- if (++i_==x) { +- i_=0; +- if (++j_==y) { +- j_=0; +- ++k_; +- } +- } +- return *this; +-} +- +-template +-boxm_block_iterator boxm_block_iterator::operator++(int) +-{ +- boxm_block_iterator old = *this; +- ++*this; +- return old; +-} +- +-template +-boxm_block_iterator& boxm_block_iterator::operator--() +-{ +- int x,y,z; +- +- scene_->block_num(x,y,z); +- if (--i_==-1) { +- i_=0; +- if (--j_==-1) { +- j_=0; +- k_--; +- } +- } +- return *this; +-} +- +-template +-boxm_block* boxm_block_iterator::operator*() +-{ +- return scene_->get_block(i_,j_,k_); +-} +- +-template +-boxm_block* boxm_block_iterator::operator->() +-{ +- return scene_->get_block(i_,j_,k_); +-} +- +-/************************************************ BOXM_CELL_ITERATOR *******************************************/ +-template +-boxm_cell_iterator& boxm_cell_iterator::begin(bool use_internal_cells) +-{ +- use_internal_cells_= use_internal_cells; +- +- // unload all blocks from memory +- block_iterator_.scene_->unload_active_blocks(); +- block_iterator_.begin(); +- +- // load active block using function pointer, retrieve pointer to all cells +- (block_iterator_.scene_->*block_loading_func_)(block_iterator_.index().x(),block_iterator_.index().y(),block_iterator_.index().z()); +- T *tree = (*block_iterator_)->get_tree(); +- assert(tree != nullptr); +- if(use_internal_cells_) +- cells_=tree->all_cells(); +- else +- cells_ = tree->leaf_cells(); +- cells_iterator_ = cells_.begin(); +- +- std::cout << "Cell iterator: # of cells: " << cells_.size() << std::endl; +- +- return *this; +-} +- +-template +-bool boxm_cell_iterator::end() +-{ +- bool end = false; +- +- end = cells_.empty() || (block_iterator_.end() && (cells_iterator_ == cells_.end())); +- +- if (end) +- block_iterator_.scene_->unload_active_blocks(); +- +- return end; +-} +- +-template +-boxm_cell_iterator& boxm_cell_iterator::operator=(const boxm_cell_iterator& /*that*/) +-{ +- std::cerr << "assignment operator not yet implemented\n"; +- return *this; +-} +- +-template +-bool boxm_cell_iterator::operator==(const boxm_cell_iterator& that) +-{ +- return (this->block_iterator_ == that.block_iterator_) && (this->cells_iterator_ == that.cells_iterator_); +-} +- +-template +-bool boxm_cell_iterator::operator!=(const boxm_cell_iterator& that) +-{ +- return (this->block_iterator_ != that.block_iterator_) && (this->cells_iterator_ != that.cells_iterator_); +-} +- +-//: Prefix operator. +-// When the end of the block is reached, it writes the block to disk and loads the next one, unless the read_only flag was set +-template +-boxm_cell_iterator& boxm_cell_iterator::operator++() +-{ +- if (++cells_iterator_ == cells_.end()) +- { +- if (!read_only_) +- block_iterator_.scene_->write_active_block(false); +- +- ++block_iterator_; +- +- if (!block_iterator_.end()) +- { +- // load active block using function pointer, retrieve pointer to all cells +- (block_iterator_.scene_->*block_loading_func_)(block_iterator_.index().x(),block_iterator_.index().y(),block_iterator_.index().z()); +- T *tree = (*block_iterator_)->get_tree(); +- assert(tree != nullptr); +- +- if(use_internal_cells_) +- cells_=tree->all_cells(); +- else +- cells_ = tree->leaf_cells(); +- +- cells_iterator_ = cells_.begin(); +- } +- } +- return *this; +-} +- +-template +-boxm_cell_iterator boxm_cell_iterator::operator+=(unsigned const &rhs) +-{ +- // is there a more efficient way to do this whitout messing all the iterator up? +- for (unsigned i =0; i +-boct_tree_cell::loc_type, typename boxm_cell_iterator::datatype>* boxm_cell_iterator::operator*() +-{ +- return *cells_iterator_; +-} +- +-template +-boct_tree_cell::loc_type, typename boxm_cell_iterator::datatype>* boxm_cell_iterator::operator->() +-{ +- return *cells_iterator_; +-} +- +-template +-vgl_point_3d boxm_cell_iterator::global_origin() +-{ +- return (*block_iterator_)->get_tree()->global_origin(*cells_iterator_); +-} +- +-template +-vgl_point_3d boxm_cell_iterator::global_centroid() +-{ +- return (*block_iterator_)->get_tree()->global_centroid(*cells_iterator_); +-} +- +-//: Return the global length of this cell +-template +-double boxm_cell_iterator::length() +-{ +- return (*block_iterator_)->get_tree()->cell_length(*cells_iterator_)*(*block_iterator_)->bounding_box().width(); +-} +- +-/******************************************* I/ O *******************************************************/ +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scene const &scene) +-{ +- scene.b_write(os); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scene const * &scene) +-{ +- scene->b_write(os); +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scene &scene) +-{ +- scene.b_read(is); +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scene *&scene) +-{ +- scene->b_read(is); +-} +- +-#define BOXM_SCENE_INSTANTIATE(T) \ +-template class boxm_scene; \ +-template void x_write(std::ostream&, boxm_scene&, std::string); \ +-template void vsl_b_write(vsl_b_ostream & os, boxm_scene const &scene); \ +-template void vsl_b_write(vsl_b_ostream & os, boxm_scene const * &scene); \ +-template void vsl_b_read(vsl_b_istream & is, boxm_scene &scene); \ +-template void vsl_b_read(vsl_b_istream & is, boxm_scene * &scene) +- +-#define BOXM_BLOCK_ITERATOR_INSTANTIATE(T) \ +-template class boxm_block_iterator; \ +-template class boxm_cell_iterator +- +-#endif +diff --git a/contrib/brl/bseg/boxm/boxm_scene_base.cxx b/contrib/brl/bseg/boxm/boxm_scene_base.cxx +deleted file mode 100644 +index 11fb0faf88..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene_base.cxx ++++ /dev/null +@@ -1,35 +0,0 @@ +-#include +-#include +-#include "boxm_scene_base.h" +-#include "boxm_scene_parser.h" +-#ifdef _MSC_VER +-# include +-#endif +- +-bool boxm_scene_base::load_scene(const std::string& filename, boxm_scene_parser& parser) +-{ +- +- if (filename.size() > 0) { +- std::FILE* xmlFile = std::fopen(filename.c_str(), "r"); +- if (!xmlFile){ +- std::cerr << filename.c_str() << " error on opening" << std::endl; +- return false; +- } +- if (!parser.parseFile(xmlFile)) { +- std::cerr << XML_ErrorString(parser.XML_GetErrorCode()) << " at line " +- << parser.XML_GetCurrentLineNumber() << '\n'; +- std::fclose(xmlFile); +- return false; +- } +- std::fclose(xmlFile); +- } +- else +- std::cerr << " Filename is empty" << std::endl; +- +- parser.paths(scene_path_, block_pref_); +- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data()); +- multi_bin_ = parser.multi_bin(); +- parser.levels(max_tree_level_, init_tree_level_); +- filename_ = filename; +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/boxm_scene_base.h b/contrib/brl/bseg/boxm/boxm_scene_base.h +deleted file mode 100644 +index 5e52195ac3..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene_base.h ++++ /dev/null +@@ -1,85 +0,0 @@ +-#ifndef boxm_scene_base_h_ +-#define boxm_scene_base_h_ +-//: +-// \file +-// \brief The main class to keep the 3D world data and pieces +-// +-// \author Gamze Tunali +-// \date Apr 14, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#include +- +-class boxm_scene_parser; +- +-class boxm_scene_base : public vbl_ref_count +-{ +- public: +- boxm_scene_base() +- : app_model_(BOXM_APM_UNKNOWN), multi_bin_(false), tree_level_set_(false), +- scene_path_(""), filename_(""), block_pref_(""), max_tree_level_(0), init_tree_level_(0) {} +- +- ~boxm_scene_base() override = default; +- +- bool load_scene(const std::string& filename, boxm_scene_parser& parser); +- +- boxm_apm_type appearence_model() { return app_model_; } +- +- void set_appearance_model(boxm_apm_type model) { app_model_ = model; } +- +- void set_bin_option(bool multi_bin) { multi_bin_ = multi_bin; } +- +- void set_octree_levels(unsigned max, unsigned init, bool tree_level_set=true) +- { +- max_tree_level_=max; +- init_tree_level_=init; +- tree_level_set_=tree_level_set; +- } +- +- void set_paths(std::string scene_path, std::string block_prefix) +- { +- scene_path_ = scene_path; +- block_pref_=block_prefix; +- } +- +- bool multi_bin() const { return multi_bin_; } +- +- bool parse_config(std::string xml, boxm_scene_parser& parser, bool filename); +- +- unsigned max_level() const { return max_tree_level_; } +- unsigned init_level() const { return init_tree_level_; } +- std::string filename() const { return filename_; } +- +- virtual vgl_box_3d get_world_bbox() const { return {}; } +- virtual vgl_vector_3d world_dim() const { return {}; } +- +- protected: +- boxm_apm_type app_model_; +- +- bool multi_bin_; +- +- //: it is set to true when max and init tree levels are given +- bool tree_level_set_; +- +- std::string scene_path_; +- std::string filename_; +- std::string block_pref_; +- +- //: maximum octree levels allowed +- unsigned max_tree_level_; +- +- //: number of initial octree levels created at the tree creation step +- unsigned init_tree_level_; +-}; +- +-typedef vbl_smart_ptr boxm_scene_base_sptr; +- +-#endif // boxm_scene_base_h_ +diff --git a/contrib/brl/bseg/boxm/boxm_scene_parser.cxx b/contrib/brl/bseg/boxm/boxm_scene_parser.cxx +deleted file mode 100644 +index be04cb28ed..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene_parser.cxx ++++ /dev/null +@@ -1,277 +0,0 @@ +-//: +-// \file +-// \brief Parses the configuration file for bwm tool. +-// +-#include +-#include +-#include +-#include +-#include "boxm_scene_parser.h" +- +-#ifdef _MSC_VER +-# include +-#endif +- +-// -------------- +-// --- PARSER --- +-// -------------- +-template +-void convert(const char* t, T& d) +-{ +- std::stringstream strm(t); +- strm >> d; +-} +- +-boxm_scene_parser::boxm_scene_parser() +-{ +- init_params(); +-} +- +-bool boxm_scene_parser::lvcs(vpgl_lvcs& lvcs) { +- vpgl_lvcs::cs_names cs_name = vpgl_lvcs::str_to_enum(lvcs_cs_name_.data()); +- vpgl_lvcs::LenUnits len_unit; +- vpgl_lvcs::AngUnits geo_unit; +- if (std::strcmp(lvcs_XYZ_unit_.data(), "feet")==0) { +- len_unit = vpgl_lvcs::FEET; +- } +- else if (std::strcmp(lvcs_XYZ_unit_.data(), "meters")==0) { +- len_unit = vpgl_lvcs::METERS; +- } +- else { +- std::cout << "LVCS Length Unit " << lvcs_XYZ_unit_ << " is not valid\n"; +- return false; +- } +- +- if (std::strcmp(lvcs_geo_angle_unit_.data(), "radians")==0) { +- geo_unit = vpgl_lvcs::RADIANS; +- } +- else if (std::strcmp(lvcs_geo_angle_unit_.data(), "degrees")==0) { +- geo_unit = vpgl_lvcs::DEG; +- } +- else { +- std::cout << "LVCS Geo Angle Unit " << lvcs_geo_angle_unit_ << " is not valid\n"; +- return false; +- } +- +- lvcs = vpgl_lvcs(lvcs_origin_lat_,lvcs_origin_lon_,lvcs_origin_elev_, cs_name, +- lvcs_lat_scale_, lvcs_lon_scale_, geo_unit, len_unit, +- lvcs_local_origin_x_, lvcs_local_origin_y_, lvcs_theta_); +- return true; +-} +- +-void boxm_scene_parser::init_params() +-{ +- lvcs_cs_name_=""; +- lvcs_origin_lon_=0; +- lvcs_origin_lat_=0; +- lvcs_origin_elev_=0; +- lvcs_lon_scale_=0; +- lvcs_lat_scale_=0; +- lvcs_XYZ_unit_=""; +- lvcs_geo_angle_unit_=""; +- lvcs_local_origin_x_=0; +- lvcs_local_origin_y_=0; +- lvcs_theta_=0; +- +- // world origin +- local_orig_x_=0; +- local_orig_y_=0; +- local_orig_z_=0; +- +- // block dimensions +- block_dim_x_=0; +- block_dim_y_=0; +- block_dim_z_=0; +- +- // block numbers +- block_num_x_=0; +- block_num_y_=0; +- block_num_z_=0; +- +- path_=""; +- block_pref_=""; +- save_internal_nodes_ = false; +- save_platform_independent_ = true; +- load_all_blocks_=false; +- p_init_=0.01f; +- num_buffers_init_ = 0; +- size_buffer_init_ = 0; +-} +- +-void +-boxm_scene_parser::startElement(const char* name, const char** atts) +-{ +-#if 0 +- std::cout<< "element=" << name << std::endl; +-#endif +- if (std::strcmp(name, LVCS_TAG) == 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "cs_name") == 0) +- convert(atts[i+1], lvcs_cs_name_); +- else if (std::strcmp(atts[i], "origin_lon") == 0) +- convert(atts[i+1], lvcs_origin_lon_); +- else if (std::strcmp(atts[i], "origin_lat") == 0) +- convert(atts[i+1], lvcs_origin_lat_); +- else if (std::strcmp(atts[i], "origin_elev") == 0) +- convert(atts[i+1], lvcs_origin_elev_); +- else if (std::strcmp(atts[i], "lon_scale") == 0) +- convert(atts[i+1], lvcs_lon_scale_); +- else if (std::strcmp(atts[i], "lat_scale") == 0) +- convert(atts[i+1], lvcs_lat_scale_); +- else if (std::strcmp(atts[i], "local_XYZ_unit") == 0) +- convert(atts[i+1], lvcs_XYZ_unit_); +- else if (std::strcmp(atts[i], "geo_angle_unit") == 0) +- convert(atts[i+1], lvcs_geo_angle_unit_); +- else if (std::strcmp(atts[i], "local_origin_x") == 0) +- convert(atts[i+1], lvcs_local_origin_x_); +- else if (std::strcmp(atts[i], "local_origin_y") == 0) +- convert(atts[i+1], lvcs_local_origin_y_); +- else if (std::strcmp(atts[i], "theta_") == 0) +- convert(atts[i+1], lvcs_theta_); +- } +- } +- else if (std::strcmp(name,LOCAL_ORIGIN_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "x") == 0) +- convert(atts[i+1], local_orig_x_); +- else if (std::strcmp(atts[i], "y") == 0) +- convert(atts[i+1], local_orig_y_); +- else if (std::strcmp(atts[i], "z") == 0) +- convert(atts[i+1], local_orig_z_); +- } +- } +- else if (std::strcmp(name,BLOCK_DIMENSIONS_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "x") == 0) +- convert(atts[i+1], block_dim_x_); +- else if (std::strcmp(atts[i], "y") == 0) +- convert(atts[i+1], block_dim_y_); +- else if (std::strcmp(atts[i], "z") == 0) +- convert(atts[i+1], block_dim_z_); +- } +- } +- else if (std::strcmp(name,BLOCK_NUM_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "x_dimension") == 0) +- convert(atts[i+1], block_num_x_); +- else if (std::strcmp(atts[i], "y_dimension") == 0) +- convert(atts[i+1], block_num_y_); +- else if (std::strcmp(atts[i], "z_dimension") == 0) +- convert(atts[i+1], block_num_z_); +- } +- } +- else if (std::strcmp(name,SCENE_PATHS_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "path") == 0) +- convert(atts[i+1], path_); +- else if (std::strcmp(atts[i], "block_prefix") == 0) +- convert(atts[i+1], block_pref_); +- } +- } +- else if (std::strcmp(name,APP_MODEL_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "type") == 0) +- convert(atts[i+1], app_model_); +- } +- } +- else if (std::strcmp(name,MULTI_BIN_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "value") == 0) +- convert(atts[i+1], multi_bin_); +- } +- } +- else if (std::strcmp(name,SAVE_INTERNAL_NODES_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "value") == 0) +- convert(atts[i+1], save_internal_nodes_); +- } +- } +- else if (std::strcmp(name,SAVE_PLATFORM_INDEPENDENT_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "value") == 0) +- convert(atts[i+1], save_platform_independent_); +- } +- //std::cout << "parser: save_platform_independent_ = " << save_platform_independent_ << std::endl; +- } +- else if (std::strcmp(name,LOAD_ALL_BLOCKS_TAG)== 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "value") == 0) +- convert(atts[i+1], load_all_blocks_); +- } +- //std::cout << "parser: load_all_blocks_ = " << load_all_blocks_ << std::endl; +- } +- +- else if (std::strcmp(name, "octree_level")==0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "max") == 0) +- convert(atts[i+1], max_tree_level_); +- else if (std::strcmp(atts[i], "init") == 0) +- convert(atts[i+1], init_tree_level_); +- } +- } +- else if (std::strcmp(name, "p_init")==0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "val") == 0) +- convert(atts[i+1], p_init_); +- } +- } +- +- else if (std::strcmp(name, "tree_init") == 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "num_buffers")==0) +- convert(atts[i+1], num_buffers_init_); +- if (std::strcmp(atts[i], "buff_size")==0) +- convert(atts[i+1], size_buffer_init_); +- } +- } +- +- else if (std::strcmp(name, "max_mb") == 0) { +- for (int i=0; atts[i]; i+=2) { +-#if 0 +- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl; +-#endif +- if (std::strcmp(atts[i], "mb") == 0) +- convert(atts[i+1], max_mb_); +- } +- } +- +-} +diff --git a/contrib/brl/bseg/boxm/boxm_scene_parser.h b/contrib/brl/bseg/boxm/boxm_scene_parser.h +deleted file mode 100644 +index cbda358d2d..0000000000 +--- a/contrib/brl/bseg/boxm/boxm_scene_parser.h ++++ /dev/null +@@ -1,108 +0,0 @@ +-#ifndef boxm_scene_parser_h_ +-#define boxm_scene_parser_h_ +- +-#include +-#include +-#include +- +-#ifdef WIN32 +- #define _LIB +-#endif +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +- +-#define LVCS_TAG "lvcs" +-#define LOCAL_ORIGIN_TAG "local_origin" +-#define BLOCK_DIMENSIONS_TAG "block_dimensions" +-#define BLOCK_NUM_TAG "blocks" +-#define SCENE_PATHS_TAG "scene_paths" +-#define APP_MODEL_TAG "appearence_model" +-#define MULTI_BIN_TAG "multi_bin" +-#define SAVE_INTERNAL_NODES_TAG "save_internal_nodes" +-#define SAVE_PLATFORM_INDEPENDENT_TAG "save_platform_independent" +-#define LOAD_ALL_BLOCKS_TAG "load_all_blocks" +-#define OCTREE_LEVELS_TAG "octree_level" +-#define P_INIT_TAG "p_init" +-#define TREE_INIT_TAG "tree_init" +-#define MAX_MB_TAG "max_mb" +- +-class boxm_scene_parser : public expatpp +-{ +- public: +- boxm_scene_parser(); +- +- ~boxm_scene_parser(void) override = default; +- +- bool lvcs(vpgl_lvcs& lvcs); +- vgl_point_3d origin() const { return {local_orig_x_,local_orig_y_,local_orig_z_}; } +- vgl_vector_3d block_dim() const { return {block_dim_x_,block_dim_y_,block_dim_z_}; } +- vgl_vector_3d block_nums() const { return {block_num_x_,block_num_y_,block_num_z_}; } +- void paths(std::string& scene_path, std::string& block_pref) { scene_path=path_; block_pref=block_pref_; } +- std::string app_model() const { return app_model_; } +- bool multi_bin() const { return multi_bin_; } +- void levels(unsigned& max, unsigned& init) { max = max_tree_level_; init=init_tree_level_; } +- bool save_internal_nodes() const { return save_internal_nodes_; } +- bool save_platform_independent() const { return save_platform_independent_; } +- bool load_all_blocks() const { return load_all_blocks_; } +- void tree_buffer_shape(int &num_buffers, int &buff_size) { num_buffers = num_buffers_init_; buff_size = size_buffer_init_; } +- int max_mb() const { return max_mb_; } +- +- float p_init() const { return p_init_; } +- +- private: +- void startElement(const XML_Char* name, const XML_Char** atts) override; +- void endElement(const XML_Char* /*name*/) override {} +- void charData(const XML_Char* /*s*/, int /*len*/) override {} +- +- void init_params(); +- +- // temporary values +- //lvcs +- std::string lvcs_cs_name_; +- double lvcs_origin_lon_; +- double lvcs_origin_lat_; +- double lvcs_origin_elev_; +- double lvcs_lon_scale_; +- double lvcs_lat_scale_; +- std::string lvcs_XYZ_unit_; +- std::string lvcs_geo_angle_unit_; +- double lvcs_local_origin_x_; +- double lvcs_local_origin_y_; +- double lvcs_theta_; +- +- // world origin +- double local_orig_x_; +- double local_orig_y_; +- double local_orig_z_; +- +- // block dimensions +- double block_dim_x_; +- double block_dim_y_; +- double block_dim_z_; +- +- // block numbers +- unsigned block_num_x_; +- unsigned block_num_y_; +- unsigned block_num_z_; +- +- std::string path_; +- std::string block_pref_; +- std::string app_model_; +- bool multi_bin_; +- unsigned max_tree_level_; +- unsigned init_tree_level_; +- bool save_internal_nodes_; +- bool save_platform_independent_; +- bool load_all_blocks_; +- float p_init_; +- int num_buffers_init_, size_buffer_init_; +- int max_mb_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/pro/CMakeLists.txt +deleted file mode 100644 +index 4c0cd29038..0000000000 +--- a/contrib/brl/bseg/boxm/pro/CMakeLists.txt ++++ /dev/null +@@ -1,29 +0,0 @@ +-# boxm's Process Library +- +-# bprb depends on expat and bvxm_prodepends on bprb primarily +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +-if(EXPAT_FOUND) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- +- set(boxm_pro_sources +- boxm_processes.h +- boxm_register.h boxm_register.cxx +- ) +- +- aux_source_directory(Templates boxm_pro_sources) +- aux_source_directory(processes boxm_pro_sources) +- +- vxl_add_library(LIBRARY_NAME boxm_pro LIBRARY_SOURCES ${boxm_pro_sources}) +- +- target_link_libraries(boxm_pro boxm boxm_util boxm_sample_algo boxm_sample vpgl_pro imesh bprb brdb brip vsol bsta bsta_pro ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl) +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +-endif() +diff --git a/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx b/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx +deleted file mode 100644 +index fb055c2df5..0000000000 +--- a/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef vnl_vector_fixed vector; +- +- +-BOCT_TREE_INSTANTIATE(short, vector ); +-BOCT_TREE_CELL_INSTANTIATE(short, vector); +diff --git a/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx +deleted file mode 100644 +index ac40b5ec2d..0000000000 +--- a/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx +deleted file mode 100644 +index 24334a0ce4..0000000000 +--- a/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx +deleted file mode 100644 +index 5de38b0662..0000000000 +--- a/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +-#include +-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr"); +diff --git a/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx b/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx +deleted file mode 100644 +index d1cce77af7..0000000000 +--- a/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/pro/boxm_processes.h b/contrib/brl/bseg/boxm/pro/boxm_processes.h +deleted file mode 100644 +index 4466447bb1..0000000000 +--- a/contrib/brl/bseg/boxm/pro/boxm_processes.h ++++ /dev/null +@@ -1,16 +0,0 @@ +-#ifndef boxm_processes_h_ +-#define boxm_processes_h_ +- +-#include +-#include +- +-//the init functions +-DECLARE_FUNC_CONS(boxm_load_scene_process); +-DECLARE_FUNC_CONS(boxm_create_scene_process); +-DECLARE_FUNC_CONS(boxm_construct_scene_from_image_process); +-DECLARE_FUNC_CONS(boxm_proj_local_cam_process); +-DECLARE_FUNC_CONS(boxm_camera_viewing_scene_process); +-DECLARE_FUNC_CONS(boxm_upload_mesh_process); +-DECLARE_FUNC_CONS(boxm_clean_scene_process); +-DECLARE_FUNC_CONS(boxm_force_write_blocks_process); +-#endif +diff --git a/contrib/brl/bseg/boxm/pro/boxm_register.cxx b/contrib/brl/bseg/boxm/pro/boxm_register.cxx +deleted file mode 100644 +index 631b5beadc..0000000000 +--- a/contrib/brl/bseg/boxm/pro/boxm_register.cxx ++++ /dev/null +@@ -1,27 +0,0 @@ +-#include "boxm_register.h" +- +-#include +-#include +-#include +- +-#include +- +-#include "boxm_processes.h" +- +-void boxm_register::register_datatype() +-{ +- REGISTER_DATATYPE( boxm_scene_base_sptr ); +-} +- +-void boxm_register::register_process() +-{ +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_load_scene_process, "boxmLoadSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_create_scene_process, "boxmCreateSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_proj_local_cam_process,"boxmProjLocalCamProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_camera_viewing_scene_process,"boxmCameraViewingSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_construct_scene_from_image_process, "boxmConstructSceneFromImageProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_upload_mesh_process,"boxmUploadMeshProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_clean_scene_process,"boxmCleanSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_force_write_blocks_process,"boxmForceWriteBlocksProcess"); +- +-} +diff --git a/contrib/brl/bseg/boxm/pro/boxm_register.h b/contrib/brl/bseg/boxm/pro/boxm_register.h +deleted file mode 100644 +index 784df08bde..0000000000 +--- a/contrib/brl/bseg/boxm/pro/boxm_register.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-#ifndef boxm_register_h_ +-#define boxm_register_h_ +- +-class boxm_register +-{ +- public: +- static void register_datatype(); +- static void register_process(); +-}; +- +-#endif // boxm_register_h_ +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx +deleted file mode 100644 +index 799958429f..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx ++++ /dev/null +@@ -1,131 +0,0 @@ +-//This is brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for generating cameras that view a scene +-// +-// \author J.L. Mundy +-// \date January 23, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-//:global variables +-namespace boxm_camera_viewing_scene_process_globals +-{ +- //this process takes no inputs +- constexpr unsigned n_inputs_ = 7; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//:sets input and output types +-bool boxm_camera_viewing_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_camera_viewing_scene_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr";// the scene +- input_types_[1] = "vcl_string";//the camera type, e.g. perspective +- input_types_[2] = "double";//camera elevation degrees +- input_types_[3] = "double";//camera azimuth degrees +- input_types_[4] = "double";//radius +- +- input_types_[5] = "unsigned";//image ni +- input_types_[6] = "unsigned";//image nj +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vpgl_camera_double_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//:creates a scene from parameters +-bool boxm_camera_viewing_scene_process(bprb_func_process& pro) +-{ +- if ( !pro.verify_inputs()) { +- std::cout << pro.name() << "boxm_camera_viewing_scene_process: invalid inputs" << std::endl; +- return false; +- } +- using namespace boxm_camera_viewing_scene_process_globals; +- boxm_scene_base_sptr scene_ptr = pro.get_input(0); +- std::cout<<"h"; +- if (!scene_ptr) return false; +- std::cout<<"hi"; +- vgl_box_3d bb = scene_ptr->get_world_bbox(); +- +- std::string cam_type = pro.get_input(1); +- if (cam_type!="vpgl_perspective_camera") +- return false; //later other camera types +- auto elevation = pro.get_input(2); +- auto azimuth = pro.get_input(3); +- auto radius = pro.get_input(4); +- +- auto ni = pro.get_input(5); +- auto nj = pro.get_input(6); +- auto dni = static_cast(ni), dnj = static_cast(nj); +- // +- //find a camera that will project the scene bounding box +- //entirely inside the image +- // +- // 1) determine the stare point (center of bounding box) +- vgl_point_3d cn = bb.centroid(); +- vgl_homg_point_3d stpt(cn.x(), cn.y(), cn.z()); +- +- // 2) determine camera center +- // the viewsphere radius is set to 10x the bounding box diameter +- //double w = bb.width(), h = bb.height(), d = bb.depth(); +- double r = radius;//std::sqrt(w*w + h*h + d*d); +- //r *=10; +- double deg_to_rad = vnl_math::pi_over_180; +- double el = elevation*deg_to_rad, az = azimuth*deg_to_rad; +- double cx = r*std::sin(el)*std::cos(az); +- double cy = r*std::sin(el)*std::sin(az); +- double cz = r*std::cos(el); +- vgl_point_3d cent(cx+cn.x(), cy+cn.y(), cz); +- +- // 3) start with a unit focal length and position the camera +- vpgl_calibration_matrix K(1.0, vgl_point_2d(ni/2, nj/2)); +- vgl_rotation_3d R; +- auto* cam = +- new vpgl_perspective_camera(K, cent, R); +- +- //stare at the center of the scene +- vgl_vector_3d up(0.0, 1.0, 0.0); +- if (std::fabs(el)<1.0e-3) +- cam->look_at(stpt, up); +- else +- cam->look_at(stpt); +- +- //4) Adjust the focal length so that the box projects into the image +- // project the bounding box +- vgl_box_2d image_bb = bpgl_project::project_bounding_box(*cam, bb); +- // get 2-d box diameter and image diameter +- double bw = image_bb.width(), bh = image_bb.height(); +- double bd = std::sqrt(bw*bw + bh*bh); +- double id = std::sqrt(dni*dni + dnj*dnj); +- //find the adjusted focal length +- double f = id/bd; +- K.set_focal_length(f); +- cam->set_calibration(K); +- +- std::cout<<"Camera :" <<*cam<(0, cam); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx +deleted file mode 100644 +index 82051affab..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx ++++ /dev/null +@@ -1,102 +0,0 @@ +-//This is brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for removing any previously created scene data from disk +-// +-// \author Daniel Crispell +-// \date Feb 18, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-//:global variables +-namespace boxm_clean_scene_process_globals +-{ +- //this process takes no inputs +- constexpr unsigned int n_inputs_ = 1; +- constexpr unsigned int n_outputs_ = 0; +-} +- +-//:sets input and output types +-bool boxm_clean_scene_process_cons(bprb_func_process& pro) +-{ +- //set output types +- using namespace boxm_clean_scene_process_globals; +- //process takes 1 input +- //input[0]: The scene +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- if (!pro.set_input_types(input_types_)) +- return false; +- +- return true; +-} +- +-//: removes data previously associated with scene +-bool boxm_clean_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_clean_scene_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_clean_scene_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- // check the input validity +- if (scene == nullptr) { +- std::cout << "boxm_clean_scene_process: scene is null, cannot run" << std::endl; +- return false; +- } +- +- switch (scene->appearence_model()) +- { +- case BOXM_APM_MOG_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->clean_scene(); +- break; +- } +- case BOXM_APM_SIMPLE_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->clean_scene(); +- break; +- } +- case BOXM_APM_MOB_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->clean_scene(); +- break; +- } +- default: +- std::cout << "boxm_clean_scene_process: undefined APM type" << std::endl; +- return false; +- } +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx +deleted file mode 100644 +index 0129877c53..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx ++++ /dev/null +@@ -1,219 +0,0 @@ +-// This is brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief Process to construct an ideal scene for testing +-// +-// \author J.L. Mundy +-// \date January 23, 2010 +-// \verbatim +-// Modifications +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-namespace boxm_construct_scene_from_image_process_globals +-{ +- // The image area should be a multiple of area unit, e.g. 64. +- // This granularity is useful for parallel implementation +- template +- void tree_from_image(vil_image_view const& image, +- unsigned area_unit, +- unsigned& base_ni, unsigned& base_nj, +- boct_tree*& tree) +- { +- tree = nullptr; +- unsigned ni = image.ni(), nj = image.nj(); +- // find a square arrangement consistent with area unit +- auto gsize = static_cast(area_unit); +- auto gwidth = static_cast(std::sqrt(gsize)); +- unsigned gheight = area_unit/gwidth; +- if (gwidth*gheight!=gsize) +- return;//maybe fixup later to handle all situations +- unsigned mni = (ni/gwidth)*gwidth, mnj = (nj/gheight)*gheight; +- double min_dim = mni; +- if (mnj(dlev+1.0); +- +- //note that tree is being constructed in local coordinates +- float rni = 1.0f/static_cast(mni), rnj =1.0f/static_cast(mnj); +- base_ni = mni; base_nj = mnj; +- std::vector > leaf_codes; +- std::vector image_int; +- float upper_v=float(mnj-1)*rnj; +- for (unsigned j=0; j(i)*rni; +- float v = upper_v-static_cast(j)*rnj; +- vgl_point_3d p(u, v, 0.0f); +- boct_loc_code loc(p, n_levels-1); +- leaf_codes.push_back(loc); +- image_int.push_back(image(i,j)); +- } +- //construct leaves +- std::vector > leaves; +- for (auto & leaf_code : leaf_codes) { +- boct_tree_cell leaf(leaf_code); +- leaves.push_back(leaf); +- } +- +- //construct tree from leaves +- auto *init_tree = +- new boct_tree(n_levels, 0); +- boct_tree_cell *root = +- init_tree->construct_tree(leaves, init_tree->number_levels()); +- +- // construct full tree with leaves and root +- //set the global bounding box, assuming a box with depth ni +- vgl_box_3d box; +- vgl_point_3d p0(0,0,0); +- vgl_point_3d p1(mni, mnj, mni); +- box.add(p0); box.add(p1); +- tree = new boct_tree(root, init_tree->number_levels()); +- tree->set_bbox(box); +- delete init_tree; +- +- // fill the leaves with data +- std::vector* > tleaves; +- tleaves = tree->leaf_cells(); +- std::size_t i = 0; +- auto lit = +- tleaves.begin(); +- for (; lit!= tleaves.end(); ++lit, ++i) +- { +- boct_loc_code code = (*lit)->get_code(); +- bool found = false; +- unsigned found_k = 0; +- for (unsigned k = 0; k >* >(*lit)) +- { +- if (found) { +- boxm_sample data(1.0f,boxm_sample::apm_datatype(image_int[found_k],0.0008f)); +- cell_grey_ptr->set_data(data); +- } +- else { +- boxm_sample data(0.0f,boxm_sample::apm_datatype(0.0f,0.0008f)); +- cell_grey_ptr->set_data(data); +- } +- } +- else if (auto * cell_mog_grey_ptr = reinterpret_cast >* >(*lit)) +- { +- if (found) { +- boxm_sample data(1.0f); +- typedef boxm_apm_traits::apm_processor aproc; +- aproc::update(data.appearance(),image_int[found_k],1.0); +- cell_mog_grey_ptr->set_data(data); +- } +- else { +- boxm_sample data(0.0f); +- cell_mog_grey_ptr->set_data(data); +- } +- } +- else if (auto * cell_float_ptr +- =reinterpret_cast* >(*lit)) +- { +- if (found) { +- float data(1.0f); +- cell_float_ptr->set_data(data); +- } +- } +- } +- } +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_construct_scene_from_image_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_construct_scene_from_image_process_globals; +- +- //input[0]: The image view +- //input[1]: appearance model type +- //input[2]: scene directory +- //input[3]: scene xml path +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vil_image_view_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "vcl_string"; +- +- //output[0]: The scene +- std::vector output_types_(n_outputs_); +- output_types_[0]= "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_construct_scene_from_image_process(bprb_func_process& pro) +-{ +- using namespace boxm_construct_scene_from_image_process_globals; +- +- if ( !pro.verify_inputs()){ +- std::cerr << pro.name() << "boxm_construct_scene_from_image_process: invalid inputs\n"; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- vil_image_view_base_sptr image = pro.get_input(i++); +- std::string app_type = pro.get_input(i++); +- std::string scene_dir = pro.get_input(i++); +- std::string xml_path = pro.get_input(i++); +- if (image == nullptr) { +- std::cerr << "boxm_construct_scene_from_image_process: null image value, cannot run\n"; +- return false; +- } +- +- vil_image_view img = *vil_convert_cast(float(), image); +- if (image->pixel_format() == VIL_PIXEL_FORMAT_BYTE) +- vil_math_scale_values(img,1.0/255.0); +- +- unsigned base_ni =0, base_nj=0; +- std::string block_prefix = "ideal"; +- boxm_scene_base_sptr scene_base = nullptr; +- if (app_type == "simple_grey") +- { +- typedef boxm_sample data_type; +- boct_tree* tree = nullptr; +- tree_from_image(img, 16, base_ni, base_nj,tree); +- if (tree == nullptr) return false; +- boxm_block >* blk = +- new boxm_block >(tree->bounding_box(), tree); +- vgl_box_3d bb = blk->bounding_box(); +- vgl_point_3d origin(0,0,0); +- vgl_vector_3d block_dim(bb.width(),bb.height(),bb.depth()); +- vgl_vector_3d world_dim(1,1,1); +- auto* scene +- = new boxm_scene >(origin, block_dim, world_dim); +- scene->set_appearance_model(BOXM_APM_SIMPLE_GREY); +- scene->set_block(vgl_point_3d(0,0,0), blk); +- scene->set_path(scene_dir, block_prefix); +- scene->write_scene(xml_path); +- scene->write_active_block(); +- scene_base = scene; +- } +- pro.set_output_val(0, scene_base); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx +deleted file mode 100644 +index d2abb94b67..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx ++++ /dev/null +@@ -1,218 +0,0 @@ +-//This is brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for creating a new boxm_scene when there is not a saved one. +-// It receives the parameters from a parameter file in XML +-// +-// \author Gamze Tunali +-// \date Apr 21, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +-#include +- +-//:global variables +-namespace boxm_create_scene_process_globals +-{ +- //this process takes no inputs +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//:sets input and output types +-bool boxm_create_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_create_scene_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//:creates a scene from parameters +-bool boxm_create_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_create_scene_process_globals; +- std::string fname = pro.get_input(0); +- +- boxm_scene_parser parser; +- +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- scene_ptr->load_scene(fname, parser); +- std::cout << "Scene path: " << scene_ptr->filename()<< '\n' +- << "Scene appearance: " <appearence_model()<< std::endl; +- +- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- else { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- std::cout<<"Multi Bin set"<appearence_model() == BOXM_APM_MOB_GREY) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- else { +- std::cout<<"Multi Bin for BOXM_APM_MOB_GREY is not defined yet"<appearence_model() == BOXM_APM_SIMPLE_GREY) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +-#if 0 +- else { +- typedef boct_tree > tree_type; +- boxm_scene* scene = new boxm_scene(); +- scene->load_scene(fname); +- std::cout<<"Multi Bin set"<appearence_model() == BOXM_FLOAT) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(fname); +- scene_ptr = scene; +- std::cout << "Scene path: " << scene->filename()<< std::endl; +- } +- } +- else if (scene_ptr->appearence_model() == VNL_FLOAT_3) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(fname); +- scene_ptr = scene; +- std::cout << "Loading scene of type vnl_float_3" << '\n' +- << "Scene path: " << scene->filename()<< std::endl; +- } +- } +- else if (scene_ptr->appearence_model() == VNL_FLOAT_10) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(fname); +- scene_ptr = scene; +- std::cout << "Loading scene of type vnl_float_10" << '\n' +- << "Scene path: " << scene->filename()<< std::endl; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_BOOL) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(fname); +- scene_ptr = scene; +- std::cout << "Scene path: " << scene->filename()<< std::endl; +- } +- } +- else if (scene_ptr->appearence_model() == BSTA_MOG_F1) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree::apm_datatype > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BSTA_GAUSS_F1) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_EDGE_TANGENT_LINE) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BOXM_SCALAR_FLOAT) { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- else { +- std::cerr << "boxm_create_scene_process: undefined APM type\n"; +- return false; +- } +- +- //store output +- pro.set_output_val(0, scene_ptr); +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx +deleted file mode 100644 +index dba8e9687e..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx ++++ /dev/null +@@ -1,102 +0,0 @@ +-//This is brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for removing any previously created scene data from disk +-// +-// \author Daniel Crispell +-// \date Feb 18, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-//:global variables +-namespace boxm_force_write_blocks_process_globals +-{ +- //this process takes no inputs +- constexpr unsigned int n_inputs_ = 1; +- constexpr unsigned int n_outputs_ = 0; +-} +- +-//:sets input and output types +-bool boxm_force_write_blocks_process_cons(bprb_func_process& pro) +-{ +- //set output types +- using namespace boxm_force_write_blocks_process_globals; +- //process takes 1 input +- //input[0]: The scene +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- if (!pro.set_input_types(input_types_)) +- return false; +- +- return true; +-} +- +-//: removes data previously associated with scene +-bool boxm_force_write_blocks_process(bprb_func_process& pro) +-{ +- using namespace boxm_force_write_blocks_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << "boxm_force_write_blocks_process: The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene = pro.get_input(i++); +- +- // check the input validity +- if (scene == nullptr) { +- std::cout << "boxm_force_write_blocks_process: scene is null, cannot run" << std::endl; +- return false; +- } +- +- switch (scene->appearence_model()) +- { +- case BOXM_APM_MOG_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->force_write_blocks(); +- break; +- } +- case BOXM_APM_SIMPLE_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->force_write_blocks(); +- break; +- } +- case BOXM_APM_MOB_GREY: +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- s->force_write_blocks(); +- break; +- } +- default: +- std::cout << "boxm_force_write_blocks_process: undefined APM type" << std::endl; +- return false; +- } +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx +deleted file mode 100644 +index 59808debc7..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx ++++ /dev/null +@@ -1,73 +0,0 @@ +-// This is brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx +-//: +-// \file +-// \brief A class for obtaining roc curve from change detection results. +-// +-// \author Gamze Tunali +-// \date April 14, 2009 +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-namespace boxm_load_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +-bool boxm_load_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_load_scene_process_globals; +- +- //process takes 1 input +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- // process has 1 output: +- // output[0]: scene sptr +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_load_scene_process(bprb_func_process& pro) +-{ +- using namespace boxm_load_scene_process_globals; +- +- if ( pro.n_inputs() < n_inputs_ ){ +- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- //get the inputs +- unsigned i = 0; +- std::string scene_file = pro.get_input(i++); +- +- boxm_scene_base_sptr scene= new boxm_scene_base(); +- boxm_scene_parser parser; +- scene->load_scene(scene_file, parser); +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- typedef boct_tree > tree_type; +- auto *s = new boxm_scene(); +- s->load_scene(parser); +- // scene.unref(scene); +- scene = s; +- } else { +- std::cout << "boxm_load_scene_process: undefined APM type" << std::endl; +- return false; +- } +- +- unsigned j = 0; +- // store scene smaprt pointer +- pro.set_output_val(j++, scene); +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx +deleted file mode 100644 +index b250a33a61..0000000000 +--- a/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx ++++ /dev/null +@@ -1,103 +0,0 @@ +-// This is brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx +-#include +-//: +-// \file +-// \brief A class for clipping and image based on a 3D bounding box. +-// - Input: +-// - Image path (string) +-// - boxm_voxel_world_sptr +-// +-// - Output: +-// - modified rational camera "vpgl_camera_double_sptr" +-// - clipped image area (NITF) "vil_image_view_base_sptr" +-// +-// - Params: +-// -geographic uncertainty (error) in meters +-// +-// \author Gamze D. Tunali +-// \date Feb 19, 2008 +-// \verbatim +-// Modifications +-// Brandon Mayer - Jan 28, 2009 - converted process-class to function to conform with new boxm_process architecture. +-// \endverbatim +- +- +-#include +- +-//#include // unused? +-//#include // unused? +-#include +- +-#include +- +-//: globals variables and functions +-namespace boxm_proj_local_cam_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 2; +-} +- +-//: set input and output types +-// this process takes 4 inputs: +-// the camera and the (x,y,z) input coordinates +-// this process takes 2 outputs: +-// the (u,v) output coordinates +-bool boxm_proj_local_cam_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_proj_local_cam_process_globals; +- +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++] = "vpgl_camera_double_sptr"; // rational camera +- input_types_[i++] = "float"; // x +- input_types_[i++] = "float"; // y +- input_types_[i++] = "float"; // z +- +- std::vector output_types_(n_outputs_); +- unsigned j=0; +- output_types_[j++] = "float"; // u +- output_types_[j++] = "float"; // v +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-bool boxm_proj_local_cam_process(bprb_func_process& pro) +-{ +- using namespace boxm_proj_local_cam_process_globals; +- //static const parameters +- static const std::string error = "error"; +- +- if ( pro.n_inputs() < n_inputs_ ) { +- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; +- return false; +- } +- +- // get the inputs: +- unsigned i = 0; +- // camera +- vpgl_camera_double_sptr camera = pro.get_input(i++); +- float X=0.0,Y=0.0,Z=0.0; +- //voxel_world +- X = pro.get_input(i++); +- Y = pro.get_input(i++); +- Z = pro.get_input(i++); +- +- auto* rat_camera = +- dynamic_cast*> (camera.as_pointer()); +- if (!rat_camera) { +- std::cerr << "The camera input is not a rational camera\n"; +- return false; +- } +- +- double u=0,v=0; +- rat_camera->project((double)X,(double)Y,(double)Z,u,v); +- //Store outputs +- unsigned j = 0; +- // update the camera and store +- pro.set_output_val(j++, float(u)); +- pro.set_output_val(j++, float(v)); +- +- std::cout<<"(u,v):"< +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for populating the octree with meshes. +-// Meshes are in ply format and the grid will be filled with 0's at the faces +-// of the meshes. +-// \author Gamze D. Tunali +-// \date July 14, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-namespace boxm_upload_mesh_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//: set input and output types +-bool boxm_upload_mesh_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_upload_mesh_process_globals; +- +- // process takes 4 inputs and no output +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++]="vcl_string"; //the directory for ply files +- input_types_[i++]="boxm_scene_base_sptr"; //scene to be uploaded +- input_types_[i++]="bool"; //true, if mesh vertices are in geo coordinates +- input_types_[i++]="vcl_string"; //true, if mesh vertices are in geo coordinates +- +- std::vector output_types_(n_outputs_); +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: Execute the process +-bool boxm_upload_mesh_process(bprb_func_process& pro) +-{ +- using namespace boxm_upload_mesh_process_globals; +- // check number of inputs +- if (pro.input_types().size() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- unsigned i=0; +- std::string input_path = pro.get_input(i++); +- boxm_scene_base_sptr scene = pro.get_input(i++); +- bool use_lvcs = pro.get_input(i++); +- std::string draw_or_fill = pro.get_input(i++); +- +- if (!vul_file::is_directory(input_path)) { +- std::cerr << "In boxm_upload_mesh_process -- input path " << input_path<< "is not valid!\n"; +- return false; +- } +- +- // get all the files in the directory +- std::stringstream glob; +- glob << input_path << "/*.ply*"; +- +- std::vector meshes; +- for (vul_file_iterator file_it = glob.str().c_str(); file_it; ++file_it) +- { +- std::string file(file_it()); +- std::string file_format = vul_file::extension(file); +- vul_string_upcase(file_format); +- +- +- std::cout << "format = " << file_format << '\n' +- << "file = " << file << '\n'; +- // call appropriate load functions to load the M +- imesh_mesh mesh; +- if (file_format == ".PLY") +- imesh_read(file, mesh); +- else if (file_format == ".PLY2") +- imesh_read_ply2(file, mesh); +- +- meshes.push_back(mesh); +- } +- if (scene->appearence_model() == BOXM_APM_MOG_GREY) { +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- +- boxm_sample val(0,boxm_utils::obtain_mog_grey_unit_mode()); +- if (draw_or_fill=="draw") +- std::cout<<"Not yet"; +- //boxm_upload_mesh_into_scene >(*s, mesh, use_lvcs, val); +- else if (draw_or_fill=="fill") +- boxm_fill_in_mesh_into_scene >(*s, meshes, use_lvcs, val); +- } +- else +- std::cout << "boxm_upload_mesh_process: multi bin is not implemented yet" << std::endl; +- } +- if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) { +- if (!scene->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto *s = static_cast*> (scene.as_pointer()); +- boxm_simple_grey simplegrey(1.0f,0.1f,1.0f); +- boxm_sample val(1,simplegrey); +- if (draw_or_fill=="draw") +- std::cout<<"Not yet"; +- //boxm_upload_mesh_into_scene >(*s, mesh, use_lvcs, val); +- else if (draw_or_fill=="fill") +- boxm_fill_in_mesh_into_scene >(*s, meshes, use_lvcs, val); +- } +- else +- std::cout << "boxm_upload_mesh_process: multi bin is not implemented yet" << std::endl; +- } +- else { +- std::cout << "boxm_upload_mesh_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt +deleted file mode 100644 +index f37ad237ce..0000000000 +--- a/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( boxm_pro_test_include test_include.cxx ) +-target_link_libraries( boxm_pro_test_include boxm_pro) +diff --git a/contrib/brl/bseg/boxm/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/pro/tests/test_include.cxx +deleted file mode 100644 +index 7a3d47df60..0000000000 +--- a/contrib/brl/bseg/boxm/pro/tests/test_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/sample/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/CMakeLists.txt +deleted file mode 100644 +index 42618cc7ca..0000000000 +--- a/contrib/brl/bseg/boxm/sample/CMakeLists.txt ++++ /dev/null +@@ -1,29 +0,0 @@ +-# brl/bseg/boxm/sample/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_sample_sources +- boxm_edge_sample.h boxm_edge_sample.hxx +- boxm_edge_tangent_sample.h boxm_edge_tangent_sample.hxx +- boxm_inf_line_sample.h boxm_inf_line_sample.hxx +- boxm_opt2_sample.h boxm_opt2_sample.hxx +- boxm_opt3_sample.h boxm_opt3_sample.hxx +- boxm_plane_obs.h boxm_plane_obs.hxx +- boxm_rt_sample.h boxm_rt_sample.hxx +- boxm_sample.h boxm_sample.hxx +- boxm_sample_multi_bin.h boxm_sample_multi_bin.hxx +- boxm_scalar_sample.h boxm_scalar_sample.hxx +- boxm_vis_implicit_sample.h +- boxm_update_sample.h +- dummy.cxx +- ) +- +-aux_source_directory(Templates boxm_sample_sources) +- +-vxl_add_library(LIBRARY_NAME boxm_sample LIBRARY_SOURCES ${boxm_sample_sources}) +-target_link_libraries(boxm_sample boxm ${VXL_LIB_PREFIX}vgl_io bsta ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vsl ${VXL_LIB_PREFIX}vcl) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-#processors for the samples +-add_subdirectory(algo) +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx +deleted file mode 100644 +index a08cc93e31..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_edge_sample); +-BOCT_TREE_INSTANTIATE(short,boxm_aux_edge_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index 130866a26d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_edge_tangent_sample); +-BOCT_TREE_INSTANTIATE(short,boxm_inf_line_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx +deleted file mode 100644 +index 8d3ee3d65a..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_opt2_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index ca506845c1..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_rt_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx +deleted file mode 100644 +index c1d7480b1c..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, boxm_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 5eaa3da056..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-// tree with alpha and appearance combined +-BOCT_TREE_INSTANTIATE(short, boxm_sample); +- +-// tree with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-BOCT_TREE_INSTANTIATE(short, apm_datatype); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx +deleted file mode 100644 +index ef07d67c7a..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, boxm_sample); +- +-// tree with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-BOCT_TREE_INSTANTIATE(short, apm_datatype); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index b45fc2a401..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, boxm_sample_multi_bin); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx +deleted file mode 100644 +index 7c93436b6a..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_scalar_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx +deleted file mode 100644 +index 8c4d0a0f82..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_edge_sample); +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_aux_edge_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index 55b487a7aa..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_edge_tangent_sample); +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_inf_line_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx +deleted file mode 100644 +index 39216280e0..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_opt2_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index 3d0b6e71a5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_rt_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx +deleted file mode 100644 +index 9a5432b934..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include "boxm/boxm_apm_traits.h" +-#include "boxm/sample/boxm_sample.h" +- +-typedef boxm_sample boxm_sample_mob_grey; +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mob_grey ); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 58cc1cfacf..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-typedef boxm_sample boxm_sample_mog_grey; +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mog_grey ); +- +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-BOCT_TREE_CELL_INSTANTIATE(short,apm_datatype ); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx +deleted file mode 100644 +index 28198f869f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include "boxm/boxm_apm_traits.h" +-#include "boxm/sample/boxm_sample.h" +- +-typedef boxm_sample boxm_sample_simple_grey; +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_simple_grey ); +- +-// tree with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-BOCT_TREE_CELL_INSTANTIATE(short, apm_datatype); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 1b9ee1e0de..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include "boxm/boxm_apm_traits.h" +-#include "boxm/sample/boxm_sample_multi_bin.h" +- +-typedef boxm_sample_multi_bin boxm_sample_mog_grey; +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mog_grey ); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx +deleted file mode 100644 +index 78c61bf35e..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_scalar_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx +deleted file mode 100644 +index 13ae4934e9..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +- +-typedef boxm_edge_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +- +-typedef boxm_aux_edge_sample aux_sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,aux_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index 3744b8ee6f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_edge_tangent_sample aux_sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,aux_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx +deleted file mode 100644 +index 08ad36f2ea..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_inf_line_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx +deleted file mode 100644 +index 18262443a5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_opt2_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index 1784facefe..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_rt_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx +deleted file mode 100644 +index 83cf840aa8..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include "boxm/boxm_apm_traits.h" +-#include "boxm/sample/boxm_sample.h" +- +-typedef boxm_sample boxm_sample_mob_grey; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,boxm_sample_mob_grey); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 68c063579f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include "boxm/boxm_apm_traits.h" +-#include "boxm/sample/boxm_sample.h" +- +-typedef boxm_sample boxm_sample_mog_grey; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,boxm_sample_mog_grey); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx +deleted file mode 100644 +index 81c19507f9..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_scalar_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx +deleted file mode 100644 +index 5e771c97e2..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_edge_sample,boxm_aux_edge_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index a73d09d6f5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_inf_line_sample,boxm_edge_tangent_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index c134345620..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_rt_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx +deleted file mode 100644 +index b8aa7777ee..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_opt2_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index 918a3be765..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_rt_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx +deleted file mode 100644 +index 70bf413567..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx +deleted file mode 100644 +index 6a0f7d745c..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_opt2_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx +deleted file mode 100644 +index 03014e67ab..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_rt_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx +deleted file mode 100644 +index 1b75036c3b..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_scalar_sample); +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_scalar_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx +deleted file mode 100644 +index a27805ad73..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx +deleted file mode 100644 +index dc6a48e38b..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,float,boxm_edge_tangent_sample); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx +deleted file mode 100644 +index c814f6a8fe..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +- +-typedef boct_tree > aux_tree; +-BOXM_BLOCK_INSTANTIATE(aux_tree); +- +-#include +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx +deleted file mode 100644 +index 802a8ca615..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx +deleted file mode 100644 +index 9ef6e210dd..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx +deleted file mode 100644 +index dc6e57af68..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +- +-#include +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx +deleted file mode 100644 +index ef11cd85a7..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +- +-#include +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx +deleted file mode 100644 +index 647e553d5e..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index b5e4f8cce0..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +- +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +- +-BOXM_BLOCK_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx +deleted file mode 100644 +index 5a2482adbc..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +- +-// block with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-BOXM_BLOCK_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 6e13f9977a..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx +deleted file mode 100644 +index 0348b21996..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +- +-#include +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx +deleted file mode 100644 +index 0b79668c5f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +- +-typedef boct_tree > aux_tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx +deleted file mode 100644 +index ea335e591d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > aux_tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree_type); +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx +deleted file mode 100644 +index 7c96bfeeee..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 052fa82c04..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +- +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx +deleted file mode 100644 +index a9d55be913..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +- +-// block iterator with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 25f9ca6e61..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx +deleted file mode 100644 +index d68f374c40..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +- +-BOXM_EDGE_SAMPLE_INSTANTIATE(float); +-BOXM_AUX_EDGE_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx +deleted file mode 100644 +index a00d2268b5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_EDGE_TANGENT_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx +deleted file mode 100644 +index f957308804..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_INF_LINE_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx +deleted file mode 100644 +index 66ceeacd2d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_OPT2_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx +deleted file mode 100644 +index c6e45bdcca..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_PLANE_OBS_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx +deleted file mode 100644 +index 1fc6db3c56..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_RT_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx +deleted file mode 100644 +index 4ee2f52816..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_MOB_GREY); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx +deleted file mode 100644 +index d1054422d9..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_MOG_GREY); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx +deleted file mode 100644 +index e3c225ae4d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_SIMPLE_GREY); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx +deleted file mode 100644 +index 4e2b56c696..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_SAMPLE_MULTI_BIN_INSTANTIATE(BOXM_APM_MOG_GREY); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx +deleted file mode 100644 +index a9552e4b00..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-BOXM_SCALAR_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx +deleted file mode 100644 +index 4fd83d2d66..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx ++++ /dev/null +@@ -1,9 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +- +-typedef boct_tree > aux_tree; +-BOXM_SCENE_INSTANTIATE(aux_tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx +deleted file mode 100644 +index 882f421e87..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > aux_tree; +-BOXM_SCENE_INSTANTIATE(aux_tree); +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx +deleted file mode 100644 +index dfec334150..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx +deleted file mode 100644 +index cd3c475545..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx +deleted file mode 100644 +index db72e7c8ea..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_SCENE_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 6d21678187..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_SCENE_INSTANTIATE(tree_type); +- +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-BOXM_SCENE_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx +deleted file mode 100644 +index 52e5afb01c..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_SCENE_INSTANTIATE(tree_type); +- +-// scene with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-BOXM_SCENE_INSTANTIATE(apm_tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index 262d6e4f89..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-BOXM_SCENE_INSTANTIATE(tree_type); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx +deleted file mode 100644 +index 4a2c0c7437..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx +deleted file mode 100644 +index b727cb7d12..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boct_tree tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx +deleted file mode 100644 +index fc06a01419..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx ++++ /dev/null +@@ -1,16 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +- +-typedef boct_tree > aux_tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx +deleted file mode 100644 +index 0b4f55a413..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > aux_tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx +deleted file mode 100644 +index 1372664c8c..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx +deleted file mode 100644 +index 5409ed1d26..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx +deleted file mode 100644 +index 3508b23e74..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx +deleted file mode 100644 +index 9676fc11a4..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +- +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx +deleted file mode 100644 +index e8c9902c7e..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx ++++ /dev/null +@@ -1,18 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +- +-// scene with appearance +-typedef boxm_apm_traits::apm_datatype apm_datatype; +-typedef boct_tree apm_tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx +deleted file mode 100644 +index 4cadf24760..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx +deleted file mode 100644 +index f013383f50..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx +deleted file mode 100644 +index 116b748109..0000000000 +--- a/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef boxm_inf_line_sample sample; +-VIL_IMAGE_VIEW_INSTANTIATE(sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt +deleted file mode 100644 +index c758e9f2a4..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt ++++ /dev/null +@@ -1,18 +0,0 @@ +-# brl/bseg/boxm/util/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_sample_algo_sources +- boxm_mob_grey_processor.h boxm_mob_grey_processor.cxx +- boxm_mog_grey_processor.h boxm_mog_grey_processor.cxx +- boxm_simple_grey_processor.h boxm_simple_grey_processor.cxx +- boxm_sigma_normalizer.h boxm_sigma_normalizer.cxx +- ) +- +-aux_source_directory(Templates boxm_sample_algo_sources) +- +-vxl_add_library(LIBRARY_NAME boxm_sample_algo LIBRARY_SOURCES ${boxm_sample_algo_sources}) +- +-target_link_libraries(boxm_sample_algo boxm_sample boxm boxm_util bsta bsta_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vbl) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 994d8628d9..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short,boxm_opt3_sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 10fc203f38..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_CELL_INSTANTIATE(short,boxm_opt3_sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index b5be45d2b1..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-typedef boxm_opt3_sample sample; +-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 0772000b0d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_opt3_sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx +deleted file mode 100644 +index 00af986d6d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample,boxm_opt3_sample); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index b4aef87f19..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_BLOCK_INSTANTIATE(tree); +- +-#include +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx +deleted file mode 100644 +index c67fd5c479..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_OPT3_SAMPLE_INSTANTIATE(BOXM_APM_MOG_GREY); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx +deleted file mode 100644 +index e0c8931986..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree; +-BOXM_SCENE_INSTANTIATE(tree); +diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx +deleted file mode 100644 +index 0bf4864b81..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx ++++ /dev/null +@@ -1,14 +0,0 @@ +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +-VBL_ARRAY_3D_INSTANTIATE(boxm_block*); +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx +deleted file mode 100644 +index e93ea9b17a..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx ++++ /dev/null +@@ -1,83 +0,0 @@ +-#include "boxm_mob_grey_processor.h" +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//: Expected value +-boxm_apm_traits::obs_datatype +-boxm_mob_grey_processor::expected_color(boxm_apm_traits::apm_datatype const& appear) +-{ +- float total_weight= 0; +- obs_datatype c = 0; +- obs_datatype expected = 0; +- +- //should be components used +- for (unsigned i = 0; i< appear.num_components(); ++i) +- { +- total_weight += appear.weight(i); +- c += appear.distribution(i).mean() * appear.weight(i); +- } +- if (total_weight > 0.0f) { +- expected = c/total_weight; +- } +- +- return expected; +-} +-//: Return probability density of observing pixel values +-float boxm_mob_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs) +-{ +- if (appear.num_components() ==0) { +- return 1.00f; +- } +- else { +- return appear.prob_density(obs); +- } +-} +- +-//: Update with a new sample image +-bool boxm_mob_grey_processor::update( apm_datatype &appear, +- obs_datatype const& obs, +- float const& weight) +-{ +- // the model +- float init_variance = 0.008f; +- float g_thresh = 0.025f; // number of std devs from mean sample must be +- +- //float t_l_u = float(std::sqrt(1-4*init_variance)*0.5); +- //float lower = 0.5f-t_l_u; +- //float upper = 0.5f+t_l_u; +- +- obs_datatype val = obs; +- //if (obs < lower) +- // val = lower+0.000001f; +- //else if (obs > upper) +- // val = upper-0.000001f; +- +- float alpha, beta; +- bsta_beta::bsta_beta_from_moments(val, init_variance,alpha,beta); +- bsta_beta_f1 this_beta(alpha,beta); +- +- const unsigned int nmodes = boxm_apm_traits::n_beta_modes_; +- +- typedef bsta_num_obs beta_type; +- typedef bsta_mixture_fixed mix_beta; +- +- // the updater +- bsta_mix_beta_updater updater(this_beta, g_thresh, init_variance, nmodes ); +- +- if (weight > 0) { +- updater(appear, obs); +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h b/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h +deleted file mode 100644 +index 8c6c4b46d8..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-// This is brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h +-#ifndef boxm_mob_grey_processor_h_ +-#define boxm_mob_grey_processor_h_ +-//: +-// \file +-// \brief A class for a grey-scale-mixture-of-beta processor +-// +-// \author Gamze Tunali +-// \date Nov 24, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +- +-class boxm_mob_grey_processor +-{ +- protected: +- // convenience typedefs +- typedef boxm_apm_traits::apm_datatype apm_datatype; +- typedef boxm_apm_traits::obs_datatype obs_datatype; +- typedef boxm_apm_traits::obs_mathtype obs_mathtype; +- +- public: +- static obs_datatype expected_color(apm_datatype const& appear); +- static float prob_density(apm_datatype const& appear, obs_datatype const& obs); +- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight); +-}; +- +-#endif // boxm_mob_grey_processor_h_ +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx +deleted file mode 100644 +index 7c7e011b07..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx ++++ /dev/null +@@ -1,286 +0,0 @@ +-#include "boxm_mog_grey_processor.h" +-//: +-// \file +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include "boxm_sigma_normalizer.h" +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//: Expected value +-boxm_apm_traits::obs_datatype +-boxm_mog_grey_processor::expected_color(boxm_apm_traits::apm_datatype const& appear) +-{ +- float total_weight= 0; +- obs_datatype c = 0; +- obs_datatype expected = 0; +- +- //should be components used +- for (unsigned i = 0; i< appear.num_components(); ++i) +- { +- total_weight += appear.weight(i); +- c += appear.distribution(i).mean() * appear.weight(i); +- } +- if (total_weight > 0.0f) { +- expected = c/total_weight; +- } +- +- return expected; +-} +- +-//: Return a random sample from the appearance distribution +-boxm_apm_traits::obs_datatype +-boxm_mog_grey_processor::sample(boxm_apm_traits::apm_datatype const& appear, vnl_random &rand_gen) +-{ +- return appear.sample(rand_gen); +-} +- +- +-//: Return probability density of observing pixel values +-float boxm_mog_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs) +-{ +- if (appear.num_components() ==0) { +- return 1.00f; +- } +- else { +- return appear.prob_density(obs); +- } +-} +- +-//: Update with a new sample image +-bool boxm_mog_grey_processor::update( apm_datatype &appear, obs_datatype const& obs, float const& weight) +-{ +- // the model +- float init_variance = 0.008f; +- float min_stddev = 0.030f; //TO UNDERSTAND: changed from 0.02 for dinoRing dataset -dec +- float g_thresh = 2.5; // number of std devs from mean sample must be +- bsta_gauss_sf1 this_gauss(0.0f, init_variance); +- +- const unsigned int nmodes = boxm_apm_traits::n_gaussian_modes_; +- +- typedef bsta_num_obs gauss_type; +- typedef bsta_mixture_fixed mix_gauss; +- +- // the updater +- bsta_mg_grimson_weighted_updater updater(this_gauss, nmodes ,g_thresh,min_stddev); +- +- if (weight > 0) { +- updater(appear, obs, weight); +- } +- +- return true; +-} +- +-void boxm_mog_grey_processor::update_appearance(std::vector::obs_datatype> const& obs, std::vector const& obs_weights, boxm_apm_traits::apm_datatype &model, float min_sigma) +-{ +- std::vector pre(obs.size(),0.0f); +- compute_appearance(obs,pre,obs_weights,model,min_sigma); +- return; +-} +- +-void boxm_mog_grey_processor::compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& obs_weights, boxm_apm_traits::apm_datatype &model, float min_sigma) +-{ +- std::vector pre(obs.size(),0.0f); +- compute_appearance(obs,pre,obs_weights,model,min_sigma); +- return; +-} +- +-void boxm_mog_grey_processor::finalize_appearance(std::vector::obs_datatype> const& obs, +- std::vector const& /*obs_weights*/, // FIXME - unused +- boxm_apm_traits::apm_datatype &model, +- float min_sigma) +-{ +- static const unsigned int nmodes = boxm_apm_traits::n_gaussian_modes_; +- const auto nobs = (unsigned int)obs.size(); +- const float min_var = min_sigma*min_sigma; +- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1] +- const float big_var = big_sigma * big_sigma; +- +- static boxm_sigma_normalizer sigma_norm(0.1f); +- for (unsigned int m=0; m min_var)) { +- mode_var = min_var; +- } +- model.distribution(m).set_var(mode_var); +- } +- return; +-} +- +-void boxm_mog_grey_processor::compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& pre, std::vector const& vis, boxm_apm_traits::apm_datatype &model, float min_sigma) +-{ +- static const unsigned int max_nmodes = boxm_apm_traits::n_gaussian_modes_; +- const float min_var = min_sigma*min_sigma; +- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1] +- const float big_var = big_sigma * big_sigma; +- +- auto nobs = (unsigned int)obs.size(); +- if (nobs == 0) { +- // nothing to do. +- return; +- } +- if (nobs == 1) { +- model = bsta_num_obs, max_nmodes> >(); +- bsta_gauss_sf1 mode(obs[0], big_sigma*big_sigma); +- model.insert(bsta_num_obs(mode), 1.0f); +- return; +- } +- +- unsigned int nmodes = model.num_components(); +- +- if (nmodes == 0) { +- // if initial model is "blank", create an arbitrary starting point for the optimization with max number of modes +- model = bsta_num_obs, max_nmodes> >(); +- nmodes = max_nmodes; +- // no need for model to have more modes than observations +- if (nobs < nmodes) { +- nmodes = nobs; +- } +- // initialize parameters +- for (unsigned int m=0; m(mode), mode_weight); +- } +- } +- +- std::vector > mode_probs(nobs); +- for (unsigned int n=0; n mode_weight_sum(nmodes,0.0f); +- +- // run EM algorithm to maximize expected probability of observations +- constexpr unsigned int max_its = 50; +- const float max_converged_weight_change = 1e-3f; +- +- for (unsigned int i=0; i new_mode_probs(nmodes); +- for (unsigned int m=0; m 1e-6) { +- for (unsigned int m=0; m max_weight_change) { +- max_weight_change = weight_change; +- } +- mode_probs[n][m] = new_mode_probs[m]; +- } +- } +- } +- // check for convergence +- if (max_weight_change < max_converged_weight_change) { +- break; +- } +- // MAXIMIZATION +- // computed the weighted means and variances for each mode based on the probabilities +- float total_weight_sum = 0.0f; +- +- // update the mode parameters +- for (unsigned int m=0; m obs_weights(nobs); +- for (unsigned int n=0; n min_var)) { +- mode_var = min_var; +- } +- +- // update mode parameters +- model.distribution(m).set_mean(mode_mean); +- model.distribution(m).set_var(mode_var); +- } +- // update mode probabilities +- if (total_weight_sum > 1e-6) { +- for (unsigned int m=0; m min_var)) { +- mode_var = min_var; +- } +- model.distribution(m).set_var(mode_var); +- } +- +- // sort the modes based on weight +- model.sort(); +- +- return; +-} +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h b/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h +deleted file mode 100644 +index b4d64bc6ad..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h ++++ /dev/null +@@ -1,50 +0,0 @@ +-// This is brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h +-#ifndef boxm_mog_grey_processor_h_ +-#define boxm_mog_grey_processor_h_ +-//: +-// \file +-// \brief A class for a grey-scale-mixture-of-gaussian processor +-// +-// \author Gamze Tunali +-// \date Apr 03, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +- +- +-class boxm_mog_grey_processor +-{ +- protected: +- // convienance typedefs +- typedef boxm_apm_traits::apm_datatype apm_datatype; +- typedef boxm_apm_traits::obs_datatype obs_datatype; +- typedef boxm_apm_traits::obs_mathtype obs_mathtype; +- +- public: +- static obs_datatype expected_color(apm_datatype const& appear); +- +- static obs_datatype sample(apm_datatype const& appear, vnl_random &rand_gen); +- +- static float prob_density(apm_datatype const& appear, obs_datatype const& obs); +- +- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight); +- +- static void compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& obs_weights, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +- static void update_appearance(std::vector::obs_datatype> const& obs, std::vector const& obs_weights, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +- static void finalize_appearance(std::vector::obs_datatype> const& obs, std::vector const& obs_weights, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +- +- static void compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& pre, std::vector const& vis, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +-}; +- +-#endif // boxm_mog_grey_processor_h_ +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx +deleted file mode 100644 +index b88fd5c03d..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx ++++ /dev/null +@@ -1,104 +0,0 @@ +-#include +-#include "boxm_sigma_normalizer.h" +-//: +-// \file +-// \brief A class for adjusting sample standard deviation values such that the probability of underestimation of the true std. dev. is fixed. +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-#include +- +-boxm_sigma_normalizer::boxm_sigma_normalizer(float under_estimation_probability) : unbias_const_(N_PRECOMPUTED_+1, 0.0f) +-{ +- class gammainc_error_fn : public vnl_least_squares_function +- { +- public: +- gammainc_error_fn(unsigned int ndof, float under_estimation_prob) : vnl_least_squares_function(1,1,no_gradient), ndof_(ndof), p_(under_estimation_prob) {} +- +- void f(vnl_vector const& x, vnl_vector& fx) override +- { +- // don't allow x to become negative +- if (x[0] < 0.0f) { +- fx[0] = x[0] - p_; // so error function is c0 continuous at x=0 +- return; +- } +- double cdf_prob = vnl_cum_prob_chi2(ndof_, x[0]); +- fx[0] = cdf_prob - p_; +- return; +- } +- private: +- unsigned int ndof_; +- float p_; +- }; +- +- // sanity check on probability +- if (under_estimation_probability < 1e-4) { +- std::cout << "error : boxm_sigma_normalizer : under_estimation_probability " << under_estimation_probability << " too low" << std::endl; +- return; +- } +- if (under_estimation_probability > (1 - 1e-4)) { +- std::cout << "error : boxm_sigma_normalizer : under_estimation_probability " << under_estimation_probability << " too high" << std::endl; +- return; +- } +- +- // populate array of normalization factors for easy lookup +- vnl_vector_fixed x(1.0); +- +- for (unsigned int n=2; n<= N_PRECOMPUTED_; ++n) { +- gammainc_error_fn f(n-1, under_estimation_probability); +- vnl_levenberg_marquardt minimizer(f); +- minimizer.set_f_tolerance(1e-8); +- minimizer.set_x_tolerance(1e-8); +- +- minimizer.minimize(x); +- //minimizer.diagnose_outcome(); +- double end_error = minimizer.get_end_error(); +- if (end_error > 1e-3) { +- std::cerr << "error: boxm_sigma_normalizer: levenberg_marquardt final error = " << end_error << '\n'; +- } +- auto unbias_constant = (float)std::sqrt((float)(n-1) / x[0]); +- +- unbias_const_[n] = unbias_constant; +- } +- // sigma is undefined for samples sizes of 0 and 1, but we can linearly interpolate to get values anyway +- unbias_const_[1] = unbias_const_[2] - (unbias_const_[3] - unbias_const_[2]); +- unbias_const_[0] = unbias_const_[1] - (unbias_const_[2] - unbias_const_[1]); +-} +- +- +-float boxm_sigma_normalizer::normalization_factor(float number_of_observations) const +-{ +- if (number_of_observations <= 1.0f) { +- return normalization_factor_int((unsigned int)1); +- } +- +- // linearly interpolate between integer values +- float nobs_floor = std::floor(number_of_observations); +- float nobs_ceil = std::ceil(number_of_observations); +- float floor_weight = nobs_ceil - number_of_observations; +- float norm_factor = (normalization_factor_int((unsigned int)nobs_floor) * floor_weight) + (normalization_factor_int((unsigned int)nobs_ceil) * (1.0f - floor_weight)); +- +- return norm_factor; +-} +- +- +-float boxm_sigma_normalizer::normalization_factor_int(unsigned int number_of_observations) const +-{ +- if (number_of_observations < 2) { +- return unbias_const_[1]; +- } +- +- if (number_of_observations <= N_PRECOMPUTED_) { +- return unbias_const_[number_of_observations]; +- } +- // else nobs >= N_PRECOMPUTED_ +- // approximate for big n with function a = m /nobs + b +- static const float m = (unbias_const_[N_PRECOMPUTED_] - unbias_const_[N_PRECOMPUTED_ - 5])/(1.0f/N_PRECOMPUTED_ - 1.0f/(N_PRECOMPUTED_ - 5)); +- static const float b = unbias_const_[N_PRECOMPUTED_] - m*(1.0f/N_PRECOMPUTED_); +- return m/number_of_observations + b; +-} +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h b/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h +deleted file mode 100644 +index aafb71a2c2..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-// this is brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h +-#ifndef boxm_sigma_normalizer_h_ +-#define boxm_sigma_normalizer_h_ +-//: +-// \file +-// \brief A class for adjusting sample standard deviation values such that the probability of underestimation of the true std. dev. is fixed. +-// +-// \author Daniel Crispell +-// \date Feb. 18, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-class boxm_sigma_normalizer +-{ +- public: +- //: create a sigma_normalizer object. +- boxm_sigma_normalizer(float under_estimation_probability); +- +- //: compute the normalization factor for a sample distribution computing with N observations +- // \a sigma_norm = sample_sigma * normalization_factor(N); +- float normalization_factor(float number_of_observations) const; +- +- //: compute the normalization factor for a sample distribution computed with N observations +- // \a sigma_norm = sample_sigma * normalization_factor(N); +- float normalization_factor_int(unsigned int number_of_observations) const; +- +- private: +- // do not allow default constructor - under-estimation param is necessary +- boxm_sigma_normalizer()= default; +- +- static const unsigned int N_PRECOMPUTED_ = 40; +- std::vector unbias_const_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx +deleted file mode 100644 +index b1d9e4639b..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx ++++ /dev/null +@@ -1,437 +0,0 @@ +-#include "boxm_simple_grey_processor.h" +-//: +-// \file +- +-#include +-#include +-#include +- +-#include "boxm_sigma_normalizer.h" +- +-//const float boxm_simple_grey_processor::one_over_sigma_ = 25.0f; +-const static bool USE_UNIFORM_COMPONENT = false; +- +-//: Return probability density of observing pixel values +-float boxm_simple_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs) +-{ +- const auto norm = float(appear.one_over_sigma() * vnl_math::one_over_sqrt2pi); +- const float diff = obs - appear.color(); +- const float p = norm * std::exp(-(diff*diff)*appear.one_over_sigma()*appear.one_over_sigma()*0.5f); +- // normalize by area of distribution between 0 and 1 +- //return p / total_prob(appear); +- return p * appear.gauss_weight() + (1.0f - appear.gauss_weight()); +-} +- +-//: Return probabilities that pixels are in range [min,max] +-float boxm_simple_grey_processor::prob_range(apm_datatype const& appear, obs_datatype const& obs_min, obs_datatype const& obs_max) +-{ +- // make sure obs_min and obs_max are within bounds +- const float obs_min_n = obs_min >= 0 ? obs_min : 0.0f; +- const float obs_max_n = obs_max <= 1.0? obs_max : 1.0f; +- +- const float diff_low = obs_min_n - appear.color(); +- const float diff_high = obs_max_n - appear.color(); +- const auto norm = float(appear.one_over_sigma()*vnl_math::sqrt1_2); +- +- const auto double_cdf_low_minus_1 = (float)vnl_erf(diff_low*norm); +- const auto double_cdf_high_minus_1 = (float)vnl_erf(diff_high*norm); +- const float P = (0.5f * (double_cdf_high_minus_1 - double_cdf_low_minus_1)); +- //return P / total_prob(appear); +- return P * appear.gauss_weight() + (1.0f - appear.gauss_weight())*(obs_max - obs_min); +-} +- +-//: Return probabilities that pixels are in range [0,1] - used for normalizing +-float boxm_simple_grey_processor::total_prob(apm_datatype const& appear) +-{ +- const float diff_low = -appear.color(); +- const float diff_high = 1.0f - appear.color(); +- const auto norm = float(appear.one_over_sigma()*vnl_math::sqrt1_2); +- const auto double_cdf_low_minus_1 = (float)vnl_erf(diff_low*norm); +- const auto double_cdf_high_minus_1 = (float)vnl_erf(diff_high*norm); +- return 0.5f * (double_cdf_high_minus_1 - double_cdf_low_minus_1); +-} +- +- +-//: Update with a new sample image +-bool boxm_simple_grey_processor::update( apm_datatype &appear, obs_datatype const& obs, float const& /*weight*/) +-{ +- appear = boxm_simple_grey(vnl_vector_fixed(obs, appear.sigma(), appear.gauss_weight())); +- return true; +-} +- +- +-//: Expected value +-boxm_apm_traits::obs_datatype boxm_simple_grey_processor::expected_color(boxm_apm_traits::apm_datatype const& appear) +-{ +- return appear.color() * appear.gauss_weight() + 0.5f * (1.0f - appear.gauss_weight()); +-} +- +-//: color of the most probable mode in the mixtures in the slab +-boxm_simple_grey_processor::obs_datatype boxm_simple_grey_processor::most_probable_color(apm_datatype const& appear) +-{ +- return appear.color(); +-} +- +-void boxm_simple_grey_processor::compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& pre, std::vector const& vis, boxm_apm_traits::apm_datatype &model, float min_sigma) +-{ +- bsta_gauss_sf1 model_bsta(model.color(),model.sigma()*model.sigma()); +- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1] +- auto nobs = (unsigned int)obs.size(); +- // check for some simple cases first +- if (nobs == 0) { +- // zero observations. nothing to do here. +- model = boxm_simple_grey(0.5f, big_sigma); +- return; +- } +- if (nobs == 1) { +- // one observation: Just return the value as the mean, and a big sigma. +- model = boxm_simple_grey(obs[0], big_sigma); +- return; +- } +- //std::cout << "nobs = " << obs.size() << std::endl; +- //for (unsigned int i=0; i +-// \endverbatim +- +-#include +-#include +-#include +-#if 0 // operator<< in commented-out section +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-class boxm_simple_grey_processor +-{ +- protected: +- // convienance typedefs +- typedef boxm_apm_traits::apm_datatype apm_datatype; +- typedef boxm_apm_traits::obs_datatype obs_datatype; +- typedef boxm_apm_traits::obs_mathtype obs_mathtype; +- +- // all methods are static - no constructor needed +- private: +- boxm_simple_grey_processor() = default; +- +-#if 0 // one_over_sigma is now a member of apm_datatype +- static const float one_over_sigma_; +-#endif +- +- public: +- +- static float prob_density(apm_datatype const& appear, obs_datatype const& obs); +- +- static float prob_range(apm_datatype const& appear, obs_datatype const& obs_min, obs_datatype const& obs_max); +- +- static float total_prob(apm_datatype const& appear); +- +- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight); +- +- static boxm_apm_traits::obs_datatype expected_color(boxm_apm_traits::apm_datatype const& appear); +- +- static boxm_apm_traits::obs_mathtype most_probable_color(boxm_apm_traits::apm_datatype const& appear); +- +- static void compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& weights, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +- static void compute_appearance(std::vector::obs_datatype> const& obs, std::vector const& pre, std::vector const& vis, boxm_apm_traits::apm_datatype &model, float min_sigma=0.01f); +- +- static void update_appearance(std::vector::obs_datatype> const& obs, std::vector const& weights, boxm_apm_traits::apm_datatype &model, float min_sigma = 0.01f); +- +- static void finalize_appearance(std::vector::obs_datatype> const& obs, std::vector const& weights, boxm_apm_traits::apm_datatype &model); +- +- //: includes a shadow density component to the single gaussian scalar appearance model, defined by a fixed shadow mean and sigma. +- // The shadow prior defines the probability that an observation is in shadow. +- // The function updates the "model" mean and sigma. +- static void boxm_compute_shadow_appearance(std::vector::obs_datatype> const& obs, +- std::vector const& pre, +- std::vector const& vis, +- boxm_apm_traits::apm_datatype &model, +- float min_app_sigma, +- float shadow_prior, +- float shadow_mean, +- float shadow_sigma, +- bool verbose = false); +- private: +- static void compute_gaussian_params(std::vector::obs_datatype> obs, std::vector weights, boxm_apm_traits::obs_datatype &mean, float &sigma); +- +- static float sigma_norm_factor(unsigned int nobs); +- +- static float sigma_norm_factor(float nobs); +-}; +- +-#if 0 +-std::ostream& operator<<(std::ostream &os, boxm_simple_grey const& apm); +-#endif +- +-#endif // boxm_simple_grey_processor_h_ +diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt +deleted file mode 100644 +index 4390b597bc..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt ++++ /dev/null +@@ -1,11 +0,0 @@ +-add_executable( boxm_sample_algo_test_all +- test_driver.cxx +- test_sigma_normalizer.cxx +- ) +- +-target_link_libraries( boxm_sample_algo_test_all boxm_sample_algo boxm_sample boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vbl bsta bsta_algo) +- +-add_test( NAME boxm_sample_test_sigma_normalizer COMMAND $ test_sigma_normalizer ) +- +-add_executable( boxm_sample_algo_test_include test_include.cxx ) +-target_link_libraries( boxm_sample_algo_test_include boxm_sample_algo) +diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx +deleted file mode 100644 +index 1258c5dc63..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +- +-DECLARE( test_sigma_normalizer ); +- +-void register_tests() +-{ +- REGISTER( test_sigma_normalizer ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx +deleted file mode 100644 +index 3c7fc60db6..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx +deleted file mode 100644 +index 7231ca0b24..0000000000 +--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx ++++ /dev/null +@@ -1,59 +0,0 @@ +- +-#include +-#include +-#include +-#include +-#include +- +- +-static void test_sigma_normalizer() +-{ +- START("boxm_sigma_normalizer test"); +- +- // generate random sets of samples from a normal distribution and compare sigma estimate to true value +- { +- vnl_random rand_gen; +- unsigned int n_trials = 5000; +- +- unsigned int n_observations = 6; +- float true_sigma = 0.5f; +- float true_mean = 2.5f; +- float under_estimation_prob = 0.4f; +- unsigned int under_estimates = 0; +- +- boxm_sigma_normalizer normalizer(under_estimation_prob); +- +- for (unsigned int t=0; t samples; +- std::vector weights; +- for (unsigned int n=0; n +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-template +-class boxm_edge_sample +-{ +- public: +- boxm_edge_sample(): edge_prob_(0), num_obs_(0.0f) {} +- ~boxm_edge_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- //: returns a basic value that represents this sample (mostly for raw file creation purposes) +- float basic_val() const { return edge_prob_; } +- OBS_T edge_prob_; +- float num_obs_; +-}; +- +-template +-class boxm_aux_edge_sample +-{ +- public: +- boxm_aux_edge_sample(): obs_(0), seg_len_(0.0f) { } +- ~boxm_aux_edge_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- OBS_T obs_; +- float seg_len_; +-}; +- +-#if 0 // two classes commented out +- +-//: traits for a grey optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_edge_sample sample_datatype; +- +- static std::string storage_subdir() { return "opt_rt_grey_work"; } +-}; +- +-//: traits for an rgb optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_edge_sample > sample_datatype; +- +- static std::string storage_subdir() { return "opt_rt_rgb_work"; } +-}; +- +-#endif // 0 +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_edge_sample& sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_aux_edge_sample& sample); +- +- +-#endif // boxm_edge_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx +deleted file mode 100644 +index d2e60dc175..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx ++++ /dev/null +@@ -1,137 +0,0 @@ +-#ifndef boxm_edge_sample_hxx_ +-#define boxm_edge_sample_hxx_ +- +-#include "boxm_edge_sample.h" +- +- +-// Edge Sample Methods +-template +-void boxm_edge_sample::print(std::ostream& os) const +-{ +- os << "(edge_prob=" << edge_prob_ << " num_obs=" << num_obs_ << ')'; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.edge_prob_); +- vsl_b_write(os, sample.num_obs_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.edge_prob_); +- vsl_b_read(is, sample.num_obs_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_edge_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_edge_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-// Auxiliary Edge Sample Methods +-template +-void boxm_aux_edge_sample::print(std::ostream& os) const +-{ +- os << "(obs=" << obs_ << " seg_len=" << seg_len_ << ')'; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.obs_); +- vsl_b_write(os, sample.seg_len_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.obs_); +- vsl_b_read(is, sample.seg_len_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_aux_edge_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_aux_edge_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_EDGE_SAMPLE_INSTANTIATE(T) \ +-template class boxm_edge_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_edge_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_edge_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_edge_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_edge_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_edge_sample&) +- +-#define BOXM_AUX_EDGE_SAMPLE_INSTANTIATE(T) \ +-template class boxm_aux_edge_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_aux_edge_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_aux_edge_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_aux_edge_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_aux_edge_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_aux_edge_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h b/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h +deleted file mode 100644 +index a92ae0e38e..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h ++++ /dev/null +@@ -1,69 +0,0 @@ +-#ifndef boxm_edge_tangent_sample_h_ +-#define boxm_edge_tangent_sample_h_ +-//: +-// \file +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include "boxm_plane_obs.h" +-#include +- +- +-template +-class boxm_edge_tangent_sample +-{ +- public: +- boxm_edge_tangent_sample() = default; +- ~boxm_edge_tangent_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- //: adds observations +- void insert(boxm_plane_obs const& obs) { obs_.push_back(obs); } +- +- //: insert a lis of observations +- void insert(std::vector > const& obs) {obs_.insert(obs_.end(),obs.begin(),obs.end()); } +- +- //: returns the number of observations +- unsigned num_obs() const { return obs_.size(); } +- +- boxm_plane_obs obs(unsigned int i) const { +- if (i < obs_.size()) return obs_[i]; +- std::cerr << "boxm_edge_tangent_sample: " << i << " is out of index - size is " << obs_.size() << std::endl; +- return boxm_plane_obs(); +- } +- +- //: returns a basic value that represents this sample (mostly for raw file creation purposes) +- float basic_val(unsigned int i) { +- if (i < obs_.size()) return obs_[i].seg_len_; +- std::cerr << "boxm_edge_tangent_sample: " << i << "is out of index - size is " << obs_.size() << std::endl; +- return -1.0f; +- } +- +- std::vector > obs_list() { return obs_; } +- +- private: +- std::vector > obs_; +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample *&sample); +- +-template +-std::ostream&operator << (std::ostream& os, boxm_edge_tangent_sample& sample); +- +- +-#endif // boxm_edge_tangent_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx +deleted file mode 100644 +index bb96baa1e0..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx ++++ /dev/null +@@ -1,79 +0,0 @@ +-#ifndef boxm_edge_tangent_sample_hxx_ +-#define boxm_edge_tangent_sample_hxx_ +- +-#include "boxm_edge_tangent_sample.h" +-#include "boxm_plane_obs.h" +- +-template +-void boxm_edge_tangent_sample::print(std::ostream& os) const +-{ +- os << " num_obs=" << this->num_obs() << std::endl; +- for (unsigned i=0; i +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample const & sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.num_obs()); +- for (unsigned i=0; i +-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- { unsigned num; +- vsl_b_read(is, num); +- boxm_plane_obs o; +- for (unsigned i=0; i&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, boxm_edge_tangent_sample &sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_EDGE_TANGENT_SAMPLE_INSTANTIATE(T) \ +-template class boxm_edge_tangent_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_edge_tangent_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_edge_tangent_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_edge_tangent_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_edge_tangent_sample *&); \ +-template std::ostream& operator << (std::ostream&, boxm_edge_tangent_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h b/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h +deleted file mode 100644 +index 953c9f286f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h ++++ /dev/null +@@ -1,55 +0,0 @@ +-#ifndef boxm_inf_line_sample_h_ +-#define boxm_inf_line_sample_h_ +-//: +-// \file +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-#include +-#include +- +-template +-class boxm_inf_line_sample +-{ +- public: +- //: initially the residual is very big, it means the solution to this inf line is not found yet +- boxm_inf_line_sample() : +- residual_(1e6), line_(vgl_infinite_line_3d(vgl_vector_2d(0,0), +- vgl_vector_3d(10,10,10))), num_obs_(0){} +- +- boxm_inf_line_sample(vgl_infinite_line_3d line,unsigned num_obs=0) : residual_(1e6),line_(line),num_obs_(num_obs) {} +- ~boxm_inf_line_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) { os << "(line=" << line_ << ')'; } +- bool operator==(const boxm_inf_line_sample &rhs) const; +- typedef boxm_inf_line_sample value_type; +- // public members +- T residual_; +- vgl_infinite_line_3d line_; +- vgl_line_3d_2_points line_clipped_; +- unsigned num_obs_; +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, boxm_inf_line_sample& sample); +- +- +-#endif // boxm_inf_line_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx +deleted file mode 100644 +index 1206b4a5f3..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx ++++ /dev/null +@@ -1,79 +0,0 @@ +-#ifndef boxm_inf_line_sample_hxx_ +-#define boxm_inf_line_sample_hxx_ +- +-#include "boxm_inf_line_sample.h" +-#include // for vsl_b_write(os, sample.line_); +-#include // for vsl_b_write(os, sample.line_clipped_); +- +-template +-bool boxm_inf_line_sample::operator==(const boxm_inf_line_sample &rhs) const +-{ +- if ((this==&rhs) || (line_==rhs.line_ && line_clipped_==rhs.line_clipped_ && num_obs_==rhs.num_obs_)) +- return true; +- else +- return false; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.num_obs_); +- vsl_b_write(os, sample.residual_); +- vsl_b_write(os, sample.line_); +- vsl_b_write(os, sample.line_clipped_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.num_obs_); +- vsl_b_read(is, sample.residual_); +- vsl_b_read(is, sample.line_); +- vsl_b_read(is, sample.line_clipped_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_inf_line_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, boxm_inf_line_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_INF_LINE_SAMPLE_INSTANTIATE(T) \ +-template class boxm_inf_line_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_inf_line_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_inf_line_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_inf_line_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_inf_line_sample *&);\ +-template std::ostream& operator << (std::ostream&, boxm_inf_line_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h b/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h +deleted file mode 100644 +index 56ac1825d9..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-#ifndef boxm_opt2_sample_h_ +-#define boxm_opt2_sample_h_ +-//: +-// \file +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +- +-template +-class boxm_opt2_sample +-{ +- public: +- boxm_opt2_sample() +- : obs_(0), pre_(0.0f), vis_(0.0f), PI_(0.0f), seg_len_(0.0f), log_pass_prob_sum_(0.0f), weighted_seg_len_sum_(0.0f) +- {} +- +- ~boxm_opt2_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- OBS_T obs_; +- float pre_; +- float vis_; +- float PI_; +- float seg_len_; +- +- float log_pass_prob_sum_; +- float weighted_seg_len_sum_; +-}; +- +-//:traits for a grey optimization sample +-template <> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_opt2_sample sample_datatype; +- +- static std::string storage_subdir() { return "opt2_grey_work"; } +-}; +- +-//:traits for an rgb optimization sample +-template <> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_opt2_sample > sample_datatype; +- +- static std::string storage_subdir() { return "opt2_rgb_work"; } +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample *&sample); +- +-template +-std::ostream& operator<< (std::ostream& os, const boxm_opt2_sample& sample); +- +-#endif // boxm_opt2_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx +deleted file mode 100644 +index 44300e3bf7..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx ++++ /dev/null +@@ -1,83 +0,0 @@ +-#ifndef boxm_opt2_sample_hxx_ +-#define boxm_opt2_sample_hxx_ +- +-#include "boxm_opt2_sample.h" +- +- +-template +-void boxm_opt2_sample::print(std::ostream& os) const +-{ +- os << "(obs=" << obs_ << " pre=" << pre_ << " vis=" << vis_ << " PI=" << PI_ +- << " seg_len=" << seg_len_ << " log_pass_prob_sum=" << log_pass_prob_sum_ +- << " weighted_seg_len_sum=" << weighted_seg_len_sum_ << ')'; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.obs_); +- vsl_b_write(os, sample.pre_); +- vsl_b_write(os, sample.vis_); +- vsl_b_write(os, sample.PI_); +- vsl_b_write(os, sample.seg_len_); +- vsl_b_write(os, sample.log_pass_prob_sum_); +- vsl_b_write(os, sample.weighted_seg_len_sum_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.obs_); +- vsl_b_read(is, sample.pre_); +- vsl_b_read(is, sample.vis_); +- vsl_b_read(is, sample.PI_); +- vsl_b_read(is, sample.seg_len_); +- vsl_b_read(is, sample.log_pass_prob_sum_); +- vsl_b_read(is, sample.weighted_seg_len_sum_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_opt2_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_opt2_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_OPT2_SAMPLE_INSTANTIATE(T) \ +-template class boxm_opt2_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_opt2_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_opt2_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_opt2_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_opt2_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_opt2_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h b/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h +deleted file mode 100644 +index 3b8d162774..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h ++++ /dev/null +@@ -1,76 +0,0 @@ +-#ifndef boxm_opt3_sample_h_ +-#define boxm_opt3_sample_h_ +-//: +-// \file +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-//: class for holding auxiliary information for opt3 process. +-// Note that APM is not necessarily appearance model type of world, +-// but observation types of the two models should be the same. +-template +-class boxm_opt3_sample +-{ +- public: +- typedef typename boxm_apm_traits::obs_datatype obs_datatype; +- typedef typename boxm_apm_traits::apm_datatype apm_datatype; +- +- boxm_opt3_sample() +- : weighted_vis_sum_(0.0f), seg_len_sum_(0.0f), log_pass_prob_sum_(0.0f) { } +- ~boxm_opt3_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- void update_obs_dist(obs_datatype obs, float obs_prob); +- +- apm_datatype obs_dist_; // distribution of samples from this observation +- float weighted_vis_sum_; // sum of visibility probabilities * corresponding seg_lens +- float seg_len_sum_; // sum of sample segment lengths +- float log_pass_prob_sum_; // sum of log of updated (1 - PQ) +-}; +- +-//: traits for a grey optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_apm_traits::obs_datatype sample_datatype; +- static const boxm_apm_type APM_TYPE = BOXM_APM_MOG_GREY; +- +- static std::string storage_subdir() { return "opt3_mog_grey"; } +-}; +- +-//: traits for an rgb optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_apm_traits::obs_datatype sample_datatype; +- static const boxm_apm_type APM_TYPE = BOXM_APM_MOG_RGB; +- +- static std::string storage_subdir() { return "opt3_mog_rgb"; } +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_opt3_sample& sample); +- +-#endif // boxm_opt3_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx +deleted file mode 100644 +index 85f2e954dc..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx ++++ /dev/null +@@ -1,92 +0,0 @@ +-#ifndef boxm_opt3_sample_hxx_ +-#define boxm_opt3_sample_hxx_ +- +-#include "boxm_opt3_sample.h" +- +-#include +-#include +-#include +-#include +-#include // for binary io functions +-#include +-#include +-#include +-#include +-//#include +- +-template +-void boxm_opt3_sample::print(std::ostream& os) const +-{ +- os << "(log_pass_prob_sum=" << log_pass_prob_sum_ << " seg_len_sum_=" << seg_len_sum_ +- << "weighted_vis_sum_=" << weighted_vis_sum_ << " obs_dist=" << obs_dist_ << ')'; +-} +- +-template +-void boxm_opt3_sample::update_obs_dist(typename boxm_opt3_sample::obs_datatype obs, float obs_prob) +-{ +- boxm_apm_traits::apm_processor::update(obs_dist_, obs, obs_prob); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.log_pass_prob_sum_); +- vsl_b_write(os, sample.seg_len_sum_); +- vsl_b_write(os, sample.weighted_vis_sum_); +- vsl_b_write(os, sample.obs_dist_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.log_pass_prob_sum_); +- vsl_b_read(is, sample.seg_len_sum_); +- vsl_b_read(is, sample.weighted_vis_sum_); +- vsl_b_read(is, sample.obs_dist_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_opt3_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_opt3_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_OPT3_SAMPLE_INSTANTIATE(T) \ +-template class boxm_opt3_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_opt3_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_opt3_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_opt3_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_opt3_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_opt3_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h b/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h +deleted file mode 100644 +index 417c0ccc98..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h ++++ /dev/null +@@ -1,45 +0,0 @@ +-#ifndef boxm_plane_obs_h_ +-#define boxm_plane_obs_h_ +-//: +-// \file +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-template +-class boxm_plane_obs +-{ +- public: +- boxm_plane_obs() : seg_len_(0.0f), plane_(vgl_homg_plane_3d()) {} +- boxm_plane_obs(vgl_homg_plane_3d plane, float seg_len) : seg_len_(seg_len), plane_(plane) {} +- ~boxm_plane_obs() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const { os << "(plane=" << plane_ << " seg_len=" << seg_len_ << ')'; } +- +- // public members +- float seg_len_; +- vgl_homg_plane_3d plane_; +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_plane_obs& sample); +- +- +-#endif // boxm_plane_obs_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx b/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx +deleted file mode 100644 +index 5d2d8b4535..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx ++++ /dev/null +@@ -1,69 +0,0 @@ +-#ifndef boxm_plane_obs_hxx_ +-#define boxm_plane_obs_hxx_ +- +-#include "boxm_plane_obs.h" +- +-#include "boxm_edge_tangent_sample.h" +-#include "boxm_inf_line_sample.h" +- +-#include // for vsl_b_write(os, sample.plane_); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.seg_len_); +- vsl_b_write(os, sample.plane_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.seg_len_); +- vsl_b_read(is, sample.plane_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_edge_tangent_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator<< (std::ostream& os, boxm_plane_obs const& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_PLANE_OBS_INSTANTIATE(T) \ +-template class boxm_plane_obs; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_plane_obs const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_plane_obs const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_plane_obs &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_plane_obs *&);\ +-template std::ostream& operator << (std::ostream&, boxm_plane_obs const&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h b/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h +deleted file mode 100644 +index e51d415ce8..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h ++++ /dev/null +@@ -1,70 +0,0 @@ +-#ifndef boxm_rt_sample_h_ +-#define boxm_rt_sample_h_ +-//: +-// \file +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +- +-template +-class boxm_rt_sample +-{ +- public: +- boxm_rt_sample() +- : obs_(0), pre_(0.0f), vis_(0.0f), PI_(0.0f), seg_len_(0.0f), Beta_(0.0f), +- updatefactor_(0.0f), log_sum_(0.0f) {} +- ~boxm_rt_sample() = default; +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- OBS_T obs_; +- float pre_; +- float vis_; +- float PI_; +- float seg_len_; +- float Beta_; +- float updatefactor_; +- float log_sum_; +-}; +- +- +-//: traits for a grey optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_rt_sample sample_datatype; +- +- static std::string storage_subdir() { return "opt_rt_grey_work"; } +-}; +- +-//: traits for an rgb optimization sample +-template<> +-class boxm_aux_traits +-{ +- public: +- typedef boxm_rt_sample > sample_datatype; +- +- static std::string storage_subdir() { return "opt_rt_rgb_work"; } +-}; +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_rt_sample& sample); +- +-#endif // boxm_rt_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx +deleted file mode 100644 +index 4202653363..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx ++++ /dev/null +@@ -1,81 +0,0 @@ +-#ifndef boxm_rt_sample_hxx_ +-#define boxm_rt_sample_hxx_ +- +-#include "boxm_rt_sample.h" +- +- +-template +-void boxm_rt_sample::print(std::ostream& os) const +-{ +- os << "(obs=" << obs_ << " pre=" << pre_ << " vis=" << vis_ << " PI=" << PI_ << " seg_len=" << seg_len_ << " Beta=" << Beta_ << ')'; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.obs_); +- vsl_b_write(os, sample.pre_); +- vsl_b_write(os, sample.vis_); +- vsl_b_write(os, sample.PI_); +- vsl_b_write(os, sample.seg_len_); +- vsl_b_write(os, sample.updatefactor_); +- vsl_b_write(os, sample.Beta_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.obs_); +- vsl_b_read(is, sample.pre_); +- vsl_b_read(is, sample.vis_); +- vsl_b_read(is, sample.PI_); +- vsl_b_read(is, sample.seg_len_); +- vsl_b_read(is, sample.updatefactor_); +- vsl_b_read(is, sample.Beta_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_rt_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream &operator << (std::ostream& os, const boxm_rt_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_RT_SAMPLE_INSTANTIATE(T) \ +-template class boxm_rt_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_rt_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_rt_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_rt_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_rt_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_rt_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample.h b/contrib/brl/bseg/boxm/sample/boxm_sample.h +deleted file mode 100644 +index 4d2312ae98..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_sample.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-#ifndef boxm_sample_h_ +-#define boxm_sample_h_ +-//: +-// \file +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-template +-class boxm_sample +-{ +- public: +- static const boxm_apm_type apm_type = APM_MODEL; +- typedef typename boxm_apm_traits::apm_datatype apm_datatype; +- typedef typename boxm_apm_traits::obs_datatype obs_datatype; +- typedef typename boxm_apm_traits::obs_mathtype obs_mathtype; +- typedef typename boxm_apm_traits::apm_processor apm_processor; +- static const unsigned int obs_dim = boxm_apm_traits::obs_dim; +- +- //: default constructor: alpha is set to 0.0015. +- boxm_sample() : alpha(0.0015f), appearance_() {} +- +- boxm_sample(float alpha_val): alpha(alpha_val), appearance_() {} +- //: constructor +- boxm_sample(float alpha_val, apm_datatype apm_val): alpha(alpha_val), appearance_(std::move(apm_val)) {} +- +- virtual ~boxm_sample() = default; +- +- static short version_no() { return 1; } +- +- //: bin is to imitate the bin number of multiple_bin case +- apm_datatype & appearance(int /*bin*/=-1) { return appearance_; } +- +- void set_appearance(apm_datatype app,int /*bin*/=-1) { appearance_=app; } +- +- //: returns a basic value that represents this sample (mostly for raw file creation purposes) +- float basic_val() const { return alpha; } +- +- //: the occlusion density at the sample point +- float alpha; +- +- //: the appearance model at the sample point +- typename boxm_apm_traits::apm_datatype appearance_; +- +- void print(std::ostream& os) const; +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_sample& sample); +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_sample.hxx +deleted file mode 100644 +index e644739f43..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_sample.hxx ++++ /dev/null +@@ -1,71 +0,0 @@ +-#ifndef boxm_sample_hxx_ +-#define boxm_sample_hxx_ +- +-#include "boxm_sample.h" +-#include +- +-template +-void boxm_sample::print(std::ostream& os) const +-{ +- os << "(alpha=" << alpha << " appearence=" << appearance_ << ')'; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.alpha); +- vsl_b_write(os, sample.appearance_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.alpha); +- vsl_b_read(is, sample.appearance_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_SAMPLE_INSTANTIATE(T) \ +-template class boxm_sample; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_sample &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_sample *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h b/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h +deleted file mode 100644 +index 838637e49f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h ++++ /dev/null +@@ -1,63 +0,0 @@ +-#ifndef boxm_sample_multi_bin_h_ +-#define boxm_sample_multi_bin_h_ +-//: +-// \file +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-template +-class boxm_sample_multi_bin +-{ +- public: +- static const boxm_apm_type apm_type = APM_MODEL; +- typedef typename boxm_apm_traits::apm_datatype apm_datatype; +- typedef typename boxm_apm_traits::obs_datatype obs_datatype; +- typedef typename boxm_apm_traits::obs_mathtype obs_mathtype; +- typedef typename boxm_apm_traits::apm_processor apm_processor; +- +- //: default constructor +- boxm_sample_multi_bin() : alpha(0.001f) {} +- //: constructor +- boxm_sample_multi_bin(float alpha_val,std::map apm_val): alpha(alpha_val), appearance_(std::move(apm_val)) {} +- +- static short version_no() { return 1; } +- +- //: returns a basic value that represents this sample (mostly for raw file creation purposes) +- float basic_val() const { return alpha; } +- +- //: the occlusion density at the sample point +- float alpha; +- apm_datatype & appearance(int bin=0); +- +- void set_appearance(apm_datatype app,int bin=0); +- +- std::map appearance_; +- +- void print(std::ostream& os) const; +- private: +- //: the appearance model at the sample point +-}; +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_sample_multi_bin& sample); +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx b/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx +deleted file mode 100644 +index 714b493eec..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx ++++ /dev/null +@@ -1,98 +0,0 @@ +-#ifndef boxm_sample_multi_bin_hxx_ +-#define boxm_sample_multi_bin_hxx_ +- +-#include "boxm_sample_multi_bin.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-template +-typename boxm_sample_multi_bin::apm_datatype & boxm_sample_multi_bin::appearance(int bin) +-{ +- if (appearance_.find(bin)==appearance_.end()) +- { +- appearance_[bin]=apm_datatype(); +- return appearance_[bin]; +- } +- else +- return appearance_[bin]; +-} +- +-template +-void boxm_sample_multi_bin::set_appearance(apm_datatype app,int bin) +-{ +- appearance_[bin]=app; +-} +- +-template +-void boxm_sample_multi_bin::print(std::ostream& os) const +-{ +- os << "(alpha=" << alpha << " appearence=" ; +- for (typename std::map::const_iterator iter=appearance_.begin(); +- iter!=appearance_.end(); ++iter) +- os << "bin#= " << iter->first << ' ' << iter->second; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.alpha); +- vsl_b_write(os, sample.appearance_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.alpha); +- vsl_b_read(is, sample.appearance_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample_multi_bin&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_sample_multi_bin& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_SAMPLE_MULTI_BIN_INSTANTIATE(T) \ +-template class boxm_sample_multi_bin; \ +-template void vsl_b_write(vsl_b_ostream &, boxm_sample_multi_bin const &); \ +-template void vsl_b_write(vsl_b_ostream &, boxm_sample_multi_bin const *&); \ +-template void vsl_b_read(vsl_b_istream &, boxm_sample_multi_bin &); \ +-template void vsl_b_read(vsl_b_istream &, boxm_sample_multi_bin *&); \ +-template std::ostream& operator << (std::ostream&, const boxm_sample_multi_bin&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h b/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h +deleted file mode 100644 +index ba4cd770ad..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h ++++ /dev/null +@@ -1,55 +0,0 @@ +-#ifndef boxm_scalar_sample_h_ +-#define boxm_scalar_sample_h_ +-//: +-// \file +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +- +-template +-class boxm_scalar_sample +-{ +- public: +- boxm_scalar_sample() : scalar_sum_(0), seg_len_(0.0f) { } +- +- ~boxm_scalar_sample() = default; +- T basic_val() { if (seg_len_>0) return scalar_sum_/seg_len_; else return (T)0; } +- static short version_no() { return 1; } +- void print(std::ostream& os) const; +- +- T scalar_sum_; +- float seg_len_; +-}; +- +-//: traits for a scalar sample +-template <> +-class boxm_apm_traits +-{ +- public: +- typedef boxm_scalar_sample sample_datatype; +- +- static std::string storage_subdir() { return "scalar_subdir"; } +-}; +- +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample const* &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample* &sample); +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_scalar_sample& sample); +- +-#endif // boxm_scalar_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx +deleted file mode 100644 +index 6eb0d37aef..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx ++++ /dev/null +@@ -1,70 +0,0 @@ +-#ifndef boxm_scalar_sample_hxx_ +-#define boxm_scalar_sample_hxx_ +- +-#include "boxm_scalar_sample.h" +- +-template +-void boxm_scalar_sample::print(std::ostream& os) const +-{ +- os << "(scalar=" << scalar_sum_ << " seg_len=" << seg_len_ << ")\n"; +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.scalar_sum_); +- vsl_b_write(os, sample.seg_len_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.scalar_sum_); +- vsl_b_read(is, sample.seg_len_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_scalar_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +-template +-std::ostream& operator << (std::ostream& os, const boxm_scalar_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BOXM_SCALAR_SAMPLE_INSTANTIATE(T) \ +- template class boxm_scalar_sample; \ +- template void vsl_b_write(vsl_b_ostream &, boxm_scalar_sample const &); \ +- template void vsl_b_write(vsl_b_ostream &, boxm_scalar_sample const *&); \ +- template void vsl_b_read(vsl_b_istream &, boxm_scalar_sample &); \ +- template void vsl_b_read(vsl_b_istream &, boxm_scalar_sample *&); \ +- template std::ostream& operator << (std::ostream&, const boxm_scalar_sample&) +- +-#endif +diff --git a/contrib/brl/bseg/boxm/sample/boxm_update_sample.h b/contrib/brl/bseg/boxm/sample/boxm_update_sample.h +deleted file mode 100644 +index 666c4a3ac5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_update_sample.h ++++ /dev/null +@@ -1,17 +0,0 @@ +-#ifndef boxm_update_sample_h_ +-#define boxm_update_sample_h_ +-//: +-// \file +- +-class boxm_update_sample +-{ +- public: +- //: default constructor +- boxm_update_sample() : update_multiplier(0.0f), do_update(false) {} +- +- //: the (unnormalized) update multiplier +- float update_multiplier; +- bool do_update; +-}; +- +-#endif // boxm_update_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h b/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h +deleted file mode 100644 +index 3ff4ed3ad5..0000000000 +--- a/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h ++++ /dev/null +@@ -1,16 +0,0 @@ +-#ifndef boxm_vis_implicit_sample_h_ +-#define boxm_vis_implicit_sample_h_ +-//: +-// \file +- +-class boxm_vis_implicit_sample +-{ +- public: +- //: default constructor +- boxm_vis_implicit_sample() : max_vis(0.0f), n_obs(0) {} +- +- float max_vis; +- unsigned int n_obs; +-}; +- +-#endif // boxm_vis_implicit_sample_h_ +diff --git a/contrib/brl/bseg/boxm/sample/dummy.cxx b/contrib/brl/bseg/boxm/sample/dummy.cxx +deleted file mode 100644 +index e69de29bb2..0000000000 +diff --git a/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt +deleted file mode 100644 +index ed11dfb489..0000000000 +--- a/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt ++++ /dev/null +@@ -1,4 +0,0 @@ +-add_executable( boxm_sample_test_include test_include.cxx ) +-target_link_libraries( boxm_sample_test_include boxm_sample) +-add_executable( boxm_sample_test_template_include test_template_include.cxx ) +-target_link_libraries( boxm_sample_test_template_include boxm_sample) +diff --git a/contrib/brl/bseg/boxm/sample/tests/test_include.cxx b/contrib/brl/bseg/boxm/sample/tests/test_include.cxx +deleted file mode 100644 +index 17e8b789dd..0000000000 +--- a/contrib/brl/bseg/boxm/sample/tests/test_include.cxx ++++ /dev/null +@@ -1,14 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx +deleted file mode 100644 +index d1f741b32f..0000000000 +--- a/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/tests/CMakeLists.txt +deleted file mode 100644 +index eb0d974b9f..0000000000 +--- a/contrib/brl/bseg/boxm/tests/CMakeLists.txt ++++ /dev/null +@@ -1,32 +0,0 @@ +-add_executable( boxm_test_all +- test_driver.cxx +- test_binary_io.cxx +- test_block_iter.cxx +-# FAILS on DASHBOARD FIX_ME +-# test_region_finder.cxx +- test_cell_iterator.cxx +- test_load_neighboring_blocks.cxx +- ) +- +-set(boxm_test_all_sources +- test_utils.h test_utils.cxx +- ) +- +-vxl_add_library(LIBRARY_NAME boxm_tests LIBRARY_SOURCES ${boxm_test_all_sources}) +-target_link_libraries(boxm_tests boxm boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul) +- +-target_link_libraries( boxm_test_all boxm_tests boxm boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul) +-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera0.txt ${CMAKE_CURRENT_BINARY_DIR}/camera0.txt COPYONLY ) +- +-add_test( NAME boxm_test_binary_io COMMAND $ test_binary_io ) +-add_test( NAME boxm_test_block_iter COMMAND $ test_block_iter ) +-#add_test( NAME boxm_test_region_finder COMMAND $ test_region_finder ) +-if( VXL_RUN_FAILING_TESTS ) ## SEGFAULT when testing with ctest -j16 (perhaps files are shared between tests) +-add_test( NAME boxm_test_cell_iterator COMMAND $ test_cell_iterator ) +-endif() +-add_test( NAME boxm_test_load_neighboring_blocks COMMAND $ test_load_neighboring_blocks ) +- +-add_executable( boxm_test_include test_include.cxx ) +-target_link_libraries( boxm_test_include boxm) +-add_executable( boxm_test_template_include test_template_include.cxx ) +-target_link_libraries( boxm_test_template_include boxm) +diff --git a/contrib/brl/bseg/boxm/tests/camera0.txt b/contrib/brl/bseg/boxm/tests/camera0.txt +deleted file mode 100644 +index cf11c57707..0000000000 +--- a/contrib/brl/bseg/boxm/tests/camera0.txt ++++ /dev/null +@@ -1,104 +0,0 @@ +-satId = "????"; +-bandId = "RGB"; +-SpecId = "RPC00B"; +-BEGIN_GROUP = IMAGE +- +- +- lineOffset = 0.0 +- sampOffset = 0.0 +- latOffset = 0.0 +- longOffset = 0.0 +- heightOffset = 0.0 +- lineScale = 1.0 +- sampScale = 1.0 +- latScale = 1.0 +- longScale = 1.0 +- heightScale = 1.0 +- lineNumCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- lineDenCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- sampNumCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- sampDenCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +-END_GROUP = IMAGE +-END; +-lvcs +-47.550493 35.395931 664.186757 +diff --git a/contrib/brl/bseg/boxm/tests/frame_00000.txt b/contrib/brl/bseg/boxm/tests/frame_00000.txt +deleted file mode 100644 +index a66e2014bd..0000000000 +--- a/contrib/brl/bseg/boxm/tests/frame_00000.txt ++++ /dev/null +@@ -1,7 +0,0 @@ +-1 0 0 +-0 1 0 +-0 0 1 +-1 0 0 +-0 1 0 +-0 0 1 +-0 0 0 +diff --git a/contrib/brl/bseg/boxm/tests/test_binary_io.cxx b/contrib/brl/bseg/boxm/tests/test_binary_io.cxx +deleted file mode 100644 +index 7dc2da196e..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_binary_io.cxx ++++ /dev/null +@@ -1,75 +0,0 @@ +- +-#include +- +-#include +-#include +-#include +-#include +- +-static void test_binary_io() +-{ +-#ifdef DEBUG +- short nlevels=5; +- typedef vgl_point_3d point_type; +- boct_tree * block = new boct_tree(nlevels); +- TEST("No of Max levels of tree",nlevels, block->num_levels()); +- +- block->split(); //block->print(); +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(30,30,30); +- boxm_scene > scene(lvcs, origin, block_dim, world_dim); +- scene.set_paths("./boxm_scene", "block"); +- x_write(std::cout, scene, "scene"); +- +- vsl_b_ofstream os("scene.bin"); +- scene.b_write(os); +- os.close(); +- vul_file::make_directory("./boxm_scene"); +- +- boxm_scene > > scene_out; +- vsl_b_ifstream is("scene.bin", std::ios::binary); +- scene_out.b_read(is); +- vpl_rmdir("./boxm_scene"); +- vpl_unlink("./scene.bin"); +- +- // writing the binary file for a scene with grey MOG +- vgl_point_3d mog_origin(0,0,0); +- vgl_vector_3d mog_block_dim(1,1,1); +- vgl_vector_3d mog_world_dim(3,3,1); +- +- boxm_scene > > mog_scene( mog_origin, mog_block_dim, mog_world_dim); +- mog_scene.set_paths("./boxm_scene", "block"); +- vul_file::make_directory("./boxm_scene"); +- boxm_block_iterator > > iter(&mog_scene); +- +- while (!iter.end()) +- { +- mog_scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > > * block=mog_scene.get_active_block(); +- boct_tree > * tree=new boct_tree >(10,6); +- block->init_tree(tree); +- mog_scene.write_active_block(); +- iter++; +- } +- mog_scene.write_scene(); +- // writing the binary file for a scene with grey MOG +- boxm_scene > > read_mog_scene; +- read_mog_scene.load_scene("./boxm_scene/scene.xml"); +- +- boxm_block_iterator > > read_iter(&read_mog_scene); +- while (!read_iter.end()) +- { +- read_mog_scene.load_block(read_iter.index().x(),read_iter.index().y(),read_iter.index().z()); +- boxm_block > > * block=read_mog_scene.get_active_block(); +- boct_tree > * tree=block->get_tree(); +- read_iter++; +- } +- vpl_rmdir("./boxm_scene"); +- vpl_unlink("./scene.bin"); +-#endif // DEBUG +-} +- +-TESTMAIN(test_binary_io); +diff --git a/contrib/brl/bseg/boxm/tests/test_block_iter.cxx b/contrib/brl/bseg/boxm/tests/test_block_iter.cxx +deleted file mode 100644 +index 376ee2d9b4..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_block_iter.cxx ++++ /dev/null +@@ -1,47 +0,0 @@ +-#include +- +-#include +-#include +- +-#include "test_utils.h" +- +-typedef boct_tree > tree_type; +- +-static void test_block_iter() +-{ +- clean_up(); +- short nlevels=5; +- auto * block = new tree_type(nlevels); +- TEST("No of Max levels of tree",nlevels, block->number_levels()); +- +- block->split(); +- block->print(); +- delete block; +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(3,3,3); +- boxm_scene scene(lvcs, origin, block_dim, world_dim); +- scene.set_paths("./boxm_scene", "block"); +- +- boxm_block_iterator iter = scene.iterator(); +- int num_blocks=0; +- for (; !iter.end(); ++iter) { +- scene.load_block(iter.index()); +- boxm_block *block = scene.get_active_block(); +- block->set_tree(new tree_type(5,3)); +- std::cout << block->bounding_box() << std::endl; +- ++num_blocks; +- scene.write_active_block(); +- } +- int x,y,z; +- scene.block_num(x,y,z); +- TEST("Number of blocks iterator visits", num_blocks, x*y*z); +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks in test_block_iter: " << boct_tree_cell >::nleaks() << '\n'; +-#endif +- clean_up(); +-} +- +-TESTMAIN(test_block_iter); +diff --git a/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx b/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx +deleted file mode 100644 +index f65529a973..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx ++++ /dev/null +@@ -1,51 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include +-#include "test_utils.h" +- +-void test_cell_iterator() +-{ +- +- clean_up(); +- //create scene +- boxm_scene > *scene = create_scene(); +- +- //get the iterator +- boxm_cell_iterator > iterator = scene->cell_iterator(&boxm_scene >::load_block_and_neighbors); +- iterator.begin(); +- +- boct_tree_cell *cell = *iterator; +- unsigned num_cells = 0; +- bool result = true; +- +- while (!iterator.end()) { +- +- if( (std::abs(cell->data() - 0.8) > 1e-7) && (std::abs(cell->data() - 0.5) > 1e-7) ){ +- result = false; +- std::cerr << " Wrong data: " << cell->data() << std::endl; +- } +- ++iterator; +- num_cells ++; +- if(!iterator.end()){ +- cell = *iterator; +- } +- } +- +- if(num_cells!=120){ +- result = false; +- std::cerr << "Wrong number of cells: " << num_cells << std::endl; +- } +- +- TEST("Valid Test", result, true); +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks at test_cell_iterator " << boct_tree_cell::nleaks() << std::endl; +-#endif +- clean_up(); +- +-} +- +- +-TESTMAIN(test_cell_iterator); +diff --git a/contrib/brl/bseg/boxm/tests/test_driver.cxx b/contrib/brl/bseg/boxm/tests/test_driver.cxx +deleted file mode 100644 +index 3e55d5a0ea..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_driver.cxx ++++ /dev/null +@@ -1,21 +0,0 @@ +-#include +- +-DECLARE( test_binary_io ); +-DECLARE( test_block_iter ); +-//FAILS ON DASHBOARD FIX_ME +-//DECLARE( test_region_finder ); +-DECLARE( test_cell_iterator ); +-DECLARE( test_load_neighboring_blocks ); +- +-void register_tests() +-{ +- REGISTER( test_binary_io ); +- REGISTER( test_block_iter ); +-//FAILS ON DASHBOARD FIX_ME +-// REGISTER( test_region_finder ); +- REGISTER( test_cell_iterator ); +- REGISTER( test_load_neighboring_blocks ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/tests/test_include.cxx b/contrib/brl/bseg/boxm/tests/test_include.cxx +deleted file mode 100644 +index ae4ae05a88..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_include.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx b/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx +deleted file mode 100644 +index 1f8fe346ca..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx ++++ /dev/null +@@ -1,89 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 17-Aug-2010 +- +-#include +- +-#include "test_utils.h" +- +-void test_load_neighboring_blocks() +-{ +- clean_up(); +- //create scene +- boxm_scene > *scene = create_scene(4,4,4); +- std::cout << "Scene Created" << std::endl; +- +- //iterate through blocks, loading blocks and eighbors +- boxm_block_iterator > iter=scene->iterator(); +- iter.begin(); +- bool result = true; +- while (!iter.end()) { +- if (scene->load_block_and_neighbors(iter.index().x(),iter.index().y(),iter.index().z())) { +- //std::cout << "Center blocks : " << iter.index()<< std::endl; +- std::set, bvgl_point_3d_cmp > active_blocks = scene->active_blocks(); +- +- //iterate through the active blocks and check that their trees are in memory +- auto it = active_blocks.begin(); +- +- for (; it!=active_blocks.end(); it++){ +- boxm_block > *block = scene->get_block(*it); +- if(!block) +- result = false; +- boct_tree *tree = block->get_tree(); +- if(!tree) +- result =false; +- } +- +- +- unsigned sum =0; +- if (iter.index().x()>0 && iter.index().x()<3) sum++; +- if (iter.index().y()>0 && iter.index().y()<3) sum++; +- if (iter.index().z()>0 && iter.index().z()<3) sum++; +- if(sum == 0) +- if(active_blocks.size()!=8){ +- result = false; +- std::cout << sum << ' ' << active_blocks.size() << std::endl; +- } +- if(sum == 1) +- if(active_blocks.size()!=12){ +- result = false; +- std::cout << sum << ' ' << active_blocks.size() << std::endl; +- } +- if(sum == 2) +- if(active_blocks.size()!=18){ +- result = false; +- std::cout << sum << ' ' << active_blocks.size() << std::endl; +- } +- if(sum == 3) +- if(active_blocks.size()!=27){ +- result=false; +- std::cout << sum << ' ' << active_blocks.size() << std::endl; +- } +-#if 0 +- std::cout << "Active blocks : " << std::endl; +- std::set >::iterator it = active_blocks.begin(); +- for (; it!=active_blocks.end(); it++) +- std::cout << *it << std::endl; +-#endif +- } +- iter++; +- +- } +- +- scene->unload_active_blocks(); +- if(scene->active_blocks().size()!=0){ +- result = false; +- std::cout << "Failed to unload active blocks" << std::endl; +- } +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks test_load_neighboring_blocks: " << boct_tree_cell::nleaks() << std::endl; +-#endif +- +- TEST("Valid Test", result, true); +- clean_up(); +-} +- +- +-TESTMAIN(test_load_neighboring_blocks); +diff --git a/contrib/brl/bseg/boxm/tests/test_region_finder.cxx b/contrib/brl/bseg/boxm/tests/test_region_finder.cxx +deleted file mode 100644 +index 47d5fd903b..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_region_finder.cxx ++++ /dev/null +@@ -1,80 +0,0 @@ +-//: +-// \file +-// \brief A test to verify that findind cells within a region is correct +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include +- +-#include "test_utils.h" +- +-void test_region_finder() +-{ +- clean_up(); +- //create scene +- boxm_scene > *scene = create_scene(); +- +- bool result = true; +- +- if(!scene) result=false; +- +- //find a region +- +- { +- vgl_point_3d max_point(14.0, 14.0, 14.0); +- vgl_point_3d min_point(6.0, 6.0, 6.0); +- vgl_box_3d roi(min_point, max_point); +- +- std::vector* > cells; +- scene->leaves_in_region(roi,cells); +- +- +- if(cells.size()!=64){ +- result=false; +- std::cerr << "Number of cells in the region: " << cells.size() <data()- 0.8f)>1.0e-7) +- { +- result = false; +- std::cerr << cells[i]->data()<unload_active_blocks(); +- +- } +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks Region1: " << boct_tree_cell::nleaks() << std::endl; +-#endif +- +- //find another region +- { +- vgl_point_3d max_point(19.0, 19.0, 19.0); +- vgl_point_3d min_point(6.0, 6.0, 6.0); +- vgl_box_3d roi(min_point, max_point); +- +- std::vector* > cells; +- scene->leaves_in_region(roi,cells); +- +- if(cells.size()!=83){ +- result=false; +- std::cerr << "Number of cells in the region: " << cells.size() <unload_active_blocks(); +- } +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks Region2: " << boct_tree_cell::nleaks() << std::endl; +-#endif +- +- if(!scene) result=false; +- +- TEST("Correct region found", result, true); +- clean_up(); +-} +- +- +-TESTMAIN(test_region_finder); +diff --git a/contrib/brl/bseg/boxm/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/tests/test_template_include.cxx +deleted file mode 100644 +index edd7156927..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_template_include.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/tests/test_utils.cxx b/contrib/brl/bseg/boxm/tests/test_utils.cxx +deleted file mode 100644 +index 58b40215a5..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_utils.cxx ++++ /dev/null +@@ -1,72 +0,0 @@ +-#include "test_utils.h" +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Aug-2010 +- +-#include +-#include +-#include +- +-void init_tree(boct_tree *tree, unsigned i) +-{ +- tree-> split(); //now we have 8 cells +- std::vector*> leaves = tree->leaf_cells(); +- leaves[i]->set_data(0.8f); +- leaves[i]->split(); +-} +- +-boxm_scene >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz) +-{ +- //crete the input scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- +- vgl_vector_3d block_dim(10, 10, 10); //world coordinate dimensions of a block +- +- vgl_vector_3d world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene +- +- auto *scene = new boxm_scene >(lvcs, origin, block_dim, world_dim); +- std::string scene_path("./"); +- scene->set_paths(scene_path, "test_scene"); +- #ifdef DEBUG +- std::cerr << "Leaks Created - scene constructor: " << boct_tree_cell::nleaks() << '\n'; +-#endif +- unsigned cell_index = 7; +- boxm_block_iterator > iter=scene->iterator(); +- iter.begin(); +- while (!iter.end()) +- { +- //std::cout << "Loading block " << iter.index() << std::endl; +- scene->load_block(iter.index()); +- boxm_block > *block = scene->get_active_block(); +- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0 +- auto *tree = new boct_tree(0.5f, 3, 1); +- //tree->print(); +- init_tree(tree, cell_index); +- //tree->print(); +- block->init_tree(tree); +- scene->write_active_block(); +- if (cell_index == 0) cell_index = 7; +- cell_index--; +- ++iter; +- } +- //scene->unload_active_blocks(); +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks Created by create_scene() : " << boct_tree_cell::nleaks() << '\n'; +-#endif +- +- return scene; +-} +- +-void clean_up() +-{ +- //clean temporary files +- vul_file_iterator file_it("./*.bin"); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it()); +- //vul_file::delete_file_glob(file_it());// already deleted ?? FIX_ME +- } +-} +diff --git a/contrib/brl/bseg/boxm/tests/test_utils.h b/contrib/brl/bseg/boxm/tests/test_utils.h +deleted file mode 100644 +index 43f864a0da..0000000000 +--- a/contrib/brl/bseg/boxm/tests/test_utils.h ++++ /dev/null +@@ -1,17 +0,0 @@ +-#ifndef boxm_test_utils_h_ +-#define boxm_test_utils_h_ +-//: +-// \file +-// \brief A file containing utility functions for other tests +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include +- +-void init_tree(boct_tree *tree, unsigned i); +- +-boxm_scene >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2); +- +-void clean_up(); +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/CMakeLists.txt b/contrib/brl/bseg/boxm/util/CMakeLists.txt +deleted file mode 100644 +index 10f3b5fd49..0000000000 +--- a/contrib/brl/bseg/boxm/util/CMakeLists.txt ++++ /dev/null +@@ -1,23 +0,0 @@ +-# brl/bseg/boxm/util/CMakeLists.txt +-include_directories( ${MUL_INCLUDE_DIR} ) +-set(boxm_util_sources +- boxm_cell_data_traits.h boxm_cell_data_traits.cxx +- boxm_plane_ransac.h +- boxm_quad_scan_iterator.h boxm_quad_scan_iterator.cxx +- boxm_rational_camera_utils.h boxm_rational_camera_utils.cxx +- boxm_raytrace_operations.h boxm_raytrace_operations.cxx +- boxm_triangle_interpolation_iterator.h boxm_triangle_interpolation_iterator.hxx +- boxm_triangle_scan_iterator.h boxm_triangle_scan_iterator.cxx +- boxm_utils.h boxm_utils.cxx +- boxm_vrml_util.h +- boxm_test_util.h boxm_test_util.cxx +- ) +- +-aux_source_directory(Templates boxm_util_sources) +- +-vxl_add_library(LIBRARY_NAME boxm_util LIBRARY_SOURCES ${boxm_util_sources}) +-target_link_libraries(boxm_util boxm boxm_sample bvrml boct bsta ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +diff --git a/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx b/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx +deleted file mode 100644 +index 3a276cc3b2..0000000000 +--- a/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BOXM_TRIANGLE_INTERPOLATION_ITERATOR_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx b/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx +deleted file mode 100644 +index b4bf234941..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx ++++ /dev/null +@@ -1,25 +0,0 @@ +-#include "boxm_cell_data_traits.h" +-//: +-// \file +- +- +-//: Template specialization of zero_val for floating point case +-template <> +-float boxm_zero_val() +-{ +- return 0.0f; +-} +- +- +-//: Template specialization of zero_val for unimodal gaussian +-template <> +-bsta_num_obs boxm_zero_val >() +-{ +- return {}; +-} +- +-template <> +-mix_gauss_sf1_type boxm_zero_val() +-{ +- return {}; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h b/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h +deleted file mode 100644 +index c96599e730..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h ++++ /dev/null +@@ -1,89 +0,0 @@ +-// This is brl/bseg/boxm/util/boxm_cell_data_traits.h +-#ifndef boxm_cell_data_traits_h_ +-#define boxm_cell_data_traits_h_ +-//: +-// \file +-// \brief Set of accessors of cell's data, taking care of different datatypes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date December 9, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-//: Float to float +-template +-float boxm_cell_to_float(boct_tree_cell* cell, double /*step_len*/) +-{ +- //return 1.0 - std::exp(-cell->data()*step_len); +- return cell->data(); +-} +- +-//: Float to float +-template +-float boxm_cell_to_float(boct_tree_cell* cell, double /*step_len*/) +-{ +- return (float)cell->data(); +-} +- +-//: bool to float +-template +-float boxm_cell_to_float(boct_tree_cell* cell, double /*step_len*/) +-{ +- return (float)cell->data(); +-} +- +-//: Mixture of gaussians to float; return the mean +-template +-float boxm_cell_to_float(boct_tree_cell >* cell, double /*step_len*/) +-{ +- return cell->data().mean(); +-} +- +-//: Mixture of gaussians to float; return the mean +-template +-float boxm_cell_to_float(boct_tree_cell::apm_datatype >* cell, double /*step_len*/) +-{ +- return cell->data().expected_value(); +-} +- +-//: boxm_sample to float. Return the probability values +-template +-float boxm_cell_to_float(boct_tree_cell* cell, double step_len) +-{ +- return 1.f - float(std::exp(-cell->data().basic_val()*step_len)); +-} +- +- +-template +-T_data boxm_zero_val() +-{ +- return T_data(0); +-} +- +-static const unsigned int n_gaussian_modes_ = 3; +-typedef bsta_num_obs gauss_type_sf1; +-typedef bsta_num_obs > mix_gauss_sf1_type; +-template <> +-mix_gauss_sf1_type boxm_zero_val(); +- +-template <> +-bsta_num_obs boxm_zero_val >(); +- +-template <> +-float boxm_zero_val(); +- +-//: boxm_scalar_sample to float. Return the normalized scalar value +-template +-float boxm_cell_to_float(boct_tree_cell >* cell, double /*step_len*/) +-{ +- return cell->data().basic_val(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h b/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h +deleted file mode 100644 +index 07d10348a6..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h ++++ /dev/null +@@ -1,126 +0,0 @@ +-#ifndef boxm_plane_ransac_h_ +-#define boxm_plane_ransac_h_ +-//: +-// \file +-// \brief class to find the optimal intersecting 3D line of a set of 3D planes. +-// +-// \author G. Tunali +-// +-// \verbatim +-// Modifications +-// Ozge C. Ozcanli July 7, 2010 : made some internal hard-coded defaults into parameters +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#define ITER_MAX 100 +- +-template +-bool boxm_plane_ransac(std::vector > aux_samples, +- std::vector /*weights*/, +- vgl_infinite_line_3d& line, +- T &min_res, vgl_box_3d cell_global_box, +- unsigned int threshold, float ortho_thres = 0.01f, float volume_ratio = 128.0f) +-{ +- unsigned int num_imgs = aux_samples.size(); +- +- vgl_point_3d local_origin((T)cell_global_box.centroid_x(),(T)cell_global_box.centroid_y(),(T)cell_global_box.centroid_z()); +- std::list > fit_planes; +- min_res=T(1e10); +- line=vgl_infinite_line_3d(vgl_vector_2d(-10000,-10000),vgl_vector_3d(0,0,1)); +- std::vector ws; +- bool set=false; +- // this threshold is to check participation from number of images +- if (num_imgs<=threshold) +- return set; +- +- for (unsigned iter=0; iter plane1 = aux_samples[index1].obs(index1_1).plane_; +- vgl_plane_3d plane2 = aux_samples[index2].obs(index2_1).plane_; +- +- vgl_infinite_line_3d inters_line; +- // form a hypothesis +- if (vgl_intersection(plane1, plane2, inters_line)) +- { +- vgl_vector_3d line_dir = inters_line.direction(); +- vgl_point_3d p=vgl_closest_point(inters_line,local_origin); +- int cnt_imgs=0; +- // only if the hypothesis is close to the cell in consideration +- // can be made more tighter. +- if (vgl_distance(p,local_origin)<0.67*cell_global_box.width()) +- { +- for (unsigned i=0; i plane = aux_samples[i].obs(j).plane_; +- vgl_vector_3d normal = plane.normal(); +- // see if the line direction and plane normal is perpendicular +- T res = dot_product(normal,line_dir); +- if (std::fabs(res) < T(ortho_thres)) { // ortho_thres, used to be hard-coded to 0.05, then made a param with default 0.01 (stricter) +- // check to see if the line is close to the plane +- if (plane.contains(p,T(cell_global_box.width())/T(volume_ratio))) // volume_ratio, used to be hard-coded to 8, then made a param with default 128 (stricter) +- { +- fit_planes.push_back(plane); +- //ws.push_back(weights[i]); +- ws.push_back(aux_samples[i].obs(j).seg_len_); +- flag=true; +- } +- } +- } +- if (flag) +- cnt_imgs++; +- } +- } +- +- // intersect the selected planes +- if (cnt_imgs > (int)threshold ) { +- T res=0; +- vgl_infinite_line_3d l; +- bool good = vgl_intersection(fit_planes, ws, l, res); +- vgl_point_3d p0,p1; +- vgl_vector_2d x0(l.x0().x(), l.x0().y()); +- vgl_vector_3d dir(l.direction().x(), l.direction().y(), l.direction().z()); +- +- if (good&&vgl_intersection(cell_global_box, vgl_infinite_line_3d(x0,dir), p0, p1)) { +- if (res +-#include +-#include +-#include +-#include "boxm_quad_scan_iterator.h" +-//: +-// \file +-#ifdef _MSC_VER +-# include +-#endif +- +-//: constructor +-boxm_quad_scan_iterator::boxm_quad_scan_iterator(double *verts_x, double *verts_y, +- unsigned int v0, unsigned int v1, +- unsigned int v2, unsigned int v3):poly_() +-{ +- poly_.new_sheet(); +- +- poly_.push_back(verts_x[v0] * supersample_ratio_ - 0.5, +- verts_y[v0] * supersample_ratio_ - 0.5); +- poly_.push_back(verts_x[v1] * supersample_ratio_ - 0.5, +- verts_y[v1] * supersample_ratio_ - 0.5); +- poly_.push_back(verts_x[v2] * supersample_ratio_ - 0.5, +- verts_y[v2] * supersample_ratio_ - 0.5); +- poly_.push_back(verts_x[v3] * supersample_ratio_ - 0.5, +- verts_y[v3] * supersample_ratio_ - 0.5); +- +- super_it_= new vgl_polygon_scan_iterator(poly_,false); +- +- poly_bb_.update(verts_x[v0], verts_y[v0]); +- poly_bb_.update(verts_x[v1], verts_y[v1]); +- poly_bb_.update(verts_x[v2], verts_y[v2]); +- poly_bb_.update(verts_x[v3], verts_y[v3]); +- +- int poly_xmin = (int)std::floor(poly_bb_.xmin()); +- int poly_xmax = (int)std::floor(poly_bb_.xmax()) + 1; +- poly_diameter_x_ = (poly_xmax - poly_xmin) + 1; +- aa_vals_ = new float[poly_diameter_x_]; +- aa_vals_offset_ = -poly_xmin; +- next_return_ = false; +-} +- +- +-//: Resets the scan iterator to before the first scan line +-// After calling this function, next() needs to be called before +-// startx() and endx() form a valid scan line. +-void boxm_quad_scan_iterator::reset() +-{ +- super_it_->reset(); +- next_return_ = super_it_->next(); +- while (next_return_ && super_it_->scany() < 0) { +- next_return_ = super_it_->next(); +- } +-} +- +-//: Tries to move to the next scan line. +-// Returns false if there are no more scan lines. +-bool boxm_quad_scan_iterator::next() +-{ +- if (!next_return_) { +- return false; +- } +- int super_scany = super_it_->scany(); +- scany_ = super_scany / supersample_ratio_; // super_scany should always be >= 0 +- +- // initialize startx_ and endx_ +- startx_ = int(poly_bb_.xmax()) + 1; +- endx_ = int(poly_bb_.xmin()) - 1; +- +- // compute antialiasing values for each pixel in scanline +- //std::fill(aa_vals_.begin(), aa_vals_.end(), 0.0f); +- for (unsigned int i=0; istartx(); +- int super_endx = super_it_->endx() + 1; +- +- super_startx = std::max(0, super_startx); +- super_endx = std::max(0, super_endx); +- // make sure super_startx < super_endx +- if (super_endx > super_startx) { +- int scanline_startx = super_startx / supersample_ratio_; +- int scanline_endx = ((super_endx - 1)/ supersample_ratio_) + 1; +- // update startx and endx +- if (scanline_startx < startx_) { +- startx_ = scanline_startx; +- } +- if (scanline_endx > endx_) { +- endx_ = scanline_endx; +- } +- // case 1: run covers 1 superpixel only +- if (scanline_startx + 1 == scanline_endx) { +- aa_vals_[aa_vals_offset_ + scanline_startx] += increment*(super_endx - super_startx); +- } +- // case 2: startx is less than endx by more than 1 +- else { +- // partial coverage at the beginning of scanline +- aa_vals_[aa_vals_offset_ + scanline_startx] += increment*(supersample_ratio_ - (super_startx % supersample_ratio_)); +- +- // full coverage in middle of scanline +- for (int x = scanline_startx + 1; x < scanline_endx-1; ++x) { +- aa_vals_[aa_vals_offset_ + x] += full_increment; +- } +- // partial coverage at end of scanline +- aa_vals_[aa_vals_offset_ + scanline_endx - 1] += increment*((super_endx - 1)% supersample_ratio_ + 1); +- } +- } +- next_return_ = super_it_->next(); +- super_scany = super_it_->scany(); +- } +- return true; +-} +- +-//: y-coordinate of the current scan line. +-int boxm_quad_scan_iterator::scany() const +-{ +- return scany_; +-} +- +-//: Returns starting x-value of the current scan line. +-// startx() should be smaller than endx(), unless the scan line is empty +-int boxm_quad_scan_iterator::startx() const +-{ +- return startx_; +-} +- +-//: Returns ending x-value of the current scan line. +-// endx() should be larger than startx(), unless the scan line is empty +-int boxm_quad_scan_iterator::endx() const +-{ +- return endx_; +-} +- +-//: returns the amount of pixel at location x in the current scanline covered by the triangle +-float boxm_quad_scan_iterator::pix_coverage(int x) +-{ +- return aa_vals_[aa_vals_offset_ + x]; +-} +- +-bool +-boxm_quad_scan_iterator:: x_start_end_val(const double * vals,double & start_val,double & end_val) +-{ +- int * chainnum=nullptr; +- int * vertnum=nullptr; +- int numcrossedges=0; +- super_it_->get_crossedge_vertices(chainnum,vertnum,numcrossedges); +- if (numcrossedges==2) +- { +- for (int i=0;i p1=poly_[chainnum[i]][vertnum[i]]; +- double val1=vals[vertnum[i]]; +- double val2=0; +- vgl_point_2d p2; +- if (vertnum[i]==3) +- { +- val2=vals[0]; +- p2=poly_[chainnum[i]][0]; +- } +- else +- { +- val2=vals[vertnum[i]+1]; +- p2=poly_[chainnum[i]][vertnum[i]+1]; +- } +- if (i==0) +- start_val=val1+(val2-val1)*(super_it_->scany()-p1.y())/(p2.y()-p1.y()); +- else +- end_val=val1+(val2-val1)*(super_it_->scany()-p1.y())/(p2.y()-p1.y()); +- } +- delete [] vertnum; +- delete [] chainnum; +- return true; +- } +- else +- return false; +-} +- +- +-boxm_quad_scan_iterator::~boxm_quad_scan_iterator() +-{ +- delete super_it_; +- delete[] aa_vals_; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h b/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h +deleted file mode 100644 +index 86c7bd0565..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h ++++ /dev/null +@@ -1,66 +0,0 @@ +-#ifndef boxm_quad_scan_iterator_h_ +-#define boxm_quad_scan_iterator_h_ +-//: +-// \file +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-class boxm_quad_scan_iterator : public vgl_region_scan_iterator +-{ +- public: +- //: constructor +- boxm_quad_scan_iterator(double *verts_x, double *verts_y, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2, unsigned int v3 = 3); +- ~boxm_quad_scan_iterator() override; +- +- //: Resets the scan iterator to before the first scan line +- // After calling this function, next() needs to be called before +- // startx() and endx() form a valid scan line. +- void reset() override; +- +- //: Tries to move to the next scan line. +- // Returns false if there are no more scan lines. +- bool next() override; +- +- //: y-coordinate of the current scan line. +- int scany() const override; +- +- //: Returns starting x-value of the current scan line. +- // startx() should be smaller than endx(), unless the scan line is empty +- int startx() const override; +- +- //: Returns ending x-value of the current scan line. +- // endx() should be larger than startx(), unless the scan line is empty +- int endx() const override; +- +- //: returns the amount of pixel at location x in the current scanline covered by the triangle +- float pix_coverage(int x); +- +- bool x_start_end_val(const double * vals,double & start_val,double & end_val); +- +- +- protected: +- static const unsigned int supersample_ratio_ = 1; +- vgl_polygon_scan_iterator * super_it_; +- vgl_polygon poly_; +- +- int startx_; +- int endx_; +- int scany_; +- bool next_return_; +- +- unsigned int poly_diameter_x_; +- float* aa_vals_; +- int aa_vals_offset_; +- +- vbl_bounding_box poly_bb_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx b/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx +deleted file mode 100644 +index 4ffdd47b22..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx ++++ /dev/null +@@ -1,36 +0,0 @@ +-#include "boxm_rational_camera_utils.h" +-#include +- +-vgl_plane_3d +-boxm_rational_camera_utils::boxm_find_parallel_image_plane(vpgl_rational_camera * rcam, +- vgl_plane_3d top, +- vgl_plane_3d bottom, +- unsigned ni, unsigned nj) +-{ +- vgl_point_3d top_guess(0,0,-top.d()/top.c()); +- vgl_point_3d bottom_guess(0,0,-bottom.d()/bottom.c()); +- vpgl_backproject::bproj_plane(*rcam,vgl_point_2d(ni/2,nj/2),top,top_guess,top_guess); +- vpgl_backproject::bproj_plane(*rcam,vgl_point_2d(ni/2,nj/2),bottom,bottom_guess,bottom_guess); +- +- vgl_plane_3d parallelplane(bottom_guess-top_guess,top_guess); +- +- return parallelplane; +-} +- +-void +-boxm_rational_camera_utils::project_corners_rational_camera(std::vector > const& corners, +- vpgl_rational_camera * rcam,vgl_plane_3d plane, +- double* xverts, double* yverts, +- float* vertdist) +-{ +- double a=plane.a(); +- double b=plane.b(); +- double c=plane.c(); +- double d=plane.d(); +- double denom=std::sqrt(a*a+b*b+c*c); +- for (unsigned i=0; iproject(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]); +- vertdist[i]=float((corners[i].x()*a+corners[i].y()*b+corners[i].z()*c+d)/denom); +- } +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h b/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h +deleted file mode 100644 +index 61c9252276..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-#ifndef boxm_rational_camera_utils_h +-#define boxm_rational_camera_utils_h +- +-#include +-#include +-#include +-#include +- +-class boxm_rational_camera_utils +-{ +- public: +- static vgl_plane_3d boxm_find_parallel_image_plane(vpgl_rational_camera * rcam, +- vgl_plane_3d top, +- vgl_plane_3d bottom, +- unsigned ni, unsigned nj); +- static void project_corners_rational_camera(std::vector > const& corners, +- vpgl_rational_camera * rcam,vgl_plane_3d plane, +- double* xverts, double* yverts, +- float* vertdist); +-}; +- +-class abs_functor +-{ +- public: +- abs_functor()= default; +- +- float operator()(float x) const { return std::fabs(x); } +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx b/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx +deleted file mode 100644 +index 1b1a95623b..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx ++++ /dev/null +@@ -1,232 +0,0 @@ +-#include "boxm_raytrace_operations.h" +- +-bool boxm_alpha_seg_len(double *xverts_2d, double* yverts_2d, float* vert_distances, boct_face_idx visible_faces, float alpha, vil_image_view &alpha_distance) +-{ +- // multiply each vertex distance by alpha +- float vert_alpha_distances[8]; +- float *vert_dist_ptr = vert_distances; +- float *vert_alpha_dist_ptr = vert_alpha_distances; +- for (unsigned int i=0; i<8; ++i) { +- *vert_alpha_dist_ptr++ = *vert_dist_ptr++ * alpha; +- } +- +- // for each face, create two triangle iterators and fill in pixel data +- // X_LOW +- // tri 0 +- boxm_triangle_interpolation_iterator tri_it(xverts_2d, yverts_2d, vert_alpha_distances, 0, 4, 3); +- if (visible_faces & X_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 4, 7, 3); +- if (visible_faces & X_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- +- // X_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 1, 2, 5); +- if (visible_faces & X_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 2, 6, 5); +- if (visible_faces & X_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- +- // Y_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 0, 1, 5); +- if (visible_faces & Y_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 0, 5, 4); +- if (visible_faces & Y_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- // Y_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 3, 2, 6); +- if (visible_faces & Y_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 3, 6, 7); +- if (visible_faces & Y_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- // Z_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 0, 1, 2); +- if (visible_faces & Z_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 0, 2, 3); +- if (visible_faces & Z_LOW) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- // Z_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 4, 5, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_alpha_distances, 4, 7, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolate_values(tri_it, alpha_distance, true); +- else +- tri_interpolate_values(tri_it, alpha_distance, false); +- +- return true; +-} +- +- +-bool boxm_depth_fill(double *xverts_2d, double* yverts_2d, +- float* vert_distances, boct_face_idx visible_faces, +- vil_image_view &depth_image) +-{ +- // for each face, create two triangle iterators and fill in pixel data +- // X_LOW +- // tri 0 +- boxm_triangle_interpolation_iterator tri_it(xverts_2d, yverts_2d, vert_distances, 0, 4, 3); +- if (visible_faces & X_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 4, 7, 3); +- if (visible_faces & X_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- +- +- // X_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 1, 2, 5); +- if (visible_faces & X_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 2, 6, 5); +- if (visible_faces & X_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- +- +- // Y_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 0, 1, 5); +- if (visible_faces & Y_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 0, 5, 4); +- if (visible_faces & Y_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- +- // Y_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 3, 2, 6); +- if (visible_faces & Y_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 3, 6, 7); +- if (visible_faces & Y_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- +- // Z_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 0, 1, 2); +- if (visible_faces & Z_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 0, 2, 3); +- if (visible_faces & Z_LOW) +- tri_interpolate_values(tri_it, depth_image, true); +- +- // Z_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 4, 5, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_distances, 4, 7, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolate_values(tri_it, depth_image, true); +- +- return true; +-} +- +- +-bool cube_fill_value(double* xverts_2d, double* yverts_2d, boct_face_idx visible_faces, vil_image_view &img, float const& val) +-{ +- // for each face, create two triangle iterators and fill in pixel data +- boxm_triangle_scan_iterator tri_it(xverts_2d, yverts_2d, 0,4,3); +- if (visible_faces & X_LOW) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 4, 3); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 7, 3); +- tri_fill_value(tri_it, img, val); +- } +- if (visible_faces & X_HIGH) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 1, 2, 5); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 2, 6, 5); +- tri_fill_value(tri_it, img, val); +- } +- if (visible_faces & Y_LOW) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 1, 5); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 5, 4); +- tri_fill_value(tri_it, img, val); +- } +- if (visible_faces & Y_HIGH) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 3, 2, 6); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 3, 6, 7); +- tri_fill_value(tri_it, img, val); +- } +- if (visible_faces & Z_LOW) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 1, 2); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 2, 3); +- tri_fill_value(tri_it, img, val); +- } +- if (visible_faces & Z_HIGH) { +- // tri 0 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 5, 6); +- tri_fill_value(tri_it, img, val); +- // tri 1 +- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 7, 6); +- tri_fill_value(tri_it, img, val); +- } +- return true; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h b/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h +deleted file mode 100644 +index ee6147127b..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h ++++ /dev/null +@@ -1,452 +0,0 @@ +-#ifndef boxm_raytrace_operations_h_ +-#define boxm_raytrace_operations_h_ +-//: +-// \file +- +-#include +-#include "boxm_triangle_interpolation_iterator.h" +-#include "boxm_triangle_scan_iterator.h" +-#include +- +-#include +-#include +-#include +-#include +- +-#if 0 +-#ifdef _MSC_VER +-# include +-#endif +-#endif +- +-bool cube_fill_value(double* xverts_2d, double* yverts_2d, boct_face_idx visible_faces, vil_image_view &img, float const& val); +- +-bool boxm_alpha_seg_len(double *xverts_2d, double* yverts_2d, float* vert_distances, boct_face_idx visible_faces, float alpha, vil_image_view &alpha_distance); +-bool boxm_depth_fill(double *xverts_2d, double* yverts_2d, +- float* vert_distances, boct_face_idx visible_faces, +- vil_image_view &depth_image); +-template +-bool tri_interpolated_weighted_sum(tri_int_it_t &tri_it, vil_image_view const& values, T &val_sum, float &weight_sum, bool subtract) +-{ +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= values.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)values.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)values.ni(),tri_it.endx()); +- +- if (subtract) { +- for (unsigned int x = startx; x < endx; ++x) { +- float point_dist = tri_it.value_at(x); +- val_sum -= values(x,yu) * point_dist; +- weight_sum -= point_dist; +- } +- } +- else { +- for (unsigned int x = startx; x < endx; ++x) { +- float point_dist = tri_it.value_at(x); +- val_sum += values(x,yu) * point_dist; +- weight_sum += point_dist; +- } +- } +- } +- return true; +-} +- +-//: returns the sum of the weights +-template +-bool tri_interpolated_weighted_sum(tri_it_t &tri_it, vil_image_view const& weights, vil_image_view const& values, T2 &val_sum, T1 &weight_sum, bool subtract=false) +-{ +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= values.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)values.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)values.ni(),tri_it.endx()); +- +- if (subtract) { +- for (unsigned int x = startx; x < endx; ++x) { +- T1 weight = tri_it.value_at(x)*weights(x,yu); +- val_sum -= weight * values(x,yu); +- weight_sum -= weight; +- } +- } +- else { +- for (unsigned int x = startx; x < endx; ++x) { +- T1 weight = tri_it.value_at(x)*weights(x,yu); +- val_sum += weight * values(x,yu); +- weight_sum += weight; +- } +- } +- } +- return true; +-} +- +- +-template +-void tri_interpolate_values(tri_it_t &tri_it, vil_image_view &img, bool subtract = false) +-{ +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx()); +- +- if (subtract) { +- for (unsigned int x = startx; x < endx; ++x) { +- img(x,yu) -= tri_it.value_at(x); +- } +- } +- else { +- for (unsigned int x = startx; x < endx; ++x) { +- img(x,yu) += tri_it.value_at(x); +- } +- } +- } +- return; +-} +- +- +-#if 0 +-template +-void tri_interpolate_values(tri_it_T &tri_it, double* xvals, double* yvals, T* vals, vil_image_view &img, vil_image_view &pix_coverage, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2) +-{ +- // first compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle +- // (no need to compute barycentric coordinates at each step) +- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel) +- double Acol0[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5}; +- double Acol1[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5}; +- double Acol2[] = {1.0, 1.0, 1.0}; +- +- double Z[] = {vals[v0], vals[v1], vals[v2]}; +- +- double detA = vnl_determinant(Acol0, Acol1, Acol2); +- double s0 = vnl_determinant(Z, Acol1, Acol2) / detA; +- double s1 = vnl_determinant(Acol0, Z, Acol2) / detA; +- double s2 = vnl_determinant(Acol0, Acol1, Z) / detA; +- +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu > img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- T interp_val = (T)(s0*x + s1*y + s2); +- if ( (min_img(x,yu) == 0) || (min_img(x,yu) > interp_val) ) { +- min_img(x,yu) = interp_val; +- } +- if (max_img(x,yu) < interp_val) { +- max_img(x,yu) = interp_val; +- } +- } +- } +- return; +-} +-#endif +- +-template +-void tri_interpolate_min_max(tri_it_T &tri_it, double* xvals, double* yvals, T* vals, vil_image_view &min_img, vil_image_view &max_img, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2) +-{ +- // first compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle +- // (no need to compute barycentric coordinates at each step) +- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel) +- double Acol0[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5}; +- double Acol1[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5}; +- double Acol2[] = {1.0, 1.0, 1.0}; +- +- double Z[] = {vals[v0], vals[v1], vals[v2]}; +- +- double detA = vnl_determinant(Acol0, Acol1, Acol2); +- double s0 = vnl_determinant(Z, Acol1, Acol2) / detA; +- double s1 = vnl_determinant(Acol0, Z, Acol2) / detA; +- double s2 = vnl_determinant(Acol0, Acol1, Z) / detA; +- +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= max_img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)max_img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)max_img.ni(),tri_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- T interp_val = (T)(s0*x + s1*y + s2); +- if ( (min_img(x,yu) == 0) || (min_img(x,yu) > interp_val) ) { +- min_img(x,yu) = interp_val; +- } +- if (max_img(x,yu) < interp_val) { +- max_img(x,yu) = interp_val; +- } +- } +- } +- return; +-} +- +-template +-void tri_weighted_sum(vgl_triangle_scan_iterator &tri_it, vil_image_view &img, vil_image_view &weights, T1 &val_sum, T2 &weight_sum) +-{ +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- val_sum += img(x,yu)*weights(x,yu); +- weight_sum += weights(x,yu); +- } +- } +- return; +-} +- +-template +-void tri_fill_value(tri_it_T &tri_it, vil_image_view &img, T val) +-{ +- tri_it.reset(); +- while (tri_it.next()) { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- img(x,yu) = val; +- } +- } +- return; +-} +- +-#if 0 // this function commented out +-template +-void tri_fill_value_aa(boxm_triangle_scan_iterator_aa &tri_it, vil_image_view &img, vil_image_view &aa_weights, T val) +-{ +- tri_it.reset(); +- while (tri_it.next()) +- { +- int y = tri_it.scany(); +- if (y < 0) { +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- float pix_cov = tri_it.pix_coverage(x); +- if ((pix_cov < 0.0f) || (pix_cov > 1.0f)) { +- std::cerr << " error: pix_cov = " << pix_cov << std::endl; +- } +- aa_weights(x,yu) += tri_it.pix_coverage(x); +- img(x,yu) += val * pix_cov; +- } +- } +- return; +-} +-#endif // 0 +- +-template +-bool cube_mean(double* xverts_2d, double* yverts_2d, float* vert_dists, boct_face_idx visible_faces, vil_image_view const& values, T &mean) +-{ +- // for each face, create two triangle iterators to interpolate distances +- T value_sum(0); +- float weight_sum(0); +- // X_LOW +- // tri 0 +- boxm_triangle_interpolation_iterator tri_it(xverts_2d, yverts_2d, vert_dists, 0, 3, 4); +- if (visible_faces & X_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 3, 4, 7); +- if (visible_faces & X_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // X_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 1, 2, 5); +- if (visible_faces & X_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 2, 5, 6); +- if (visible_faces & X_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // Y_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 0, 1, 5); +- if (visible_faces & Y_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 4, 0, 5); +- if (visible_faces & Y_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // Y_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 7, 3, 2); +- if (visible_faces & Y_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 2, 6, 7); +- if (visible_faces & Y_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // Z_LOW +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 0, 2, 1); +- if (visible_faces & Z_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 0, 2, 3); +- if (visible_faces & Z_LOW) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- // Z_HIGH +- // tri 0 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 4, 5, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- // tri 1 +- tri_it = boxm_triangle_interpolation_iterator(xverts_2d, yverts_2d, vert_dists, 4, 7, 6); +- if (visible_faces & Z_HIGH) +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true); +- else +- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false); +- +- if (std::fabs(weight_sum) > 1e-6) { +- mean = value_sum / weight_sum; +- } +- else { +- mean = T(0); +- return false; +- } +- return true; +-} +- +-inline void init_triangle_scan_iterator(vgl_triangle_scan_iterator &tri_it, const double* xverts, const double* yverts, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2) +-{ +- // subtract 0.5 to follow convention that the center of pixel i,j is located at coordinates i+0.5, j+0.5 +- tri_it.a.x = xverts[v0] - 0.5; tri_it.a.y = yverts[v0] - 0.5; +- tri_it.b.x = xverts[v1] - 0.5; tri_it.b.y = yverts[v1] - 0.5; +- tri_it.c.x = xverts[v2] - 0.5; tri_it.c.y = yverts[v2] - 0.5; +-} +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_test_util.cxx b/contrib/brl/bseg/boxm/util/boxm_test_util.cxx +deleted file mode 100644 +index 1586ba9fcd..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_test_util.cxx ++++ /dev/null +@@ -1,141 +0,0 @@ +-#include "boxm_test_util.h" +-#include +-#include +-#include +- +-void generate_persp_camera(double focal_length, +- vgl_point_2d& pp, //principal point +- double x_scale, double y_scale, +- vgl_point_3d& camera_center, +- vpgl_perspective_camera& cam) +-{ +- vpgl_calibration_matrix K(focal_length,pp, x_scale, y_scale); +- cam.set_calibration(K); +- cam.set_camera_center(camera_center); +-} +- +-vpgl_rational_camera +-perspective_to_rational(vpgl_perspective_camera& cam_pers) +-{ +- vnl_matrix_fixed cam_pers_matrix = cam_pers.get_matrix(); +- std::vector neu_u,den_u,neu_v,den_v; +- double x_scale = 1.0, x_off = 0.0, +- y_scale = 1.0, y_off = 0.0, +- z_scale = 1.0, z_off = 0.0, +- u_scale = 1.0, u_off = 0.0, +- v_scale = 1.0, v_off = 0.0; +- +- for (int i=0; i<20; i++) { +- neu_u.push_back(0.0); +- neu_v.push_back(0.0); +- den_u.push_back(0.0); +- den_v.push_back(0.0); +- } +- +- int vector_map[] = {9,15,18,19}; +- +- for (int i=0; i<4; i++) { +- neu_u[vector_map[i]] = cam_pers_matrix(0,i); +- neu_v[vector_map[i]] = cam_pers_matrix(1,i); +- den_u[vector_map[i]] = cam_pers_matrix(2,i); +- den_v[vector_map[i]] = cam_pers_matrix(2,i); +- } +- +- vpgl_rational_camera cam_rat(neu_u,den_u,neu_v,den_v, +- x_scale,x_off,y_scale,y_off,z_scale,z_off, +- u_scale,u_off,v_scale,v_off); +- return cam_rat; +-} +- +-vpgl_camera_double_sptr generate_camera_top(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U*0.5, IMAGE_V*0.5); +- +- vgl_point_3d centroid = world.centroid(); +- vgl_point_3d camera_center(centroid.x(), centroid.y(), centroid.z()+boxm_camera_dist); +- +- std::vector rat_cameras; +- +- vpgl_perspective_camera persp_cam; +- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam); +- double r[] = { 1, 0, 0, +- 0, -1, 0, +- 0, 0, -1 }; +- +- vnl_matrix_fixed R(r); +- persp_cam.set_rotation(vgl_rotation_3d(R)); +- +- //persp_cam.look_at(vgl_homg_point_3d(centroid)); +- vpgl_rational_camera* rat_cam = new vpgl_rational_camera(perspective_to_rational(persp_cam)); +- return rat_cam; +-} +- +-vpgl_camera_double_sptr generate_camera_top_persp(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U*0.5, IMAGE_V*0.5); +- +- vgl_point_3d centroid = world.centroid(); +- vgl_point_3d camera_center(centroid.x(), centroid.y(), centroid.z()+boxm_camera_dist); +- +- std::vector rat_cameras; +- +- auto * persp_cam= new vpgl_perspective_camera(); +- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, *persp_cam); +- persp_cam->look_at(vgl_homg_point_3d(centroid)); +- return persp_cam; +-} +- +-std::vector generate_cameras_diagonal(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_line_3d_2_points diag(world.min_point(), world.max_point()); +- +- std::vector > centers; +- unsigned i=0; +- for (double t=0; t<=1.0; t+=0.1) { +- vgl_point_3d centroid = diag.point_t(1-t); +- centers.push_back(centroid); +- std::cout << centers[i++] << std::endl; +- } +- +- std::vector cameras; +- for (auto camera_center : centers) +- { +- vpgl_perspective_camera persp_cam; +- generate_persp_camera(boxm_focal_length, principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam); +- persp_cam.look_at(vgl_homg_point_3d(0,0,0)); //camera_center.x()+10, camera_center.y()+10, camera_center.z())); +- cameras.push_back(new vpgl_perspective_camera(persp_cam)); +- } +- return cameras; +-} +- +-std::vector generate_cameras_circular(vgl_box_3d& world) +-{ +- vgl_point_2d principal_point(IMAGE_U/2., IMAGE_V/2.); +- +- vgl_line_3d_2_points diag(world.min_point(), world.max_point()); +- +- std::vector > centers; +- vgl_point_3d centroid(0,0,0); +- double x,y; +- double alpha = 0; +- double delta_alpha = vnl_math::pi/9.; +- for (unsigned i=0; i<11; i++) { +- x = boxm_camera_dist*std::cos(alpha); +- y = boxm_camera_dist*std::sin(alpha); +- centers.emplace_back(centroid.x()+x, centroid.y()+y, centroid.z()); +- std::cout << centers[i] << std::endl; +- alpha += delta_alpha; +- } +- +- std::vector cameras; +- for (auto camera_center : centers) +- { +- vpgl_perspective_camera persp_cam; +- generate_persp_camera(boxm_focal_length, principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam); +- persp_cam.look_at(vgl_homg_point_3d(0,0,0)); //camera_center.x()+10, camera_center.y()+10, camera_center.z())); +- cameras.push_back(new vpgl_perspective_camera(persp_cam)); +- } +- return cameras; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_test_util.h b/contrib/brl/bseg/boxm/util/boxm_test_util.h +deleted file mode 100644 +index b960b6d3c7..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_test_util.h ++++ /dev/null +@@ -1,37 +0,0 @@ +-#ifndef boxm_test_util_h +-#define boxm_test_util_h +-//: +-// \file +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +- +-constexpr int IMAGE_U = 800; +-constexpr int IMAGE_V = 500; +-constexpr int boxm_x_scale = 500; +-constexpr int boxm_y_scale = 500; +-constexpr double boxm_focal_length = 1.0; +-constexpr double boxm_camera_dist = 300; +-constexpr unsigned num_train_images = 20; +-constexpr bool verbose = true; +- +-void generate_persp_camera(double focal_length, +- vgl_point_2d& pp, //principal point +- double x_scale, double y_scale, +- vgl_point_3d& camera_center, +- vpgl_perspective_camera& cam); +- +-vpgl_rational_camera +-perspective_to_rational(vpgl_perspective_camera& cam_pers); +- +-vpgl_camera_double_sptr generate_camera_top(vgl_box_3d& world); +- +-vpgl_camera_double_sptr generate_camera_top_persp(vgl_box_3d& world); +- +-//: create a trajectory of perspective cameras at the diagonal of world (inside) +-std::vector generate_cameras_diagonal(vgl_box_3d& world); +- +-std::vector generate_cameras_circular(vgl_box_3d& world); +-#endif // boxm_test_util_h +diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h b/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h +deleted file mode 100644 +index e3561eb3b5..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h ++++ /dev/null +@@ -1,53 +0,0 @@ +-#ifndef boxm_triangle_interpolation_iterator_h_ +-#define boxm_triangle_interpolation_iterator_h_ +-//: +-// \file +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-template +-class boxm_triangle_interpolation_iterator : public vgl_region_scan_iterator +-{ +- public: +- //: constructor +- boxm_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *values, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2); +- +- //: Resets the scan iterator to before the first scan line +- // After calling this function, next() needs to be called before +- // startx() and endx() form a valid scan line. +- void reset() override; +- +- //: Tries to move to the next scan line. +- // Returns false if there are no more scan lines. +- bool next() override; +- +- //: y-coordinate of the current scan line. +- int scany() const override; +- +- //: Returns starting x-value of the current scan line. +- // startx() should be smaller than endx(), unless the scan line is empty +- int startx() const override; +- +- //: Returns ending x-value of the current scan line. +- // endx() should be larger than startx(), unless the scan line is empty +- int endx() const override; +- +- //: returns the interpolated value at location x in the current scanline +- T value_at(int x); +- +- protected: +- +- vgl_triangle_scan_iterator tri_it_; +- +- double s0_; +- double s1_; +- double s2_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx b/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx +deleted file mode 100644 +index 8ea38cb6c3..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx ++++ /dev/null +@@ -1,100 +0,0 @@ +-#ifndef boxm_triangle_interpolation_iterator_hxx_ +-#define boxm_triangle_interpolation_iterator_hxx_ +-//: +-// \file +- +-#include +-#include +-#include +-#include +-#include "boxm_triangle_interpolation_iterator.h" +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +- +-//: constructor +-template +-boxm_triangle_interpolation_iterator::boxm_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *vals, unsigned int v0, unsigned int v1, unsigned int v2) +-: tri_it_() +-{ +- tri_it_.a.x = verts_x[v0] - 0.5; +- tri_it_.a.y = verts_y[v0] - 0.5; +- tri_it_.b.x = verts_x[v1] - 0.5; +- tri_it_.b.y = verts_y[v1] - 0.5; +- tri_it_.c.x = verts_x[v2] - 0.5; +- tri_it_.c.y = verts_y[v2] - 0.5; +- +- +- // compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle +- double Acol0[] = {tri_it_.a.x + 0.5, tri_it_.b.x + 0.5, tri_it_.c.x + 0.5}; +- double Acol1[] = {tri_it_.a.y + 0.5, tri_it_.b.y + 0.5, tri_it_.c.y + 0.5}; +- double Acol2[] = {1.0, 1.0, 1.0}; +- +- double Z[] = {vals[v0], vals[v1], vals[v2]}; +- +- double detA = vnl_determinant(Acol0, Acol1, Acol2); +- s0_ = vnl_determinant(Z, Acol1, Acol2) / detA; +- s1_ = vnl_determinant(Acol0, Z, Acol2) / detA; +- s2_ = vnl_determinant(Acol0, Acol1, Z) / detA; +- +- //std::cout << "s0 = " << s0_ <<" s1 = " << s1_ << " s2 = " << s2_ << std::endl; +-} +- +- +-//: Resets the scan iterator to before the first scan line +-// After calling this function, next() needs to be called before +-// startx() and endx() form a valid scan line. +-template +-void boxm_triangle_interpolation_iterator::reset() +-{ +- tri_it_.reset(); +-} +- +-//: Tries to move to the next scan line. +-// Returns false if there are no more scan lines. +-template +-bool boxm_triangle_interpolation_iterator::next() +-{ +- return tri_it_.next(); +-} +- +-//: y-coordinate of the current scan line. +-template +-int boxm_triangle_interpolation_iterator::scany() const +-{ +- return tri_it_.scany(); +-} +- +-//: Returns starting x-value of the current scan line. +-// startx() should be smaller than endx(), unless the scan line is empty +-template +-int boxm_triangle_interpolation_iterator::startx() const +-{ +- return tri_it_.startx(); +-} +- +-//: Returns ending x-value of the current scan line. +-// endx() should be larger than startx(), unless the scan line is empty +-template +-int boxm_triangle_interpolation_iterator::endx() const +-{ +- return tri_it_.endx() + 1; +-} +- +- +-//: returns the interpolated value at location x in the current scanline +-template +-T boxm_triangle_interpolation_iterator::value_at(int x) +-{ +- return (T)((s0_*(x+0.5) + s1_*(tri_it_.scany()+0.5) + s2_)); +-} +- +- +-#define BOXM_TRIANGLE_INTERPOLATION_ITERATOR_INSTANTIATE(T) \ +- template class boxm_triangle_interpolation_iterator +- +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx b/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx +deleted file mode 100644 +index c268ecca30..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx ++++ /dev/null +@@ -1,59 +0,0 @@ +-#include +-#include +-#include +-#include +-#include "boxm_triangle_scan_iterator.h" +-//: +-// \file +-#ifdef _MSC_VER +-# include +-#endif +- +- +-//: constructor +-boxm_triangle_scan_iterator::boxm_triangle_scan_iterator(const double *verts_x, const double *verts_y, unsigned int v0, unsigned int v1, unsigned int v2) +-: tri_it_() +-{ +- tri_it_.a.x = verts_x[v0] - 0.5; +- tri_it_.a.y = verts_y[v0] - 0.5; +- tri_it_.b.x = verts_x[v1] - 0.5; +- tri_it_.b.y = verts_y[v1] - 0.5; +- tri_it_.c.x = verts_x[v2] - 0.5; +- tri_it_.c.y = verts_y[v2] - 0.5; +-} +- +- +-//: Resets the scan iterator to before the first scan line +-// After calling this function, next() needs to be called before +-// startx() and endx() form a valid scan line. +-void boxm_triangle_scan_iterator::reset() +-{ +- tri_it_.reset(); +-} +- +-//: Tries to move to the next scan line. +-// Returns false if there are no more scan lines. +-bool boxm_triangle_scan_iterator::next() +-{ +- return tri_it_.next(); +-} +- +-//: y-coordinate of the current scan line. +-int boxm_triangle_scan_iterator::scany() const +-{ +- return tri_it_.scany(); +-} +- +-//: Returns starting x-value of the current scan line. +-// startx() should be smaller than endx(), unless the scan line is empty +-int boxm_triangle_scan_iterator::startx() const +-{ +- return tri_it_.startx(); +-} +- +-//: Returns ending x-value of the current scan line. +-// endx() should be larger than startx(), unless the scan line is empty +-int boxm_triangle_scan_iterator::endx() const +-{ +- return tri_it_.endx() + 1; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h b/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h +deleted file mode 100644 +index 47b52ebc26..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h ++++ /dev/null +@@ -1,46 +0,0 @@ +-#ifndef boxm_triangle_scan_iterator_h_ +-#define boxm_triangle_scan_iterator_h_ +-//: +-// \file +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-class boxm_triangle_scan_iterator : public vgl_region_scan_iterator +-{ +- public: +- //: constructor +- boxm_triangle_scan_iterator(const double *verts_x, const double *verts_y, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2); +- +- //: Resets the scan iterator to before the first scan line +- // After calling this function, next() needs to be called before +- // startx() and endx() form a valid scan line. +- void reset() override; +- +- //: Tries to move to the next scan line. +- // Returns false if there are no more scan lines. +- bool next() override; +- +- //: y-coordinate of the current scan line. +- int scany() const override; +- +- //: Returns starting x-value of the current scan line. +- // startx() should be smaller than endx(), unless the scan line is empty +- int startx() const override; +- +- //: Returns ending x-value of the current scan line. +- // endx() should be larger than startx(), unless the scan line is empty +- int endx() const override; +- +- protected: +- +- vgl_triangle_scan_iterator tri_it_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_utils.cxx b/contrib/brl/bseg/boxm/util/boxm_utils.cxx +deleted file mode 100644 +index 2464b5c4a8..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_utils.cxx ++++ /dev/null +@@ -1,1469 +0,0 @@ +-#include +-#include +-#include +-#include "boxm_utils.h" +-//: +-// \file +-#include "boxm_quad_scan_iterator.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-bool boxm_utils::is_visible(vgl_box_3d const& bbox, +- vpgl_camera_double_sptr const& camera, +- unsigned int img_ni, unsigned int img_nj, +- bool do_front_test) +-{ +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- // make a test for vertices for behind-front case +- auto* cam = static_cast*>(camera.ptr()); +- if (do_front_test) { +- if (cam->is_behind_camera(vgl_homg_point_3d(bbox.min_x(),bbox.min_y(),bbox.min_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.min_x(),bbox.min_y(),bbox.max_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.min_x(),bbox.max_y(),bbox.min_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.min_x(),bbox.max_y(),bbox.max_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.max_x(),bbox.min_y(),bbox.min_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.max_x(),bbox.min_y(),bbox.max_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.max_x(),bbox.max_y(),bbox.min_z()))&& +- cam->is_behind_camera(vgl_homg_point_3d(bbox.max_x(),bbox.max_y(),bbox.max_z()))) +- return false; +- } +- } +- +- // make sure corners project into image bounds +- vgl_box_2d cube_proj_bb; +- vgl_box_2d img_bb; +- img_bb.add(vgl_point_2d(0.0, 0.0)); +- img_bb.add(vgl_point_2d(img_ni, img_nj)); +- // project corners of block into image +- double u,v; +- camera->project(bbox.min_x(),bbox.min_y(),bbox.min_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.min_x(),bbox.min_y(),bbox.max_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.min_x(),bbox.max_y(),bbox.min_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.min_x(),bbox.max_y(),bbox.max_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.max_x(),bbox.min_y(),bbox.min_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.max_x(),bbox.min_y(),bbox.max_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.max_x(),bbox.max_y(),bbox.min_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- camera->project(bbox.max_x(),bbox.max_y(),bbox.max_z(),u,v); +- cube_proj_bb.add(vgl_point_2d(u,v)); +- // check for intersection +- vgl_box_2d intersection = vgl_intersection(cube_proj_bb, img_bb); +- return ! intersection.is_empty(); +-} +- +-//: +-// \verbatim +-// MaxPosition +-// +-// 7-----------6 +-// / /| +-// / / | +-// 4-----------5 | +-// | | | +-// | | | +-// | 3 | 2 +-// Z | | / +-// | Y | |/ +-// | / 0-----------1 +-// | / MinPosition +-// O-----X +-// +-// \endverbatim +-std::vector > +-boxm_utils::corners_of_box_3d(vgl_box_3d const& box) +-{ +- std::vector > corners; +- +- corners.push_back(box.min_point()); +- corners.emplace_back(box.min_x()+box.width(), box.min_y(), box.min_z()); +- corners.emplace_back(box.min_x()+box.width(), box.min_y()+box.height(), box.min_z()); +- corners.emplace_back(box.min_x(), box.min_y()+box.height(), box.min_z()); +- corners.emplace_back(box.min_x(), box.min_y(), box.max_z()); +- corners.emplace_back(box.min_x()+box.width(), box.min_y(), box.max_z()); +- corners.push_back(box.max_point()); +- corners.emplace_back(box.min_x(), box.min_y()+box.height(), box.max_z()); +- return corners; +-} +- +-void +-boxm_utils::project_corners(std::vector > const& corners, +- const vpgl_camera_double_sptr& camera, +- double* xverts, double* yverts) +-{ +- for (unsigned i=0; iproject(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]); +-} +- +-void +-boxm_utils::project_corners(std::vector > const& corners, +- const vpgl_camera_double_sptr& camera, +- double* xverts, double* yverts, +- float* vertdist) +-{ +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- auto* cam = static_cast*>(camera.ptr()); +- vgl_point_3d cam_center = vgl_point_3d(cam->camera_center()); +- for (unsigned i=0; iproject(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]); +- vertdist[i]=(float)(cam_center-corners[i]).length(); +- } +- } +-} +- +-void +-boxm_utils::project_point3d(vgl_point_3d const& point, +- const vpgl_camera_double_sptr& camera, +- double & xvert, double &yvert, +- double & vertdist) +-{ +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- auto* cam = static_cast*>(camera.ptr()); +- vgl_point_3d cam_center = vgl_point_3d(cam->camera_center()); +- cam->project(point.x(), point.y(), point.z(), xvert,yvert); +- vertdist=(float)(cam_center-point).length(); +- } +-} +- +-//: corners of the input face: visible? +-bool boxm_utils::is_face_visible(const double * xverts, const double *yverts, +- unsigned id1,unsigned id2,unsigned id3,unsigned /*id4*/) // id4 unused?!? - FIXME +-{ +- double normal=(xverts[id2]-xverts[id1])*(yverts[id3]-yverts[id2])-(yverts[id2]-yverts[id1])*(xverts[id3]-xverts[id2]); +- return normal < 0; +-} +- +-//: corners of the input face: visible? +-bool boxm_utils::is_face_visible(std::vector > &face, +- vpgl_camera_double_sptr const& camera) +-{ +- assert(face.size() >= 3); +- std::vector > vs; +- +- for (auto & i : face) { +- double u,v; +- camera->project(i.x(), i.y(), i.z(), u, v); +- vs.emplace_back(u,v); +- } +- +- vgl_vector_2d v0 = vs[1] - vs[0]; +- vgl_vector_2d v1 = vs[2] - vs[1]; +- auto normal = cross_product(v0,v1); +- //if (normal>-1e-4 && normal<0.0) +- // std::cout<<"+"; +- return normal < -1e-5; +-} +- +-std::vector > +-boxm_utils::project_face(std::vector > &face, +- vpgl_camera_double_sptr const& camera) +-{ +- std::vector > vs; +- +- for (auto & i : face) { +- double u,v; +- camera->project(i.x(), i.y(), i.z(), u, v); +- vs.emplace_back(u,v); +- } +- +- return vs; +-} +- +-boct_face_idx +-boxm_utils::visible_faces(vgl_box_3d const& bbox, const vpgl_camera_double_sptr& camera) +-{ +- boct_face_idx face_idx = NONE; +- //if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- // vpgl_perspective_camera* cam = static_cast*>(camera.ptr()); +- // vgl_point_3d const& cam_center = cam->camera_center(); +- +- // if (cam_center.x() > bbox.max_x()) { +- // face_idx |= X_HIGH; +- // } +- // else if (cam_center.x() < bbox.min_x()) { +- // face_idx |= X_LOW; +- // } +- // if (cam_center.y() > bbox.max_y()) { +- // face_idx |= Y_HIGH; +- // } +- // else if (cam_center.y() < bbox.min_y()) { +- // face_idx |= Y_LOW; +- // } +- // if (cam_center.z() > bbox.max_x()) { +- // face_idx |= Z_HIGH; +- // } +- // else if (cam_center.z() < bbox.min_z()) { +- // face_idx |= Z_LOW; +- // } +- //} +- //// for other cameras, use projection and normals +- //else +- { +- // fix the face normals so that the vertices are in counter-clockwise order +- std::map > > faces; +- faces_of_box_3d(bbox, faces); +- +- if (is_face_visible(faces.find(Z_LOW)->second, camera)) { +- face_idx |= Z_LOW; +-#ifdef DEBUG +- std::cout << "Z_LOW " ; +-#endif +- } +- if (is_face_visible(faces.find(Z_HIGH)->second, camera)) { +- face_idx |= Z_HIGH; +-#ifdef DEBUG +- std::cout << "Z_HIGH " ; +-#endif +- } +- if (is_face_visible(faces.find(X_LOW)->second, camera)) { +- face_idx |= X_LOW; +-#ifdef DEBUG +- std::cout << "X_LOW " ; +-#endif +- } +- +- if (is_face_visible(faces.find(X_HIGH)->second, camera)) { +- face_idx |= X_HIGH; +-#ifdef DEBUG +- std::cout << "X_HIGH " ; +-#endif +- } +- +- if (is_face_visible(faces.find(Y_LOW)->second, camera)) { +- face_idx |= Y_LOW; +-#ifdef DEBUG +- std::cout << "Y_LOW " ; +-#endif +- } +- +- if (is_face_visible(faces.find(Y_HIGH)->second, camera)) { +- face_idx |= Y_HIGH; +-#ifdef DEBUG +- std::cout << "Y_HIGH " ; +-#endif +- } +- } +-#ifdef DEBUG +- std::cout << std::endl; +-#endif +- +- return face_idx; +-} +- +-boct_face_idx +-boxm_utils::visible_faces(vgl_box_3d const& /*bbox*/, // FIXME: currently unused -- see commented out code +- const vpgl_camera_double_sptr& /*camera*/, // idem +- double *xverts, double *yverts) +-{ +- boct_face_idx face_idx = NONE; +-#if 0 +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- vpgl_perspective_camera* cam = static_cast*>(camera.ptr()); +- vgl_point_3d const& cam_center = cam->camera_center(); +- +- if (cam_center.x() > bbox.max_x()) { +- face_idx |= X_HIGH; +- } +- else if (cam_center.x() < bbox.min_x()) { +- face_idx |= X_LOW; +- } +- if (cam_center.y() > bbox.max_y()) { +- face_idx |= Y_HIGH; +- } +- else if (cam_center.y() < bbox.min_y()) { +- face_idx |= Y_LOW; +- } +- if (cam_center.z() > bbox.max_x()) { +- face_idx |= Z_HIGH; +- } +- else if (cam_center.z() < bbox.min_z()) { +- face_idx |= Z_LOW; +- } +- } +- // for other cameras, use projection and normals +- else +-#endif // 0 +- { +- // fix the face normals so that the vertices are the counter clockwise order +-#if 0 +- std::map > > faces; +- faces_of_box_3d(bbox, faces); +- project_corners(bbox,camera,xverts,yverts); +-#endif // 0 +- if (is_face_visible(xverts,yverts,1,0,3,2)) { +- face_idx |= Z_LOW; +-#ifdef DEBUG +- std::cout << "Z_LOW " ; +-#endif +- } +- if (is_face_visible(xverts,yverts,4,5,6,7)) { +- face_idx |= Z_HIGH; +-#ifdef DEBUG +- std::cout << "Z_HIGH " ; +-#endif +- } +- if (is_face_visible(xverts,yverts,7,3,0,4)) { +- face_idx |= X_LOW; +-#ifdef DEBUG +- std::cout << "X_LOW " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,1,2,6,5)) { +- face_idx |= X_HIGH; +-#ifdef DEBUG +- std::cout << "X_HIGH " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,0,1,5,4)) { +- face_idx |= Y_LOW; +-#ifdef DEBUG +- std::cout << "Y_LOW " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,2,3,7,6)) { +- face_idx |= Y_HIGH; +-#ifdef DEBUG +- std::cout << "Y_HIGH " ; +-#endif +- } +- } +-#ifdef DEBUG +- std::cout << std::endl; +-#endif +- +- return face_idx; +-} +- +-boct_face_idx +-boxm_utils::visible_faces_cell(vgl_box_3d const& bbox, const vpgl_camera_double_sptr& camera, +- double *xverts, double *yverts) +-{ +- boct_face_idx face_idx = NONE; +- if (camera->type_name().compare("vpgl_perspective_camera")==0) { +- auto* cam = static_cast*>(camera.ptr()); +- vgl_point_3d const& cam_center = cam->camera_center(); +- +- if (cam_center.x() > bbox.max_x()) { +- face_idx |= X_HIGH; +- } +- else if (cam_center.x() < bbox.min_x()) { +- face_idx |= X_LOW; +- } +- if (cam_center.y() > bbox.max_y()) { +- face_idx |= Y_HIGH; +- } +- else if (cam_center.y() < bbox.min_y()) { +- face_idx |= Y_LOW; +- } +- if (cam_center.z() > bbox.max_x()) { +- face_idx |= Z_HIGH; +- } +- else if (cam_center.z() < bbox.min_z()) { +- face_idx |= Z_LOW; +- } +- } +- // for other cameras, use projection and normals +- else +- { +- // fix the face normals so that the vertices are the counter clockwise order +-#if 0 +- std::map > > faces; +- faces_of_box_3d(bbox, faces); +- double * xverts; double *yverts; +- project_corners(bbox,camera,xverts,yverts); +-#endif // 0 +- if (is_face_visible(xverts,yverts,1,0,3,2)) { +- face_idx |= Z_LOW; +-#ifdef DEBUG +- std::cout << "Z_LOW " ; +-#endif +- } +- if (is_face_visible(xverts,yverts,4,5,6,7)) { +- face_idx |= Z_HIGH; +-#ifdef DEBUG +- std::cout << "Z_HIGH " ; +-#endif +- } +- if (is_face_visible(xverts,yverts,7,3,0,4)) { +- face_idx |= X_LOW; +-#ifdef DEBUG +- std::cout << "X_LOW " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,1,2,6,5)) { +- face_idx |= X_HIGH; +-#ifdef DEBUG +- std::cout << "X_HIGH " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,0,1,5,4)) { +- face_idx |= Y_LOW; +-#ifdef DEBUG +- std::cout << "Y_LOW " ; +-#endif +- } +- +- if (is_face_visible(xverts,yverts,2,3,7,6)) { +- face_idx |= Y_HIGH; +-#ifdef DEBUG +- std::cout << "Y_HIGH " ; +-#endif +- } +- } +-#ifdef DEBUG +- std::cout << std::endl; +-#endif +- +- return face_idx; +-} +- +-//: returns the faces of a box, the vertices are ordered in the normal direction +-void boxm_utils::faces_of_box_3d(vgl_box_3d const& bbox, +- std::map > >& faces) +-{ +- std::vector > corners=corners_of_box_3d(bbox); +- +- // face bottom [1,0,3,2] +- std::vector > face_corners; +- face_corners.push_back(corners[1]); +- face_corners.push_back(corners[0]); +- face_corners.push_back(corners[3]); +- face_corners.push_back(corners[2]); +- faces[Z_LOW] = face_corners; +- +- face_corners.resize(0); +- face_corners.push_back(corners[4]); +- face_corners.push_back(corners[5]); +- face_corners.push_back(corners[6]); +- face_corners.push_back(corners[7]); +- faces[Z_HIGH] = face_corners; +- +- face_corners.resize(0); +- face_corners.push_back(corners[7]); +- face_corners.push_back(corners[3]); +- face_corners.push_back(corners[0]); +- face_corners.push_back(corners[4]); +- faces[X_LOW] = face_corners; +- +- face_corners.resize(0); +- face_corners.push_back(corners[1]); +- face_corners.push_back(corners[2]); +- face_corners.push_back(corners[6]); +- face_corners.push_back(corners[5]); +- faces[X_HIGH] = face_corners; +- +- face_corners.resize(0); +- face_corners.push_back(corners[0]); +- face_corners.push_back(corners[1]); +- face_corners.push_back(corners[5]); +- face_corners.push_back(corners[4]); +- faces[Y_LOW] = face_corners; +- +- face_corners.resize(0); +- face_corners.push_back(corners[2]); +- face_corners.push_back(corners[3]); +- face_corners.push_back(corners[7]); +- face_corners.push_back(corners[6]); +- faces[Y_HIGH] = face_corners; +-} +- +-//: returns the union of the projected faces of a polygon +-void boxm_utils::project_cube(vgl_box_3d &bbox, +- const vpgl_camera_double_sptr& camera, +- std::map > > & faces, +- boct_face_idx & vis_face_ids) +-{ +- faces_of_box_3d(bbox, faces); +- vis_face_ids=boxm_utils::visible_faces(bbox,camera); +-} +- +- +-void boxm_utils::quad_interpolate(boxm_quad_scan_iterator &poly_it, +- double* xvals, double* yvals, double* vals, +- vil_image_view &img,unsigned img_plane_num, +- unsigned int v0, unsigned int v1, +- unsigned int v2,unsigned int v3 ) +-{ +- // first compute s0, s1, s2, s3 such that val = s0*x + s1*y + s2 for any point within the triangle +- // (no need to compute barycentric coordinates of a quadrilateral at each step) +- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel) +- +- double Acol0[] = {(xvals[v0]-0.5)*(yvals[v0]-0.5), +- (xvals[v1]-0.5)*(yvals[v1]-0.5), +- (xvals[v2]-0.5)*(yvals[v2]-0.5), +- (xvals[v3]-0.5)*(yvals[v3]-0.5)}; +- double Acol1[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5,xvals[v3]-0.5}; +- double Acol2[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5,yvals[v3]-0.5}; +- double Acol3[] = {1.0, 1.0, 1.0,1.0}; +- +- double Z[] = {vals[v0], vals[v1], vals[v2],vals[v3]}; +- +- double detA = vnl_determinant(Acol0, Acol1, Acol2,Acol3); +- double s0 = vnl_determinant(Z, Acol1, Acol2,Acol3) / detA; +- double s1 = vnl_determinant(Acol0, Z, Acol2,Acol3) / detA; +- double s2 = vnl_determinant(Acol0, Acol1, Z,Acol3) / detA; +- double s3 = vnl_determinant(Acol0, Acol1, Acol2,Z) / detA; +- +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- auto interp_val = (float)(s0*x*y + s1*x + s2*y+s3); +- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*interp_val); +- } +- } +- return; +-#if 0 // commented out +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- unsigned int yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- double start_val=0; +- double end_val=0; +- +- if (poly_it.x_start_end_val(vals,start_val,end_val)) +- { +- float rx=endx-startx; +- for (unsigned int x = startx; x < endx; ++x) { +- float interp_val = start_val+(x-startx)/rx*(end_val-start_val); +- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*interp_val); +- //img(x,yu,img_plane_num) =interp_val; +- } +- } +- } +- return; +-#endif // 0 +-} +- +-void boxm_utils::quad_fill(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float val, +- unsigned img_plane_num) +-{ +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- img(x,yu,img_plane_num) = val; +-#if 0 // was: +- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val); +- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val); +- if (poly_it.pix_coverage(x)>1) +- std::cout<<"ERROR ALERT "<1); +-#endif // 0 +- } +- } +- return; +-} +- +- +-void boxm_utils::quad_fill(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, +- vil_image_view &weights_img, +- float val, +- unsigned img_plane_num) +-{ +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- //img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val); +- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val); +- weights_img(x,yu)+=poly_it.pix_coverage(x); +- } +- } +- return; +-} +- +- +-void boxm_utils::quad_mean(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float &val, float & count) +-{ +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- val+=poly_it.pix_coverage(x)*img(x,yu) ; +- count+=poly_it.pix_coverage(x); +- } +- } +- return; +-} +- +-void boxm_utils::quad_weighted_mean(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, +- vil_image_view &weighted_img, +- float &numerator, float & denominator) +-{ +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- numerator+=poly_it.pix_coverage(x)*img(x,yu)*weighted_img(x,yu); +- denominator+=poly_it.pix_coverage(x)*weighted_img(x,yu); +- //numerator+=img(x,yu)*weighted_img(x,yu); +- //denominator+=weighted_img(x,yu); +- } +- } +- return; +-} +- +-void boxm_utils::quad_sum(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float &val) +-{ +- poly_it.reset(); +- while (poly_it.next()) { +- int y = poly_it.scany(); +- if (y < 0){ +- // not inside of image bounds yet. go to next scanline. +- continue; +- } +- auto yu = (unsigned int)y; +- if (yu >= img.nj() ) { +- // we have left the image bounds. no need to continue. +- break; +- } +- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) { +- // no part of this scanline is within the image bounds. go to next scanline. +- continue; +- } +- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx()); +- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx()); +- +- for (unsigned int x = startx; x < endx; ++x) { +- val+=(poly_it.pix_coverage(x)*img(x,yu)) ; +- } +- } +- return; +-} +- +-bool boxm_utils::project_cube_xyz( std::map > > & faces, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- const vpgl_camera_double_sptr& cam) +-{ +- auto face_it=faces.begin(); +- for (; face_it!=faces.end(); ++face_it) +- { +- std::vector > face_corners=face_it->second; +- std::vector > face_projected=project_face(face_corners,cam); +- +- double xs[]={face_projected[0].x(),face_projected[1].x(),face_projected[2].x(),face_projected[3].x()}; +- double ys[]={face_projected[0].y(),face_projected[1].y(),face_projected[2].y(),face_projected[3].y()}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- double Xs[]={face_corners[0].x(),face_corners[1].x(),face_corners[2].x(),face_corners[3].x()}; +- double Ys[]={face_corners[0].y(),face_corners[1].y(),face_corners[2].y(),face_corners[3].y()}; +- double Zs[]={face_corners[0].z(),face_corners[1].z(),face_corners[2].z(),face_corners[3].z()}; +- +- if (vis_face_ids & face_it->first){ +- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2); +- } +- else +- { +- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2); +- } +- } +- +- return true; +-} +- +- +-bool boxm_utils::project_cube_xyz(std::vector< vgl_point_3d > & corners, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- double *xverts,double * yverts) +-{ +- // open extra scope, to allow redeclaration of xs[], ys[] +- { +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +-#if 0 +- std::vector > face_polygon(4); +- for (unsigned i=0;i<4;++i) +- face_polygon.push_back(vgl_point_2d(xs[i],ys[i])); +-#endif // 0 +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- +- double Xs[]={corners[1].x(),corners[0].x(),corners[3].x(),corners[2].x()}; +- double Ys[]={corners[1].y(),corners[0].y(),corners[3].y(),corners[2].y()}; +- double Zs[]={corners[1].z(),corners[0].z(),corners[3].z(),corners[2].z()}; +- if (vis_face_ids & Z_LOW){ +- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1); +- quad_fill(poly_it,front_xyz,float(Zs[0]),2); +- } +- else +- { +- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1); +- quad_fill(poly_it,back_xyz,float(Zs[0]),2); +- } +- } +- { +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- +- double Xs[]={corners[4].x(),corners[5].x(),corners[6].x(),corners[7].x()}; +- double Ys[]={corners[4].y(),corners[5].y(),corners[6].y(),corners[7].y()}; +- double Zs[]={corners[4].z(),corners[5].z(),corners[6].z(),corners[7].z()}; +- if (vis_face_ids & Z_HIGH){ +- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1); +- quad_fill(poly_it,front_xyz,float(Zs[0]),2); +- } +- else +- { +- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0); +- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1); +- quad_fill(poly_it,back_xyz,float(Zs[0]),2); +- } +- } +- { +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- double Xs[]={corners[7].x(),corners[3].x(),corners[0].x(),corners[4].x()}; +- double Ys[]={corners[7].y(),corners[3].y(),corners[0].y(),corners[4].y()}; +- double Zs[]={corners[7].z(),corners[3].z(),corners[0].z(),corners[4].z()}; +- if (vis_face_ids & X_LOW){ +- quad_fill(poly_it,front_xyz,float(Xs[0]),0); +- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2); +- } +- else +- { +- quad_fill(poly_it,back_xyz,float(Xs[0]),0); +- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2); +- } +- } +- { +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- double Xs[]={corners[1].x(),corners[2].x(),corners[6].x(),corners[5].x()}; +- double Ys[]={corners[1].y(),corners[2].y(),corners[6].y(),corners[5].y()}; +- double Zs[]={corners[1].z(),corners[2].z(),corners[6].z(),corners[5].z()}; +- if (vis_face_ids & X_HIGH){ +- quad_fill(poly_it,front_xyz,float(Xs[0]),0); +- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2); +- } +- else +- { +- quad_fill(poly_it,back_xyz,float(Xs[0]),0); +- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1); +- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2); +- } +- } +- { +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- +- double Xs[]={corners[0].x(),corners[1].x(),corners[5].x(),corners[4].x()}; +- double Ys[]={corners[0].y(),corners[1].y(),corners[5].y(),corners[4].y()}; +- double Zs[]={corners[0].z(),corners[1].z(),corners[5].z(),corners[4].z()}; +- if (vis_face_ids & Y_LOW){ +- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0); +- +- quad_fill(poly_it,front_xyz,float(Ys[0]),1); +- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2); +- } +- else +- { +- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0); +- quad_fill(poly_it,back_xyz,float(Ys[0]),1); +- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2); +- } +- } +- { +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- +- double Xs[]={corners[2].x(),corners[3].x(),corners[7].x(),corners[6].x()}; +- double Ys[]={corners[2].y(),corners[3].y(),corners[7].y(),corners[6].y()}; +- double Zs[]={corners[2].z(),corners[3].z(),corners[7].z(),corners[6].z()}; +- if (vis_face_ids & Y_HIGH){ +- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0); +- quad_fill(poly_it,front_xyz,float(Ys[0]),1); +- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2); +- } +- else +- { +- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0); +- quad_fill(poly_it,back_xyz,float(Ys[0]),1); +- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2); +- } +- } +- +- return true; +-} +- +- +-bool boxm_utils::project_cube_xyz(std::vector< vgl_point_3d > & /*corners*/, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- double *xverts,double * yverts,float * vertdist) +-{ +- // Use extra {} so that destructors will do their work +- { +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- double ds[]={vertdist[1],vertdist[0],vertdist[3],vertdist[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- if (vis_face_ids & Z_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- { +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- double ds[]={vertdist[4],vertdist[5],vertdist[6],vertdist[7]}; +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- if (vis_face_ids & Z_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- { +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- double ds[]={vertdist[7],vertdist[3],vertdist[0],vertdist[4]}; +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- if (vis_face_ids & X_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- { +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- double ds[]={vertdist[1],vertdist[2],vertdist[6],vertdist[5]}; +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- if (vis_face_ids & X_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- { +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- double ds[]={vertdist[0],vertdist[1],vertdist[5],vertdist[4]}; +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- if (vis_face_ids & Y_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- { +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- double ds[]={vertdist[2],vertdist[3],vertdist[7],vertdist[6]}; +- +- boxm_quad_scan_iterator poly_it(xs,ys); +- vgl_polygon p(xs,ys,4); +- if (vis_face_ids & Y_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); } +- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); } +- } +- +- return true; +-} +- +- +-#if 0 +-bool boxm_utils::project_cube_fill_val( std::map > > & faces, +- boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- float val, vpgl_camera_double_sptr cam) +-{ +- for (std::map > >::iterator face_it=faces.begin(); +- face_it!=faces.end(); ++face_it) +- { +- std::vector > face_corners=face_it->second; +- std::vector > face_projected=project_face(face_corners,cam); +- vgl_polygon face_polygon(face_projected); +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- if (vis_face_ids & face_it->first){ +- quad_fill(poly_it,fill_img,val,0); +- } +- } +-} +-#else +-bool boxm_utils::project_cube_fill_val( std::map > > &, +- boct_face_idx &, vil_image_view &, float, const vpgl_camera_double_sptr&) +-{ return false; } +-#endif // 0 +- +-bool boxm_utils::project_cube_fill_val(boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- float val, double *xverts,double * yverts) +-{ +- if (vis_face_ids & Z_LOW){ +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- if (vis_face_ids & Z_HIGH){ +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- if (vis_face_ids & X_LOW){ +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- if (vis_face_ids & X_HIGH){ +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- if (vis_face_ids & Y_LOW){ +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- if (vis_face_ids & Y_HIGH){ +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,val,0); +- } +- return true; +-} +- +- +-bool boxm_utils::project_cube_fill_val_aa(boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- vil_image_view &weight_img, +- float val, double *xverts,double * yverts) +-{ +- if (vis_face_ids & Z_LOW){ +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- if (vis_face_ids & Z_HIGH){ +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- if (vis_face_ids & X_LOW){ +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- if (vis_face_ids & X_HIGH){ +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- if (vis_face_ids & Y_LOW){ +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- if (vis_face_ids & Y_HIGH){ +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_fill(poly_it,fill_img,weight_img,val,0); +- } +- return true; +-} +- +-bool boxm_utils::cube_sum(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- float & val, double *xverts,double * yverts) +-{ +- val=0; +- if (vis_face_ids & Z_LOW){ +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- if (vis_face_ids & Z_HIGH){ +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- if (vis_face_ids & X_LOW){ +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- if (vis_face_ids & X_HIGH){ +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- if (vis_face_ids & Y_LOW){ +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- if (vis_face_ids & Y_HIGH){ +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_sum(poly_it,img,val); +- } +- +- return true; +-} +- +- +-bool boxm_utils::cube_uniform_mean(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- float & val, double *xverts,double * yverts) +-{ +- val=0; +- float count=0; +- if (vis_face_ids & Z_LOW){ +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- if (vis_face_ids & Z_HIGH){ +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- if (vis_face_ids & X_LOW){ +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- if (vis_face_ids & X_HIGH){ +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- if (vis_face_ids & Y_LOW){ +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- if (vis_face_ids & Y_HIGH){ +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_mean(poly_it,img,val,count); +- } +- +- if (count > 0) { +- val/=(float)count; +- return true; +- } +- else { +- val = 0; +- return true; +- } +-} +- +- +-bool boxm_utils::cube_weighted_mean(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- vil_image_view &weight_img, +- float & val, double *xverts,double * yverts) +-{ +- val=0; +- float count=0; +- if (vis_face_ids & Z_LOW){ +- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]}; +- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- if (vis_face_ids & Z_HIGH){ +- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]}; +- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- if (vis_face_ids & X_LOW){ +- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]}; +- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- if (vis_face_ids & X_HIGH){ +- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]}; +- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- if (vis_face_ids & Y_LOW){ +- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]}; +- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- if (vis_face_ids & Y_HIGH){ +- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]}; +- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]}; +- boxm_quad_scan_iterator poly_it(xs,ys); +- quad_weighted_mean(poly_it,img,weight_img,val,count); +- } +- +- if (count > 0) { +- val/=(float)count; +- return true; +- } +- else { +- val = 0; +- return true; +- } +-} +- +- +-bool +-boxm_utils::cube_entry_point(vgl_box_3d cube,vgl_point_3d pt, +- vgl_vector_3d direction, +- vgl_point_3d & entry_point, +- double & lambda,boct_face_idx & face_id) +-{ +- // check each face +- if (direction.x() > 0 && pt.x()<=cube.min_x()) { +- // intersect with low x plane +- lambda = (cube.min_x() - pt.x()) / direction.x(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) && +- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) { +- face_id=X_LOW; +- return true; +- } +- } +- else if (direction.x() < 0 && pt.x()>=cube.max_x()){ +- // intersect with high x plane +- lambda = (cube.max_x() - pt.x()) / direction.x(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) && +- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) { +- face_id=X_HIGH; +- return true; +- } +- } +- if (direction.y() > 0&& pt.y()<=cube.min_y()) { +- // intersect with low y plane +- lambda = (cube.min_y() - pt.y()) / direction.y(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) && +- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) { +- face_id=Y_LOW; +- return true; +- } +- } +- else if (direction.y() < 0 && pt.y()>=cube.max_y()){ +- // intersect with high y plane +- lambda = (cube.max_y() - pt.y()) / direction.y(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) && +- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) { +- face_id=Y_HIGH; +- return true; +- } +- } +- if (direction.z() > 0&& pt.z()<=cube.min_z()) { +- // intersect with low z plane +- lambda = (cube.min_z() - pt.z()) / direction.z(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) && +- (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) ) { +- face_id=Z_LOW; +- return true; +- } +- } +- else if (direction.z() < 0 && pt.z()>=cube.max_z()){ +- // intersect with high z plane +- lambda = (cube.max_z() - pt.z()) / direction.z(); +- entry_point = pt + direction * lambda; +- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) && +- (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) ) { +- face_id=Z_HIGH; +- return true; +- } +- } +- return false; +-} +- +- +-bool boxm_utils::cube_exit_point(vgl_box_3d cube,vgl_point_3d pt, +- vgl_vector_3d direction, +- vgl_point_3d & exit_pt, +- double & lambda,boct_face_idx & face_id) +-{ +- // check each face +- if (direction.x() < 0 ) { +- // intersect with low x plane +- lambda = (cube.min_x() - pt.x()) / direction.x(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) && +- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) { +- face_id=X_LOW; +- return true; +- } +- } +- else if (direction.x() > 0 ) { +- // intersect with high x plane +- lambda = (cube.max_x() - pt.x()) / direction.x(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) && +- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) { +- face_id=X_HIGH; +- return true; +- } +- } +- if (direction.y() < 0 ) { +- // intersect with low y plane +- lambda = (cube.min_y() - pt.y()) / direction.y(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) && +- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) { +- face_id=Y_LOW; +- return true; +- } +- } +- else if (direction.y() > 0 ) { +- // intersect with high y plane +- lambda = (cube.max_y() - pt.y()) / direction.y(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) && +- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) { +- face_id=Y_HIGH; +- return true; +- } +- } +- if (direction.z() < 0 ) { +- // intersect with low z plane +- lambda = (cube.min_z() - pt.z()) / direction.z(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) && +- (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) ) { +- face_id=Z_LOW; +- return true; +- } +- } +- else if (direction.z() > 0 ) { +- // intersect with high z plane +- lambda = (cube.max_z() - pt.z()) / direction.z(); +- exit_pt = pt + direction * lambda; +- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) && +- (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) ) { +- face_id=Z_HIGH; +- return true; +- } +- } +- return false; +-} +- +- +-boxm_apm_traits::apm_datatype +-boxm_utils::obtain_mog_grey_unit_mode() +-{ +- bsta_gauss_sf1 simple_gauss_sf1(1.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- return simple_obs_mix_gauss_val_sf1; +-} +- +-boxm_apm_traits::apm_datatype +-boxm_utils::obtain_mog_grey_zero_mode() +-{ +- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- return simple_obs_mix_gauss_val_sf1; +-} +- +-boxm_apm_traits::apm_datatype +-boxm_utils::obtain_mog_grey_single_mode(float mean) +-{ +- bsta_gauss_sf1 simple_gauss_sf1(mean,0.1f); +- bsta_num_obs simple_obs_gauss_val_sf1(simple_gauss_sf1,1); +- bsta_mixture_fixed, 3> simple_mix_gauss_val_sf1; +- +- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f); +- +- typedef bsta_mixture_fixed,3> simple_bsta_mixture_fixed_sf1_3; +- bsta_num_obs simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1); +- +- return simple_obs_mix_gauss_val_sf1; +-} +- +-double boxm_utils::max_point_to_box_dist(vgl_box_3d box,vgl_point_3d pt) +-{ +- double dist_max=0; +- +- std::vector > corners=corners_of_box_3d(box); +- for (const auto & corner : corners) +- { +- if (dist_max<(corner-pt).length()) +- dist_max=(corner-pt).length(); +- } +- return dist_max; +-} +diff --git a/contrib/brl/bseg/boxm/util/boxm_utils.h b/contrib/brl/bseg/boxm/util/boxm_utils.h +deleted file mode 100644 +index 86f74b3945..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_utils.h ++++ /dev/null +@@ -1,168 +0,0 @@ +-#ifndef boxm_utils_h_ +-#define boxm_utils_h_ +-//: +-// \file +-// \brief The utility methods for the boxm project +-// +-// \author Gamze Tunali +-// \date Apr 07, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include "boxm_quad_scan_iterator.h" +-#include +-#include +-#include +-#include +-#include +-#include +- +-class safe_inverse_functor +-{ +- public: +- safe_inverse_functor(float tol = 0.0f) : tol_(tol) {} +- +- float operator()(float x) const { return (x > tol_)? 1.0f/x : 0.0f; } +- +- float tol_; +-}; +- +-class boxm_utils +-{ +- public: +- +- //: returns true if a given box is visible from the camera and the image plane +- static bool is_visible(vgl_box_3d const& bbox, +- vpgl_camera_double_sptr const& camera, +- unsigned int img_ni, unsigned int img_nj, +- bool do_front_test = true); +- +- // returns the 8 corner points of a box +- static std::vector > corners_of_box_3d(vgl_box_3d const& box); +- +- //: returns the indices of the faces visible from the camera +- static bool is_face_visible(std::vector > &face, +- vpgl_camera_double_sptr const& camera); +- +- //: +- static bool is_face_visible(const double * xverts, const double *yerts, +- unsigned id1,unsigned id2,unsigned id3,unsigned id4); +- +- //: returns the visible faces of a box given a camera. +- // It puts a bit 1 for each face visible based on the boct_cell_face values. +- static boct_face_idx visible_faces(vgl_box_3d const& bbox, +- const vpgl_camera_double_sptr& camera, +- double *xverts, double *yerts); +- static boct_face_idx visible_faces_cell(vgl_box_3d const& bbox, +- const vpgl_camera_double_sptr& camera, +- double *xverts, double *yverts); +- +- static boct_face_idx visible_faces(vgl_box_3d const& bbox, const vpgl_camera_double_sptr& camera); +- +- static void faces_of_box_3d(vgl_box_3d const& bbox, +- std::map > > & faces); +- +- static void project_corners(std::vector > const& corners,const vpgl_camera_double_sptr& camera, +- double * xverts, double *yerts); +- static void project_point3d(vgl_point_3d const& point, +- const vpgl_camera_double_sptr& camera, +- double & xvert, double &yert, double & vertdist); +- +- static void project_corners(std::vector > const& corners, +- const vpgl_camera_double_sptr& camera, +- double* xverts, double* yverts, +- float* vertdist); +- static void project_cube(vgl_box_3d &bbox, +- const vpgl_camera_double_sptr& camera, +- std::map > > & faces, +- boct_face_idx & vis_face_ids); +- +- static std::vector > project_face(std::vector > &face, +- vpgl_camera_double_sptr const& camera); +- +- static void quad_interpolate(boxm_quad_scan_iterator &poly_it, +- double* xvals, double* yvals, double* vals, +- vil_image_view &img,unsigned img_plane_num=0, +- unsigned int v0=0, unsigned int v1=1, +- unsigned int v2=2,unsigned int v3=3); +- +- static void quad_fill(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float val, +- unsigned img_plane_num=0); +- static void quad_fill(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, +- vil_image_view &weights_img, +- float val, +- unsigned img_plane_num=0); +- +- static bool project_cube_xyz(std::map > > & faces, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- const vpgl_camera_double_sptr& camera); +- +- static bool project_cube_xyz(std::vector< vgl_point_3d > & corners, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- double *xverts,double * yerts); +- //: only for perspective camera +- static bool project_cube_xyz(std::vector< vgl_point_3d > & corners, +- boct_face_idx & vis_face_ids, +- vil_image_view &front_xyz, +- vil_image_view &back_xyz, +- double *xverts,double * yverts,float * vertdist); +- +- static bool project_cube_fill_val( std::map > > & faces, +- boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- float val, const vpgl_camera_double_sptr& cam); +- +- static bool project_cube_fill_val(boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- float val, double *xverts,double * yverts); +- static bool project_cube_fill_val_aa(boct_face_idx & vis_face_ids, +- vil_image_view &fill_img, +- vil_image_view &weights_img, +- float val, double *xverts,double * yverts); +- +- static bool cube_uniform_mean(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- float & val, double *xverts,double * yverts); +- static bool cube_weighted_mean(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- vil_image_view &weight_img, +- float & val, double *xverts,double * yverts); +- +- static bool cube_sum(boct_face_idx & vis_face_ids, +- vil_image_view &img, +- float & val, double *xverts,double * yverts); +- +- static void quad_mean(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float &val, float & count); +- static void quad_sum(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, float &val); +- static void quad_weighted_mean(boxm_quad_scan_iterator &poly_it, +- vil_image_view &img, +- vil_image_view &weighted_img, +- float &numerator, float & denominator); +- static bool cube_entry_point(vgl_box_3d box,vgl_point_3d pt, +- vgl_vector_3d dir, +- vgl_point_3d & entry_point, +- double & lambda, boct_face_idx & face_id); +- static bool cube_exit_point(vgl_box_3d box,vgl_point_3d pt, +- vgl_vector_3d dir, vgl_point_3d & exit_point, +- double & lambda,boct_face_idx & face_id); +- +- static double max_point_to_box_dist(vgl_box_3d box,vgl_point_3d pt); +- +- static boxm_apm_traits::apm_datatype obtain_mog_grey_unit_mode(); +- +- static boxm_apm_traits::apm_datatype obtain_mog_grey_zero_mode(); +- +- static boxm_apm_traits::apm_datatype obtain_mog_grey_single_mode(float mean); +-}; +- +-#endif +diff --git a/contrib/brl/bseg/boxm/util/boxm_vrml_util.h b/contrib/brl/bseg/boxm/util/boxm_vrml_util.h +deleted file mode 100644 +index 3e7bcdc580..0000000000 +--- a/contrib/brl/bseg/boxm/util/boxm_vrml_util.h ++++ /dev/null +@@ -1,214 +0,0 @@ +-// This is brl/bseg/boxm/util/boxm_vrml_util.h +-#ifndef boxm_vrml_util_h +-#define boxm_vrml_util_h +-//: +-// \file +-// \brief Set of utilities to save a boxm_scene as vrml files +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date Dec 9, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include "boxm_cell_data_traits.h" +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-class boxm_vrml_util +-{ +- public: +- +- // Writes the values in the scene above the threshold as vrml dots +- template +- static void write_vrml_scene(std::ofstream& str, boxm_scene > *scene, +- const float threshold= 0.0f); +-#if 0 // not yet working? +- static void write_vrml_scene(std::ofstream& str, bvxm_voxel_scene > *scene, +- const float threshold); +- static void write_vrml_scene_as_spheres(std::ofstream& str, bvxm_voxel_scene *scene, float threshold); +- static void write_vrml_scene_as_spheres(std::ofstream& str, bvxm_voxel_scene *scene, float threshold, int s=1); +- static void write_vrml_scene_as_pointers(std::ofstream& str, bvxm_voxel_scene *scene, float threshold, int s=1); +-#endif // 0 +-}; +- +- +-template +-void boxm_vrml_util::write_vrml_scene(std::ofstream& str, boxm_scene > *scene, float /*threshold*/) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- std::ofstream temp_stream("temp.txt"); +- +- bvrml_write::write_vrml_header(str); +- +- str << "Shape {\n" +- << " appearance NULL\n" +- << " geometry PointSet {\n" +- << " color Color{\n" +- << " color[\n"; +- // write the colors +- // iterate through the scene +- boxm_block_iterator iter= scene->iterator(); +- iter.begin(); +- +- for (; !iter.end(); iter++) { +- scene->load_block(iter.index()); +- tree_type *tree = (*iter)->get_tree(); +- +- // iterate through the tree +- std::vector cells = tree->leaf_cells(); +- +- for (unsigned i = 0; i < cells.size(); i++) +- { +- str <<" 0.5 0.2 0.8\n"; +- vgl_point_3d coord = tree->global_origin(cells[i]); +- temp_stream <<" " << (int)coord.x() << ' ' <<(int)coord.y() << ' ' << (int)coord.z() << '\n'; +- } +- } +- temp_stream.close(); +- +- str << " ]\n }\n" +- << " coord Coordinate{\n" +- << " point[\n"; +- +- // write the coordinates. +- std::ifstream fin; // file in +- std::filebuf *fb; // file buffer +- fb = fin.rdbuf(); +- fb->open ("temp.txt",std::ios::in); +- if (fb->is_open() ) +- { +- while (fb->sgetc()!=EOF) +- { +- std::string temp_str; +- std::istream isbf(fb); +- std::getline(isbf, temp_str); +- str << temp_str << '\n'; +- } +- } +- else +- std::cerr << "file is not open.\n"; +- +- fin.close(); +- str << " ]\n }\n }\n}\n"; +-} +- +-#if 0 // not yet working? +-void bvxm_vrml_voxel_grid::write_vrml_grid(std::ofstream& str, bvxm_voxel_grid > *grid, float threshold) +-{ +- bvxm_voxel_grid >::iterator grid_it = grid->begin(); +- +- str << "Shape {\n" +- << " appearance NULL\n" +- << " geometry PointSet {\n" +- << " color Color{\n" +- << " color[\n"; +- // write the colors +- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) { +- for (unsigned i=0; i<(*grid_it).nx(); ++i) { +- for (unsigned j=0; j < (*grid_it).ny(); ++j) { +- if ((((*grid_it)(i,j)).mean() > threshold)) +- str <<" " << ((*grid_it)(i,j)).mean() << ' '<< ((*grid_it)(i,j)).mean() << ' '<< ((*grid_it)(i,j)).mean() << '\n'; +- } +- } +- } +- str << " ]\n }\n" +- << " coord Coordinate{\n" +- << " point[\n"; +- +- // write the coordinates +- grid_it = grid->begin(); +- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) { +- std::cout << '.'; +- for (unsigned i=0; i<(*grid_it).nx(); ++i) { +- for (unsigned j=0; j < (*grid_it).ny(); ++j) { +- if (((*grid_it)(i,j)).mean() > threshold) +- str<<" " << i << ' ' < *grid, float threshold) +-{ +- bvxm_voxel_grid::iterator grid_it = grid->begin(); +- vgl_vector_3d dim=grid->grid_size(); +- unsigned s=3; +- // write the colors +- for (unsigned k=dim.z()-1; grid_it != grid->end(); ++grid_it, --k) { +- if (k%1==0) +- { +- for (unsigned i=0; i<(*grid_it).nx(); i+=s) { +- for (unsigned j=0; j < (*grid_it).ny(); j+=s) { +- if (((*grid_it)(i,j) > threshold)) { +-#ifdef DEBUG +- vgl_sphere_3d sphere((float)i,(float)j,(float)k,0.5f); +- write_vrml_sphere(str, sphere, (*grid_it)(i,j),(*grid_it)(i,j),(*grid_it)(i,j),1-(*grid_it)(i,j)); +-#endif // DEBUG +- vgl_sphere_3d sphere((float)i/s,(float)j/s,(float)k/s,0.4f); +- bvrml_write::write_vrml_sphere(str, sphere, 1,0,0,0); +- } +- } +- } +- } +- } +-} +- +-void bvxm_vrml_voxel_grid::write_vrml_grid_as_spheres(std::ofstream& str, bvxm_voxel_grid *grid, float threshold, int s) +-{ +- bvxm_voxel_grid::iterator grid_it = grid->begin(); +- // write the colors +- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) { +- for (unsigned i=0; i<(*grid_it).nx(); ) { +- for (unsigned j=0; j < (*grid_it).ny(); ) { +- if ((*grid_it)(i,j)[3]/255.0f > threshold) { +- vgl_sphere_3d sphere((float)i/s,(float)j/s,(float)k/s,0.5f); +- bvrml_write::write_vrml_sphere(str, sphere, 1,0,0,0); +- } +- } +- } +- } +-} +- +- +-void bvxm_vrml_voxel_grid::write_vrml_grid_as_pointers(std::ofstream& str, bvxm_voxel_grid *grid, float threshold, int s) +-{ +- bvxm_voxel_grid::iterator grid_it = grid->begin(); +- vgl_point_3d origin(0.0,0.0,0.0); +- vgl_vector_3d dirx(1,0,0); +- vgl_vector_3d diry(0,1,0); +- vgl_vector_3d dirz(0,0,1); +- bvrml_write::write_vrml_line(str,origin,dirx,1,1,0,0); +- bvrml_write::write_vrml_line(str,origin,diry,1,0,1,0); +- bvrml_write::write_vrml_line(str,origin,dirz,1,0,0,1); +- +- vgl_vector_3d dim=grid->grid_size(); +- // write the colors +- for (unsigned k=dim.z()-1; grid_it != grid->end(); ++grid_it, --k) { +- if (k%s==0) +- { +- for (unsigned i=0; i<(*grid_it).nx(); i=i+s) { +- for (unsigned j=0; j < (*grid_it).ny(); j=j+s) { +- if (((*grid_it)(i,j)[3] > threshold)) { +- vgl_vector_3d dir((*grid_it)(i,j)[0],(*grid_it)(i,j)[1],(*grid_it)(i,j)[2]); +- vgl_point_3d pt((double)i/s,(double)j/s,(double)k/s); +- bvrml_write::write_vrml_line(str, pt,dir,4*((*grid_it)(i,j)[3]-0.5f),1,0,0); +- bvrml_write::write_vrml_disk(str, pt,dir,2*((*grid_it)(i,j)[3]-0.5f),0,0.5f,0.0f); +- } +- } +- } +- } +- } +-} +-#endif // 0 +- +-#endif // boxm_vrml_util_h +diff --git a/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt +deleted file mode 100644 +index 91cc0db455..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt ++++ /dev/null +@@ -1,18 +0,0 @@ +-add_executable( boxm_util_test_all +- test_driver.cxx +- test_boxm_plane_ransac.cxx +- test_boxm_rational_camera_utils.cxx +- test_quad_interpolate.cxx +- ) +- +-target_link_libraries( boxm_util_test_all boxm_util boxm boxm_sample ${VXL_LIB_PREFIX}testlib boct bsta ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vil bvrml) +-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera0.txt ${CMAKE_CURRENT_BINARY_DIR}/camera0.txt COPYONLY ) +- +-add_test( NAME boxm_util_test_plane_ransac COMMAND $ test_boxm_plane_ransac ) +-add_test( NAME boxm_util_test_rational_camera_utils COMMAND $ test_boxm_rational_camera_utils ${CMAKE_CURRENT_SOURCE_DIR}) +-add_test( NAME boxm_util_test_quad_interpolate COMMAND $ test_quad_interpolate ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) +- +-add_executable( boxm_util_test_include test_include.cxx ) +-target_link_libraries( boxm_util_test_include boxm_util) +-add_executable( boxm_util_test_template_include test_template_include.cxx ) +-target_link_libraries( boxm_util_test_template_include boxm_util) +diff --git a/contrib/brl/bseg/boxm/util/tests/camera0.txt b/contrib/brl/bseg/boxm/util/tests/camera0.txt +deleted file mode 100644 +index cf11c57707..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/camera0.txt ++++ /dev/null +@@ -1,104 +0,0 @@ +-satId = "????"; +-bandId = "RGB"; +-SpecId = "RPC00B"; +-BEGIN_GROUP = IMAGE +- +- +- lineOffset = 0.0 +- sampOffset = 0.0 +- latOffset = 0.0 +- longOffset = 0.0 +- heightOffset = 0.0 +- lineScale = 1.0 +- sampScale = 1.0 +- latScale = 1.0 +- longScale = 1.0 +- heightScale = 1.0 +- lineNumCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- lineDenCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- sampNumCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +- sampDenCoef = ( +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1, +- 1); +-END_GROUP = IMAGE +-END; +-lvcs +-47.550493 35.395931 664.186757 +diff --git a/contrib/brl/bseg/boxm/util/tests/frame_00000.txt b/contrib/brl/bseg/boxm/util/tests/frame_00000.txt +deleted file mode 100644 +index a66e2014bd..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/frame_00000.txt ++++ /dev/null +@@ -1,7 +0,0 @@ +-1 0 0 +-0 1 0 +-0 0 1 +-1 0 0 +-0 1 0 +-0 0 1 +-0 0 0 +diff --git a/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx b/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx +deleted file mode 100644 +index 6664f28f37..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx ++++ /dev/null +@@ -1,79 +0,0 @@ +-//: +-// \file +-// \author Gamze Tunali +-// \brief this code tests the function boxm_plane_ransac. +-// Creates 10 planes that the same line goes through and 10 random planes +-// which do not contain the plane. It makes sure it returns only the +-// first 10 planes as the fittest ones. +-// +-// \date March 25, 2010 +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-static const unsigned int test_num=10; +-static const unsigned int test_set=10; +- +-static void test_boxm_plane_ransac() +-{ +- // create 10 planes that the line go through and 10 random planes +- vgl_point_3d p1(20,20,10); +- vgl_point_3d p2(30,20,10); +- vgl_infinite_line_3d line(p1,p2); +- +- std::vector > planes; +- vnl_random rand; +- // get two points from the line, and create a random 3rd point to define a plane +- +- for (unsigned i=0; i p3(x,y,z); +- vgl_plane_3d plane(p1,p2,p3); +- boxm_plane_obs obs(plane,1); +- boxm_edge_tangent_sample sample; +- sample.insert(obs); +- planes.push_back(sample); +- } +- +- // add the random planes +- for (unsigned i=0; i plane(a,b,c,d); +- boxm_plane_obs obs(plane,1); +- boxm_edge_tangent_sample sample; +- sample.insert(obs); +- planes.push_back(sample); +- } +- +- std::cout << " planes size: " << planes.size() << std::endl; +- +- std::vector weights(test_set,1); +- int threshold=2; +- float residual; +- vgl_infinite_line_3d l; +- vgl_box_3d cell_global_box(18,15,5,32,25,15); +- float ortho_thres = 0.01f; +- float volume_ratio = 128; +- boxm_plane_ransac(planes, weights, l, residual, cell_global_box, threshold, ortho_thres, volume_ratio); +- +- TEST_NEAR("test_boxm_plane_ransac: found the right plane set", +- (l.point()-line.point()).sqr_length() + (l.direction()-line.direction()).sqr_length(), +- 0.0f, 0.01f); +-} +- +-TESTMAIN(test_boxm_plane_ransac); +diff --git a/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx b/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx +deleted file mode 100644 +index bbee3d575d..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx ++++ /dev/null +@@ -1,24 +0,0 @@ +-#include +-#include +-#include +-#include +- +- +-static void test_boxm_rational_camera_utils() +-{ +- std::string filename="camera0.txt"; +- +- vpgl_local_rational_camera* rcam=read_local_rational_camera( "./" + filename); +- vgl_plane_3d top(0,0,1,-200); +- vgl_plane_3d bottom(0,0,1,0); +- +- unsigned ni=800, +- nj=800; +- double u, v; +- +- rcam->project(495,431,200,u,v); +- vgl_plane_3d plane_parallel=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam,top,bottom,ni,nj); +- // TODO: do something with plane_parallel ! +-} +- +-TESTMAIN(test_boxm_rational_camera_utils); +diff --git a/contrib/brl/bseg/boxm/util/tests/test_driver.cxx b/contrib/brl/bseg/boxm/util/tests/test_driver.cxx +deleted file mode 100644 +index 3bc9c909f2..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_driver.cxx ++++ /dev/null +@@ -1,15 +0,0 @@ +-#include +- +-DECLARE( test_boxm_plane_ransac ); +-DECLARE( test_boxm_rational_camera_utils ); +-DECLARE( test_quad_interpolate ); +- +-void register_tests() +-{ +- REGISTER( test_boxm_plane_ransac ); +- REGISTER( test_boxm_rational_camera_utils ); +- REGISTER( test_quad_interpolate ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/boxm/util/tests/test_include.cxx b/contrib/brl/bseg/boxm/util/tests/test_include.cxx +deleted file mode 100644 +index fec661974c..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_include.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx b/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx +deleted file mode 100644 +index 2c8c986813..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx ++++ /dev/null +@@ -1,117 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +-#include +-#include +- +- +-static void test_quad_interpolate(int argc, char* argv[]) +-{ +- std::vector > points; +- points.emplace_back(10,10); +- points.emplace_back(10,12); +- points.emplace_back(12,12); +- points.emplace_back(12,10); +- +- double xvals[]={10,10,12,12}; +- double yvals[]={10,12,12,10}; +- double vals[]={10,10,12,12}; +- //vgl_polygon poly(points); +- boxm_quad_scan_iterator poly_it(xvals,yvals); +- vil_image_view img_min(40,40); +- vil_image_view img_max(40,40); +- vil_image_view g_img_max(40,40); +- +- img_max.fill(0.0f); +- g_img_max.fill(0.0f); +- // creating ground truth +- g_img_max(10,10)=10.5f; g_img_max(10,11)=10.5f; +- g_img_max(11,10)=11.5f; g_img_max(11,11)=11.5f; +- +- boxm_utils::quad_interpolate(poly_it, xvals, yvals, vals,img_max,0); +- for (unsigned i=10;i<=12;i++) +- { +- for (unsigned j=10;j<=12;j++) +- { +- std::cout << img_max(j,i) << ' '; +- } +- std::cout << '\n'; +- } +- bool flag=true; +- for (unsigned i=0; i > points1; +- points.emplace_back(10.25,10.25); +- points.emplace_back(10.25,12.25); +- points.emplace_back(12.25,12.25); +- points.emplace_back(12.25,10.25); +- +- double xvals1[]={10.3,10.3,11.4,11.4}; +- double yvals1[]={10.3,11.4,11.4,10.3}; +- //double vals1[]={10,10,12,12}; +- ////vgl_polygon poly(points); +- boxm_quad_scan_iterator poly_it_1(xvals1,yvals1); +- //vil_image_view img_min(40,40); +- //vil_image_view img_max(40,40); +- +- g_img_max.fill(0.0f); +- // creating ground truth +- g_img_max(10,10)=10;g_img_max(10,11)=10; +- g_img_max(11,10)=10;g_img_max(11,11)=10; +- +- float val=0; +- float count=0; +- boxm_utils::quad_mean(poly_it_1,g_img_max,val,count); +- +- // code to test the projection of a cube . +- vgl_box_3d cell_bb(-0.8,19.2,-18.75,0.7625, 20.7625,-17.1875); +- std::string camera_input_path = (argc < 2) ? "." : argv[1]; +- std::ifstream ifs((camera_input_path + "/frame_00000.txt").c_str()); +- if (!ifs.is_open()) { +- std::cerr << "Failed to open file " << camera_input_path << "/frame_00000.txt\n"; +- TEST("Opening camera file", true, false); +- return; +- } +- auto* cam = new vpgl_perspective_camera(); +- ifs >> *cam; +- double xverts[8]; +- double yverts[8]; +- float vertdist[8]; +- unsigned int ni=1280; +- unsigned int nj=720; +- +- vpgl_camera_double_sptr cam_d(cam); +- vil_image_view front_xyz(ni,nj,1);front_xyz.fill(0.0f); +- vil_image_view back_xyz(ni,nj,1) ;back_xyz.fill(0.0f); +- +- std::vector > corners=boxm_utils::corners_of_box_3d(cell_bb); +- boxm_utils::project_corners(corners,cam_d,xverts,yverts,vertdist); +- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam_d,xverts,yverts); +- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdist); +- +- std::string image_output_path = (argc < 3) ? "." : argv[2]; +- std::cout << "Saving two TIFF files to directory " << image_output_path << '\n'; +- vil_save(vil_plane(front_xyz,0),(image_output_path + "/front.tiff").c_str()); +- vil_save(vil_plane(back_xyz,0), (image_output_path + "/back.tiff").c_str()); +-} +- +-TESTMAIN_ARGS(test_quad_interpolate); +diff --git a/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx +deleted file mode 100644 +index a3fbe3c4ae..0000000000 +--- a/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm_batch/CMakeLists.txt b/contrib/brl/bseg/boxm_batch/CMakeLists.txt +deleted file mode 100644 +index 643a441654..0000000000 +--- a/contrib/brl/bseg/boxm_batch/CMakeLists.txt ++++ /dev/null +@@ -1,59 +0,0 @@ +-# contrib/brl/bseg/boxm_batch/CMakeLists.txt +- +-include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) +-include( ${VXL_CMAKE_DIR}/NewCMake/FindOpenCL.cmake ) +- +-if( PYTHON_FOUND ) +- FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +- if( EXPAT_FOUND ) +- include_directories( ${PYTHON_INCLUDE_DIRS} ) +- include_directories( ${BRL_INCLUDE_DIR} ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/core ) +- +- include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl ) +- include_directories( ${MUL_INCLUDE_DIR} ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm/algo ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg/brec ) +- include_directories( ${BRL_INCLUDE_DIR}/bbas/bsta ) +- +- set(boxm_batch_sources +- reg_boxm.h reg_boxm.cxx +- ) +- if(NOT VXL_BUILD_POSITION_DEPENDENT_CODE) +- vxl_add_library(LIBRARY_NAME boxm_batch LIBRARY_SOURCES SHARED ${boxm_batch_sources}) +- +- #library has to have different name depending on debug or release version. +- if(WIN32) +- set_target_properties(boxm_batch PROPERTIES OUTPUT_NAME boxm_batch DEBUG_POSTFIX _d SUFFIX .pyd) +- endif() +- if(APPLE) +- set_target_properties(boxm_batch PROPERTIES OUTPUT_NAME boxm_batch SUFFIX .so) +- endif() +- set_target_properties(boxm_batch PROPERTIES PREFIX "") +- +- target_link_libraries(boxm_batch bpro_batch boxm_pro boxm_sample_algo boxm_algo_rt_pro boxm_algo_sp_pro boxm_algo_pro ${VXL_LIB_PREFIX}vpgl_io vpgl_pro ${VXL_LIB_PREFIX}vil_io vil_pro sdet_pro bsta_pro icam_pro bapl_pro ) +- +- if(PYTHON_DEBUG_LIBRARIES) +- target_link_libraries( boxm_batch debug ${PYTHON_DEBUG_LIBRARY}) +- endif() +- +- if(PYTHON_LIBRARIES) +- target_link_libraries( boxm_batch optimized ${PYTHON_LIBRARY}) +- endif() +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +- endif() +- endif() +-endif() +- +-include( ${VXL_CMAKE_DIR}/NewCMake/FindDirectShow.cmake ) +-if(DIRECTSHOW_FOUND) +- add_definitions(-DHAS_DIRECTSHOW) +-endif() +diff --git a/contrib/brl/bseg/boxm_batch/reg_boxm.cxx b/contrib/brl/bseg/boxm_batch/reg_boxm.cxx +deleted file mode 100644 +index baa2f55b02..0000000000 +--- a/contrib/brl/bseg/boxm_batch/reg_boxm.cxx ++++ /dev/null +@@ -1,135 +0,0 @@ +-#include "reg_boxm.h" +-#include +-#include +-#include +- +-// processes +-#include +-#include +-#include +-//#include +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-#include +- +-#include +-PyObject * +-register_processes(PyObject *self, PyObject *args) +-{ +- vil_register::register_process(); +- vpgl_register::register_process(); +- boxm_register::register_process(); +- boxm_algo_register::register_process(); +- +- boxm_algo_rt_register::register_process(); +- boxm_algo_sp_register::register_process(); +- sdet_register::register_process(); +- //icam_register::register_process(); +- bapl_register::register_process(); +- bbas_register::register_process(); +- Py_INCREF(Py_None); +- return Py_None; +-} +- +-PyObject * +-register_datatypes(PyObject *self, PyObject *args) +-{ +- register_basic_datatypes(); +- vil_register::register_datatype(); +- vpgl_register::register_datatype(); +- boxm_register::register_datatype(); +- boxm_algo_register::register_process(); +- +- boxm_algo_rt_register::register_datatype(); +- boxm_algo_sp_register::register_datatype(); +- +- bsta_register::register_datatype(); +- //icam_register::register_datatype(); +- bapl_register::register_datatype(); +- bbas_register::register_datatype(); +- Py_INCREF(Py_None); +- return Py_None; +-} +- +- +-PyObject *get_boxm_array_1d_float(PyObject * /*self*/, PyObject *args) +-{ +- unsigned id; +- boxm_array_1d_float_sptr value; +- if (!PyArg_ParseTuple(args, "i:get_boxm_array_1d_float", &id)) +- return NULL; +- +- std::string relation_name = "boxm_array_1d_float_sptr_data"; +- +- // query to get the data +- brdb_query_aptr Q = brdb_query_comp_new("id", brdb_query::EQ, id); +- brdb_selection_sptr selec = DATABASE->select(relation_name, std::move(Q)); +- PyObject *array_1d=0; +- if (selec->size()!=1) { +- std::cout << "in get_boxm_array_1d_float() - no relation with type" << relation_name << " id: " << id << std::endl; +- +- return array_1d; +- } +- +- brdb_value_sptr brdb_value; +- if (!selec->get_value(std::string("value"), brdb_value)) { +- std::cout << "in get_boxm_array_1d_float() didn't get value\n"; +- return array_1d; +- } +- +- if (!brdb_value) { +- std::cout << "in get_boxm_array_1d_float() - null value\n"; +- return array_1d; +- } +- +- brdb_value_t* result_out = static_cast* >(brdb_value.ptr()); +- value = result_out->value(); +- +- array_1d = PyList_New(value->data_array.size()); +- PyObject *x; +- for(unsigned i=0;idata_array.size();i++) +- { +- x=PyFloat_FromDouble((double)value->data_array[i]); +- PyList_SetItem(array_1d, i,x);//Py_DECREF(x); +- } +- Py_INCREF(array_1d); +- return array_1d; +-} +-PyMODINIT_FUNC +-initboxm_batch(void) +-{ +- PyMethodDef reg_pro; +- reg_pro.ml_name = "register_processes"; +- reg_pro.ml_meth = register_processes; +- reg_pro.ml_doc = "register_processes() create instances of each defined process"; +- reg_pro.ml_flags = METH_VARARGS; +- +- +- PyMethodDef reg_data; +- reg_data.ml_name = "register_datatypes"; +- reg_data.ml_meth = register_datatypes; +- reg_data.ml_doc = "register_datatypes() insert tables in the database for each type"; +- reg_data.ml_flags = METH_VARARGS; +- +- PyMethodDef get_boxm_array_1d_float_func; +- get_boxm_array_1d_float_func.ml_name = "get_boxm_array_1d_float"; +- get_boxm_array_1d_float_func.ml_meth = get_boxm_array_1d_float; +- get_boxm_array_1d_float_func.ml_doc = "get_boxm_array_1d_float() Get 1-d array in python"; +- get_boxm_array_1d_float_func.ml_flags = METH_VARARGS; +- +- boxm_batch_methods[0]=reg_pro; +- boxm_batch_methods[1]=reg_data; +- boxm_batch_methods[2]=get_boxm_array_1d_float_func; +- +- for (int i=0; i +- +-static PyObject *register_processes(PyObject *self, PyObject *args); +-static PyObject *register_datatypes(PyObject *self, PyObject *args); +-static PyObject *get_boxm_array_1d_float(PyObject * self, PyObject *args); +- +-static PyMethodDef boxm_batch_methods[METHOD_NUM+3]; +- +-#endif +diff --git a/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt b/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt +deleted file mode 100644 +index 8b72db0d89..0000000000 +--- a/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( boxm_batch_test_include test_include.cxx ) +-target_link_libraries( boxm_batch_test_include boxm_batch) +diff --git a/contrib/brl/bseg/boxm_batch/tests/test_include.cxx b/contrib/brl/bseg/boxm_batch/tests/test_include.cxx +deleted file mode 100644 +index f962b339e8..0000000000 +--- a/contrib/brl/bseg/boxm_batch/tests/test_include.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/boxm_bridge/CMakeLists.txt b/contrib/brl/bseg/boxm_bridge/CMakeLists.txt +deleted file mode 100644 +index 7186a42583..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/CMakeLists.txt ++++ /dev/null +@@ -1,25 +0,0 @@ +-if (HAS_GEOTIFF) +-include( ${VXL_CMAKE_DIR}/NewCMake/FindOpenCL.cmake ) +-if(OPENCL_FOUND) +- +- add_definitions(-DHAS_OPENCL=1) +- include_directories( ${OPENCL_INCLUDE_PATH} ) +- include_directories( ${GEL_INCLUDE_DIR}/mrc ) +- include_directories( ${MUL_INCLUDE_DIR} ) +- +- add_executable( boxm2_to_boxm_exe boxm2_to_boxm.cxx boxm2_to_boxm.h) +- target_link_libraries( boxm2_to_boxm_exe boxm2 boxm boxm_sample boxm2_io boct ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl) +- +- # executable to convert a bit scene to a boxm2_scene +- add_executable( boxm_to_boxm2_exe boxm_to_boxm2.cxx boxm_to_boxm2.h) +- target_link_libraries( boxm_to_boxm2_exe boxm2 boxm boxm_sample boxm2_io boct ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl) +- +- #tests +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- +-endif() +-else() +- message(STATUS "Skipping contrib/brl/bseg/boxm_bridge: requires geotiff") +-endif() +diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx b/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx +deleted file mode 100644 +index a9a7c43ba6..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx ++++ /dev/null +@@ -1,233 +0,0 @@ +-//: +-// \file +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//executable args +-#include +- +-#include +-#include +- +-//boct files +-#include +-#include +- +-//boxm2 files +-#include +-#include +-#include +-#include +-#include +- +-// boxm files +-#include +-#include +- +-#define BOXM2_SCENE_HAS_DIMENSIONS +- +-//: computes the log2 of a number and returns it. +-// power_of_2 is set to true if \p x is an exact power of two. +-// returns -1 when \p x is zero. +-int mylog2(unsigned x, bool& power_of_2) +-{ +- unsigned orig_x = x; +- int l = -1; // mylog2(0) will return -1 +- while (x != 0u) { +- x >>= 1u; +- ++l; +- } +- if (orig_x > std::pow(2.0,l)) { +- power_of_2 = false; +- ++l; +- } +- else +- power_of_2 = true; +- return l; +-} +- +- +-template +-void insert(boct_tree*& tree, boct_tree*& subtree, vgl_box_3d cell_bb) +-{ +- // find the leaf node in the tree to insert subtree +- boct_tree_cell* node = tree->locate_point(cell_bb.centroid()); +- if (!node) +- std::cerr << "The node could NOT be FOUND\n"; +- if (node->children()) { +- std::cerr << "The node is not a leaf node! Cannot insert here\n"; +- return; // it should have been a leaf node +- } +- +- boct_tree_cell* sub_root = subtree->root(); +- node->insert_subtree(sub_root); +-} +- +-// converts the bit tree to boct_octree representation +-template +-void convert_tree(boct_bit_tree2 const& bit_tree, boct_tree*& tree, +- boxm2_data* normal_data) +-{ +- // check if root has any child, if not return the empty tree +- tree = new boct_tree(4, 1); +- +- // if root has no child return a root node filled with data +- if (!bit_tree.bit_at(0)) { +- int data_idx = bit_tree.get_data_index(0,false); +- boxm2_data_traits::datatype data = normal_data->data()[data_idx]; +- tree->root()->set_data(vnl_vector_fixed (data[0], data[1], data[2])); +- return; +- } +- +- std::queue*> Q; +- boct_tree_cell* root = tree->root(); +- Q.push(root); +- +- // go through the bits and create cells +- int data_idx=bit_tree.get_data_index(0,false); +- for (unsigned i=0; i<73; i++) { +- int parent_idx = (i-1)/8; +- if (i==0 || bit_tree.bit_at(parent_idx)) { +- if (!Q.empty()) { +- boxm2_data_traits::datatype data = normal_data->data()[data_idx]; +- vnl_vector_fixed normal(data[0], data[1], data[2]); +- boct_tree_cell* ptr = Q.front(); +- ptr->set_data(normal); +- Q.pop(); +- if (bit_tree.bit_at(i)) { +- ptr->split(); +- boct_tree_cell* children = ptr->children(); +- for (unsigned j=0; j<8; j++) { +- Q.push(&children[j]); +- } +- } +- data_idx++; +- } +- } +- } +- +- // some of the leaf nodes are still in the queue, fill them with data +- while (!Q.empty()) { +- if (data_idx > bit_tree.get_data_index(0,false)+585) +- std::cerr << "ERROR! exceeded!\n"; +- boxm2_data_traits::datatype data = normal_data->data()[data_idx]; +- vnl_vector_fixed normal(data[0], data[1], data[2]); +- boct_tree_cell* ptr = Q.front(); +- ptr->set_data(normal); +- Q.pop(); +- data_idx++; +- } +-} +- +-int main(int argc, char** argv) +-{ +- std::cout<<"Converting boxm2 scene to boxm scene"< boxm2_file("-scene", "scene filename", ""); +- vul_arg boxm_dir("-out", "output directory", ""); +- vul_arg_parse(argc, argv); +- +- boxm2_scene scene2(boxm2_file()); +- +- //initialize a block and data cache +- boxm2_lru_cache::create(&scene2); +- boxm2_cache_sptr cache = boxm2_cache::instance(); +- +- bgeo_lvcs lvcs = scene2.lvcs(); +- //vgl_point_3d origin = scene2.local_origin(); +- vgl_box_3d world = scene2.bounding_box(); +- std::map blocks = scene2.blocks(); +- std::map::iterator iter = blocks.begin(); +- +- typedef boct_tree > tree_type; +- vgl_vector_3d block_nums = scene2.scene_dimensions(); +- vgl_point_3d min_block_index; +- vgl_point_3d origin; +- scene2.min_block_index(min_block_index, origin); +- vgl_vector_3d ww(world.width()/block_nums.x(),world.height()/block_nums.y(),world.depth()/block_nums.z()); +- +- +- boxm_scene scene(lvcs, origin, ww, block_nums,false,true,true); +- std::string scene_path=boxm_dir(); //"C:/data/boxm2/downtown/boxm_scene"; +- scene.set_paths(scene_path,"block"); +- scene.set_appearance_model(VNL_FLOAT_3); +- +- int x_dim; +- while (iter != blocks.end()) { +- boxm2_block_metadata metadata = iter ->second; +- boxm2_block_id id = iter->first; +- boxm2_block * block = cache->get_block(iter->first); +- std::cout<<" DATA buffers "<< block->num_buffers()<get_data_base(iter->first,boxm2_data_traits::prefix()); +- boxm2_data *data =new boxm2_data(data_base->data_buffer(),data_base->buffer_length(),data_base->block_id()); +- +- // compute the block bounding box etc +- vgl_vector_3d dim = block->sub_block_num(); +- vgl_vector_3d subdim=block->sub_block_dim(); +- +- // block dimensions should be equal +- bool equal = (dim.x()==dim.y()); +- equal = equal && (dim.x()==dim.z()); +- assert(equal); +- +- // the block dimensions should be the power of 2 for octree creation +- bool pow_of_2; +- x_dim = mylog2((double)dim.x(),pow_of_2); +- assert(pow_of_2); +- +- double p[3]; +- p[0] = metadata.local_origin_.x(); +- p[1] = metadata.local_origin_.y(); +- p[2] = metadata.local_origin_.z(); +- vgl_box_3d block_bb(p, subdim.x()*dim.x(), subdim.y()*dim.y(), subdim.z()*dim.z(), vgl_box_3d::min_pos); +- tree_type* block_tree=new tree_type(x_dim+4, x_dim+1); // FIX take max of 3 dims instead +- block_tree->set_bbox(block_bb); +- block_tree->init_cells(0); +- +- int block_i = id.i() - min_block_index.x(); +- int block_j = id.j() - min_block_index.y(); +- int block_k = id.k() - min_block_index.z(); +- +- scene.load_block(block_i, block_j, block_k); +- // go over the subtrees +- for (unsigned z=0; ztrees()[x][y][z]; +- boct_bit_tree2 bit_tree((unsigned char*)tree.data_block()); +- if (bit_tree.num_cells() >= 1) { +- tree_type* octree; +- convert_tree(bit_tree,octree,data); +- int n1=bit_tree.num_cells(); +- int n2=octree->all_cells().size(); +- if (n1 != n2) { +- std::cerr << x << ',' << y << ',' << z << '\n' +- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << '\n'; +- } +- +- // all three dimensions should be same now, so we can use the one value +- double cell_dim=1./dim.x(); +- p[0] = x*cell_dim; +- p[1] = y*cell_dim; +- p[2] = z*cell_dim; +- vgl_box_3d cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- insert(block_tree,octree, cell_bb); +- +- // since the subtree is added to the main tree, we can delete the root node now +- delete octree; +- } +- } +- } +- } +- boxm_block* block_new = scene.get_block(block_i, block_j, block_k); +- block_new->init_tree(block_tree); +- scene.write_active_block(); +- iter++; +- } +- scene.set_octree_levels(x_dim+4, x_dim+1); +- scene.write_scene("boxm_scene.xml"); +-} +diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx b/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx +deleted file mode 100644 +index a9d5135776..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx ++++ /dev/null +@@ -1,292 +0,0 @@ +-#include +-#include +-#include "boxm2_to_boxm.h" +-//: +-// \file +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//executable args +-#include +- +-#include +-#include +- +-//boct files +-#include +-#include +- +-//boxm2 files +-#include +-#include +-#include +-#include +-#include +- +-// boxm files +-#include +-#include +- +-#define BOXM2_SCENE_HAS_DIMENSIONS +- +-//: computes the log2 of a number and returns it. +-// power_of_2 is set to true if \p x is an exact power of two. +-// returns -1 when \p x is zero. +-int mylog2(unsigned x, bool& power_of_2) +-{ +- unsigned orig_x = x; +- int l = -1; // mylog2(0) will return -1 +- while (x != 0u) { +- x >>= 1u; +- ++l; +- } +- if (orig_x > std::pow(2.0,l)) { +- power_of_2 = false; +- ++l; +- } +- else +- power_of_2 = true; +- return l; +-} +- +- +-template +-void insert(boct_tree*& tree, boct_tree*& subtree, vgl_box_3d cell_bb) +-{ +- // find the leaf node in the tree to insert subtree +- boct_tree_cell* node = tree->locate_point(cell_bb.centroid()); +- if (!node) +- std::cerr << "The node could NOT be FOUND\n"; +- if (node->children()) { +- std::cerr << "The node is not a leaf node! Cannot insert here\n"; +- return; // it should have been a leaf node +- } +- +- boct_tree_cell* sub_root = subtree->root(); +- node->insert_subtree(sub_root); +-} +- +-//: combine the data values to create a sample +-boxm_sample create_sample(float alpha, +- boxm2_data_traits::datatype data, +- boxm2_data_traits::datatype num_obs) +-{ +- float m0=data[0]/255.0f; +- float v0=data[1]/255.0f; +- float w0=data[2]/255.0f; +- float m1=data[3]/255.0f; +- float v1=data[4]/255.0f; +- float w1=data[5]/255.0f; +- float m2=data[6]/255.0f; +- float v2=data[7]/255.0f; +- float w2=0; +- if (w0>0 && w1>0) +- w2=1.0-w0-w1; +- +- unsigned short n0=num_obs[0]; +- unsigned short n1=num_obs[1]; +- unsigned short n2=num_obs[2]; +- unsigned short nmix=num_obs[3]; +- +- typedef boxm_apm_traits::gauss_type_sf1 gauss_type_sf1; +- typedef boxm_apm_traits::mix_gauss_sf1_type mix_gauss_sf1_type; +- +- +- bsta_gauss_sf1 dist0((float)m0, (float)v0); +- bsta_num_obs num_obs_dist0(dist0, n0); +- bsta_gauss_sf1 dist1((float)m1, (float)v1); +- bsta_num_obs num_obs_dist1(dist1, n1); +- bsta_gauss_sf1 dist2((float)m2, (float)v2); +- bsta_num_obs num_obs_dist2(dist2, n2); +- +- bsta_mixture_fixed mf; +- mf.insert(num_obs_dist0,w0); +- mf.insert(num_obs_dist1,w1); +- mf.insert(num_obs_dist2,w2); +- +- bsta_num_obs > obs(mf,nmix/100.0f); +- +- boxm_sample sample(alpha, obs); +- return sample; +-} +- +-// converts the bit tree to boct_octree representation +-template +-void convert_tree(boct_bit_tree const& bit_tree, boct_tree*& tree, +- boxm2_data* alpha_data, +- boxm2_data* mog3_data, +- boxm2_data* num_obs) +-{ +- // check if root has any child, if not return the empty tree +- tree = new boct_tree(4, 1); +- +- // if root has no child return a root node filled with data +- if (!bit_tree.bit_at(0)) { +- int data_idx = bit_tree.get_data_index(0,false); +- boxm2_data_traits::datatype data = mog3_data->data()[data_idx]; +- boxm2_data_traits::datatype nums = num_obs->data()[data_idx]; +- boxm2_data::datatype alpha = alpha_data->data()[data_idx]; +- boxm_sample sample = create_sample(alpha,data,nums); +- tree->root()->set_data(sample); +- return; +- } +- +- std::queue*> Q; +- boct_tree_cell* root = tree->root(); +- Q.push(root); +- +- // go through the bits and create cells +- int data_idx=bit_tree.get_data_index(0,false); +- for (unsigned i=0; i<73; i++) { +- int parent_idx = (i-1)/8; +- if (i==0 || bit_tree.bit_at(parent_idx)) { +- if (!Q.empty()) { +- boxm2_data_traits::datatype data = mog3_data->data()[data_idx]; +- boxm2_data_traits::datatype nums = num_obs->data()[data_idx]; +- boxm2_data::datatype alpha = alpha_data->data()[data_idx]; +- boxm_sample sample = create_sample(alpha,data,nums); +- +- boct_tree_cell* ptr = Q.front(); +- ptr->set_data(sample); +- Q.pop(); +- if (bit_tree.bit_at(i)) { +- ptr->split(); +- boct_tree_cell* children = ptr->children(); +- for (unsigned j=0; j<8; j++) { +- Q.push(&children[j]); +- } +- } +- data_idx++; +- } +- } +- } +- +- // some of the leaf nodes are still in the queue, fill them with data +- while (!Q.empty()) { +- if (data_idx > bit_tree.get_data_index(0,false)+585) +- std::cerr << "ERROR! exceeded!\n"; +- boxm2_data_traits::datatype data = mog3_data->data()[data_idx]; +- boxm2_data_traits::datatype nums = num_obs->data()[data_idx]; +- boxm2_data::datatype alpha = alpha_data->data()[data_idx]; +- boxm_sample sample = create_sample(alpha,data,nums); +- boct_tree_cell* ptr = Q.front(); +- ptr->set_data(sample); +- Q.pop(); +- data_idx++; +- } +-} +- +-int main(int argc, char** argv) +-{ +- std::cout<<"Converting boxm2 scene to boxm scene"< boxm2_file("-scene", "scene filename", ""); +- vul_arg boxm_dir("-out", "output directory", ""); +- vul_arg_parse(argc, argv); +- +- boxm2_scene_sptr scene2 = new boxm2_scene(boxm2_file()); +- +- //initialize a block and data cache +- boxm2_lru_cache::create(scene2); +- boxm2_cache_sptr cache = boxm2_cache::instance(); +- +- vpgl_lvcs lvcs = scene2->lvcs(); +- //vgl_point_3d origin = scene2->local_origin(); +- vgl_box_3d world = scene2->bounding_box(); +- std::map blocks = scene2->blocks(); +- auto iter = blocks.begin(); +- +- typedef boct_tree > tree_type; +- vgl_vector_3d block_nums = scene2->scene_dimensions(); +- vgl_point_3d min_block_index; +- vgl_point_3d origin; +- scene2->min_block_index(min_block_index, origin); +- vgl_vector_3d ww(world.width()/block_nums.x(),world.height()/block_nums.y(),world.depth()/block_nums.z()); +- +- +- boxm_scene scene(lvcs, origin, ww, block_nums,false,true,true); +- std::string scene_path=boxm_dir(); //"C:/data/boxm2/downtown/boxm_scene"; +- scene.set_paths(scene_path,"block"); +- scene.set_appearance_model(BOXM_APM_MOG_GREY); +- +- int x_dim; +- while (iter != blocks.end()) { +- boxm2_block_metadata metadata = iter ->second; +- boxm2_block_id id = iter->first; +- boxm2_block * block = cache->get_block(scene2, iter->first); +- std::cout<<" DATA buffers "<< block->num_buffers()<get_data_base(scene2, iter->first,boxm2_data_traits::prefix()); +- boxm2_data *num_obs=new boxm2_data(data_base->data_buffer(),data_base->buffer_length(),data_base->block_id()); +- +- boxm2_data_base * mog3_data_base = cache->get_data_base(scene2, iter->first,boxm2_data_traits::prefix()); +- boxm2_data *mog3_data=new boxm2_data(mog3_data_base->data_buffer(),mog3_data_base->buffer_length(),mog3_data_base->block_id()); +- boxm2_data_base * alpha_data_base = cache->get_data_base(scene2, iter->first,boxm2_data_traits::prefix()); +- boxm2_data *alpha_data =new boxm2_data(alpha_data_base->data_buffer(),alpha_data_base->buffer_length(),alpha_data_base->block_id()); +- +- // compute the block bounding box etc +- vgl_vector_3d dim = block->sub_block_num(); +- vgl_vector_3d subdim=block->sub_block_dim(); +- +- // block dimensions should be equal +- bool equal = (dim.x()==dim.y()); +- equal = equal && (dim.x()==dim.z()); +- assert(equal); +- +- // the block dimensions should be the power of 2 for octree creation +- bool pow_of_2; +- x_dim = mylog2((double)dim.x(),pow_of_2); +- assert(pow_of_2); +- +- double p[3]; +- p[0] = metadata.local_origin_.x(); +- p[1] = metadata.local_origin_.y(); +- p[2] = metadata.local_origin_.z(); +- vgl_box_3d block_bb(p, subdim.x()*dim.x(), subdim.y()*dim.y(), subdim.z()*dim.z(), vgl_box_3d::min_pos); +- auto* block_tree=new tree_type(x_dim+4, x_dim+1); // FIX take max of 3 dims instead +- block_tree->set_bbox(block_bb); +- block_tree->init_cells(0); +- +- int block_i = id.i() - min_block_index.x(); +- int block_j = id.j() - min_block_index.y(); +- int block_k = id.k() - min_block_index.z(); +- +- scene.load_block(block_i, block_j, block_k); +- // go over the subtrees +- for (unsigned z=0; ztrees()[x][y][z]; +- boct_bit_tree bit_tree((unsigned char*)tree.data_block()); +- if (bit_tree.num_cells() >= 1) { +- tree_type* octree; +- convert_tree(bit_tree,octree,alpha_data,mog3_data,num_obs); +- int n1=bit_tree.num_cells(); +- int n2=octree->all_cells().size(); +- if (n1 != n2) { +- std::cerr << x << ',' << y << ',' << z << '\n' +- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << '\n'; +- } +- +- // all three dimensions should be same now, so we can use the one value +- double cell_dim=1./dim.x(); +- p[0] = x*cell_dim; +- p[1] = y*cell_dim; +- p[2] = z*cell_dim; +- vgl_box_3d cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- insert(block_tree,octree, cell_bb); +- +- // since the subtree is added to the main tree, we can delete the root node now +- delete octree; +- } +- } +- } +- } +- boxm_block* block_new = scene.get_block(block_i, block_j, block_k); +- block_new->init_tree(block_tree); +- scene.write_active_block(); +- iter++; +- } +- scene.set_octree_levels(x_dim+4, x_dim+1); +- scene.write_scene("boxm_scene.xml"); +-} +diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h b/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h +deleted file mode 100644 +index a4dec11806..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h ++++ /dev/null +@@ -1,24 +0,0 @@ +-#ifndef boxm2_to_boxm_h_ +-#define boxm2_to_boxm_h_ +-//: +-// \file +- +-#include +-#include +-#include +-#include +-#include +- +-//: combine the data values to create a sample +-boxm_sample create_sample(float alpha, +- boxm2_data_traits::datatype data, +- boxm2_data_traits::datatype num_obs); +- +-//: converts the bit tree to boct_octree representation +-template +-void convert_tree(boct_bit_tree const& bit_tree, boct_tree*& tree, +- boxm2_data* alpha_data, +- boxm2_data* mog3_data, +- boxm2_data* num_obs); +- +-#endif // boxm2_to_boxm_h_ +diff --git a/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx b/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx +deleted file mode 100644 +index 54dc134841..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx ++++ /dev/null +@@ -1,326 +0,0 @@ +-#include +-#include +-#include "boxm_to_boxm2.h" +-//: +-// \file +-// +-// boxm_normals_to_boxm2.cxx +-// +-// \author +-// Created by David Borton on 11/28/11. +-// Copyright (c) 2011 Brown University. All rights reserved. +-// +- +-#ifdef _MSC_VER +-# include +-#endif +- +-//executable args +-#include +- +-#include +-#include +- +-//boct files +-#include +-#include +- +-//boxm2 files +-#include +-#include +-#include +-#include +-#include +- +-// boxm files +-#include +-#include +-#include +- +- +-//: extracts the tree cell's data into an array format for boxm2 representation +-template +-void convert_data(boct_tree* tree, +- boct_tree_cell* tree_cell, +- boct_tree_cell* valid_cell, +- boct_tree_cell* alpha_cell, +- boxm2_data_traits::datatype* normals_arr, +- boxm2_data_traits::datatype* points_arr, +- boxm2_data_traits::datatype* alpha_arr, +- int& data_idx) +-{ +- // go through the tree, in depth first order to collect data +- std::queue*> Q; +- std::queue*> alpha_Q; +- std::queue*> valid_Q; +- +- Q.push(tree_cell); +- alpha_Q.push(alpha_cell); +- valid_Q.push(valid_cell); +- +- while (!Q.empty()) { +- boct_tree_cell* ptr = Q.front(); +- boct_tree_cell* valid_ptr = valid_Q.front(); +- boct_tree_cell alpha_ptr = alpha_Q.front(); +- vgl_point_3d point = tree->global_centroid(tree_cell); +- +- if (ptr && valid_ptr && alpha_ptr) +- { +- if (valid_ptr->data()) { +- T_data normal = tree_cell->data(); +- +- normals_arr[data_idx][0] = normal[0]; +- normals_arr[data_idx][1] = normal[2]; +- normals_arr[data_idx][2] = normal[3]; +- normals_arr[data_idx][3] = 0.0f; +- +- points_arr[data_idx][0] = point.x(); +- points_arr[data_idx][1] = point.y(); +- points_arr[data_idx][2] = point.z(); +- points_arr[data_idx][3] = 0.0f; +- +- alpha_arr[data_idx]=alpha_cell->data(); +- } +- else { +- normals_arr[data_idx][0] = 0.0f; +- normals_arr[data_idx][1] = 0.0f; +- normals_arr[data_idx][2] = 0.0f; +- normals_arr[data_idx][3] = 0.0f; +- +- points_arr[data_idx][0] = point.x(); +- points_arr[data_idx][1] = point.y(); +- points_arr[data_idx][2] = point.z(); +- points_arr[data_idx][3] = 0.0f; +- +- alpha_arr[data_idx]=alpha_cell->data(); +- } +- +- data_idx++; +- +- if (!ptr->is_leaf()) { +- boct_tree_cell* children = ptr->children(); +- boct_tree_cell* valid_children = valid_ptr->children(); +- boct_tree_cell* alpha_chidren = alpha_ptr->children(); +- for (unsigned j=0; j<8; j++) { +- Q.push(&children[j]); +- alpha_Q.push(&alpha_chidren[j]); +- valid_Q.push(&valid_children[j]); +- } +- } +- } +- Q.pop(); +- alpha_Q.pop(); +- valid_Q.pop(); +- } +-} +- +-//: recursively sets the bits based on the octree structure +-template +-void set_bits(boct_bit_tree2*& bit_tree, int idx, unsigned int child_idx, boct_tree_cell & cell) +-{ +- if (cell.code_.level == 0) +- return; +- +- if (!cell.is_leaf()) { +- int bit_idx=idx*8+1+child_idx; +- bit_tree->set_bit_at(bit_idx,true); +- for (unsigned i=0; i<8; i++) +- set_bits(bit_tree, bit_idx, i, cell.children()[i]); +- } +-} +- +-//: converts the bit tree to boct_octree representation +-template +-void convert_to_bittree(boct_tree_cell* tree_cell, boct_bit_tree2*& bit_tree) +-{ +- bit_tree = new boct_bit_tree2(); +- // first set all the bits to 0 +- for (unsigned i=0; i<73; i++) +- bit_tree->set_bit_at(i,false); +- +- // empty tree +- if (!tree_cell) +- return; +- +- // only root node +- if (tree_cell->is_leaf()) +- return; +- +- int idx=0; +- bit_tree->set_bit_at(idx,true); // root +- for (unsigned i=0; i<8; i++) { // level root-1 +- set_bits(bit_tree, idx, i, tree_cell->children()[i]); +- } +-} +- +-template +-void convert_scene( boxm_scene > &scene, +- boxm_scene > &valid_scene, +- boxm_scene > &alpha_scene, +- boxm2_scene &new_scene) +-{ +- std::map new_blocks; +- unsigned int dim=sub_block_dim(); +- typedef boct_octree tree_type; +- boxm_block_iterator iter(&scene); +- boxm_block_iterator validd_iter(&valid_scene); +- boxm_block_iterator alpha_iter(&alpha_scene); +- +- while (!iter.end()) { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- std::cout<get_tree(); +- +- valid_scene.load_block(idx); +- boxm_block >* valid_block = valid_scene.get_block(idx); +- boct_tree * valid_tree = valid_block->get_tree(); +- +- alpha_scene.load_block(idx); +- boxm_block >* alpha_block = alpha_scene.get_block(idx); +- boct_tree * alpha_tree = alpha_block->get_tree(); +- +- // create metadata for the block +- boxm2_block_id block_id(idx.x(),idx.y(),idx.z()); +- vgl_vector_3d sub_block_dim(1.0/dim,1.0/dim,1.0/dim); +- vgl_vector_3d sub_block_num(dim,dim,dim); +- vgl_vector_3d real_block_dim(sub_block_dim.x()*scene.block_dim().x(), +- sub_block_dim.y()*scene.block_dim().y(), +- sub_block_dim.z()*scene.block_dim().z()); +- boxm2_block_metadata metadata(block_id, block->bounding_box().min_point(), +- real_block_dim,sub_block_num,1,4,650.0,0.001); +- boxm2_block new_block(metadata); +- new_blocks[block_id]=metadata; +- +- // find the total number of cells to figure out data array sizes, as the first step +- int data_size=0; +- for (unsigned z=0; z cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- boct_tree_cell* node = tree->locate_point_at_level(cell_bb.centroid(),3); +- if (!node) +- std::cout << "The node COULD not be FOUND" << std::endl; +- else { +- std::vector > *> children; +- node->all_children(children); +- int n2= children.size()+1; +- data_size += n2; +- } +- } +- } +- } +- +- // allocate data array +- boxm2_data_traits::datatype* normals_arr=new boxm2_data_traits::datatype[data_size]; +- boxm2_data_traits::datatype* points_arr=new boxm2_data_traits::datatype[data_size]; +- boxm2_data_traits::datatype* alpha_arr = new boxm2_data_traits::datatype[data_size]; +- +- // divide the blocks +- int data_idx=0; +- boxm2_array_3d& trees = new_block.trees(); +- for (unsigned z=0; z cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- boct_tree_cell* node = tree->locate_point_at_level(cell_bb.centroid(),3); +- boct_tree_cell* valid_node = valid_tree->locate_point_at_level(cell_bb.centroid(), 3); +- boct_tree_cell *alpha_node = alpha_tree->locate_point_at_level(cell_bb.centroid(), 3); +- +- if (!(node && valid_node && alpha_node) ) +- std::cout << "One of the nodes COULD not be FOUND" << std::endl; +- else { +- std::vector *> children; +- node->all_children(children); +- int n2= children.size()+1; +- +- boct_bit_tree2* bit_tree; +- convert_to_bittree(node, bit_tree); +- int n1=bit_tree->num_cells(); +- int start=data_idx; +- convert_data(tree, node, valid_node, alpha_node, normals_arr, points_arr, alpha_arr, data_idx); +- // set the data index at the tree +- bit_tree->set_data_ptr(start, false); +- // set the tree at the block +- boxm2_block::uchar16& t=trees[x][y][z]; +- t.set(bit_tree->get_bits()); +- if (n1 != n2) { +- std::cout << x << ',' << y << ',' << z << '\n' +- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << std::endl; +- } +- } +- } +- } +- } +- char* b1 = reinterpret_cast(normals_arr); +- boxm2_data *normals_data=new boxm2_data(b1,data_size*sizeof(boxm2_data_traits::datatype),block_id); +- char* b2 = reinterpret_cast(pointa_arr); +- boxm2_data *points_data=new boxm2_data(b2,data_size*sizeof(boxm2_data_traits::datatype),block_id); +- char* b3 = reinterpret_cast(alpha_arr); +- boxm2_data *alpha_data = new boxm2_data(b3, data_size*sizeof(boxm2_data_traits::datatype),block_id); +- +- boxm2_sio_mgr::save_block(new_scene.data_path(), &new_block); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, normals_data); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, points_data); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, alpha_data); +- +- delete [] normals_arr; +- delete [] points_arr; +- delete [] alpha_arr; +- iter++; +- } +- new_scene.set_blocks(new_blocks); +- new_scene.save_scene(); +-} +- +-int main(int argc, char** argv) +-{ +- std::cout << "Converting boxm scene with normals to boxm2 normals and points" << std::endl; +- vul_arg scene_path("-normals_scene", "scene filename", ""); +- vul_arg scene_path("-valid_scene", "scene filename", ""); +- vul_arg scene_path("-alpha_scene", "scene filename", ""); +- vul_arg out_dir("-out", "output directory", ""); +- vul_arg sub_block_dim("-dim", "sub block dimensions", 64); +- vul_arg_parse(argc, argv); +- +- boxm_scene_parser parser; +- boxm_scene_base_sptr n_scene_ptr=new boxm_scene_base(); +- n_scene_ptr->load_scene(normals_scene(), parser); +- +- if (n_scene_ptr->appearence_model() == VNL_FLOAT_3) +- { +- typedef boct_tree tree_type; +- boxm_scene scene; +- scene.load_scene(normals_scene()); +- +- boxm_scene > valid_scene; +- valid_scene.load_scene(valid_scene()); +- +- boxm_scene > alpha_scene; +- alpha_scene.load_scene(alpha_scene()); +- +- // create a boxm2 scene +- boxm2_scene new_scene; +- new_scene.set_data_path(out_dir()); +- new_scene.set_local_origin(scene.origin()); +- new_scene.set_lvcs(scene.lvcs()); +- new_scene.set_xml_path(out_dir()+"/scene.xml"); +- +- //initialize a block +- boxm2_lru_cache::create(&new_scene); +- +- convert_scene(scene, valid_scene, alpha_scene, new_scene); +- } +-} +diff --git a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx b/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx +deleted file mode 100644 +index 5a3d2d6e83..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx ++++ /dev/null +@@ -1,262 +0,0 @@ +-#include +-#include +-#include "boxm_to_boxm2.h" +-//: +-// \file +-#ifdef _MSC_VER +-# include +-#endif +- +-//executable args +-#include +- +-#include +-#include +- +-//boct files +-#include +-#include +- +-//boxm2 files +-#include +-#include +-#include +-#include +-#include +- +-// boxm files +-#include +-#include +-#include +- +- +-//: extracts the parameters of a boxm_sample for boxm2 representation +-void deconstruct_sample(boxm_sample sample, +- float &alpha, +- boxm2_data_traits::datatype& data, +- boxm2_data_traits::datatype& num_obs) +-{ +- alpha=sample.alpha; +- +- typedef boxm_apm_traits::gauss_type_sf1 gauss_type_sf1; +- +- bsta_num_obs > obs = sample.appearance(); +- unsigned int nmix = obs.num_observations*100.0; +- num_obs[3] = nmix; +- +- for (unsigned i=0; i +-void convert_data(boct_tree_cell* tree_cell, +- float* alpha, +- boxm2_data_traits::datatype* data, +- boxm2_data_traits::datatype* num_obs, +- int& data_idx) +-{ +- // go through the tree, in depth first order to collect data +- std::queue*> Q; +- Q.push(tree_cell); +- while (!Q.empty()) { +- boct_tree_cell* ptr = Q.front(); +- { +- deconstruct_sample(ptr->data(),alpha[data_idx],data[data_idx],num_obs[data_idx]); +- data_idx++; +- if (!ptr->is_leaf()) { +- boct_tree_cell* children = ptr->children(); +- for (unsigned j=0; j<8; j++) { +- Q.push(&children[j]); +- } +- } +- } +- Q.pop(); +- } +-} +- +-//: recursively sets the bits based on the octree structure +-template +-void set_bits(boct_bit_tree*& bit_tree, int idx, unsigned int child_idx, boct_tree_cell & cell) +-{ +- if (cell.code_.level == 0) +- return; +- +- if (!cell.is_leaf()) { +- int bit_idx=idx*8+1+child_idx; +- bit_tree->set_bit_at(bit_idx,true); +- for (unsigned i=0; i<8; i++) +- set_bits(bit_tree, bit_idx, i, cell.children()[i]); +- } +-} +- +-//: converts the bit tree to boct_octree representation +-template +-void convert_to_bittree(boct_tree_cell* tree_cell, boct_bit_tree*& bit_tree) +-{ +- bit_tree = new boct_bit_tree(); +- // first set all the bits to 0 +- for (unsigned i=0; i<73; i++) +- bit_tree->set_bit_at(i,false); +- +- // empty tree +- if (!tree_cell) +- return; +- +- // only root node +- if (tree_cell->is_leaf()) { +- return; +- } +- +- int idx=0; +- bit_tree->set_bit_at(idx,true); // root +- for (unsigned i=0; i<8; i++) { // level root-1 +- set_bits(bit_tree, idx, i, tree_cell->children()[i]); +- } +-} +- +-int main(int argc, char** argv) +-{ +- std::cout << "Converting boxm scene to boxm2 Scene" << std::endl; +- vul_arg scene_path("-scene", "scene filename", ""); +- vul_arg out_dir("-out", "output directory", ""); +- vul_arg sub_block_dim("-dim", "sub block dimensions", 64); +- vul_arg_parse(argc, argv); +- +- typedef boct_tree > tree_type; +- boxm_scene scene; +- scene.load_scene(scene_path()); +- +- // create a boxm2 scene +- boxm2_scene new_scene; +- new_scene.set_data_path(out_dir()); +- new_scene.set_local_origin(scene.origin()); +- new_scene.set_lvcs(scene.lvcs()); +- new_scene.set_xml_path(out_dir()+"/scene.xml"); +- +- //initialize a block +- boxm2_lru_cache::create(&new_scene); +- +- std::map new_blocks; +- unsigned int dim=sub_block_dim(); +- if (scene.appearence_model() == BOXM_APM_MOG_GREY) { +- boxm_block_iterator iter(&scene); +- while (!iter.end()) { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- vgl_box_3d block_bb = block->bounding_box(); +- std::cout<get_tree(); +- +- // create metadata for the block +- boxm2_block_id block_id(idx.x(),idx.y(),idx.z()); +- vgl_vector_3d sub_block_dim(1.0/dim,1.0/dim,1.0/dim); +- vgl_vector_3d sub_block_num(dim,dim,dim); +- vgl_vector_3d real_block_dim(sub_block_dim.x()*scene.block_dim().x(), +- sub_block_dim.y()*scene.block_dim().y(), +- sub_block_dim.z()*scene.block_dim().z()); +- boxm2_block_metadata metadata(block_id, block->bounding_box().min_point(), +- real_block_dim,sub_block_num,1,4,650.0,0.001); +- boxm2_block new_block(metadata); +- new_blocks[block_id]=metadata; +- +- // find the total number of cells to figure out data array sizes, as the first step +- int data_size=0; +- for (unsigned z=0; z cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- boct_tree_cell >* node = tree->locate_point_at_level(cell_bb.centroid(),3); +- if (!node) +- std::cout << "The node COULD not be FOUND" << std::endl; +- else { +- std::vector > *> children; +- node->all_children(children); +- int n2= children.size()+1; +- data_size += n2; +- } +- } +- } +- } +- +- // allocate data array +- auto* data_arr=new boxm2_data_traits::datatype[data_size]; +- auto* num_obs_arr=new boxm2_data_traits::datatype[data_size]; +- auto* alpha_arr = new float[data_size]; +- +- // divide the blocks +- int data_idx=0; +- boxm2_array_3d trees = new_block.trees_copy(); +- for (unsigned z=0; z cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d::min_pos); +- boct_tree_cell >* node = tree->locate_point_at_level(cell_bb.centroid(),3); +- if (!node) +- std::cout << "The node COULD not be FOUND" << std::endl; +- else { +- std::vector > *> children; +- node->all_children(children); +- int n2= children.size()+1; +- +- boct_bit_tree* bit_tree; +- convert_to_bittree(node, bit_tree); +- int n1=bit_tree->num_cells(); +- int start=data_idx; +- convert_data(node, alpha_arr, data_arr, num_obs_arr, data_idx); +- // set the data index at the tree +- bit_tree->set_data_ptr(start, false); +- // set the tree at the block +- boxm2_block::uchar16& t=trees[x][y][z]; +- t.set(bit_tree->get_bits()); +- if (n1 != n2) { +- std::cout << x << ',' << y << ',' << z << '\n' +- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << std::endl; +- } +- } +- } +- } +- } +- new_block.set_trees(trees); +- char* b1 = reinterpret_cast(alpha_arr); +- boxm2_data *alpha_data=new boxm2_data(b1,data_size*sizeof(float),block_id); +- char* b2 = reinterpret_cast(data_arr); +- boxm2_data *mog_data=new boxm2_data(b2,data_size*sizeof(boxm2_data_traits::datatype),block_id); +- char* b3 = reinterpret_cast(num_obs_arr); +- boxm2_data *num_data=new boxm2_data(b3,data_size*sizeof(boxm2_data_traits::datatype),block_id); +- +- boxm2_sio_mgr::save_block(new_scene.data_path(), &new_block); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, alpha_data); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, mog_data); +- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, num_data); +- +- delete [] alpha_arr; +- delete [] data_arr; +- delete [] num_obs_arr; +- iter++; +- } +- new_scene.set_blocks(new_blocks); +- new_scene.save_scene(); +- } +-} +diff --git a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h b/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h +deleted file mode 100644 +index 6f15345854..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-#ifndef boxm_to_boxm2_h_ +-#define boxm_to_boxm2_h_ +-//: +-// \file +- +-#include +-#include +-#include +-#include +-#include +- +-//: extracts the parameters of a boxm_sample for boxm2 representation +-void deconstruct_sample(boxm_sample sample, +- float &alpha, +- boxm2_data_traits::datatype& data, +- boxm2_data_traits::datatype& num_obs); +- +-//: extracts the tree cell's data into an array format for boxm2 representation +-template +-void convert_data(boct_tree_cell* tree_cell, +- float* alpha, +- boxm2_data_traits::datatype* data, +- boxm2_data_traits::datatype* num_obs, +- int& data_idx); +- +-//: converts the boct_octree to bit tree representation +-template +-void convert_to_bittree(boct_tree_cell* tree_cell, boct_bit_tree*& bit_tree); +- +-#endif // boxm_to_boxm2_h_ +diff --git a/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt b/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt +deleted file mode 100644 +index 62cccc7c6f..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( boxm_bridge_test_include test_include.cxx ) +-target_link_libraries( boxm_bridge_test_include boxm) +diff --git a/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx b/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx +deleted file mode 100644 +index ee10496c92..0000000000 +--- a/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/CMakeLists.txt b/contrib/brl/bseg/bvpl/CMakeLists.txt +index 424ed5bf50..2593480038 100644 +--- a/contrib/brl/bseg/bvpl/CMakeLists.txt ++++ b/contrib/brl/bseg/bvpl/CMakeLists.txt +@@ -24,7 +24,6 @@ target_link_libraries(bvpl bvpl_kernels bvpl_functors bvxm_grid bdgl bsta ${VXL_ + + add_subdirectory(pro) + add_subdirectory(util) +-add_subdirectory(bvpl_octree) + add_subdirectory(kernels) + add_subdirectory(functors) + +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt +deleted file mode 100644 +index 1f390f966c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt ++++ /dev/null +@@ -1,71 +0,0 @@ +-# This is contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt +-# Brown Voxel Processing library for octrees +- +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +- +-#option( VXL_FORCE_V3P_RPLY "Use v3p ply library" YES) +-#mark_as_advanced( VXL_FORCE_V3P_RPLY ) +- +-if(EXPAT_FOUND) +- +-find_package( Threads ) +- +-#vxl_configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bvpl_octree_config.h.in +-# ${CMAKE_CURRENT_BINARY_DIR}/bvpl_octree_config.h include/vxl/contrib/brl/bseg/bvpl/bvpl_octree) +- +-include_directories( ${EXPAT_INCLUDE_DIR} ) +-include_directories( ${BRL_INCLUDE_DIR}/bseg/boct ) +-include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm ) +-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl ) +-include_directories( ${BRL_INCLUDE_DIR}/b3p/expatpp ) +- +-set(bvpl_octree_sources +- bvpl_octree_kernel_operator.h +- bvpl_octree_vector_operator.h +- bvpl_scene_kernel_operator.h +- bvpl_scene_vector_operator.h +- bvpl_block_kernel_operator.h +- bvpl_block_vector_operator.h +- bvpl_octree_vrml_util.h +- bvpl_cell_data_traits.h +- bvpl_octree_neighbors.h +- bvpl_scene_neighborhood_operator.h bvpl_scene_neighborhood_operator.cxx +- bvpl_scene_statistics.h bvpl_scene_statistics.cxx +- bvpl_discover_pca_kernels.h bvpl_discover_pca_kernels.cxx +- bvpl_pca_error_scenes.h bvpl_pca_error_scenes.cxx +- bvpl_global_pca.h bvpl_global_pca.hxx +- bvpl_taylor_scenes_map.h bvpl_taylor_scenes_map.cxx +- bvpl_taylor_basis.h bvpl_taylor_basis.cxx +- bvpl_global_taylor.h bvpl_global_taylor.hxx bvpl_global_taylor.cxx +- bvpl_global_corners.h bvpl_global_corners.cxx +- bvpl_corner_detector.h +- bvpl_corner_functors.h +- bvpl_gauss3D_steerable_filters.h bvpl_gauss3D_steerable_filters.cxx +- ) +- +-aux_source_directory(Templates bvpl_octree_sources) +- +-vxl_add_library(LIBRARY_NAME bvpl_octree LIBRARY_SOURCES ${bvpl_octree_sources}) +-target_link_libraries(bvpl_octree bvpl_kernels bvpl_functors bvpl_octree_sample bvrml boxm boct ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl) +- +-#Binary io +-add_subdirectory(io) +- +-#Directory with python/c++ processes +-add_subdirectory(pro) +- +-# Octree samples needed by bvpl +-add_subdirectory(sample) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-if( CMAKE_USE_PTHREADS_INIT ) +- add_definitions(-DBVPL_OCTREE_HAS_PTHREADS=1) +- set_target_properties(bvpl_octree PROPERTIES COMPILE_FLAGS -pthread) +- target_link_libraries(bvpl_octree pthread) +-endif() +- +-endif() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx +deleted file mode 100644 +index 067773b3d9..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +- +-BOCT_TREE_INSTANTIATE(short, bvpl_octree_sample); +-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_octree_sample); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx +deleted file mode 100644 +index a5900cfb6b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, bvpl_octree_sample); +-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_octree_sample); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx +deleted file mode 100644 +index 7c2f63355a..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, bvpl_pca_basis_sample<10>); +-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_pca_basis_sample<10>); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx +deleted file mode 100644 +index 81366222a6..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +-#include +- +-BOCT_TREE_INSTANTIATE(short, bvpl_taylor_basis2_sample); +-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_taylor_basis2_sample); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx +deleted file mode 100644 +index 7cad8969f8..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx ++++ /dev/null +@@ -1,20 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx +deleted file mode 100644 +index 8a135d4e05..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx ++++ /dev/null +@@ -1,17 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx +deleted file mode 100644 +index fcc60090f2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef boct_tree > tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx +deleted file mode 100644 +index d4d340f12d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +- +-typedef boct_tree tree_type; +- +-BOXM_BLOCK_INSTANTIATE(tree_type); +-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(boxm_block *); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx +deleted file mode 100644 +index cafd0cfaf7..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx ++++ /dev/null +@@ -1,2 +0,0 @@ +-#include +-BVPL_GLOBAL_PCA(125); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx +deleted file mode 100644 +index 9e815605e3..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BVPL_GLOBAL_TAYLOR_INSTANTIATE(double, 10); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx +deleted file mode 100644 +index b8312f8e7e..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BVPL_GLOBAL_TAYLOR_INSTANTIATE(float, 3); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx +deleted file mode 100644 +index e32ee1303b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(bvpl_discover_pca_kernels); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx +deleted file mode 100644 +index 1bf245a9f9..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(bvpl_global_corners); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx +deleted file mode 100644 +index ff5175103e..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef bvpl_global_pca<125> bvpl_global_pca_125; +-VBL_SMART_PTR_INSTANTIATE(bvpl_global_pca_125); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx +deleted file mode 100644 +index 254b91e81f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +- +-typedef bvpl_global_taylor gt; +-VBL_SMART_PTR_INSTANTIATE(gt); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx +deleted file mode 100644 +index a13ebae610..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(bvpl_pca_error_scenes); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx +deleted file mode 100644 +index 07c500d5bb..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx +deleted file mode 100644 +index e15416cdba..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx ++++ /dev/null +@@ -1,2 +0,0 @@ +-#include +-VNL_MATRIX_FIXED_INSTANTIATE(double,125,125); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h +deleted file mode 100644 +index ec59fe4893..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h ++++ /dev/null +@@ -1,134 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h +-#ifndef bvpl_block_kernel_operator_h +-#define bvpl_block_kernel_operator_h +- +-//: +-// \file +-// \brief A class operates a kernel on a boxm_block +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 1-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +- +-#include +-#include +-#include +-#include "bvpl_octree_kernel_operator.h" +-#ifdef _MSC_VER +-# include +-#endif +- +-//: A class which operates a kernel on a boxm_block. +-// This class differes from bvpl_octree_kernel_operator in that it loads neighbor block to process blocks appropriately. +-// This class is useful to run multithreading processes +-class bvpl_block_kernel_operator +-{ +- public: +- //: "Convolves" kernel with an input octree, storing the output in an output octree. +- // This function only iterate through leaf_cells at level 0; +- template +- void operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel, +- unsigned i, unsigned j, unsigned k, +- boxm_scene > &scene_out, +- boxm_scene > &valid_scene, double cell_length); +-}; +- +-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_block_kernel_operator::operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > &scene_out, +- boxm_scene > &valid_scene, double cell_length) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- +- //scene_in.clone_blocks(scene_out, T_data()); +- +- // Load input and output blocks +- scene_in.load_block_and_neighbors(block_i,block_j,block_k); +- scene_out.load_block(block_i,block_j,block_k); +- valid_scene.load_block(block_i,block_j,block_k); +- +- +- tree_type *tree_in = scene_in.get_block(block_i, block_j, block_k)->get_tree(); +- tree_type *tree_out = tree_in->clone(); +- boct_tree *valid_tree = tree_in->template clone_to_type(); +- +- std::vector cells_in = tree_in->leaf_cells(); +- std::vector cells_out = tree_out->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- +- //iterators +- typename std::vector::iterator it_in = cells_in.begin(); +- typename std::vector::iterator it_out = cells_out.begin(); +- typename std::vector * >::iterator valid_it = valid_cells.begin(); +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- +- for (; (it_in!=cells_in.end())&&(it_out!= cells_out.end())&& (valid_it!=valid_cells.end()); it_in++, it_out++, valid_it++) +- { +- boct_tree_cell *center_cell = *it_in; +- boct_tree_cell *out_center_cell = *it_out; +- boct_tree_cell *valid_center_cell = *valid_it; +- bool valid = true; +- +-#ifdef DEBUG +- boct_loc_code out_code = out_center_cell->get_code(); +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){ +- std::cerr << " Input and output cells don't have the same structure\n"; +- continue; +- } +-#endif +- +- vgl_point_3d center_cell_centroid = tree_in->global_centroid(center_cell); +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- boct_tree_cell *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data val = this_cell->data(); +- functor.apply(val, d); +- } +- else { +- valid = false; +- break; +- } +- +- ++kernel_iter; +- } +- +- out_center_cell->set_data(functor.result()); +- valid_center_cell->set_data(valid); +- } +- +- //write the output block +- std::cout << "Writing scenes\n"; +- scene_out.get_block(block_i, block_j, block_k)->init_tree(tree_out); +- scene_out.write_active_block(); +- valid_scene.get_block(block_i, block_j, block_k)->init_tree(valid_tree); +- valid_scene.write_active_block(); +-} +- +-#endif // bvpl_block_kernel_operator_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h +deleted file mode 100644 +index 7c772dbd2f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h ++++ /dev/null +@@ -1,146 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h +-#ifndef bvpl_block_vector_operator_h +-#define bvpl_block_vector_operator_h +- +-//: +-// \file +-// \brief A class operates a kernel on a boxm_block +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 1-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +- +-#include +-#include +-#include +-#include "bvpl_octree_kernel_operator.h" +-#ifdef _MSC_VER +-# include +-#endif +- +-//:A class operates a kernel on a boxm_block. +-// This class differes from bvpl_octree_kernel_operator in that it loads neighbor block to process blocks appropriately. +-// This class is useful to run multathreding processes +-class bvpl_block_vector_operator +-{ +- public: +- //: "Convolves" kernel with an input octree, storing the output in an output octree. +- // This function only iterate through leaf_cells at level 0; +- template +- void operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_vector_sptr kernel_vector, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > > &scene_out, +- boxm_scene > &valid_scene, double cell_length); +-}; +- +-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_block_vector_operator::operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_vector_sptr kernel_vector, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > > &scene_out, +- boxm_scene > &valid_scene, double cell_length) +-{ +- if (kernel_vector->size()!=dim) { +- std::cout << "Error in bvpl_block_vector_operator::operate ---> size missmatch\n"; +- return; +- } +- +- typedef boct_tree tree_type_in; +- typedef boct_tree_cell cell_type_in; +- +- typedef boct_tree > tree_type_out; +- typedef boct_tree_cell > cell_type_out; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- +- // Load input and output blocks +- scene_in.load_block_and_neighbors(block_i,block_j,block_k); +- scene_out.load_block(block_i,block_j,block_k); +- valid_scene.load_block(block_i,block_j,block_k); +- +- +- tree_type_in *tree_in = scene_in.get_block(block_i, block_j, block_k)->get_tree(); +- tree_type_out *tree_out = tree_in->template clone_to_type >(); +- boct_tree *valid_tree = tree_in->template clone_to_type(); +- +- std::vector cells_in = tree_in->leaf_cells(); +- std::vector cells_out = tree_out->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- +- //iterators +- typename std::vector::iterator it_in = cells_in.begin(); +- typename std::vector::iterator it_out = cells_out.begin(); +- typename std::vector * >::iterator valid_it = valid_cells.begin(); +- +- for (; (it_in!=cells_in.end())&&(it_out!= cells_out.end() && (valid_it!=valid_cells.end())); ++it_in, ++it_out, ++valid_it) +- { +- cell_type_in *center_cell = *it_in; +- cell_type_out *out_center_cell = *it_out; +- boct_tree_cell *valid_center_cell = *valid_it; +- bool valid = true; +- +-#ifdef DEBUG +- boct_loc_code out_code = out_center_cell->get_code(); +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){ +- std::cerr << " Input and output cells don't have the same structure\n"; +- continue; +- } +-#endif +- +- vgl_point_3d center_cell_centroid = tree_in->global_centroid(center_cell); +- +- vnl_vector_fixed responses; +- +- for (unsigned k=0; k< kernel_vector->kernels_.size(); ++k) +- { +- bvpl_kernel_sptr kernel = kernel_vector->kernels_[k]; +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- boct_tree_cell *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data_in val =(T_data_in)this_cell->data(); +- functor.apply(val, d); +- } +- else { +- valid = false; +- break; +- } +- +- ++kernel_iter; +- } +- responses[k] = (T_data_out)(functor.result()); +- } +- +- out_center_cell->set_data(responses); +- valid_center_cell->set_data(valid); +- } +- +- //write the output block +- scene_out.get_block(block_i, block_j, block_k)->init_tree(tree_out); +- scene_out.write_active_block(); +- valid_scene.get_block(block_i, block_j, block_k)->init_tree(valid_tree); +- valid_scene.write_active_block(); +-} +- +-#endif // bvpl_block_vector_operator_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h +deleted file mode 100644 +index 7f28fa9bef..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h ++++ /dev/null +@@ -1,34 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h +-#ifndef bvpl_cell_data_traits_h +-#define bvpl_cell_data_traits_h +-//: +-// \file +-// \brief Set of accessors of cell's data, taking care of different datatypes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date Dec 16, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-//: Float to float +-template +-float bvpl_cell_to_float(boct_tree_cell >* cell) +-{ +- return cell->data().response_; +-} +- +-//: Mixture of gaussians to float; return the mean +-template +-float bvpl_cell_to_float(boct_tree_cell > >* cell) +-{ +- return cell->data().response_.mean(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h +deleted file mode 100644 +index e3988f369f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h ++++ /dev/null +@@ -1,299 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h +-#ifndef bvpl_corner_detector_h +-#define bvpl_corner_detector_h +-//: +-// \file +-// \brief A class to detect 3d Harris corners, based on the 2nd moment matrix +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 20-Jul-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +-#include +- +-class bvpl_corner_detector +-{ +- public: +- //: Detects Harris features kernel with an input octree +- // However, features below the Harris threshold are set as invalid in the valid_scene (in place) +- // The type of measure used, depends on the functor. +- template +- void detect_and_threshold( boxm_scene > *scene_in, +- F harris_functor, +- vgl_point_3d min_neigborhood_idx, +- vgl_point_3d max_neigborhood_idx, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene, +- double cell_length); +- +- //: Computes the corner measure and stores it in "corner_scene" +- // Input scene and auxiliary valid scene are not modified +- template +- void compute_C( boxm_scene > *scene_in, +- F harris_functor, +- vgl_point_3d min_neigborhood_idx, +- vgl_point_3d max_neigborhood_idx, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene, +- double cell_length); +- +- //: Compute the determinant of the hessian +- template +- void compute_det_H(boxm_scene > *scene_in, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene); +-}; +- +- +-template +-void bvpl_corner_detector::detect_and_threshold( boxm_scene > *scene_in, +- F harris_functor, +- vgl_point_3d min_neigborhood_idx, +- vgl_point_3d max_neigborhood_idx, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene, +- double cell_length) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- +- // Load input and output blocks +- scene_in->load_block_and_neighbors(block_i,block_j,block_k); +- valid_scene->load_block(block_i,block_j,block_k); +- corner_scene->load_block(block_i,block_j,block_k); +- +- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *corner_tree = tree_in->template clone_to_type(); +- corner_tree->init_cells(0.0f); +- +- std::vector cells_in = tree_in->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- std::vector * > corner_cells = corner_tree->leaf_cells(); +- +- //iterators +- typename std::vector::iterator it_in = cells_in.begin(); +- std::vector * >::iterator valid_it = valid_cells.begin(); +- std::vector * >::iterator corner_it = corner_cells.begin(); +- +- unsigned long n_fail = 0; +- +- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++) +- { +- boct_tree_cell *center_cell = *it_in; +- boct_tree_cell *valid_center_cell = *valid_it; +- boct_tree_cell *corner_center_cell = *corner_it; +- +- if (!valid_center_cell->data()) { +- continue; +- } +-#if 0 +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- continue; +- } +-#endif +- +- vgl_point_3d center_cell_centroid = tree_in->global_centroid(center_cell); +- +- for (int k = min_neigborhood_idx.z(); k <= max_neigborhood_idx.z(); k++) +- for (int j = min_neigborhood_idx.y(); j <= max_neigborhood_idx.y(); j++) +- for (int i = min_neigborhood_idx.x(); i <= max_neigborhood_idx.x(); i++) +- { +- vgl_point_3d neighbor_cell_idx(i, j, k); +- +- vgl_point_3d neighbor_cell_centroid(center_cell_centroid.x() + ((double)neighbor_cell_idx.x())*cell_length, +- center_cell_centroid.y() + ((double)neighbor_cell_idx.y())*cell_length, +- center_cell_centroid.z() + ((double)neighbor_cell_idx.z())*cell_length); +- +- boct_tree_cell *this_cell = scene_in->locate_point_in_memory(neighbor_cell_centroid); +- +- if (this_cell) { +- harris_functor.apply(this_cell->data()); +- } +- else +- break; +- } +- +- double C = 0; +- if (!harris_functor.result(C)) { +- valid_center_cell->set_data(false); +- ++n_fail; +- } +- corner_center_cell->set_data(float(C)); +- } +- +- std::cout << "Number of Harris fails: " << n_fail << std::endl; +- //write the output block +- valid_scene->get_block(block_i, block_j, block_k)->init_tree(valid_tree); +- valid_scene->write_active_block(); +- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree); +- corner_scene->write_active_block(); +-} +- +-template +-void bvpl_corner_detector::compute_C( boxm_scene > *scene_in, +- F harris_functor, +- vgl_point_3d min_neigborhood_idx, +- vgl_point_3d max_neigborhood_idx, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene, +- double cell_length) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- +- // Load input and output blocks +- scene_in->load_block_and_neighbors(block_i,block_j,block_k); +- valid_scene->load_block(block_i,block_j,block_k); +- corner_scene->load_block(block_i,block_j,block_k); +- +- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *corner_tree = tree_in->template clone_to_type(); +- corner_tree->init_cells(0.0f); +- +- std::vector cells_in = tree_in->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- std::vector * > corner_cells = corner_tree->leaf_cells(); +- +- //iterators +- typename std::vector::iterator it_in = cells_in.begin(); +- std::vector * >::iterator valid_it = valid_cells.begin(); +- std::vector * >::iterator corner_it = corner_cells.begin(); +- +- unsigned long n_fail = 0; +- +- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++) +- { +- boct_tree_cell *center_cell = *it_in; +- boct_tree_cell *valid_center_cell = *valid_it; +- boct_tree_cell *corner_center_cell = *corner_it; +- +- if (!valid_center_cell->data()) { +- continue; +- } +-#if 0 +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- continue; +- } +-#endif +- +- vgl_point_3d center_cell_centroid = tree_in->global_centroid(center_cell); +- +- for (int k = min_neigborhood_idx.z(); k <= max_neigborhood_idx.z(); k++) +- for (int j = min_neigborhood_idx.y(); j <= max_neigborhood_idx.y(); j++) +- for (int i = min_neigborhood_idx.x(); i <= max_neigborhood_idx.x(); i++) +- { +- vgl_point_3d neighbor_cell_idx(i, j, k); +- +- vgl_point_3d neighbor_cell_centroid(center_cell_centroid.x() + ((double)neighbor_cell_idx.x())*cell_length, +- center_cell_centroid.y() + ((double)neighbor_cell_idx.y())*cell_length, +- center_cell_centroid.z() + ((double)neighbor_cell_idx.z())*cell_length); +- +- boct_tree_cell *this_cell = scene_in->locate_point_in_memory(neighbor_cell_centroid); +- +- if (this_cell) { +- harris_functor.apply(this_cell->data()); +- } +- else +- break; +- } +- +- double C = 0; +- harris_functor.result(C); +- corner_center_cell->set_data(float(C)); +- } +- +- std::cout << "Number of Harris fails: " << n_fail << std::endl; +- //write the output block +- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree); +- corner_scene->write_active_block(); +-} +- +- +-template +-void bvpl_corner_detector::compute_det_H( boxm_scene > *scene_in, +- unsigned block_i, unsigned block_j, unsigned block_k, +- boxm_scene > *valid_scene, +- boxm_scene > *corner_scene) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- // Load input and output blocks +- scene_in->load_block_and_neighbors(block_i,block_j,block_k); +- valid_scene->load_block(block_i,block_j,block_k); +- corner_scene->load_block(block_i,block_j,block_k); +- +- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree(); +- boct_tree *corner_tree = tree_in->template clone_to_type(); +- corner_tree->init_cells(0.0f); +- +- std::vector cells_in = tree_in->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- std::vector * > corner_cells = corner_tree->leaf_cells(); +- +- //iterators +- typename std::vector::iterator it_in = cells_in.begin(); +- std::vector * >::iterator valid_it = valid_cells.begin(); +- std::vector * >::iterator corner_it = corner_cells.begin(); +- +- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++) +- { +- boct_tree_cell *center_cell = *it_in; +- boct_tree_cell *valid_center_cell = *valid_it; +- boct_tree_cell *corner_center_cell = *corner_it; +- +- if (!valid_center_cell->data()) { +- continue; +- } +- +- vnl_vector_fixed mean_coeff = center_cell->data(); +- +- vnl_double_3x3 H; +- H.put(0,0,mean_coeff[4]); +- H.put(0,1,mean_coeff[7]); +- H.put(0,2,mean_coeff[8]); +- H.put(1,0,mean_coeff[7]); +- H.put(1,1,mean_coeff[5]); +- H.put(1,2,mean_coeff[9]); +- H.put(2,0,mean_coeff[8]); +- H.put(2,1,mean_coeff[9]); +- H.put(2,2,mean_coeff[6]); +- +- corner_center_cell->set_data(float(vnl_determinant(H))); +- } +- +- //write the output block +- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree); +- corner_scene->write_active_block(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h +deleted file mode 100644 +index 85231de3e0..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h +-#ifndef bvpl_corner_functors_h +-#define bvpl_corner_functors_h +-//: +-// \file +-// \brief Set of functors based on Harris measures +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 20-Jul-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-// Functor to threshold on Harris corner measure proposed in: +-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107-123, 2005 +-class bvpl_harris_laptev_functor +-{ +- public: +- bvpl_harris_laptev_functor(double k) +- { +- H_ = vnl_double_3x3(0.0); +- count_ = 0; +- k_ = k; +- } +- +- //: Apply a given operation to value \p val, depending on the dispatch character +- void apply(vnl_vector_fixed taylor_coeff) +- { +- vnl_double_3x3 temp_H; +- for (unsigned mi = 0; mi <3; mi++) +- for (unsigned mj = 0; mj <3; mj++) +- temp_H.put(mi,mj, taylor_coeff[mi+1] * taylor_coeff[mj+1]); +- +- H_ = H_ + temp_H; +- count_++; +- } +- +- //: Returns true if the harris threshold is passed, returns by reference the value of the harris ration +- bool result( double &C) +- { +- H_ /= (double)count_; +- +- double trace_H = H_[0][0] + H_[1][1] + H_[2][2]; +- bool pass = false; +- +- C = vnl_determinant(H_) - k_*(trace_H * trace_H * trace_H); +- +- if (C >= 1e-7) +- pass = true; +- +- count_ = 0; +- H_.fill(0.0); +- +- return pass; +- } +- +- protected: +- +- vnl_double_3x3 H_; +- unsigned count_; +- double k_; +-}; +- +-#endif // bvpl_corner_functors_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx +deleted file mode 100644 +index a2aa13a8c6..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx ++++ /dev/null +@@ -1,1028 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 8-Nov-2010 +- +-#include "bvpl_discover_pca_kernels.h" +-#include +-#include +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-bvpl_discover_pca_kernels::bvpl_discover_pca_kernels(const std::string &path) +-{ +- std::cout << "Loading pca info from xml-file" << std::endl; +- +- path_out_ = path; +- std::ifstream xml_ifs(xml_path().c_str()); +- +- if (!xml_ifs) +- return; +- bxml_document doc = bxml_read(xml_ifs); +- bxml_element query("pca_info"); +- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query); +- if (!root) { +- std::cout << "bvpl_discover_pca_kernels - could not parse xml root\n"; +- } +- +- //Parse neighborhood bounding box - units are number of voxels +- bxml_element nbbox_query("neighborhood"); +- bxml_data_sptr nbbox_data = bxml_find_by_name(root, nbbox_query); +- auto* nbbox_elm = dynamic_cast(nbbox_data.ptr()); +- int min_x=0, min_y=0, min_z=0, max_x=0, max_y=0, max_z =0; +- nbbox_elm->get_attribute("min_x", min_x); +- nbbox_elm->get_attribute("min_y", min_y); +- nbbox_elm->get_attribute("min_z", min_z); +- nbbox_elm->get_attribute("max_x", max_x); +- nbbox_elm->get_attribute("max_y", max_y); +- nbbox_elm->get_attribute("max_z", max_z); +- +- nbbox_ = vgl_box_3d(vgl_point_3d(min_x, min_y, min_y), vgl_point_3d(max_x, max_y, max_z)); +- std::cout << "Neighborhood: " << nbbox_ << std::endl; +- +- //Parse Number of samples +- bxml_element nsamples_query("samples"); +- bxml_data_sptr nsamples_data = bxml_find_by_name(root, nsamples_query); +- auto* nsamples_elm = dynamic_cast(nsamples_data.ptr()); +- nsamples_elm->get_attribute("nsamples", nsamples_); +- std::cout << "Number of samples: " << nsamples_ << std::endl; +- +- //Parse dimension +- bxml_element dim_query("dimension"); +- bxml_data_sptr dim_data = bxml_find_by_name(root, dim_query); +- auto* dim_elm = dynamic_cast(dim_data.ptr()); +- dim_elm->get_attribute("feature_dim", feature_dim_); +- std::cout << "Feature dimension: " << feature_dim_ << std::endl; +- +- //Parse paths and set matrices +- bxml_element paths_query("paths"); +- bxml_data_sptr paths_data = bxml_find_by_name(root, paths_query); +- auto* path_elm = dynamic_cast(paths_data.ptr()); +- +- int valid = 0; +- std::string ifs_path; +- +- path_elm->get_attribute("pc_path", ifs_path); +- if (ifs_path != pc_path()) +- valid = -1; +- else{ +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> pc_; +- if (pc_.size()!=feature_dim_*feature_dim_) +- valid = -2; +- } +- +- path_elm->get_attribute("weights_path", ifs_path); +- if (ifs_path != weights_path()) +- valid = -3; +- else{ +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> weights_; +- if (weights_.size()!=feature_dim_) +- valid = -4; +- } +- +- path_elm->get_attribute("sample_mean_path", ifs_path); +- if (ifs_path != sample_mean_path()) +- valid = -5; +- else +- { +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> sample_mean_feature_ ; +- if (sample_mean_feature_.size()!=feature_dim_) +- valid = -6; +- } +- +- path_elm->get_attribute("data_path", ifs_path); +- if (ifs_path != data_path()) +- valid = -7; +- +- path_elm->get_attribute("positions_path", ifs_path); +- if (ifs_path != pos_path()) +- valid = -8; +- +- path_elm->get_attribute("scene_path", scene_path_); +- +- //load scene +- boxm_scene_parser parser; +- data_scene_base_=new boxm_scene_base(); +- data_scene_base_->load_scene(scene_path_, parser); +- +- //cast scene +- auto *scene= new boxm_scene >(); +- if (data_scene_base_->appearence_model() == BOXM_FLOAT){ +- scene->load_scene(parser); +- data_scene_base_ = scene; +- } +- +- path_elm->get_attribute("data_mean_path", ifs_path); +- if (ifs_path != data_mean_path()){ +- compute_mean_feature(scene); +- valid = -9; +- std::cout << "bvpl_discover_pca_kernels - errors parsing data_mean_feature.xml\n"; +- } +- else +- { +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> data_mean_feature_ ; +- if (data_mean_feature_.size()!=feature_dim_) +- valid = -10; +- } +- +- //Parse dimension +- bxml_element cell_length_query("finest_cell_length"); +- bxml_data_sptr cell_length_data = bxml_find_by_name(root, cell_length_query); +- auto* cell_length_elm = dynamic_cast(cell_length_data.ptr()); +- bool has_length = cell_length_elm->get_attribute("length", finest_cell_length_); +- if (!has_length || finest_cell_length_ < 0.0){ +- std::cout << "Error: Finest cell length read from file: " << finest_cell_length_ << " has length " << has_length << std::endl; +- finest_cell_length_ = scene->finest_cell_length(); +- valid = -11; +- } +- std::cout << "Finest cell length: " << finest_cell_length_ << std::endl; +- +- if (valid<0){ +- std::cout << "bvpl_discover_pca_kernels - errors parsing pca_info.xml. Error code: " << valid << std::endl; +- xml_write(); +- } +-} +- +- +-//: Set Up the PCA matrix for the given scene +-void bvpl_discover_pca_kernels::set_up_pca_svd(boxm_scene > *scene) +-{ +- //zero-mean feature matrix +- vnl_matrix M = this->compute_deviation_matrix(scene); +- +- vnl_svd A(M); +- +- //columns of U contain principal components. +- pc_.set_size(feature_dim_, feature_dim_); +- A.U().extract(pc_); +- weights_.set_size(feature_dim_); +- weights_ = A.W().diagonal().extract(feature_dim_); +- +- weights_ = element_product(weights_, weights_); +- +-#ifdef DEBUG +- std::cerr << "Scatter Matix svd" << M*M.transpose() << '\n' +- << "PC Matix SVD:\n Size: " << pc_.size() << '\n' <> number of dimensions +-void bvpl_discover_pca_kernels::set_up_pca_evd(boxm_scene > *scene) +-{ +- //zero-mean feature matrix +- vnl_matrix S = this->compute_scatter_matrix(scene); +- +- // Compute eigenvectors(principal components) and values of S +- pc_.set_size(feature_dim_,feature_dim_); +- weights_.set_size(feature_dim_); +- +- vnl_symmetric_eigensystem_compute(S, pc_, weights_); +- +- pc_.fliplr(); +- weights_.flip(); +- +-#ifdef DEBUG +- std::cerr << "Scatter Matix" << S << '\n' +- << "PC Matix EVD:\n Size: " << pc_.size() << '\n' < bvpl_discover_pca_kernels::compute_scatter_matrix( boxm_scene > *scene) +-{ +- //init variables +- double scene_ncells = scene->size(); +- scene->unload_active_blocks(); +- sample_mean_feature_.fill(0.0f); +- vnl_matrix S(feature_dim_, feature_dim_, 0.0f); +- vnl_random rng; +- std::ofstream pos_ofs(pos_path().c_str()); +- std::ofstream data_ofs(data_path().c_str()); +- data_ofs.precision(15); +- +- // 1. Traverse through the blocks/trees +- boxm_block_iterator > it = scene->iterator(); +- unsigned long long nfeature = 1; +- for (it.begin(); !it.end(); ++it) +- { +- scene->load_block_and_neighbors(it.index()); +- boct_tree *tree = (*it)->get_tree(); +- assert(tree != nullptr); +- +- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree +- std::vector *> leaf_cells = tree->leaf_cells(); +- int tree_ncells = leaf_cells.size(); +- auto tree_nsamples = (unsigned long)((float)tree_ncells/scene_ncells*nsamples_); +-#ifdef DEBUG +- std::cout <<"Tree nsamples is: " << tree_nsamples << '\n' +- <<" nsamples is: " << nsamples_ < *center_cell = leaf_cells[sample]; +- vgl_point_3d center_cell_centroid = tree->global_centroid(center_cell); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- vgl_box_3d roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(), +- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z()); +- roi.set_centroid(center_cell_centroid); +- +- //if neighborhood is not inclusive we would have missing features +- if (!((scene->get_world_bbox()).contains(roi))){ +- --i; +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_, +- center_cell_centroid.y() + (double)y*finest_cell_length_, +- center_cell_centroid.z() + (double)z*finest_cell_length_); +- +- boct_tree_cell *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid); +- +- assert(neighbor_cell !=nullptr); +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- assert(curr_dim == feature_dim_); +- +- pos_ofs << center_cell_centroid <<'\n' ; +- data_ofs << this_feature << '\n'; +- +- //increment weights +- double rho = 1.0/(double)nfeature; +- double rho_comp = 1.0 - rho; +- +- // the difference vector between the sample and the mean +- vnl_vector diff = this_feature - sample_mean_feature_; +- +- //update the covariance +- S += rho_comp*outer_product(diff,diff); +- +- //update the mean +- sample_mean_feature_ += (rho*diff); +- +- ++nfeature; +-#ifdef DEBUG +- std::cerr << "Feature EVD: " < bvpl_discover_pca_kernels::compute_deviation_matrix( boxm_scene > *scene) +-{ +- //init variables +- unsigned long scene_ncells = scene->size(); +- sample_mean_feature_.fill(0.0f); +- vnl_matrix M(feature_dim_, (unsigned int)nsamples_); +- vnl_random rng(9667566ul); +- std::ofstream pos_ofs(pos_path().c_str()); +- +- // 1. Traverse through the blocks/trees +- boxm_block_iterator > it = scene->iterator(); +- unsigned long feature_col = 0; +- for (it.begin(); !it.end(); ++it) +- { +- scene->load_block_and_neighbors(it.index()); +- boct_tree *tree = (*it)->get_tree(); +- assert(tree != nullptr); +- +- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree +- std::vector *> leaf_cells = tree->leaf_cells(); +- int tree_ncells = leaf_cells.size(); +- auto tree_nsamples = (unsigned long)(tree_ncells*nsamples_/scene_ncells); // possible overflow ... +- +- for (unsigned int i=0; i *center_cell = leaf_cells[sample]; +- vgl_point_3d center_cell_centroid = tree->global_centroid(center_cell); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- vgl_box_3d roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(), +- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z()); +- roi.set_centroid(center_cell_centroid); +- +- //if neighborhood is not inclusive we would have missing features +- if (!((scene->get_world_bbox()).contains(roi))){ +- --i; +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_, +- center_cell_centroid.y() + (double)y*finest_cell_length_, +- center_cell_centroid.z() + (double)z*finest_cell_length_); +- +- boct_tree_cell *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid); +- +- assert(neighbor_cell !=nullptr); +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- assert(curr_dim == feature_dim_); +- +- pos_ofs << center_cell_centroid <<'\n' ; +- +- M.set_column(feature_col,this_feature); +- sample_mean_feature_+=this_feature; +- ++feature_col; +-#ifdef DEBUG +- std::cerr << "Feature SVD: " < F(feature_dim_, feature_col); +- +- M.extract(F); +- +- //4. Normalize feature vector +- sample_mean_feature_/=feature_col; +-#ifdef DEBUG +- std::cerr << "Mean Feature SVD: " < &proj_error) +-{ +- std::ifstream data_ifs(data_path().c_str()); +- std::cerr << data_path() << '\n'; +- //a vector to keep projection error - first element refers to error when using only first pc, +- //the sencond elemend, to error when projecting on frist 2 components and so on +- proj_error.set_size(feature_dim_); +- proj_error.fill(0.0); +- +- //For all samples +- for (unsigned long i = 0; i < nsamples_; ++i) +- { +- if (data_ifs.eof()) +- continue; +- +- //retrieve the data from file +- vnl_vector norm_feature(feature_dim_, 0.0); +- data_ifs >> norm_feature; +-#ifdef DEBUG +- std::cerr << "Feature: " < a(feature_dim_, 0.0); +- a = pc_.transpose() * (norm_feature); +- +- //project as a function of number of components +- for (unsigned c = 0; c < feature_dim_; ++c) +- { +- //reconstruct +- vnl_vector norm_feature_approx = pc_.extract(feature_dim_, c+1) * a.extract(c+1); +- vnl_vector rec_feature = pc_*a; +- //compute error +- proj_error[c]+= (norm_feature - norm_feature_approx).squared_magnitude(); +- } +- } +-} +- +- +-//: Project training samples onto pca space and return error as a function of number of components used +-void bvpl_discover_pca_kernels::compute_normalized_training_error(vnl_vector &proj_error) +-{ +- theoretical_training_error(proj_error); +- proj_error /= (double)nsamples_; +-} +- +-//: Project training samples onto pca space and return error as a function of number of components used +-void bvpl_discover_pca_kernels::theoretical_training_error(vnl_vector &proj_error) +-{ +- //a vector to keep projection error - first element refers to error when using only first pc, +- //the sencond elemend, to error when projecting on frist 2 components and so on +- proj_error.set_size(feature_dim_); +- proj_error.fill(0.0); +- +- for (unsigned i=0; i &proj_error) +-{ +- //a vector to keep projection error - first element refers to error when using only first pc, +- //the sencond element, to error when projecting on frist 2 components and so on +- proj_error.set_size(feature_dim_); +- proj_error.fill(0.0); +- +- //cast scene +- auto *scene= dynamic_cast > *> (data_scene_base_.as_pointer()); +- +- compute_mean_feature(scene); +- +- //iterate through leaves and arrage as vectors. +- boxm_cell_iterator > cell_it = scene->cell_iterator(&boxm_scene >::load_block_and_neighbors, true); +- cell_it.begin(); +- +- while (!(cell_it.end())) +- { +- //boct_tree_cell *center_cell = *cell_it; +- vgl_point_3d center_cell_centroid = cell_it.global_centroid(); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- vgl_box_3d roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(), +- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z()); +- roi.set_centroid(center_cell_centroid); +- +- //if neighborhood is not inclusive we would have missing features +- if (!((scene->get_world_bbox()).contains(roi))){ +- ++cell_it; +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_, +- center_cell_centroid.y() + (double)y*finest_cell_length_, +- center_cell_centroid.z() + (double)z*finest_cell_length_); +- +- boct_tree_cell *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid); +- +- assert(neighbor_cell !=nullptr); +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- assert(curr_dim == feature_dim_); +- +- this_feature-=data_mean_feature_; +- +- //solve for the coefficients +- vnl_vector a(feature_dim_, 0.0); +- a = pc_.transpose() * (this_feature); +- +-#ifdef DEBUG +- std::cout <<"This feature is " << this_feature < feature_approx = pc_.extract(feature_dim_, c+1) * a.extract(c+1); +- vnl_vector rec_feature = pc_*a; +-#ifdef DEBUG +- std::cout <<"Feature approx at c = " << c << " is " << feature_approx < training_error; +- this->theoretical_training_error(training_error); +- proj_error-=training_error; +-#endif +-} +- +- +-//: Reconstructions error on testing samples. By block. Error is given as average error per sample +-void bvpl_discover_pca_kernels::compute_testing_error(const boxm_scene_base_sptr& error_scene_base, unsigned ncomponents, +- int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- //cast the scenes +- auto* data_scene = dynamic_cast* > (data_scene_base_.as_pointer()); +- auto * error_scene = dynamic_cast* > (error_scene_base.as_pointer()); +- +- if (!(data_scene &&error_scene)){ +- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n"; +- return; +- } +- +- //get the cells for this block +- if (!(data_scene->valid_index(block_i, block_j, block_k) && error_scene->valid_index(block_i, block_j, block_k))){ +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return; +- } +- data_scene->unload_active_blocks(); +- error_scene->unload_active_blocks(); +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- error_scene->load_block(block_i, block_j, block_k); +- +- //get the trees +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- float_tree_type* error_tree = data_tree->clone(); +- //error is always positive, therefore cells with negative errors can be identified as uninitialized. +- error_tree->init_cells(-1.0f); +- +- //get the leaves +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector error_leaves = error_tree->leaf_cells(); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d min_point = nbbox_.min_point(); +- vgl_point_3d max_point = nbbox_.max_point(); +- +- for (unsigned i=0; i centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)min_point.x()*finest_cell_length_, centroid.y() + (double)min_point.y()*finest_cell_length_, centroid.z() + (double)min_point.z()*finest_cell_length_); +- vgl_point_3d max_point_global(centroid.x() + (double)max_point.x()*finest_cell_length_, centroid.y() + (double)max_point.y()*finest_cell_length_, centroid.z() + (double)max_point.z()*finest_cell_length_); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) +- continue; +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(centroid.x() + (double)x*finest_cell_length_, +- centroid.y() + (double)y*finest_cell_length_, +- centroid.z() + (double)z*finest_cell_length_); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- if (!neighbor_cell){ +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- if (curr_dim != feature_dim_){ +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- this_feature-=data_mean_feature_; +- +- //solve for the coefficients +- vnl_vector a(feature_dim_, 0.0); +- a = pc_.transpose() * (this_feature); +- +- //project as a function of number of components +- vnl_vector feature_approx = pc_.extract(feature_dim_, ncomponents) * a.extract(ncomponents); +- +- //compute error +- error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude())); +- } +- +- // write and release memory +- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree); +- error_scene->write_active_block(); +- data_scene->unload_active_blocks(); +- error_scene->unload_active_blocks(); +-} +- +- +-#if BVPL_OCTREE_HAS_PTHREADS +-void bvpl_discover_pca_kernels::compute_testing_error_thread_safe(boxm_scene > * error_scene, +- unsigned ncomponents, +- int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- //cast the scenes +- auto* data_scene = dynamic_cast* > (data_scene_base_.as_pointer()); +- +- if (!(data_scene &&error_scene)){ +- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n"; +- return; +- } +- +- if (!(data_scene->load_all_blocks() && error_scene->load_all_blocks())){ +- std::cerr << "Must load all blocks into memory before using threads\n"; +- return; +- } +- //get the cells for this block +- if (!error_scene->valid_index(block_i, block_j, block_k)){ +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return; +- } +- +- //error_scene->load_block_thread_safe(block_i, block_j, block_k); +- +- //get the trees +- boxm_block *data_block = data_scene->get_block(block_i, block_j, block_k); +- if (!data_block) +- return; +- +- float_tree_type* data_tree = data_block->get_tree(); +- float_tree_type* error_tree = error_scene->get_block(block_i, block_j, block_k)->get_tree(); +- //error is always positive, therefore cells with negative errors can be identified as uninitialized. +- // error_tree->init_cells(-1.0f); +- +- //get the leaves +- std::vector data_leaves = data_tree->leaf_cells(); +- //std::vector error_leaves = error_tree->leaf_cells(); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d min_point = nbbox_.min_point(); +- vgl_point_3d max_point = nbbox_.max_point(); +- +- for (auto data_cell : data_leaves) +- { +- //create a region around the center cell +- vgl_point_3d centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)min_point.x()*finest_cell_length_, centroid.y() + (double)min_point.y()*finest_cell_length_, centroid.z() + (double)min_point.z()*finest_cell_length_); +- vgl_point_3d max_point_global(centroid.x() + (double)max_point.x()*finest_cell_length_, centroid.y() + (double)max_point.y()*finest_cell_length_, centroid.z() + (double)max_point.z()*finest_cell_length_); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) +- continue; +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(centroid.x() + (double)x*finest_cell_length_, +- centroid.y() + (double)y*finest_cell_length_, +- centroid.z() + (double)z*finest_cell_length_); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- if (!neighbor_cell){ +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- if (curr_dim != feature_dim_){ +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- this_feature-=data_mean_feature_; +- +- //solve for the coefficients +- vnl_vector a(feature_dim_, 0.0); +- a = pc_.transpose() * (this_feature); +- +- //project as a function of number of components +- vnl_vector feature_approx = pc_.extract(feature_dim_, ncomponents) * a.extract(ncomponents); +- +- //compute error +- //error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude())); +- } +- +- // write and release memory +- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree); +- error_scene->write_block_thread_safe(block_i, block_j, block_k); +-} +-#endif // BVPL_OCTREE_HAS_PTHREADS +- +- +-//: Compute mean feature of all "leaf-features" in a scene +-void bvpl_discover_pca_kernels::compute_mean_feature(boxm_scene > *scene) +-{ +- //a vector to keep projection error - first element refers to error when using only first pc, +- //the sencond element, to error when projecting on frist 2 components and so on +- data_mean_feature_.set_size(feature_dim_); +- data_mean_feature_.fill(0.0); +- unsigned long nfeatures = 0; +- +- //iterate through leaves and arrage as vectors. +- double cell_length = scene->finest_cell_length(); +- +- boxm_cell_iterator > cell_it = scene->cell_iterator(&boxm_scene >::load_block_and_neighbors, true); +- cell_it.begin(); +- +- while (!(cell_it.end())) +- { +- //boct_tree_cell *center_cell = *cell_it; +- vgl_point_3d center_cell_centroid = cell_it.global_centroid(); +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- vgl_box_3d roi(cell_length*(double)nmin.x(),cell_length*(double)nmin.y(),cell_length*(double)nmin.z(), +- cell_length*(double)nmax.x(),cell_length*(double)nmax.y(),cell_length*(double)nmax.z()); +- roi.set_centroid(center_cell_centroid); +- +- //if neighborhood is not inclusive we would have missing features +- if (!((scene->get_world_bbox()).contains(roi))){ +- ++cell_it; +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(center_cell_centroid.x() + (double)x*cell_length, +- center_cell_centroid.y() + (double)y*cell_length, +- center_cell_centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid); +- +- assert(neighbor_cell !=nullptr); +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- ++curr_dim; +- } +- +- assert(curr_dim == feature_dim_); +- +- data_mean_feature_+=this_feature; +- ++nfeatures; +- ++cell_it; +- } +- data_mean_feature_ = data_mean_feature_/(double)nfeatures; +- +- std::ofstream mean_ofs(data_mean_path().c_str()); +- mean_ofs.precision(15); +- mean_ofs << data_mean_feature_; +- mean_ofs.close(); +-} +- +- +-#if 0 //too_slow +- //: Compute deviations i.e. zero-mean feature matrix +-vnl_matrix& bvpl_discover_pca_kernels::compute_deviation_matrix(boxm_scene > *scene) +-{ +- unsigned long max_nsamples = scene->size(); +- +- //iterate through leaves, keep random samples in memory and arrage as vectors. +- boxm_cell_iterator > cell_it = scene->cell_iterator(&boxm_scene >::load_block_and_neighbors, true); +- cell_it.begin(); +- +- vnl_random rng(9667566ul); +- unsigned long pos_pre = 0; //previous position on random samples array +- +- for (unsigned i=1; i roi = nbbox_; +- for (unsigned u = 0; u + pos_pre < sample; ++u) +- ++cell_it; +- pos_pre = sample; +- roi.set_centroid(cell_it.global_centroid()); +- if (!((scene->get_world_bbox()).contains(roi))){ +- --i; +- continue; +- } +- +- positions_.push_back(sample); +- } +- +- //sort random numbers for easy access +- positions_.sort(); +- if (nsamples_ != positions_.size()) +- { +- std::cerr << "Error computing PCA features: Wrong number of random samples generated\n"; +- return false; +- } +- +- cell_it.begin(); +- +- //init cells array to first random element +- std::list::const_iterator rand_it = positions_.begin(); +- cell_it+=(*rand_it - pos_pre); +- pos_pre = *rand_it; +- +- //init quantities for mean +- unsigned feature_dim = nbbox_.width()*nbbox_.height()* nbbox_.depth(); +- vnl_vector mean(feature_dim); +- M.set_size(feature_dim, nsamples_); +- unsigned i=0; +- +- double cell_length = scene->finest_cell_length(); +- while (!(cell_it.end())) +- { +- boct_tree_cell *center_cell = *cell_it; +- vgl_point_3d center_cell_centroid = cell_it.global_centroid(); +- +- if (!center_cell){ +- std::cerr << "Error is bvpl_discover_pca_kernels: Unexpected NULL cell\n"; +- return false; +- } +- +- //assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim); +- +- unsigned curr_dims = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_origin(center_cell_centroid.x() + (double)x*cell_length, +- center_cell_centroid.y() + (double)y*cell_length, +- center_cell_centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = scene->locate_point_in_memory(neighbor_origin); +- +- if (!neighbor_cell){ +- std::cerr << "Error is bvpl_discover_pca_kernels: Unexpected NULL cell\n"; +- return false; +- } +- +- this_feature[x + nbbox_.width()*y + nbbox_.width()*nbbox_.height()*z] = neighbor_cell->data(); +- ++curr_dims; +- } +- +- M.set_column(i,this_feature); +- mean+=this_feature; +- +- //increment iterators +- cell_it+=(*rand_it - pos_pre); +- pos_pre = *rand_it; +- ++rand_it; +- ++i; +- } +- +- mean/=nsamples_; +- +- for (unsigned int j=0; jappend_text("\n"); +- +- bxml_element* paths = new bxml_element("paths"); +- paths->append_text("\n"); +- paths->set_attribute("pc_path", pc_path() ); +- paths->set_attribute("data_path", data_path() ); +- paths->set_attribute("weights_path", weights_path() ); +- paths->set_attribute("positions_path", pos_path()) ; +- paths->set_attribute("sample_mean_path", sample_mean_path()); +- paths->set_attribute("data_mean_path", data_mean_path()); +- paths->set_attribute("scene_path", scene_path_); +- root->append_data(paths); +- root->append_text("\n"); +- +- bxml_element* neighborhood = new bxml_element("neighborhood"); +- neighborhood->append_text("\n"); +- neighborhood->set_attribute("min_x", nbbox_.min_point().x()); +- neighborhood->set_attribute("min_y", nbbox_.min_point().y()); +- neighborhood->set_attribute("min_z", nbbox_.min_point().z()); +- neighborhood->set_attribute("max_x", nbbox_.max_point().x()); +- neighborhood->set_attribute("max_y", nbbox_.max_point().y()); +- neighborhood->set_attribute("max_z", nbbox_.max_point().z()); +- root->append_data(neighborhood); +- root->append_text("\n"); +- +- bxml_element* nsamples = new bxml_element("samples"); +- nsamples->append_text("\n"); +- nsamples->set_attribute("nsamples", nsamples_); +- root->append_data(nsamples); +- root->append_text("\n"); +- +- bxml_element* dim = new bxml_element("dimension"); +- dim->append_text("\n"); +- dim->set_attribute("feature_dim", feature_dim_); +- root->append_data(dim); +- root->append_text("\n"); +- +- bxml_element* cell_length = new bxml_element("finest_cell_length"); +- cell_length->append_text("\n"); +- cell_length->set_attribute("length", finest_cell_length_); +- root->append_data(cell_length); +- root->append_text("\n"); +- +- std::ofstream os(xml_path().c_str()); +- bxml_write(os, doc); +- os.close(); +- +- //: Write pca main matrices -other matrices aren't class variables and should have been written during computation time +- +- write_pca_matrices(); +-} +- +- +-//: Write a PCA file +-bool bvpl_discover_pca_kernels::write_pca_matrices() +-{ +- std::ofstream pc_ofs(pc_path().c_str()); +- pc_ofs.precision(15); +- std::ofstream weights_ofs(weights_path().c_str()); +- weights_ofs.precision(15); +- +- pc_ofs << pc_; +- pc_ofs.close(); +- weights_ofs << weights_; +- weights_ofs.close(); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h +deleted file mode 100644 +index 875504affa..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h ++++ /dev/null +@@ -1,309 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h +-#ifndef bvpl_discover_pca_kernels_h +-#define bvpl_discover_pca_kernels_h +-//: +-// \file +-// \brief A class to discover those features that represent the data the best in a least square sense using PCA +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 8-Nov-2010. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +- +-#if BVPL_OCTREE_HAS_PTHREADS +-#include +-#endif +- +-class bvpl_discover_pca_kernels; +- +-typedef vbl_smart_ptr bvpl_discover_pca_kernels_sptr; +- +-class bvpl_discover_pca_kernels: public vbl_ref_count +-{ +- public: +- //: Constructor from neighborhood bounding boxm, number of samples to be drawn, scene and flag to indicate whether to use evd or svd +- bvpl_discover_pca_kernels(vgl_box_3d nbbox, unsigned long long nsamples, boxm_scene > *scene, std::string path_out=".", bool use_evd = true): +- nbbox_(nbbox), nsamples_(nsamples), path_out_(std::move(path_out)) +- { +- scene_path_ = scene->filename(); +- std::cout << "Scene path: " << scene->filename()<< std::endl;; +- data_scene_base_=scene; +- +- finest_cell_length_ = scene->finest_cell_length(); +- +- feature_dim_ = (nbbox_.width()+1)*(nbbox_.height()+1)* (nbbox_.depth()+1); +- compute_mean_feature(scene); +- +- sample_mean_feature_.set_size(feature_dim_); +- +- if (use_evd) +- set_up_pca_evd(scene); +- else +- set_up_pca_svd(scene); +- +- scene->unload_active_blocks(); +- } +- +- //: Construct from xml file +- bvpl_discover_pca_kernels(const std::string &path); +- +- //: Constructor from zero-mean matrix +- bvpl_discover_pca_kernels(const vnl_matrix& M) +- { +- vnl_svd A(M, -1e-8); +- +- //columns of U contain principal components. +- pc_.set_size(A.rank(), M.rows()); +- A.U().extract(pc_); +- } +- +- //: Access the principal components +- const vnl_matrix& principal_comps() { return pc_; } +- +- //: Access the coefficients +- const vnl_vector& weights() { return weights_; } +- +- //: Access the mean of samples +- const vnl_vector& mean() { return sample_mean_feature_; } +- +- //: Project training samples onto pca space and return error as a function of number of components used +- void compute_training_error(vnl_vector &proj_error); +- +- //: Project training samples onto pca space and return error as a function of number of components used +- void compute_normalized_training_error(vnl_vector &proj_error); +- +- //: Reconstrcution error on training samples. Same as above but it is not computed from samples. +- void theoretical_training_error(vnl_vector &proj_error); +- +- //: Reconstructions error on testing samples. All training samples are excuded! +- void compute_testing_error(vnl_vector &proj_error); +- +- //: Reconstructions error on testing samples. By block. Error is given as average error per sample +- void compute_testing_error(const boxm_scene_base_sptr& error_scene_base, unsigned ncomponents, +- int block_i, int block_j, int block_k); +- +-#if BVPL_OCTREE_HAS_PTHREADS +- +- void compute_testing_error_thread_safe(boxm_scene > * error_scene, unsigned ncomponents, +- int block_i, int block_j, int block_k); +- +-// //: Reconstructions error on testing samples. By block. Error is the sse of feature vector approximation +-// bool compute_testing_error_thread_safe(boxm_scene_base_sptr error_scene_base, unsigned ncomponents); +-// +-// //: Reconstructions error on testing samples. By block. Error is the sse of feature vector approximation +-// friend void *compute_testing_error_thread( void *ptr); +- +-#endif +- +- //: Computes pca projection at each voxel on the block and it save the specified number of dimensions (dim) +- template +- void project(boxm_scene > > *proj_scene, +- int block_i, int block_j, int block_k); +- +- //: Compute the mean feature of all "leaf" samples in the data scene associated with this class +- void compute_mean_feature(boxm_scene > *scene); +- +- //: Return the number of samples used +- unsigned long long nsamples() const { return nsamples_; } +- +- //: Return dimension of the features +- unsigned feature_dim() const { return feature_dim_; } +- +- //: Return scene path +- std::string scene_path() const { return scene_path_; } +- +- //: Return number of blocks in the data scene +- vgl_vector_3d data_scene_dim() const { return data_scene_base_->world_dim(); } +- +- bool load_all_scene_blocks() +- { +- boxm_scene > *scene = dynamic_cast >* > (data_scene_base_.as_pointer()); +- return scene->read_all_blocks(); +- } +- +- void unload_all_scene_blocks() +- { +- boxm_scene > *scene = dynamic_cast >* > (data_scene_base_.as_pointer()); +- scene->unload_active_blocks(); +- } +- +- //: Compute deviations i.e. zero-mean feature matrix +- vnl_matrix compute_deviation_matrix(boxm_scene > *scene); +- +- //: Compute the scatter matrix. +- vnl_matrix compute_scatter_matrix(boxm_scene > *scene); +- +- void xml_write(); +- +- protected: +- +- //: Set Up the PCA matrix for the given scene. +- // This method computes the deviation matrix and performs SVD to find the principal components +- // If the number of samples is very large use set_up_pca_evd +- void set_up_pca_svd(boxm_scene > *scene); +- +- //: Set Up the PCA matrix for the given scene +- // This method performs eigen value decomposition on the covariance matrix +- // Use this method when number of samples >> number of dimensions +- void set_up_pca_evd(boxm_scene > *scene); +- +- //: Write a PCA file +- bool write_pca_matrices(); +- +- //: The size around the central feature to include in PCA vectors +- vgl_box_3d nbbox_; +- //: Number of total samples(leaves) to be drawn +- unsigned long long nsamples_; +- //: Number of dimension of feature vector +- unsigned feature_dim_; +- //: Principal components - eigen vectors of the scatter matrix +- vnl_matrix pc_; +- //: Weights - eigen values of the scatter matrix +- vnl_vector weights_; +- //: The mean of sample data +- vnl_vector sample_mean_feature_; +- //: The mean of all features in the scene data +- vnl_vector data_mean_feature_; +- //: Pointer to data scene +- boxm_scene_base_sptr data_scene_base_; +- //: Finest cell length of data scene +- double finest_cell_length_; +- +- //: Paths for i/o of matrices and vectors +- std::string path_out_; +- std::string scene_path_; +- std::string pc_path() const { return path_out_ + "/pc.txt" ; } +- std::string data_path() const { return path_out_ + "/data.txt"; } +- std::string weights_path() const { return path_out_ + "/weights.txt"; } +- std::string pos_path() const { return path_out_ + "/positions.txt"; } +- std::string sample_mean_path() const { return path_out_ + "/sample_mean.txt"; } +- std::string data_mean_path() const { return path_out_ + "/data_mean.txt"; } +- std::string xml_path() const { return path_out_ + "/pca_info.xml"; } +- +- //: Tolerance, retain eigenvalues above max(eigenVals)*tol +- double tol_; +-}; +- +- +-//: Computes pca projection at each voxel on the block and it saves the specified number of coefficientes +-template +-void bvpl_discover_pca_kernels::project(boxm_scene > > *proj_scene, +- int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- typedef boct_tree > pca_tree_type; +- typedef boct_tree_cell > pca_cell_type; +- +- //cast the scenes +- boxm_scene* data_scene = dynamic_cast* > (data_scene_base_.as_pointer()); +- +- if (!(data_scene &&proj_scene)) { +- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n"; +- return; +- } +- +- double cell_length = data_scene->finest_cell_length(); +- +- //get the cells for this block +- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k))) { +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return; +- } +- +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- proj_scene->load_block(block_i, block_j, block_k); +- +- //get the trees +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- pca_tree_type* proj_tree = data_tree->template clone_to_type >(); +- +- //get the leaves +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector proj_leaves = proj_tree->leaf_cells(); +- +- //CAUTION: the neighborhood box was supposed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d min_point = nbbox_.min_point(); +- vgl_point_3d max_point = nbbox_.max_point(); +- +- for (unsigned i =0; i centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd test if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)min_point.x()*cell_length, centroid.y() + (double)min_point.y()*cell_length, centroid.z() + (double)min_point.z()*cell_length); +- vgl_point_3d max_point_global(centroid.x() + (double)max_point.x()*cell_length, centroid.y() + (double)max_point.y()*cell_length, centroid.z() + (double)max_point.z()*cell_length); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) { +- proj_leaves[i]->set_data(bvpl_pca_basis_sample()); +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector this_feature(feature_dim_, 0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++) +- { +- vgl_point_3d neighbor_centroid(centroid.x() + (double)x*cell_length, +- centroid.y() + (double)y*cell_length, +- centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- if (!neighbor_cell) { +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- curr_dim++; +- } +- +- if (curr_dim != feature_dim_) { +- std::cerr << "Error in compute_testing_error\n"; +- return; +- } +- this_feature-=data_mean_feature_; +- +- //solve for the coefficients +- vnl_vector a(feature_dim_, 0.0); +- a = pc_.transpose() * (this_feature); +- +- //compute error +- bvpl_pca_basis_sample sample(a.extract(DIM), 0); +- proj_leaves[i]->set_data(sample); +- } +- +- // write and release memory +- proj_scene->get_block(block_i, block_j, block_k)->init_tree(proj_tree); +- proj_scene->write_active_block(); +- data_scene->unload_active_blocks(); +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx +deleted file mode 100644 +index 978a9443de..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx ++++ /dev/null +@@ -1,512 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 12-Aug-2011 +- +-#include "bvpl_gauss3D_steerable_filters.h" +-#include +- +-//: Constructor +-// Initializes the order separable filter tabs should be applied for eac bases +-bvpl_gauss3D_steerable_filters::bvpl_gauss3D_steerable_filters() +-{ +- axis_.clear(); +- axis_.emplace_back(1,0,0); +- axis_.emplace_back(0,1,0); +- axis_.emplace_back(0,0,1); +- +- //Initialize from lists - waiting for VXL to support TR1! +- basis_.clear(); +- basis_names_.clear(); +- +- //zerth order - that is gaussian functio +- std::string G0a[3] = {"f01", "f02", "f02"}; +- basis_.emplace_back(&G0a[0], &G0a[3]); +- basis_names_.emplace_back("G0a"); +- +- //first order derivatives +- std::string G1a[3] = {"f11", "f12", "f12"}; +- std::string G1b[3] = {"f12", "f11", "f12"}; +- std::string G1c[3] = {"f12", "f12", "f11"}; +- basis_.emplace_back(&G1a[0], &G1a[3]); +- basis_.emplace_back(&G1b[0], &G1b[3]); +- basis_.emplace_back(&G1c[0], &G1c[3]); +- basis_names_.emplace_back("G1a"); +- basis_names_.emplace_back("G1b"); +- basis_names_.emplace_back("G1c"); +- +- //second order derivatives +- std::string G2a[3] = {"f21", "f22", "f22"}; +- std::string G2b[3] = {"f23", "f24", "f22"}; +- std::string G2c[3] = {"f22", "f21", "f22"}; +- std::string G2d[3] = {"f23", "f22", "f24"}; +- std::string G2e[3] = {"f22", "f23", "f24"}; +- std::string G2f[3] = {"f22", "f22", "f21"}; +- basis_.emplace_back(&G2a[0], &G2a[3]); +- basis_.emplace_back(&G2b[0], &G2b[3]); +- basis_.emplace_back(&G2c[0], &G2c[3]); +- basis_.emplace_back(&G2d[0], &G2d[3]); +- basis_.emplace_back(&G2e[0], &G2e[3]); +- basis_.emplace_back(&G2f[0], &G2f[3]); +- basis_names_.emplace_back("G2a"); +- basis_names_.emplace_back("G2b"); +- basis_names_.emplace_back("G2c"); +- basis_names_.emplace_back("G2d"); +- basis_names_.emplace_back("G2e"); +- basis_names_.emplace_back("G2f"); +-} +- +-//: Computes the responses to separable filter taps. +-// There are 10 basis, corresponding to gaussians zeroth, first and second derivatives +-// Each basis is made up of 3 1-d filter taps (x, y, z) +-// "scene" should be initialized with a dim-dimensional vector of the real input scene. +-// the taps have size 5, this could be changed later on +-bool bvpl_gauss3D_steerable_filters::basis_response_at_leaves(boxm_scene > > *scene, +- boxm_scene > *valid_scene, double cell_length) +-{ +- this->assemble_basis_size_5(); +- +- bvpl_algebraic_functor functor; +- +- // each basis function, should have 3 1-d taps (one in x, one in y, one in z) +- unsigned max_ntaps = 3; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- // Load input and output blocks +- scene->clone_blocks_to_type(*valid_scene, true); +- +- //create and init a temporary scene to hold the intermediate 1-d output. +- boxm_scene *temp_scene = +- new boxm_scene(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level()); +- temp_scene->set_paths(".", "temp_gsf_scene"); +- temp_scene->set_appearance_model(VNL_FLOAT_10); +- temp_scene->write_scene("temp_gsf_scene.xml"); +- scene->clone_blocks(*temp_scene); +- +- for (unsigned tap_i=0; tap_i > one_d_taps; +- +- for (unsigned dim=0; dim< DIM_; dim++){ +- std::string tap_name = basis_[dim][tap_i]; +- one_d_taps.push_back(separable_taps_[tap_name]); +- } +- +- //Traverse applying the appropriate 1-d taps +- boxm_cell_iterator cell_it = scene->cell_iterator(&boxm_scene::load_block_and_neighbors); +- cell_it.begin(); +- +- boxm_cell_iterator temp_cell_it = temp_scene->cell_iterator(&boxm_scene::load_block); +- temp_cell_it.begin(); +- +- boxm_cell_iterator > valid_cell_it = valid_scene->cell_iterator(&boxm_scene >::load_block); +- valid_cell_it.begin(); +- +- while ( !(cell_it.end() || temp_cell_it.end() || valid_cell_it.end()) ) +- { +- cell_type *temp_center_cell = *temp_cell_it; +- boct_tree_cell *valid_center_cell = *valid_cell_it; +- +- if (!valid_center_cell->data()) +- { +- ++cell_it; ++temp_cell_it; ++valid_cell_it; +- continue; +- } +- +- bool valid = true; +- +- vgl_point_3d center_cell_centroid = cell_it.global_centroid(); +- +- vnl_vector_fixed responses(0.0); +- +- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++) +- { +- vnl_vector_fixed this_tap = one_d_taps[response_dim]; +- +- for (int i =-2; i<=2; i++) +- { +- vgl_vector_3d kernel_idx = i*axis_[tap_i]; +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid); +- +- if (this_cell) { +- bvpl_kernel_dispatch d(this_tap[i+2]); +- float val =(float)(this_cell->data()[response_dim]); +- functor.apply(val, d); +- } +- else { +- valid = false; +- break; +- } +- } +- +- if (!valid) +- break; +- +- responses[response_dim] = (float)(functor.result()); +- } +- +- temp_center_cell->set_data(responses); +- valid_center_cell->set_data(valid); +- ++cell_it; ++temp_cell_it; ++valid_cell_it; +- } +- +- //copy temp cells into cells +- cell_it.begin(); +- temp_cell_it.begin(); +- +- while ( !(cell_it.end() || temp_cell_it.end()) ) +- { +- (*cell_it)->set_data((*temp_cell_it)->data()); +- ++cell_it; ++temp_cell_it; +- } +- } +- +- //clear memory +- scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- temp_scene->unload_active_blocks(); +- delete temp_scene; +- return true; +-} +- +- +-//: Compute basis response at all levels - assumes the intermediate cells of the tree have ben filled with meaningful info, otherwise the result could be garbage +-bool bvpl_gauss3D_steerable_filters::multiscale_basis_response(boxm_scene > > *scene, +- boxm_scene > *valid_scene, unsigned resolution_level) +-{ +- this->assemble_basis_size_5(); +- +- bvpl_algebraic_functor functor; +- +- // each basis function, should have 3 1-d taps (one in x, one in y, one in z) +- unsigned max_ntaps = 3; +- +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- // Load input and output blocks +- scene->clone_blocks_to_type(*valid_scene, true); +- +- //create and init a temporary scene to hold the intermediate 1-d output. +- boxm_scene *temp_scene = +- new boxm_scene(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level()); +- temp_scene->set_paths(".", "temp_gsf_scene"); +- temp_scene->set_appearance_model(VNL_FLOAT_10); +- temp_scene->write_scene("temp_gsf_scene.xml"); +- scene->clone_blocks(*temp_scene); +- +- for (unsigned tap_i=0; tap_i > one_d_taps; +- +- for (unsigned dim=0; dim< DIM_; dim++){ +- std::string tap_name = basis_[dim][tap_i]; +- one_d_taps.push_back(separable_taps_[tap_name]); +- } +- +- //Traverse applying the appropriate 1-d taps +- boxm_cell_iterator cell_it = scene->cell_iterator(&boxm_scene::load_block_and_neighbors); +- cell_it.begin(true); +- +- boxm_cell_iterator temp_cell_it = temp_scene->cell_iterator(&boxm_scene::load_block); +- temp_cell_it.begin(true); +- +- boxm_cell_iterator > valid_cell_it = valid_scene->cell_iterator(&boxm_scene >::load_block); +- valid_cell_it.begin(true); +- +- while ( !(cell_it.end() || temp_cell_it.end() || valid_cell_it.end()) ) +- { +- cell_type *temp_center_cell = *temp_cell_it; +- boct_tree_cell *valid_center_cell = *valid_cell_it; +- +- if (!valid_center_cell->data()) +- { +- ++cell_it; ++temp_cell_it; ++valid_cell_it; +- continue; +- } +- +- bool valid = true; +- +- vgl_point_3d center_cell_centroid = cell_it.global_centroid(); +- double cell_length = cell_it.length(); +- +- vnl_vector_fixed responses(0.0); +- +- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++) +- { +- vnl_vector_fixed this_tap = one_d_taps[response_dim]; +- +- for (int i =-2; i<=2; i++) +- { +- vgl_vector_3d kernel_idx = i*axis_[tap_i]; +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid, resolution_level); +- +- if (this_cell) { +- bvpl_kernel_dispatch d(this_tap[i+2]); +- float val =(float)(this_cell->data()[response_dim]); +- functor.apply(val, d); +- } +- else { +- valid = false; +- break; +- } +- } +- +- if (!valid) +- break; +- +- responses[response_dim] = (float)(functor.result()); +- } +- +- temp_center_cell->set_data(responses); +- valid_center_cell->set_data(valid); +- ++cell_it; ++temp_cell_it; ++valid_cell_it; +- } +- +- //copy temp cells into cells +- cell_it.begin(); +- temp_cell_it.begin(); +- +- while ( !(cell_it.end() || temp_cell_it.end()) ) +- { +- (*cell_it)->set_data((*temp_cell_it)->data()); +- ++cell_it; ++temp_cell_it; +- } +- } +- +- //clear memory +- scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- temp_scene->unload_active_blocks(); +- delete temp_scene; +- return true; +-} +- +-#if 0 +-//: Computes the responses to separable filter taps. +-// There are 10 basis, corresponding to gaussians zeroth, first and second derivatives +-// Each basis is made up of 3 1-d filter taps (x, y, z) +-// "scene" should be initialized with a dim-dimensional vector of the real input scene. +-// the taps have size 5, this could be changed later on +-bool bvpl_gauss3D_steerable_filters::basis_response(boxm_scene > > *scene, +- int block_i, int block_j, int block_k, +- boxm_scene > *valid_scene, double cell_length) +-{ +- this->assemble_basis_size_5(); +- +- bvpl_algebraic_functor functor; +- +- // each basis function, should have 3 1-d taps (one in x, one in y, one in z) +- unsigned max_ntaps = 3; +- +- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl; +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- // Load input and output blocks +- scene->load_block_and_neighbors(block_i,block_j,block_k); +- valid_scene->load_block(block_i,block_j,block_k); +- +- tree_type *tree = scene->get_block(block_i, block_j, block_k)->get_tree(); +- tree_type *temp_tree = tree->clone(); //a temporary tree to store partial results +- boct_tree *valid_tree = tree->clone_to_type(); +- valid_tree->init_cells(true); +- +- std::vector cells = tree->leaf_cells(); +- std::vector temp_cells = temp_tree->leaf_cells(); +- std::vector * > valid_cells = valid_tree->leaf_cells(); +- +- std::cout << scene->locate_point_in_memory(test_point)->data()<< std::endl; +- +- for (unsigned tap_i=0; tap_i > one_d_taps; +- +- for (unsigned dim=0; dim< DIM_; dim++){ +- std::string tap_name = basis_[dim][tap_i]; +- one_d_taps.push_back(separable_taps_[tap_name]); +- } +- +- //Traverse applying the appropriate 1-d taps +- std::vector::iterator cells_it = cells.begin(); +- std::vector::iterator temp_it = temp_cells.begin(); +- std::vector * >::iterator valid_it = valid_cells.begin(); +- for (; (cells_it!=cells.end())&&(temp_it!=temp_cells.end())&&(valid_it!=valid_cells.end()); cells_it++, valid_it++, temp_it++) +- { +- cell_type *center_cell = *cells_it; +- cell_type *temp_center_cell = *temp_it; +- boct_tree_cell *valid_center_cell = *valid_it; +- +- if (!valid_center_cell->data()) +- continue; +- +- bool valid = true; +- +- vgl_point_3d center_cell_centroid = tree->global_centroid(center_cell); +- +- vnl_vector_fixed responses(0.0); +- +- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++) +- { +- vnl_vector_fixed this_tap = one_d_taps[response_dim]; +- +- for (int i =-2; i<=2; i++) +- { +- vgl_vector_3d kernel_idx = i*axis_[tap_i]; +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid); +- +- if (this_cell) { +- bvpl_kernel_dispatch d(this_tap[i+2]); +- float val =(float)(this_cell->data()[response_dim]); +- functor.apply(val, d); +- } +- else { +- valid = false; +- break; +- } +- } +- +- if (!valid) +- break; +- +- responses[response_dim] = (float)(functor.result()); +- } +- +- temp_center_cell->set_data(responses); +- valid_center_cell->set_data(valid); +- } +- +- //copy temp cells into cells +- cells_it = cells.begin(); +- temp_it = temp_cells.begin(); +- for (; (cells_it!=cells.end())&&(temp_it!=temp_cells.end()); cells_it++, temp_it++) +- (*cells_it)->set_data((*temp_it)->data()); +- +- std::cout << scene->locate_point_in_memory(test_point)->data()<< std::endl;; +- } +- +- //write the output block +- scene->get_block(block_i, block_j, block_k)->init_tree(tree); +- scene->write_active_block(); +- valid_scene->get_block(block_i, block_j, block_k)->init_tree(valid_tree); +- valid_scene->write_active_block(); +- +- //clear memory +- scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- delete temp_tree; +- return true; +-} +-#endif +- +- +-bool bvpl_gauss3D_steerable_filters::rotation_invariant_interpolation(boxm_scene > > *scene, +- boxm_scene > *valid_scene) +-{ +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- //Traverse all cells +- boxm_cell_iterator cell_it = scene->cell_iterator(&boxm_scene::load_block); +- cell_it.begin(); +- boxm_cell_iterator > valid_cell_it = valid_scene->cell_iterator(&boxm_scene >::load_block, true); +- valid_cell_it.begin(); +- +- while ( !(cell_it.end() || valid_cell_it.end()) ) +- { +- cell_type *center_cell = *cell_it; +- boct_tree_cell *valid_center_cell = *valid_cell_it; +- +- if (!valid_center_cell->data()){ +- ++cell_it; ++valid_cell_it; +- continue; +- } +- +- vnl_vector_fixed responses=center_cell->data(); +- +- vgl_vector_3d grad(responses[1], responses[2],responses[3]); +- normalize(grad); //after normalizing the gradient the direction cosines are the cartesian coordinates of grad +- +- //rotate the responses according to the gradient +- vnl_vector_fixed rotation_weigths(1.0f); +- rotation_weigths[0] = 1; +- rotation_weigths[1] = grad.x(); rotation_weigths[2] = grad.y(); rotation_weigths[3] = grad.z(); +- rotation_weigths[4] = grad.x()* grad.x(); rotation_weigths[5] = 2.0f* grad.x()*grad.y(); +- rotation_weigths[6] = grad.y()* grad.y(); rotation_weigths[7] = 2.0f* grad.x()*grad.z(); +- rotation_weigths[8] = 2.0f * grad.y()* grad.z(); rotation_weigths[9] = grad.z()*grad.z(); +- +- responses = element_product(responses, rotation_weigths); +- +- center_cell->set_data(responses); +- ++cell_it; ++valid_cell_it; +- } +- +- //clear memory +- scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- return true; +-} +- +- +-void bvpl_gauss3D_steerable_filters::assemble_basis_size_5() +-{ +- separable_taps_.clear(); +- +- //Zeroth Derivative G0 +- //Separable basis taps: f01, f02 +- float f01_data[5] = {0.000402093f, 0.162216f, 1.19862f, 0.162216f, 0.000402093f}; +- vnl_vector_fixed f01(f01_data); +- separable_taps_.insert(std::pair >("f01", f01)); +- +- float f02_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f}; +- vnl_vector_fixed f02(f02_data); +- separable_taps_.insert(std::pair >("f02", f02)); +- +- //First Derivative Basis: G1 = alpha*G1a + beta*G1b +- //Separable basis functions: f11, f12 +- float f11_data[5] = {0.00227458f, 0.458816f, 0.0f, -0.458816f, -0.00227458f}; +- vnl_vector_fixed f11(f11_data); +- separable_taps_.insert(std::pair >("f11", f11)); +- float f12_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f}; +- vnl_vector_fixed f12(f12_data); +- separable_taps_.insert(std::pair >("f12", f12)); +- +- //Second derivative basis G2 = alpha^2*G2a + 2*alpha*beta*G2b + beta^2*G2c + 2*alpha*gamma*G2d + 2*beta*gamma*G2e + gamma^2*G2f +- //Separable basis taps = f21, f22, f23, f24 +- float f21_data[5] = {0.00696448f, 0.561934f, -1.38405f, 0.561934f, 0.00696448f}; +- vnl_vector_fixed f21(f21_data); +- separable_taps_.insert(std::pair >("f21", f21)); +- +- float f22_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f}; +- vnl_vector_fixed f22(f22_data); +- separable_taps_.insert(std::pair >("f22", f22)); +- +- float f23_data[5] = {-0.00643349f, -1.29773f, 0.0f, 1.29773f, 0.00643349f}; +- vnl_vector_fixed f23(f23_data); +- separable_taps_.insert(std::pair >("f23", f23)); +- +- float f24_data[5] = {-0.000670925f, -0.135335f, 0.0f, 0.135335f, 0.000670925f}; +- vnl_vector_fixed f24(f24_data); +- separable_taps_.insert(std::pair >("f24", f24)); +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h +deleted file mode 100644 +index bda8905d49..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h ++++ /dev/null +@@ -1,61 +0,0 @@ +-// This is bvpl_gauss3D_steerable_filters.h +-#ifndef bvpl_gauss3D_steerable_filters_h +-#define bvpl_gauss3D_steerable_filters_h +- +-//: +-// \file +-// \brief 3-d Streerable filters implemented theough separable basis +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 12-Aug-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +- +-class bvpl_gauss3D_steerable_filters{ +- +-public: +- bvpl_gauss3D_steerable_filters(); +- +- //: The dimension of the filter response e.i. number of steerable filters +- enum { DIM_ = 10 }; +- +- //: Compute basis response at all leaf cells +- bool basis_response_at_leaves(boxm_scene > > *scene, +- boxm_scene > *valid_scene, double cell_length); +- +- //: Compute basis response at all levels - assumes the intermediate cells of the tree have ben filled with meaningful info, otherwise the result could be garbage +- bool multiscale_basis_response(boxm_scene > > *scene, +- boxm_scene > *valid_scene, unsigned resolution_level); +- +- //: Assemble basis for: -2 -1 0 1 2 +- void assemble_basis_size_5(); +- +- std::vector > basis() {return basis_;} +- std::vector basis_names() {return basis_names_;} +- std::map > separable_taps(){return separable_taps_;} +- +- bool rotation_invariant_interpolation(boxm_scene > > *scene, +- boxm_scene > *valid_scene); +- +-protected: +- +- //: lists of 1-d filter tap names needed for each basis +- std::vector > basis_; +- +- //: list of basis identifying strings +- std::vector basis_names_; +- +- //: map containing the 1-d filter taps (actual values) and their identifying string +- std::map > separable_taps_; +- +- std::vector > axis_; +-}; +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx +deleted file mode 100644 +index 391c7f157e..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx ++++ /dev/null +@@ -1,475 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 21-Jul-2011 +- +-#include +-#include +-#include "bvpl_global_corners.h" +- +-#include +- +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +- +-//: Constructor from xml file +-bvpl_global_corners::bvpl_global_corners(const std::string &path) +-{ +- std::cout << "Loading corners info from xml-file" << std::endl; +- path_out_ = path; +- std::ifstream xml_ifs(xml_path().c_str()); +- if (!xml_ifs.is_open()){ +- std::cerr << "Error: could not open xml info file: " << xml_path() << '\n'; +- throw; +- } +- bxml_document doc = bxml_read(xml_ifs); +- bxml_element query("global_corners_info"); +- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query); +- if (!root) { +- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n"; +- throw; +- } +- +- //Parse scenes +- bxml_element scenes_query("scene"); +- std::vector scenes_data = bxml_find_all_with_name(root, scenes_query); +- +- unsigned nscenes=scenes_data.size(); +- std::cout << "Number of scenes: " << nscenes << std::endl; +- +- aux_dirs_.clear(); +- aux_dirs_.resize(nscenes); +- +- finest_cell_length_.clear(); +- finest_cell_length_.resize(nscenes); +- +- for (unsigned si = 0; si < nscenes; si++) +- { +- auto* scenes_elm = dynamic_cast(scenes_data[si].ptr()); +- int id = -1; +- scenes_elm->get_attribute("id", id); +- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]); +- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]); +- +- if (!(vul_file::exists(aux_dirs_[id]) && vul_file::is_directory(aux_dirs_[id]))){ +- vul_file::make_directory(aux_dirs_[id]); +- } +- } +- +- //Parse kernels +- bxml_element params_query("parameters"); +- bxml_data_sptr params_data = bxml_find_by_name(root, params_query); +- if (params_data) +- { +- auto* params_elm = dynamic_cast(params_data.ptr()); +- +- params_elm->get_attribute("harris_k", harris_k_); +- std::cout << "Harris_k is " << harris_k_ << '\n'; +- } +- else { +- std::cerr << " In Gobal Corners: no parameters element\n"; +- } +-} +- +- +-//: Compute Harris' measure extension to 3-d as proposed by: +-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005 +-void bvpl_global_corners::compute_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree > taylor_tree_type; +- typedef boct_tree_cell > taylor_cell_type; +- +- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id); +- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id); +- +- auto* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- auto* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- boxm_scene >* corner_scene = +- new boxm_scene >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level()); +- corner_scene->set_appearance_model(BOXM_FLOAT); +- corner_scene->set_paths(aux_dirs_[scene_id], "corner_scene"); +- corner_scene->write_scene("harris_scene.xml"); +- +- if (!( proj_scene && valid_scene && corner_scene )) +- { +- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +- +- //operate on scene +- bvpl_corner_detector corner_detector; +- bvpl_harris_laptev_functor harris_functor(harris_k_); +- +- vgl_point_3d max_neighborhood_idx = global_taylor->kernel_vector_->max(); +- vgl_point_3d min_neighborhood_idx = global_taylor->kernel_vector_->min(); +- +- std::cout << "Neighborhood for Harris threshold: " << min_neighborhood_idx << " , " << max_neighborhood_idx << std::endl; +- +- corner_detector.compute_C(proj_scene, harris_functor, min_neighborhood_idx, max_neighborhood_idx, block_i, block_j, block_k, valid_scene, corner_scene, finest_cell_length_[scene_id]); +- +- //clean memory +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +-} +- +- +-//: Compute corner measure extension to 3-d as proposed by: +-// P. Beaudet, Rotationally invariant image operators, in Proc. 4th Int. Joint Conf. Patt. Recog. 1978. +-void bvpl_global_corners::compute_beaudet_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree > taylor_tree_type; +- typedef boct_tree_cell > taylor_cell_type; +- +- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id); +- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id); +- +- auto* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- auto* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- boxm_scene >* corner_scene = +- new boxm_scene >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level()); +- corner_scene->set_appearance_model(BOXM_FLOAT); +- corner_scene->set_paths(aux_dirs_[scene_id], "corner_scene"); +- corner_scene->write_scene("harris_scene.xml"); +- +- if (!( proj_scene && valid_scene && corner_scene )) +- { +- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +- +- //operate on scene +- bvpl_corner_detector corner_detector; +- +- corner_detector.compute_det_H(proj_scene, block_i, block_j, block_k, valid_scene, corner_scene); +- +- //clean memory +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +-} +- +- +-//: Threshold a percentage of corners, based of the Harris' measure extension to 3-d proposed by: +-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005 +-void bvpl_global_corners::threshold_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, float harris_thresh, const std::string& output_path) +-{ +- typedef boct_tree > taylor_tree_type; +- +- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id); +- boxm_scene_base_sptr corner_scene_base = this->load_corner_scene(scene_id); +- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id); +- +- auto* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- +- auto* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- +- auto* corner_scene = dynamic_cast >*> (corner_scene_base.as_pointer()); +- +- if (!(vul_file::exists(output_path) && vul_file::is_directory(output_path))) +- vul_file::make_directory(output_path); +- +- boxm_scene >* valid_corner_scene = +- new boxm_scene >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level()); +- valid_corner_scene->set_appearance_model(BOXM_BOOL); +- +- std::stringstream valid_ss; +- valid_ss << "valid_scene_" << scene_id ; +- +- valid_corner_scene->set_paths(output_path, valid_ss.str()); +- valid_corner_scene->write_scene(valid_ss.str() + ".xml"); +- valid_scene->clone_blocks(*valid_corner_scene); +- +- std::stringstream proj_ss; +- proj_ss << "proj_taylor_scene_" << scene_id ; +- +- boxm_scene* copy_proj_scene = +- new boxm_scene(proj_scene->lvcs(), proj_scene->origin(), proj_scene->block_dim(), proj_scene->world_dim(), proj_scene->max_level(), proj_scene->init_level()); +- copy_proj_scene->set_appearance_model(VNL_DOUBLE_10); +- copy_proj_scene->set_paths(proj_scene->path(), proj_scene->block_prefix()); +- copy_proj_scene->write_scene(output_path, proj_ss.str() + ".xml"); +- +- delete copy_proj_scene; +- +- if (!( valid_scene && corner_scene && valid_corner_scene)) +- { +- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n"; +- return; +- } +- +- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0; +- boxm_cell_iterator > valid_it = valid_scene->cell_iterator(&boxm_scene >::load_block, true); +- valid_it.begin(); +- +- boxm_cell_iterator > corners_it = corner_scene->cell_iterator(&boxm_scene >::load_block, true); +- corners_it.begin(); +- +- boxm_cell_iterator > valid_corners_it = valid_corner_scene->cell_iterator(&boxm_scene >::load_block); +- valid_corners_it.begin(); +- +- while ( !(valid_it.end() || corners_it.end() || valid_corners_it.end()) ) +- { +- boct_tree_cell *valid_cell = *valid_it; +- boct_tree_cell *corner_cell = *corners_it; +- boct_tree_cell *valid_corner_cell = *valid_corners_it; +- +- boct_loc_code valid_code = valid_cell->get_code(); +- boct_loc_code corner_code = corner_cell->get_code(); +- boct_loc_code valid_corner_code = valid_corner_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((valid_cell->level() != corner_cell->level()) || (valid_cell->level() != valid_corner_cell->level()) || !(valid_code.isequal(&corner_code)) || !(valid_code.isequal(&valid_corner_code))){ +- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n"; +- return; +- } +- +- /*****CAUTION: Only looking at cells at level 0*/ +- if (valid_cell->level()!=0) { +- ++valid_it; +- ++corners_it; +- valid_corner_cell->set_data(false); +- ++valid_corners_it; +- continue; +- } +- +- if (corner_cell->data() < harris_thresh) +- valid_corner_cell->set_data(false); +- else +- valid_corner_cell->set_data(true); +- +- ++valid_it; +- ++corners_it; +- ++valid_corners_it; +- } +- +- //clean memory +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +- valid_corner_scene->unload_active_blocks(); +- +- delete valid_corner_scene; +-} +- +-//: Take a histogram of corners and get different values for percentage of thresholds +-void bvpl_global_corners::explore_corner_statistics(const bvpl_global_taylor_sptr& global_taylor,int scene_id) +-{ +- typedef boct_tree > taylor_tree_type; +- +- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id); +- boxm_scene_base_sptr corner_scene_base = this->load_corner_scene(scene_id); +- +- auto* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- +- auto* corner_scene = dynamic_cast >*> (corner_scene_base.as_pointer()); +- +- if (!( valid_scene && corner_scene)) +- { +- std::cerr << "Error in bvpl_global_corners::explore_corner_statistics: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +- +- //compute scene statistics at valid cells only +- +- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0; +- boxm_cell_iterator > valid_it = valid_scene->cell_iterator(&boxm_scene >::load_block, true); +- valid_it.begin(); +- +- boxm_cell_iterator > corners_it = corner_scene->cell_iterator(&boxm_scene >::load_block, true); +- corners_it.begin(); +- +- float cell_count = 0; +- auto max = (float)(*corners_it)->data(); +- float min = max; +- float this_val = max; +- while ( !(valid_it.end() || corners_it.end()) ) +- { +- boct_tree_cell *valid_cell = *valid_it; +- boct_tree_cell *corner_cell = *corners_it; +- +- boct_loc_code valid_code = valid_cell->get_code(); +- boct_loc_code corner_code = corner_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((valid_cell->level() != corner_cell->level()) || !(valid_code.isequal(&corner_code))){ +- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n"; +- return; +- } +- +- /*****CAUTION: Only looking at cells at level 0*/ +- if (valid_cell->level()!=0) { +- ++valid_it; +- ++corners_it; +- continue; +- } +- +- cell_count++; +- this_val = (float)(*corners_it)->data(); +- if ( this_val > max) max = this_val; +- if ( this_val < min) min = this_val; +- +- ++valid_it; +- ++corners_it; +- } +- +- auto nbins = (unsigned int)std::floor(std::sqrt(cell_count)); +- bsta_histogram corner_hist(min, max, nbins); +- valid_it.begin(); +- corners_it.begin(); +- while ( !(valid_it.end() || corners_it.end()) ) +- { +- boct_tree_cell *valid_cell = *valid_it; +- boct_tree_cell *corner_cell = *corners_it; +- +- boct_loc_code valid_code = valid_cell->get_code(); +- boct_loc_code corner_code = corner_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((valid_cell->level() != corner_cell->level()) || !(valid_code.isequal(&corner_code))){ +- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n"; +- return; +- } +- +- /*****CAUTION: Only looking at cells at level 0*/ +- if (valid_cell->level()!=0) { +- ++valid_it; +- ++corners_it; +- continue; +- } +- +- corner_hist.upcount((float)(*corners_it)->data(), 1.0f); +- +- ++valid_it; +- ++corners_it; +- } +- +- std::string file = aux_dirs_[scene_id] + "/corner_threshold_values.txt"; +- float threshold[] = {0.01f, 0.02f, 0.05f, 0.1f, 0.2f, 0.5f, 0.8f}; +- std::ofstream ofs(file.c_str()); +- ofs.precision(7); +- for (float i : threshold) { +- ofs << i << ' ' << corner_hist.value_with_area_above(i) << '\n'; +- } +- +- //clean memory +- ofs.close(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +-} +- +-//: Load scene info +-boxm_scene_base_sptr bvpl_global_corners::load_corner_scene(int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)aux_dirs_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_corners::load_corner_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr scene_base = new boxm_scene_base(); +- boxm_scene_parser scene_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/harris_scene.xml"; +- scene_base->load_scene(aux_scene_ss.str(), scene_parser); +- +- //cast scene +- auto *scene= new boxm_scene >(); +- if (scene_base->appearence_model() == BOXM_FLOAT){ +- scene->load_scene(scene_parser); +- scene_base = scene; +- } +- else { +- std::cerr << "Error in bvpl_global_corners::load_corner_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return scene_base; +-} +- +-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid +-boxm_scene_base_sptr bvpl_global_corners::load_valid_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)aux_dirs_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_corners::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base(); +- boxm_scene_parser aux_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml"; +- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser); +- +- //cast scene +- auto *aux_scene= new boxm_scene >(); +- if (aux_scene_base->appearence_model() == BOXM_BOOL){ +- aux_scene->load_scene(aux_parser); +- aux_scene_base = aux_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_corners::load_aux_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return aux_scene_base; +-} +- +-//: Write this class to xml file +-void bvpl_global_corners::xml_write() +-{ +- bxml_document doc; +- bxml_element *root = new bxml_element("global_corners_info"); +- doc.set_root_element(root); +- root->append_text("\n"); +- +- //write the scene elements +- for (unsigned i =0; iappend_text("\n"); +- scenes_elm->set_attribute("id", i); +- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]); +- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]); +- root->append_data(scenes_elm); +- root->append_text("\n"); +- } +- +- //write parameters for corner detection +- bxml_element* param_elm = new bxml_element("parameters"); +- param_elm->append_text("\n"); +- param_elm->set_attribute("harris_k", harris_k_); +- root->append_data(param_elm); +- root->append_text("\n"); +- +- //write to disk +- std::ofstream os(xml_path().c_str()); +- bxml_write(os, doc); +- os.close(); +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h +deleted file mode 100644 +index 0e7924fe1b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h ++++ /dev/null +@@ -1,71 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h +-#ifndef bvpl_global_corners_h +-#define bvpl_global_corners_h +-//: +-// \file +-// \brief A class to compute corner features across different boxm_scenes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 21-Jul-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-class bvpl_global_corners : public vbl_ref_count +-{ +- +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- public: +- +- //: Constructor from xml file +- bvpl_global_corners(const std::string &path); +- +- //: Compute Harris' measure extension to 3-d as proposed by: +- // I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005 +- void compute_laptev_corners(const bvpl_global_taylor_sptr& global_taylor, int scene_id, int block_i, int block_j, int block_k); +- +- //: Compute corner measure extension to 3-d as proposed by: +- // P. Beaudet, Rotationally invariant image operators, in Proc. 4th Int. Joint Conf. Patt. Recog. 1978. +- void compute_beaudet_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k); +- +- //: Threshold corners below a threshold +- void threshold_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, float thresh, const std::string& output_path); +- +- //: Take a histogram of corners and get different values for percentage of thresholds +- void explore_corner_statistics(const bvpl_global_taylor_sptr& global_taylor,int scene_id); +- +- //: Write to global_corners_info.xml +- void xml_write(); +- +- // Accessors +- std::string path_out() {return path_out_;} +- std::vector aux_dirs() { return aux_dirs_; } +- std::string aux_dirs( unsigned i ) { return aux_dirs_[i]; } +- std::vector cell_lengths() { return finest_cell_length_; } +- +- boxm_scene_base_sptr load_corner_scene (int scene_id); +- boxm_scene_base_sptr load_valid_scene (int scene_id); +- +- std::string xml_path() { return path_out_ + "/global_corners_info.xml"; } +- +- protected: +- +- //: A vector to hold paths to keep taylor coefficient scenes and valid scenes +- std::vector aux_dirs_; +- //: A vector to hold the finest cell length of the corresponding scene scene +- std::vector finest_cell_length_; +- //: Path to xml info file +- std::string path_out_; +- //: The value of the parameter k for harris corners +- float harris_k_; +-}; +- +-typedef vbl_smart_ptr bvpl_global_corners_sptr; +- +- +-#endif // bvpl_global_corners_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx +deleted file mode 100644 +index 7b33da89da..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include "bvpl_global_pca.h" +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Mar-2011 +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h +deleted file mode 100644 +index 39ff106c20..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h ++++ /dev/null +@@ -1,153 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h +-#ifndef bvpl_global_pca_h +-#define bvpl_global_pca_h +-//: +-// \file +-// \brief A class to compute and learn pca features across different boxm_scenes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 14-Mar-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#include +- +- +-template +-class bvpl_global_pca: public vbl_ref_count +-{ +- public: +- //: Constructor +- bvpl_global_pca(std::vector scenes, std::vector aux_dirs, std::vector finest_cell_length, +- vgl_box_3d nbbox, double training_fraction = 0.1, std::string path_out = "./"): +- scenes_(std::move(scenes)), aux_dirs_(std::move(aux_dirs)), finest_cell_length_(std::move(finest_cell_length)), nbbox_(nbbox), training_fraction_(training_fraction),path_out_(std::move(path_out)) +- { +- training_scenes_ = std::vector(scenes_.size(), true); +- nleaves_ = std::vector(scenes_.size(), 0); +- nsamples_ = 0; +- training_mean_.fill(0.0); +- pc_.fill(0.0); +- weights_.fill(0.0); +- scatter_.fill(0.0); +- this->xml_write(); +- } +- +- //:Create from xml file +- bvpl_global_pca(const std::string &path); +- +- //: Init auxiliary scenes and smallest cell length values +- void init(unsigned scene_id); +- +- //: Computes the scatter matrix and mean vector of a portion of random samples from a block +- bool sample_statistics( int scene_id, int block_i, int block_j, int block_k, +- vnl_matrix_fixed &S, +- vnl_vector_fixed &mean, +- unsigned long &nfeature); +- +- //: Update mean and scatter, given the mean and scatter of two sets. +- // Calculation is done according to Chan et al. Updating Formulae and a Pairwise Algorithm for Computing Sample Variances +- static void combine_pairwise_statistics( const vnl_vector_fixed &mean1, +- const vnl_matrix_fixed &scatter1, +- double const n1, +- const vnl_vector_fixed &mean2, +- const vnl_matrix_fixed &scatter2, +- double const n2, +- vnl_vector_fixed & mean_out, +- vnl_matrix_fixed & scatter_out, +- double &n_out ); +- +- //: Set total scatter matrix, mean, sample, principal components and weights for this class +- void set_up_pca_evd(const vnl_matrix_fixed &S, +- const vnl_vector_fixed &mean, +- const double total_nsamples); +- +- //: Access the principal components +- const vnl_matrix_fixed& principal_comps() { return pc_; } +- +- //: Access the coefficients +- const vnl_vector_fixed& weights() { return weights_; } +- +- //: Access the mean of samples +- const vnl_vector_fixed& mean() { return training_mean_; } +- +- bool register_scene(std::string scene_path, std::string aux_path) +- { +- if (scenes_.size()!=aux_dirs_.size()) +- return false; +- scenes_.push_back(scene_path); +- aux_dirs_.push_back(aux_path); +- return true; +- } +- +- void xml_write(); +- +- //: Computes 10-dimensional pca projection at each voxel on the block and saves it +- void project(int scene_id, int block_i, int block_j, int block_k); +- +- void projection_error(int scene_id, int block_i, int block_j, int block_k); +- +- +- std::string path_out() const { return path_out_; } +- +- inline std::vector scenes() const { return scenes_; } +- inline std::vector aux_dirs() const { return aux_dirs_; } +- inline std::vector cell_lengths() const { return finest_cell_length_; } +- inline std::vector training_scenes() const { return training_scenes_; } +- inline vgl_box_3d nbbox() const { return nbbox_; } +- inline unsigned nscenes() const { return scenes_.size(); } +- protected: +- +- //: A vector to hold scene paths +- std::vector scenes_; +- //: A vector to hold paths to keep any kind of auxiliary scene or info(must be in the same order as scenes_) +- std::vector aux_dirs_; +- //: A vector to hold the finest cell length of the corresponding scene scene +- std::vector finest_cell_length_; +- //: A vector that indicates whether a scene should be used as train (True) or test(False). Order is equivalent to scenes_ +- std::vector training_scenes_; +- //: A vector to keep the size of each scene +- std::vector nleaves_; +- +- //: The size around the central feature to include in PCA vectors +- vgl_box_3d nbbox_; +- //: Number of total samples(leaves) to be drawn +- unsigned long long nsamples_; +- +- //: Principal components - eigen vectors of the scatter matrix +- vnl_matrix_fixed pc_; +- //: Weights - eigen values of the scatter matrix +- vnl_vector_fixed weights_; +- //: The mean of sample data +- vnl_vector_fixed training_mean_; +- //: Scatter matrix used to compute pca +- vnl_matrix_fixed scatter_; +- //: Fraction of cells used for learning +- double training_fraction_; +- +- //: Paths for i/o of matrices and vectors +- std::string path_out_; +- std::string pc_path() const { return path_out_ + "/pc.txt" ; } +- std::string weights_path() const { return path_out_ + "/weights.txt"; } +- std::string mean_path() const { return path_out_ + "/mean.txt"; } +- std::string scatter_path() const { return path_out_ + "/scatter.txt"; } +- std::string xml_path() const { return path_out_ + "/pca_global_info.xml"; } +- +- void write_pca_matrices(); +- +- public: +- boxm_scene_base_sptr load_scene (int scene_id); +- boxm_scene_base_sptr load_train_scene (int scene_id); +- boxm_scene_base_sptr load_valid_scene (int scene_id); +- boxm_scene_base_sptr load_projection_scene (int scene_id); +- boxm_scene_base_sptr load_error_scene (int scene_id); +-}; +- +-typedef vbl_smart_ptr > bvpl_global_pca_125_sptr; +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx +deleted file mode 100644 +index 6877b12a34..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx ++++ /dev/null +@@ -1,1018 +0,0 @@ +-#ifndef bvpl_global_pca_hxx_ +-#define bvpl_global_pca_hxx_ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 14-Mar-2011 +- +-#include "bvpl_global_pca.h" +-#include +- +- +-#include +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-//#define DEBUG_PROJ +- +-//: Create from xml_file +-template +-bvpl_global_pca::bvpl_global_pca(const std::string &path) +-{ +- std::cout << "Loading pca info from xml-file" << std::endl; +- int valid = 0; +- path_out_ = path; +- std::ifstream xml_ifs(xml_path().c_str()); +- if (!xml_ifs.is_open()) { +- std::cerr << "Error: bvpl_discover_pca_kernels - could not open xml info file: " << xml_path() << '\n'; +- throw; +- } +- bxml_document doc = bxml_read(xml_ifs); +- bxml_element query("pca_global_info"); +- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query); +- if (!root) { +- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n"; +- throw; +- } +- +- //Parse neighborhood bounding box - units are number of voxels +- bxml_element nbbox_query("neighborhood"); +- bxml_data_sptr nbbox_data = bxml_find_by_name(root, nbbox_query); +- bxml_element* nbbox_elm = dynamic_cast(nbbox_data.ptr()); +- int min_x, min_y, min_z, max_x, max_y, max_z =0; +- nbbox_elm->get_attribute("min_x", min_x); +- nbbox_elm->get_attribute("min_y", min_y); +- nbbox_elm->get_attribute("min_z", min_z); +- nbbox_elm->get_attribute("max_x", max_x); +- nbbox_elm->get_attribute("max_y", max_y); +- nbbox_elm->get_attribute("max_z", max_z); +- +- nbbox_ = vgl_box_3d(vgl_point_3d(min_x, min_y, min_y), vgl_point_3d(max_x, max_y, max_z)); +- std::cout << "Neighborhood: " << nbbox_ << std::endl; +- +- //Parse Number of samples +- bxml_element properties_query("properties"); +- bxml_data_sptr properties_data = bxml_find_by_name(root, properties_query); +- bxml_element* properties_elm = dynamic_cast(properties_data.ptr()); +- properties_elm->get_attribute("nsamples", nsamples_); +- unsigned temp_dim; +- properties_elm->get_attribute("feature_dim", temp_dim); +- if (temp_dim!=feature_dim) { +- valid = -10; +- } +- properties_elm->get_attribute("training_fraction", training_fraction_); +- +- unsigned nscenes = 0; +- properties_elm->get_attribute("nscenes", nscenes); +- +- std::cout << "Number of samples: " << nsamples_ << '\n' +- << "Feature dimension: " << temp_dim << '\n' +- << "Number of scenes: " << nscenes < scenes_data = bxml_find_all_with_name(root, scenes_query); +- +- if (nscenes !=scenes_data.size()) { +- std::cerr<<"Wrong number of scenes\n"; +- throw; +- } +- +- scenes_.clear(); +- scenes_.resize(nscenes); +- +- aux_dirs_.clear(); +- aux_dirs_.resize(nscenes); +- +- finest_cell_length_.clear(); +- finest_cell_length_.resize(nscenes); +- +- nleaves_.clear(); +- nleaves_.resize(nscenes); +- +- for (unsigned si = 0; si < nscenes; si++) +- { +- bxml_element* scenes_elm = dynamic_cast(scenes_data[si].ptr()); +- int id = -1; +- scenes_elm->get_attribute("id", id); +- scenes_elm->get_attribute("path", scenes_[id]); +- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]); +- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]); +- scenes_elm->get_attribute("nleaves", nleaves_[id]); +- +- std::cout << "Scene " << id << " is " << scenes_[id] << '\n'; +- } +- +- //Parse training scenes +- bxml_element train_query("training_scenes"); +- bxml_element* train_elm = dynamic_cast(bxml_find_by_name(root, train_query).ptr()); +- unsigned n_train_scenes = 0; +- train_elm->get_attribute("nscenes", n_train_scenes); +- training_scenes_.clear(); +- training_scenes_.resize(nscenes, false); +- +- //read out the scenes +- for (bxml_element::const_data_iterator s_it = train_elm->data_begin(); s_it != train_elm->data_end(); s_it++) { +- if ((*s_it)->type() == bxml_data::TEXT) { +- bxml_text* t = dynamic_cast((*s_it).ptr()); +- std::stringstream text_d(t->data()); std::string buf; +- std::vector tokens; +- while (text_d >> buf) { +- tokens.push_back(buf); +- } +- if (tokens.size() != n_train_scenes) +- continue; +- for (unsigned i = 0; i < n_train_scenes; i++) { +- std::stringstream ss2(tokens[i]); int s_type_id; +- ss2 >> s_type_id; +- std::cout << "Scene: " << s_type_id << " is used for training\n"; +- training_scenes_[s_type_id]=true; +- } +- break; +- } +- } +- +- //Parse paths and set matrices +- bxml_element paths_query("paths"); +- bxml_data_sptr paths_data = bxml_find_by_name(root, paths_query); +- if (paths_data) +- { +- bxml_element* path_elm = dynamic_cast(paths_data.ptr()); +- +- std::string ifs_path; +- +- path_elm->get_attribute("pc_path", ifs_path); +- if (ifs_path != pc_path()) +- valid = -1; +- else{ +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> pc_; +- ifs.close(); +- if (pc_.size()!=feature_dim*feature_dim) +- valid = -2; +- } +- +- path_elm->get_attribute("weights_path", ifs_path); +- if (ifs_path != weights_path()) +- valid = -3; +- else{ +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> weights_; +- ifs.close(); +- if (weights_.size()!=feature_dim) +- valid = -4; +- } +- +- path_elm->get_attribute("mean_path", ifs_path); +- if (ifs_path != mean_path()) +- valid = -5; +- else +- { +- if ( vul_file::exists(ifs_path)) +- { +- std::ifstream ifs(ifs_path.c_str()); +- ifs >> training_mean_; +- ifs.close(); +- } +- else{ +- std::cerr << " Warning: Mean file is empty\n"; +- training_mean_.fill(0.0); +- } +- +- path_elm->get_attribute("scatter_path", ifs_path); +- if (ifs_path != scatter_path()) +- valid = -6; +- else if (vul_file::exists(ifs_path)) { +- std::ifstream(ifs_path); +- ifs_path >> scatter_; +- ifs_path.close(); +- } +- else{ +- std::cerr << " Warning: Scatter file is empty\n"; +- scatter_.fill(0.0); +- } +- +- if (valid<0) { +- std::cout << "bvpl_discover_pca_kernels - errors parsing pca_info.xml. Error code: " << valid << std::endl; +- xml_write(); +- } +- } +- } +- +- xml_ifs.close(); +-} +- +-//: Init auxiliary scenes and smallest cell length values +-template +-void bvpl_global_pca::init(unsigned scene_id) +-{ +- boxm_scene_base_sptr data_scene_base = load_scene(scene_id); +- boxm_scene >* data_scene = dynamic_cast >*> (data_scene_base.as_pointer()); +- if (!data_scene) { +- std::cerr << "Error in bvpl_global_pca::init(): Could not cast data scene\n"; +- return; +- } +- double finest_cell_length = data_scene->finest_cell_length(); +- finest_cell_length_[scene_id] = finest_cell_length; +- nleaves_[scene_id] = data_scene->size(); +- +- if (!(vul_file::exists(aux_dirs_[scene_id]) && vul_file::is_directory(aux_dirs_[scene_id]))) { +- vul_file::make_directory(aux_dirs_[scene_id]); +- } +- +- { +- std::stringstream aux_scene_ss; +- aux_scene_ss << "train_scene_" << scene_id ; +- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml"; +- if (!vul_file::exists(aux_scene_path)) { +- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl; +- boxm_scene > *aux_scene = +- new boxm_scene >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- aux_scene->set_appearance_model(BOXM_BOOL); +- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str()); +- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml"); +- } +- } +- { +- std::stringstream aux_scene_ss; +- aux_scene_ss << "valid_scene_" << scene_id ; +- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml"; +- if (!vul_file::exists(aux_scene_path)) { +- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl; +- boxm_scene > *aux_scene = +- new boxm_scene >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- aux_scene->set_appearance_model(BOXM_BOOL); +- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str()); +- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml"); +- } +- } +- +- { +- std::stringstream proj_scene_ss; +- proj_scene_ss << "proj_pca_scene_" << scene_id ; +- std::string proj_scene_path = aux_dirs_[scene_id] + "/" + proj_scene_ss.str() + ".xml"; +- if (!vul_file::exists(proj_scene_path)) { +- std::cout<< "Scene: " << proj_scene_path << " does not exist, initializing" << std::endl; +- typedef boct_tree > pca_tree_type; +- boxm_scene *proj_scene = +- new boxm_scene(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- proj_scene->set_appearance_model(VNL_DOUBLE_10); +- proj_scene->set_paths(aux_dirs_[scene_id], proj_scene_ss.str()); +- proj_scene->write_scene("/" + proj_scene_ss.str() + ".xml"); +- } +- } +- +- xml_write(); +-} +- +-//: Compute the scatter matrix of the specified block. A random number of cells are drawn for the calculation +-// The mask block indicates, whether a cell was used for learning the scatter matrix and mean +-// Ramndom samples according to octree structure. +-// Sampling is achieved by generating uniform random cell samples. +-// Since there are more cells where the resolution is finer, then these regions get sampled more often +-template +-bool bvpl_global_pca::sample_statistics( int scene_id, int block_i, int block_j, int block_k, +- vnl_matrix_fixed &S, +- vnl_vector_fixed &mean, +- unsigned long &nfeature) +-{ +- if (!training_scenes_[scene_id]) { +- std::cout << "Skiping scene: " << scene_id <<", labeled for testing\n"; +- return false; +- } +- +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- typedef boct_tree bool_tree_type; +- typedef boct_tree_cell bool_cell_type; +- +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- boxm_scene_base_sptr mask_scene_base =load_train_scene(scene_id); +- +- boxm_scene >* data_scene = dynamic_cast >*>(data_scene_base.as_pointer()); +- boxm_scene >* mask_scene = dynamic_cast >*>(mask_scene_base.as_pointer()); +- +- if (!(data_scene)) +- { +- std::cerr << "Error in bvpl_global_pca::sample_statistics: Could not cast data scenes\n"; +- return false; +- } +- if (!(mask_scene)) +- { +- std::cerr << "Error in bvpl_global_pca::sample_statistics: Could not cast mask scenes\n"; +- return false; +- } +- +- //init variables +- data_scene->unload_active_blocks(); +- mask_scene->unload_active_blocks(); +- +- mean.fill(0.0); +- S.fill(0.0); +- +- vnl_random rng; +- //vnl_random rng(9667566ul); +- +- //get the cells for this block +- if (!(data_scene->valid_index(block_i, block_j, block_k) && mask_scene->valid_index(block_i, block_j, block_k))) { +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return false; +- } +- +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- mask_scene->load_block(block_i, block_j, block_k); +- +- //get the trees +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- bool_tree_type* mask_tree = data_tree->template clone_to_type(); +- mask_tree->init_cells(false); +- +- nfeature = 1; +- +- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree +- std::vector leaf_cells = data_tree->leaf_cells(); +- std::vector mask_leaves = mask_tree->leaf_cells(); +- +- int tree_ncells = leaf_cells.size(); +- unsigned long tree_nsamples = (unsigned long)(tree_ncells*training_fraction_); +- double cell_length = finest_cell_length_[scene_id]; +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- std::cout <<" In block (" << block_i <<", " << block_j << ", " << block_k << "), number of nsamples is: " << tree_nsamples << ", cell length is: " << cell_length << std::endl; +- +- for (unsigned long i=0; i *center_cell = leaf_cells[sample]; +- vgl_point_3d center_cell_centroid = data_tree->global_centroid(center_cell); +- +- vgl_box_3d roi(cell_length*(double)nmin.x(),cell_length*(double)nmin.y(),cell_length*(double)nmin.z(), +- cell_length*(double)nmax.x(),cell_length*(double)nmax.y(),cell_length*(double)nmax.z()); +- roi.set_centroid(center_cell_centroid); +- +- //if neighborhood is not inclusive we would have missing features +- if (!((data_scene->get_world_bbox()).contains(roi))) { +- i--; +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector_fixed this_feature(0.0); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++) +- { +- vgl_point_3d neighbor_centroid(center_cell_centroid.x() + (double)x*cell_length, +- center_cell_centroid.y() + (double)y*cell_length, +- center_cell_centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- assert(neighbor_cell !=nullptr); +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- curr_dim++; +- } +- +- assert(curr_dim == feature_dim); +- +- mask_leaves[sample]->set_data(true); +- +- //increment weights +- double rho = 1.0/(double)nfeature; +- double rho_comp = 1.0 - rho; +- +- // the difference vector between the sample and the mean +- vnl_vector_fixed diff = this_feature - mean; +- +- //update the covariance +- S += rho_comp*outer_product(diff,diff); +- +- //update the mean +- mean += (rho*diff); +- +- ++nfeature; +-#if 0 +- std::cerr << "Feature EVD: " <get_block(block_i, block_j, block_k)->init_tree(mask_tree); +- mask_scene->write_active_block(); +- +- data_scene->unload_active_blocks(); +- mask_scene->unload_active_blocks(); +- +- return true; +-} +- +- +-//: Update mean and scatter, given the mean and scatter of two sets. +-// Calculation is done according to Chan et al. Updating Formulae and a Pairwise Algorithm for Computing Sample Variances +-template +-void bvpl_global_pca::combine_pairwise_statistics( const vnl_vector_fixed &mean1, +- const vnl_matrix_fixed &scatter1, +- double const n1, +- const vnl_vector_fixed &mean2, +- const vnl_matrix_fixed &scatter2, +- double const n2, +- vnl_vector_fixed & mean_out, +- vnl_matrix_fixed & scatter_out, +- double &n_out ) +-{ +- n_out = n1+n2; +- mean_out = (n1*mean1 + n2*mean2)* (1.0/n_out); +- vnl_vector_fixed d = mean2 - mean1; +- scatter_out = scatter1 + scatter2 + (n1*n2/n_out)*outer_product(d,d); +-} +- +-//: Set total scatter matrix, mean, sample, principal components and weights for this class +-template +-void bvpl_global_pca::set_up_pca_evd(const vnl_matrix_fixed &S, +- const vnl_vector_fixed &mean, +- const double total_nsamples) +-{ +- scatter_ = S; +- training_mean_ = mean; +- nsamples_ = (long unsigned int)total_nsamples; +- +- // Compute eigenvectors(principal components) and values of S +- +- vnl_matrix pc_temp; +- vnl_vector w_temp; +- +- vnl_symmetric_eigensystem_compute(scatter_.as_ref(), pc_temp, w_temp); +- pc_ = pc_temp.fliplr(); +- weights_=w_temp.flip(); +- +- //save the newly set vaeiables +- this->xml_write(); +-} +- +-//: Computes 10-dimensional pca projection at each voxel on the block and saves it +-template +-void bvpl_global_pca::project(int scene_id, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- typedef boct_tree > pca_tree_type; +- typedef boct_tree_cell > pca_cell_type; +- +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id); +- boxm_scene_base_sptr aux_scene_base = load_valid_scene(scene_id); +- +- boxm_scene >* data_scene = dynamic_cast >*>(data_scene_base.as_pointer()); +- boxm_scene* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- boxm_scene >* aux_scene = dynamic_cast >*> (aux_scene_base.as_pointer()); +- if (!(data_scene && proj_scene && aux_scene)) +- { +- std::cerr << "Error in bvpl_global_pca::sample_statistics: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- data_scene->unload_active_blocks(); +- proj_scene->unload_active_blocks(); +- aux_scene->unload_active_blocks(); +- +- //get the cells for this block +- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k) && aux_scene->valid_index(block_i, block_j, block_k))) { +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return; +- } +- +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- proj_scene->load_block(block_i, block_j, block_k); +- aux_scene->load_block(block_i, block_j, block_k); +- +- //get the trees +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- pca_tree_type* proj_tree = data_tree->template clone_to_type >(); +- boct_tree* aux_tree = data_tree->template clone_to_type(); +- aux_tree->init_cells(true); +- +- //get leaf cells +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector proj_leaves = proj_tree->leaf_cells(); +- std::vector *> aux_leaves = aux_tree->leaf_cells(); +- +- double cell_length = finest_cell_length_[scene_id]; +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +-#ifdef DEBUG_PROJ +- double error = 0.0; +- unsigned long n_valid_cells= 0; +-#endif +- +- for (unsigned long i =0; i centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd test if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)nmin.x()*cell_length, centroid.y() + (double)nmin.y()*cell_length, centroid.z() + (double)nmin.z()*cell_length); +- vgl_point_3d max_point_global(centroid.x() + (double)nmax.x()*cell_length, centroid.y() + (double)nmax.y()*cell_length, centroid.z() + (double)nmax.z()*cell_length); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) { +- proj_leaves[i]->set_data(vnl_vector_fixed(0.0)); +- aux_leaves[i]->set_data(false); +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector_fixed this_feature(0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++) +- { +- vgl_point_3d neighbor_centroid(centroid.x() + (double)x*cell_length, +- centroid.y() + (double)y*cell_length, +- centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- if (!neighbor_cell) { +- std::cerr << "Error in bvpl_global_pca::project\n"; +- return; +- } +- +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- curr_dim++; +- } +- +- if (curr_dim != feature_dim) { +- std::cerr << "Error in bvpl_global_pca::project\n"; +- return; +- } +- this_feature-=training_mean_; +- +- //solve for the coefficients +- vnl_vector_fixed a(0.0); +- a = pc_.transpose() * (this_feature); +- vnl_vector_fixed sample(a.extract(10)); +- proj_leaves[i]->set_data(sample); +- +-#ifdef DEBUG_PROJ +- //project as a function of number of components +- vnl_vector_fixed feature_approx = pc_.extract(feature_dim, 10) * sample; +- +- //compute error +- error+=(float)((this_feature - feature_approx).squared_magnitude()); +- n_valid_cells++; +-#endif +- } +- +- // write and release memory +- proj_scene->get_block(block_i, block_j, block_k)->init_tree(proj_tree); +- proj_scene->write_active_block(); +- proj_scene->unload_active_blocks(); +- aux_scene->get_block(block_i, block_j, block_k)->init_tree(aux_tree); +- aux_scene->write_active_block(); +- aux_scene->unload_active_blocks(); +- data_scene->unload_active_blocks(); +- +-#ifdef DEBUG_PROJ +- std::cout << "Total error in this block: " << error/(double)n_valid_cells << std::endl; +-#endif +-} +- +-//: Computes the projection error (as square magniture) given 10-dimensional pca projection at each voxel on the block +-template +-void bvpl_global_pca::projection_error(int scene_id, int block_i, int block_j, int block_k) +-{ +- if (training_scenes_[scene_id]) { +- std::cout << "Skipping training scene: " < float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- typedef boct_tree > pca_tree_type; +- typedef boct_tree_cell > pca_cell_type; +- +- boxm_scene_base_sptr proj_scene_base = load_projection_scene(scene_id); +- boxm_scene_base_sptr error_scene_base = load_error_scene(scene_id); +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- +- boxm_scene* data_scene = dynamic_cast*>(data_scene_base.as_pointer()); +- boxm_scene* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- boxm_scene* error_scene = dynamic_cast*>(error_scene_base.as_pointer()); +- +- if (!(data_scene && error_scene && proj_scene)) +- { +- std::cerr << "Error in bvpl_global_pca::sample_statistics: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- data_scene->unload_active_blocks(); +- proj_scene->unload_active_blocks(); +- error_scene->unload_active_blocks(); +- +- //get the cells for this block +- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k) && error_scene->valid_index(block_i, block_j, block_k))) { +- std::cerr << "In compute_testing_error: Invalid block\n"; +- return; +- } +- +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- proj_scene->load_block(block_i, block_j, block_k); +- error_scene->load_block(block_i, block_j, block_k); +- +- //get the trees +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- pca_tree_type* proj_tree = proj_scene->get_block(block_i, block_j, block_k)->get_tree(); +- float_tree_type* error_tree = data_tree->clone(); +- error_tree->init_cells(-1.0f); +- +- //get leaf cells +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector proj_leaves = proj_tree->leaf_cells(); +- std::vector error_leaves = error_tree->leaf_cells(); +- +- double cell_length = finest_cell_length_[scene_id]; +- +- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors +- //convert neighborhood box to scene coordinates +- vgl_point_3d nmin = nbbox_.min_point(); +- vgl_point_3d nmax = nbbox_.max_point(); +- +- for (unsigned i =0; i centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates aad test if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)nmin.x()*cell_length, centroid.y() + (double)nmin.y()*cell_length, centroid.z() + (double)nmin.z()*cell_length); +- vgl_point_3d max_point_global(centroid.x() + (double)nmax.x()*cell_length, centroid.y() + (double)nmax.y()*cell_length, centroid.z() + (double)nmax.z()*cell_length); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) { +- error_leaves[i]->set_data(-1.0f); +- continue; +- } +- +- //3. Assemble neighborhood as a feature-vector +- vnl_vector_fixed this_feature(0.0f); +- +- unsigned curr_dim = 0; +- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z) +- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y) +- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x) +- { +- vgl_point_3d neighbor_centroid(centroid.x() + (double)x*cell_length, +- centroid.y() + (double)y*cell_length, +- centroid.z() + (double)z*cell_length); +- +- boct_tree_cell *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid); +- +- if (!neighbor_cell) { +- std::cerr << "Error in bvpl_global_pca::project\n"; +- return; +- } +- +- this_feature[curr_dim] = (double)neighbor_cell->data(); +- curr_dim++; +- } +- +- if (curr_dim != feature_dim) { +- std::cerr << "Error in bvpl_global_pca::project\n"; +- return; +- } +- this_feature-=training_mean_; +- +- //get the coefficients +- vnl_vector_fixed a = proj_leaves[i]->data(); +- +- //project +- vnl_vector_fixed feature_approx = pc_.extract(feature_dim, 10) * a; +- +- //compute error +- error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude())); +- } +- +- // write and release memory +- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree); +- error_scene->write_active_block(); +- error_scene->unload_active_blocks(); +- data_scene->unload_active_blocks(); +- proj_scene->unload_active_blocks(); +-} +- +- +-//: Load scene info +-template +-boxm_scene_base_sptr bvpl_global_pca::load_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr scene_base = new boxm_scene_base(); +- boxm_scene_parser scene_parser; +- scene_base->load_scene(scenes_[scene_id], scene_parser); +- +- //cast scene +- boxm_scene > *scene= new boxm_scene >(); +- if (scene_base->appearence_model() == BOXM_FLOAT) { +- scene->load_scene(scene_parser); +- scene_base = scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return scene_base; +-} +- +-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid +-template +-boxm_scene_base_sptr bvpl_global_pca::load_valid_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base(); +- boxm_scene_parser aux_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml"; +- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser); +- +- //cast scene +- boxm_scene > *aux_scene= new boxm_scene >(); +- if (aux_scene_base->appearence_model() == BOXM_BOOL) { +- aux_scene->load_scene(aux_parser); +- aux_scene_base = aux_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_aux_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return aux_scene_base; +-} +- +-//: Load auxiliary scene indicating if a cell is should be used for training +-template +-boxm_scene_base_sptr bvpl_global_pca::load_train_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base(); +- boxm_scene_parser aux_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/train_scene_" << scene_id << ".xml"; +- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser); +- +- //cast scene +- boxm_scene > *aux_scene= new boxm_scene >(); +- if (aux_scene_base->appearence_model() == BOXM_BOOL) { +- aux_scene->load_scene(aux_parser); +- aux_scene_base = aux_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_aux_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return aux_scene_base; +-} +- +- +-//: Load auxiliary scene info +-template +- +-boxm_scene_base_sptr bvpl_global_pca::load_projection_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_projection_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr proj_scene_base = new boxm_scene_base(); +- boxm_scene_parser proj_parser; +- std::stringstream proj_scene_ss; +- proj_scene_ss << aux_dirs_[scene_id] << "/proj_pca_scene_" << scene_id << ".xml"; +- proj_scene_base->load_scene(proj_scene_ss.str(), proj_parser); +- +- //cast scene +- typedef boct_tree > pca_tree_type; +- boxm_scene *proj_scene= new boxm_scene(); +- if (proj_scene_base->appearence_model() == VNL_DOUBLE_10) { +- proj_scene->load_scene(proj_parser); +- proj_scene_base = proj_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_proj_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return proj_scene_base; +-} +- +- +-//: Load auxiliary scene info +-template +-boxm_scene_base_sptr bvpl_global_pca::load_error_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_error_scene: Invalid scene id\n"; +- return nullptr; +- } +- +- boxm_scene_base_sptr data_scene_base = load_scene(scene_id); +- boxm_scene >* data_scene = dynamic_cast >*> (data_scene_base.as_pointer()); +- if (!data_scene) { +- std::cerr << "Error in bvpl_global_pca::init(): Could not cast data scene\n"; +- return nullptr; +- } +- +- std::stringstream aux_scene_ss; +- aux_scene_ss << "error_pca_scene_" << scene_id ; +- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml"; +- if (!vul_file::exists(aux_scene_path)) { +- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl; +- boxm_scene > *aux_scene = +- new boxm_scene >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- aux_scene->set_appearance_model(BOXM_FLOAT); +- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str()); +- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml"); +- } +- +- //load scene +- boxm_scene_base_sptr error_scene_base = new boxm_scene_base(); +- boxm_scene_parser error_parser; +- std::stringstream error_scene_ss; +- error_scene_ss << aux_dirs_[scene_id] << "/error_pca_scene_" << scene_id << ".xml"; +- error_scene_base->load_scene(error_scene_ss.str(), error_parser); +- +- //cast scene +- boxm_scene > *error_scene= new boxm_scene >(); +- if (error_scene_base->appearence_model() == BOXM_FLOAT) { +- error_scene->load_scene(error_parser); +- error_scene_base = error_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_error_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return error_scene_base; +-} +- +- +-//: Write this class to xml file +-template +-void bvpl_global_pca::xml_write() +-{ +- bxml_document doc; +- bxml_element *root = new bxml_element("pca_global_info"); +- doc.set_root_element(root); +- root->append_text("\n"); +- +- bxml_element* paths = new bxml_element("paths"); +- paths->append_text("\n"); +- paths->set_attribute("pc_path", pc_path() ); +- paths->set_attribute("weights_path", weights_path() ); +- paths->set_attribute("mean_path", mean_path()); +- paths->set_attribute("scatter_path", scatter_path()); +- root->append_data(paths); +- root->append_text("\n"); +- +- bxml_element* neighborhood = new bxml_element("neighborhood"); +- neighborhood->append_text("\n"); +- neighborhood->set_attribute("min_x", nbbox_.min_point().x()); +- neighborhood->set_attribute("min_y", nbbox_.min_point().y()); +- neighborhood->set_attribute("min_z", nbbox_.min_point().z()); +- neighborhood->set_attribute("max_x", nbbox_.max_point().x()); +- neighborhood->set_attribute("max_y", nbbox_.max_point().y()); +- neighborhood->set_attribute("max_z", nbbox_.max_point().z()); +- root->append_data(neighborhood); +- root->append_text("\n"); +- +- bxml_element* properties = new bxml_element("properties"); +- properties->append_text("\n"); +- properties->set_attribute("nsamples", nsamples_); +- properties->set_attribute("feature_dim", feature_dim); +- //properties->set_attribute("finest_cell_length", finest_cell_length_); +- properties->set_attribute("nscenes", scenes_.size()); +- properties->set_attribute("training_fraction", training_fraction_); +- +- root->append_data(properties); +- root->append_text("\n"); +- +- //write the scenes +- for (unsigned i =0; iappend_text("\n"); +- scenes_elm->set_attribute("id", i); +- scenes_elm->set_attribute("path", scenes_[i]); +- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]); +- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]); +- scenes_elm->set_attribute("nleaves", nleaves_[i]); +- root->append_data(scenes_elm); +- root->append_text("\n"); +- } +- +- //write training scenes +- bxml_element* train_elm = new bxml_element("training_scenes"); +- train_elm->append_text("\n"); +- +- std::stringstream ss; +- unsigned ts = 0; +- +- for (unsigned i = 0; i< training_scenes_.size(); i++) { +- if (training_scenes_[i]) { +- ss << i << ' '; +- ts++; +- } +- } +- +- train_elm->set_attribute("nscenes", ts); +- train_elm->append_text(ss.str()); +- train_elm->append_text("\n"); +- root->append_data(train_elm); +- root->append_text("\n"); +- +- //write to disk +- std::ofstream os(xml_path().c_str()); +- bxml_write(os, doc); +- os.close(); +- +- // Write pca main matrices -other matrices aren't class variables and should have been written during computation time +- write_pca_matrices(); +-} +- +-//: Write a PCA file +-template +-void bvpl_global_pca::write_pca_matrices() +-{ +- std::ofstream pc_ofs(pc_path().c_str()); +- pc_ofs.precision(15); +- std::ofstream weights_ofs(weights_path().c_str()); +- weights_ofs.precision(15); +- std::ofstream mean_ofs(mean_path().c_str()); +- mean_ofs.precision(15); +- std::ofstream scatter_ofs(scatter_path().c_str()); +- scatter_ofs.precision(15); +- +- pc_ofs << pc_; +- pc_ofs.close(); +- weights_ofs << weights_; +- weights_ofs.close(); +- mean_ofs << training_mean_; +- mean_ofs.close(); +- scatter_ofs << scatter_; +- scatter_ofs.close(); +-} +- +- +-#define BVPL_GLOBAL_PCA(feature_dim) \ +-template class bvpl_global_pca; +- +- +-#endif // bvpl_global_pca_hxx_ +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx +deleted file mode 100644 +index 40ca062045..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx ++++ /dev/null +@@ -1,12 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 11-Apr-2011 +- +-#include "bvpl_global_taylor.h" +- +-template <> +-boxm_apm_type bvpl_taylor_apm(){return VNL_DOUBLE_10;} +- +-template <> +-boxm_apm_type bvpl_taylor_apm(){return VNL_FLOAT_3;} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h +deleted file mode 100644 +index 38c05600fb..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h ++++ /dev/null +@@ -1,100 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h +-#ifndef bvpl_global_taylor_h +-#define bvpl_global_taylor_h +-//: +-// \file +-// \brief A class to compute taylor features across different boxm_scenes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 11-Apr-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-//Forward declaration +-class bvpl_global_corners; +- +-template +-boxm_apm_type bvpl_taylor_apm(); +- +-namespace bvpl_global_tylor_defaults +-{ +- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" }; +-; +-} +- +-template +-class bvpl_global_taylor : public vbl_ref_count +-{ +- public: +- +- //: Constructor from xml file +- bvpl_global_taylor(const std::string &path, const std::string kernel_names[]); +- +- //: Init auxiliary scenes and smallest cell length values +- void init(); +- +- //: Compute the DIM taylor kernels for this scene at current block. The output is saved to the projection scene as a DIM-d vector +- void compute_taylor_coefficients(int scene_id, int block_i, int block_j, int block_k); +- +- //: Compute reconstruction error +- bool compute_approximation_error(int scene_id, int block_i, int block_j, int block_k); +- +- //: Extract a particular coefficient scene +- void extract_coefficient_scene(int scene_id, int coefficient_id, boxm_scene > *coeff_scene); +- +- //: Threshold non-salient features according to Harris' measure +- void threshold_corners(int scene_id, int block_i, int block_j, int block_k, double k); +- +- //: Write to taylor_global_info.xml +- void xml_write(); +- +- // Accessors +- std::string path_out() const { return path_out_; } +- std::vector scenes() const { return scenes_; } +- std::vector aux_dirs() const { return aux_dirs_; } +- std::string aux_dirs( unsigned i ) const { return aux_dirs_[i]; } +- std::vector cell_lengths() const { return finest_cell_length_; } +- //std::vector training_scenes() const { return training_scenes_; } +- +- boxm_scene_base_sptr load_scene (int scene_id); +- boxm_scene_base_sptr load_error_scene (int scene_id); +- boxm_scene_base_sptr load_valid_scene (int scene_id); +- boxm_scene_base_sptr load_projection_scene (int scene_id); +- +- std::string xml_path() { return path_out_ + "/taylor_global_info.xml"; } +- +- friend class bvpl_global_corners; +- +- protected: +- +- //: A vector to hold scene paths +- std::vector scenes_; +- //: A vector to hold paths to keep any kind of auxiliary scene or info(must be in the same order as scenes_) +- std::vector aux_dirs_; +- //: A vector to hold the finest cell length of the corresponding scene scene +- std::vector finest_cell_length_; +- //: A vector that indicates whether a scene should be used as train (True) or test(False). Order is equivalent to scenes_ +- //std::vector training_scenes_; +- +- //: A vector to 2-degree taylor approximation kernels +- // The order is I0, Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz (therefore this class works for dimensions 1-10) +- bvpl_kernel_vector_sptr kernel_vector_; +- +- //: Path to kernel files +- std::string kernels_path_; +- //: Path to xml info file +- std::string path_out_; +-}; +- +-#include +-// This does not really seem like a good idea to me ... - PVr. +-typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx +deleted file mode 100644 +index d8bdd3f0e4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx ++++ /dev/null +@@ -1,645 +0,0 @@ +-#ifndef bvpl_global_taylor_hxx_ +-#define bvpl_global_taylor_hxx_ +-//: +-// \file +-#include "bvpl_global_taylor.h" +-// \author Isabel Restrepo +-// \date 11-Apr-2011 +- +-#include +-#include +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +-#include +- +-//: Constructor from xml file +-template +-bvpl_global_taylor::bvpl_global_taylor(const std::string &path, const std::string kernel_names[]) +-{ +- std::cout << "Loading taylor info from xml-file" << std::endl; +- path_out_ = path; +- std::ifstream xml_ifs(xml_path().c_str()); +- if (!xml_ifs.is_open()) { +- std::cerr << "Error: could not open xml info file: " << xml_path() << '\n'; +- throw; +- } +- bxml_document doc = bxml_read(xml_ifs); +- bxml_element query("taylor_global_info"); +- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query); +- if (!root) { +- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n"; +- throw; +- } +- +- //Parse scenes +- bxml_element scenes_query("scene"); +- std::vector scenes_data = bxml_find_all_with_name(root, scenes_query); +- +- unsigned nscenes=scenes_data.size(); +- std::cout << "Number of scenes: " << nscenes <(scenes_data[si].ptr()); +- int id = -1; +- scenes_elm->get_attribute("id", id); +- scenes_elm->get_attribute("path", scenes_[id]); +- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]); +- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]); +- +- std::cout << "Scene " << id << " is " << scenes_[id] << '\n'; +- } +- +- //Parse kernels +- bxml_element kernels_query("kernels"); +- bxml_data_sptr kernels_data = bxml_find_by_name(root, kernels_query); +- if (kernels_data) +- { +- bxml_element* kernels_elm = dynamic_cast(kernels_data.ptr()); +- +- kernels_elm->get_attribute("path", kernels_path_); +- +- std::cout << "Kernels path is " << kernels_path_ << '\n'; +- kernel_vector_ = new bvpl_kernel_vector; +- +- if (vul_file::exists(kernels_path_) && vul_file::is_directory(kernels_path_)) { +- //read the kernels +- +- kernel_vector_->kernels_.clear(); +- +- kernel_vector_->kernels_.resize(DIM, nullptr); +- //std::string kernel_names[]={"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"}; +- for (unsigned ki = 0; kikernels_[ki] = kernel; +- } +- } +- } +- else { +- std::cerr << " In Gobal Taylor, path to kernels does not exist\n"; +- } +-} +- +-//: Compute the DIM taylor kernels for this scene at current block. The output is saved to the projection scene as a DIM-d vector +-template +-void bvpl_global_taylor::compute_taylor_coefficients(int scene_id, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree_cell float_cell_type; +- +- typedef boct_tree > taylor_tree_type; +- +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id); +- boxm_scene_base_sptr valid_scene_base = load_valid_scene(scene_id); +- +- boxm_scene >* data_scene = dynamic_cast >*>(data_scene_base.as_pointer()); +- boxm_scene* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- boxm_scene >* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- if (!(data_scene && proj_scene && valid_scene)) +- { +- std::cerr << "Error in bvpl_global_taylor::sample_statistics: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- data_scene->unload_active_blocks(); +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- +- //operate on scene +- bvpl_block_vector_operator block_oper; +- bvpl_algebraic_functor functor; +- block_oper.operate(*data_scene, functor, kernel_vector_, block_i, block_j, block_k, *proj_scene, *valid_scene, finest_cell_length_[scene_id]); +- +- //clean memory +- data_scene->unload_active_blocks(); +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +-} +- +-template +-bool bvpl_global_taylor::compute_approximation_error(int scene_id, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- typedef boct_tree > taylor_tree_type; +- typedef boct_tree_cell > taylor_cell_type; +- +- boxm_scene_base_sptr proj_scene_base = load_projection_scene(scene_id); +- boxm_scene_base_sptr error_scene_base = load_error_scene(scene_id); +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- +- //cast the scenes +- boxm_scene* data_scene = dynamic_cast* > (data_scene_base.as_pointer()); +- boxm_scene* basis_scene = dynamic_cast* > (proj_scene_base.as_pointer()); +- boxm_scene * error_scene = dynamic_cast* > (error_scene_base.as_pointer()); +- +- if (!data_scene || !basis_scene || !error_scene) { +- std::cerr << "Error in compute_approximation_error: Faild to cast scene\n"; +- return false; +- } +- +- //load blocks of interest +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- basis_scene->load_block(block_i, block_j, block_k); +- error_scene->load_block(block_i, block_j, block_k); +- +- //get the leaves +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- float_tree_type* error_tree = data_tree->clone(); +- +- //error is always positive, therefore cells with negative errors can be identified as uninitialized. +- error_tree->init_cells(-1.0f); +- taylor_tree_type* basis_tree = basis_scene->get_block(block_i, block_j, block_k)->get_tree(); +- +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector error_leaves = error_tree->leaf_cells(); +- std::vector basis_leaves = basis_tree->leaf_cells(); +- +- vgl_point_3d min_point = kernel_vector_->min(); +- vgl_point_3d max_point = kernel_vector_->max(); +- double cell_length = this->finest_cell_length_[scene_id]; +- std::cout << "In computing taylor error, limits are: " < data_code = data_cell->get_code(); +- boct_loc_code basis_code = basis_cell->get_code(); +- +- //check cells are at the same location +- if (! data_code.isequal(basis_code)) { +- std::cerr << "Error in compute_approximation_error: Cells don't have the same location in the tree\n" +- << "Data Code: " << data_code << '\n' +- << "Basis Code: " << basis_code << '\n'; +- +- return false; +- } +- +- //create a region around the center cell +- vgl_point_3d centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)min_point.x()*cell_length, +- centroid.y() + (double)min_point.y()*cell_length, +- centroid.z() + (double)min_point.z()*cell_length); +- if (! data_scene->locate_point_in_memory(min_point_global)) +- continue; +- vgl_point_3d max_point_global(centroid.x() + (double)max_point.x()*cell_length, +- centroid.y() + (double)max_point.y()*cell_length, +- centroid.z() + (double)max_point.z()*cell_length); +- if (! data_scene->locate_point_in_memory(max_point_global)) +- continue; +- +- //assemble basis +-// double I0 = basis_cell->data().I0; +-// vnl_double_3 G= basis_cell->data().G; +-// vnl_double_3x3 H = basis_cell->data().H; +- vnl_vector_fixed taylor_coeff = basis_cell->data(); +- +- //form basis +- double I0 = taylor_coeff[0]; +- vnl_double_3 G(taylor_coeff[1], taylor_coeff[2], taylor_coeff[3]); +- vnl_double_3x3 H; +- H.put(0,0,taylor_coeff[4]); +- H.put(0,1,taylor_coeff[7]); +- H.put(0,2,taylor_coeff[8]); +- H.put(1,0,taylor_coeff[7]); +- H.put(1,1,taylor_coeff[5]); +- H.put(1,2,taylor_coeff[9]); +- H.put(2,0,taylor_coeff[8]); +- H.put(2,1,taylor_coeff[9]); +- H.put(2,2,taylor_coeff[6]); +- +- double error = 0.0; +- for (int x = min_point.x(); x<= max_point.x(); x++) { +- for (int y = min_point.y(); y<=max_point.y(); y++) { +- for (int z = min_point.z(); z<=max_point.z(); z++) { +- vgl_point_3d point2visit(centroid.x()+(double)x*cell_length, centroid.y()+ (double)y*cell_length, centroid.z() + (double)z*cell_length); +- boct_tree_cell *this_cell = data_scene->locate_point_in_memory(point2visit); +- if (this_cell) { +- vnl_double_3 X((double)x,(double)y, (double)z); +- double approx = I0 + dot_product(X,G) + 0.5* (dot_product(X,(H*X))); +- error = error + (this_cell->data() - approx)*(this_cell->data() - approx); +- //std::cout << "Taylor Error :\n" << "This centroid: " << this_centroid << ", box_centroid: " <set_data((float)error); +- } +- +- // write and release memory +- error_scene->get_block(block_i, block_j, block_k)->set_tree(error_tree); +- error_scene->write_active_block(); +- data_scene->unload_active_blocks(); +- basis_scene->unload_active_blocks(); +- +- return true; +-} +- +- +-//: Threshold non-salient features according to Harris' measure +-template +-void bvpl_global_taylor::threshold_corners(int scene_id, int block_i, int block_j, int block_k, double harris_k) +-{ +- typedef boct_tree > taylor_tree_type; +- typedef boct_tree_cell > taylor_cell_type; +- +- boxm_scene_base_sptr data_scene_base =load_scene(scene_id); +- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id); +- boxm_scene_base_sptr valid_scene_base = load_valid_scene(scene_id); +- +- boxm_scene* proj_scene = dynamic_cast*>(proj_scene_base.as_pointer()); +- boxm_scene >* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- boxm_scene >* corner_scene = +- new boxm_scene >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level()); +- corner_scene->set_appearance_model(BOXM_FLOAT); +- corner_scene->set_paths(valid_scene->path(), "harris_scene"); +- corner_scene->write_scene("/harris_scene.xml"); +- +- if (!( proj_scene && valid_scene && corner_scene )) +- { +- std::cerr << "Error in bvpl_global_taylor::threshold_corners: Could not cast input scenes\n"; +- return; +- } +- +- //init variables +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- +- //operate on scene +- bvpl_corner_detector corner_detector; +- bvpl_harris_laptev_functor harris_functor(harris_k); +- +- vgl_point_3d max_neigborhood_idx = kernel_vector_->max(); +- vgl_point_3d min_neigborhood_idx = kernel_vector_->min(); +- +- std::cout << "Neighborhood for harris threshhold: " << min_neigborhood_idx << " , " << max_neigborhood_idx << std::endl; +- +- corner_detector.detect_and_threshold(proj_scene, harris_functor, min_neigborhood_idx, max_neigborhood_idx, +- block_i, block_j, block_k, valid_scene, corner_scene, finest_cell_length_[scene_id]); +- +- //clean memory +- proj_scene->unload_active_blocks(); +- valid_scene->unload_active_blocks(); +- corner_scene->unload_active_blocks(); +-} +- +-//: Init auxiliary scenes and smallest cell length values +-template +-void bvpl_global_taylor::init() +-{ +- for (unsigned i = 0; i < aux_dirs_.size(); i++) +- { +- boxm_scene_base_sptr data_scene_base = load_scene(i); +- boxm_scene >* data_scene = dynamic_cast >*> (data_scene_base.as_pointer()); +- if (!data_scene) { +- std::cerr << "Error in bvpl_global_taylor::init(): Could not cast data scene\n"; +- return; +- } +- double finest_cell_length = data_scene->finest_cell_length(); +- finest_cell_length_[i] = finest_cell_length; +- +- if (!(vul_file::exists(aux_dirs_[i]) && vul_file::is_directory(aux_dirs_[i]))) { +- vul_file::make_directory(aux_dirs_[i]); +- } +- +- { +- std::stringstream aux_scene_ss; +- aux_scene_ss << "valid_scene_" << i ; +- std::string aux_scene_path = aux_dirs_[i] + "/" + aux_scene_ss.str() + ".xml"; +- if (!vul_file::exists(aux_scene_path)) { +- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl; +- boxm_scene > *aux_scene = +- new boxm_scene >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- aux_scene->set_appearance_model(BOXM_BOOL); +- aux_scene->set_paths(aux_dirs_[i], aux_scene_ss.str()); +- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml"); +- } +- } +- +- { +- std::stringstream proj_scene_ss; +- proj_scene_ss << "proj_taylor_scene_" << i ; +- std::string proj_scene_path = aux_dirs_[i] + "/" + proj_scene_ss.str() + ".xml"; +- if (!vul_file::exists(proj_scene_path)) { +- std::cout<< "Scene: " << proj_scene_path << " does not exist, initializing" << std::endl; +- typedef boct_tree > taylor_tree_type; +- boxm_scene *proj_scene = +- new boxm_scene(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- proj_scene->set_appearance_model(bvpl_taylor_apm()); +- proj_scene->set_paths(aux_dirs_[i], proj_scene_ss.str()); +- proj_scene->write_scene("/" + proj_scene_ss.str() + ".xml"); +- } +- } +- } +- +- xml_write(); +-} +- +- +-//: Load scene info +-template +-boxm_scene_base_sptr bvpl_global_taylor::load_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr scene_base = new boxm_scene_base(); +- boxm_scene_parser scene_parser; +- scene_base->load_scene(scenes_[scene_id], scene_parser); +- +- //cast scene +- boxm_scene > *scene= new boxm_scene >(); +- if (scene_base->appearence_model() == BOXM_FLOAT) { +- scene->load_scene(scene_parser); +- scene_base = scene; +- } +- else { +- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return scene_base; +-} +- +-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid +-template +-boxm_scene_base_sptr bvpl_global_taylor::load_valid_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_taylor::load_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base(); +- boxm_scene_parser aux_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml"; +- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser); +- +- //cast scene +- boxm_scene > *aux_scene= new boxm_scene >(); +- if (aux_scene_base->appearence_model() == BOXM_BOOL) { +- aux_scene->load_scene(aux_parser); +- aux_scene_base = aux_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_taylor::load_aux_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return aux_scene_base; +-} +- +- +-//: Load auxiliary scene info +-template +-boxm_scene_base_sptr bvpl_global_taylor::load_error_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>=(int)scenes_.size()) +- { +- std::cerr << "Error in bvpl_global_taylor::load_error_scene: Invalid scene id\n"; +- return nullptr; +- } +- +- boxm_scene_base_sptr data_scene_base = load_scene(scene_id); +- boxm_scene >* data_scene = dynamic_cast >*> (data_scene_base.as_pointer()); +- if (!data_scene) { +- std::cerr << "Error in bvpl_global_pca::init(): Could not cast data scene\n"; +- return nullptr; +- } +- +- std::stringstream aux_scene_ss; +- aux_scene_ss << "error_taylor_scene_" << scene_id ; +- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml"; +- if (!vul_file::exists(aux_scene_path)) { +- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl; +- boxm_scene > *aux_scene = +- new boxm_scene >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- aux_scene->set_appearance_model(BOXM_FLOAT); +- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str()); +- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml"); +- } +- +- //load scene +- boxm_scene_base_sptr error_scene_base = new boxm_scene_base(); +- boxm_scene_parser error_parser; +- std::stringstream error_scene_ss; +- error_scene_ss << aux_dirs_[scene_id] << "/error_taylor_scene_" << scene_id << ".xml"; +- error_scene_base->load_scene(error_scene_ss.str(), error_parser); +- +- //cast scene +- boxm_scene > *error_scene= new boxm_scene >(); +- if (error_scene_base->appearence_model() == BOXM_FLOAT) { +- error_scene->load_scene(error_parser); +- error_scene_base = error_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_taylor::load_error_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return error_scene_base; +-} +- +- +-#if 0 +-//: Load auxiliary scene indicating if a cell is should be used for training +-boxm_scene_base_sptr bvpl_global_taylor::load_train_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_taylor::load_scene: Invalid scene id\n"; +- return NULL; +- } +- //load scene +- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base(); +- boxm_scene_parser aux_parser; +- std::stringstream aux_scene_ss; +- aux_scene_ss << aux_dirs_[scene_id] << "/train_scene_" << scene_id << ".xml"; +- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser); +- +- //cast scene +- boxm_scene > *aux_scene= new boxm_scene >(); +- if (aux_scene_base->appearence_model() == BOXM_BOOL) { +- aux_scene->load_scene(aux_parser); +- aux_scene_base = aux_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_taylor::load_aux_scene: Invalid appearance model\n"; +- return NULL; +- } +- +- return aux_scene_base; +-} +-#endif +- +- +-//: Load auxiliary scene info +-template +-boxm_scene_base_sptr bvpl_global_taylor::load_projection_scene (int scene_id) +-{ +- if (scene_id<0 || scene_id>((int)scenes_.size() -1)) +- { +- std::cerr << "Error in bvpl_global_taylor::load_projection_scene: Invalid scene id\n"; +- return nullptr; +- } +- //load scene +- boxm_scene_base_sptr proj_scene_base = new boxm_scene_base(); +- boxm_scene_parser proj_parser; +- std::stringstream proj_scene_ss; +- proj_scene_ss << aux_dirs_[scene_id] << "/proj_taylor_scene_" << scene_id << ".xml"; +- proj_scene_base->load_scene(proj_scene_ss.str(), proj_parser); +- +- //cast scene +- typedef boct_tree > taylor_tree_type; +- boxm_scene *proj_scene= new boxm_scene(); +- if (proj_scene_base->appearence_model() == bvpl_taylor_apm()) { +- proj_scene->load_scene(proj_parser); +- proj_scene_base = proj_scene; +- } +- else { +- std::cerr << "Error in bvpl_global_taylor::load_proj_scene: Invalid appearance model\n"; +- return nullptr; +- } +- +- return proj_scene_base; +-} +- +-//: Write this class to xml file +-template +-void bvpl_global_taylor::xml_write() +-{ +- bxml_document doc; +- bxml_element *root = new bxml_element("taylor_global_info"); +- doc.set_root_element(root); +- root->append_text("\n"); +- +- //write the scenes +- for (unsigned i =0; iappend_text("\n"); +- scenes_elm->set_attribute("id", i); +- scenes_elm->set_attribute("path", scenes_[i]); +- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]); +- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]); +- root->append_data(scenes_elm); +- root->append_text("\n"); +- } +- +- //write path to kernels +- bxml_element* kernel_elm = new bxml_element("kernels"); +- kernel_elm->append_text("\n"); +- kernel_elm->set_attribute("path", kernels_path_); +- root->append_data(kernel_elm); +- root->append_text("\n"); +- +- //write to disk +- std::ofstream os(xml_path().c_str()); +- bxml_write(os, doc); +- os.close(); +-} +- +- +-//: Extract a particular coefficient scene +-template +-void bvpl_global_taylor::extract_coefficient_scene(int scene_id, int coefficient_id, boxm_scene > *float_scene) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- +- typedef boct_tree > projection_tree_type; +- typedef boct_tree_cell > projection_cell_type; +- std::vector > projections; +- +- boxm_scene_base_sptr projection_scene_base = load_projection_scene(scene_id); +- +- boxm_scene* projection_scene = dynamic_cast* >(projection_scene_base.as_pointer()); +- +- if (!(projection_scene && float_scene)) +- { +- std::cerr << "Error in bof_util::random_label_for_training: Could not cast scenes\n"; +- return; +- } +- +- //init variables +- projection_scene->unload_active_blocks(); +- float_scene->unload_active_blocks(); +- +- //get the cells for these blocks +- boxm_block_iterator it = projection_scene->iterator(); +- for (it.begin(); !it.end(); ++it) +- { +- if (!(projection_scene->valid_index(it.index()) && float_scene->valid_index(it.index()))) { +- std::cerr << "In bof_util::random_label_for_training: invalid block\n"; +- return; +- } +- +- projection_scene->load_block(it.index()); +- float_scene->load_block(it.index()); +- +- //get the trees +- projection_tree_type* projection_tree = projection_scene->get_block(it.index())->get_tree(); +- float_tree_type* float_tree = projection_tree->clone_to_type(); +- +- //get leaf cells +- std::vector projection_leaves = projection_tree->leaf_cells(); +- std::vector float_leaves = float_tree->leaf_cells(); +- +- unsigned int tree_ncells = projection_leaves.size(); +- +- for (unsigned int i =0; iset_data(float(projection_leaves[i]->data()[coefficient_id])); +- } +- float_scene->get_block(it.index())->init_tree(float_tree); +- float_scene->write_active_block(); +- } +- +- //release memory +- projection_scene->unload_active_blocks(); +- float_scene->unload_active_blocks(); +-} +- +- +-#define BVPL_GLOBAL_TAYLOR_INSTANTIATE(T1,T2) \ +-template class bvpl_global_taylor +- +-#endif // bvpl_global_taylor_hxx_ +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h +deleted file mode 100644 +index 6d3206a9c5..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h ++++ /dev/null +@@ -1,142 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h +-#ifndef bvpl_octree_kernel_operator_h +-#define bvpl_octree_kernel_operator_h +-//: +-// \file +-// \brief A class that operates a bvpl_kernel on an octree or boxm scene +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date November 13, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class bvpl_octree_kernel_operator +-{ +- public: +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- //Constructor from a bvpl functor +- bvpl_octree_kernel_operator(tree_type* tree_in): tree_in_(tree_in){} +- +- // "Convolves" kernel with class tree, storing the output in an output octree. +- template +- void operate(F functor, bvpl_kernel_sptr kernel, tree_type* out_tree, short level, double cell_length) +- { +- // get all (leaf) cells at given scale +- std::vector cells = tree_in_->leaf_cells_at_level(level); +- std::vector out_cells = out_tree->leaf_cells_at_level(level); +- +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- +- // iterate, through all cells +- for (unsigned i = 0; i < cells.size();i++) +- { +- // iterate through vector and compute result +- cell_type* center_cell = cells[i]; +- +- if (center_cell->level()!=level) +- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is not at the right level\n"; +- +- if (!center_cell->is_leaf()) +- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is a leaf\n"; +- +- vgl_point_3d this_cell_origin = tree_in_->local_origin(center_cell); +- +- // TODO: check bounds. Is it more efficient to check bounds for every kernel or to let is run and store a dummy value in it? +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d this_cell_idx(this_cell_origin.x() + (double)kernel_idx.x()*cell_length, +- this_cell_origin.y() + (double)kernel_idx.y()*cell_length, +- this_cell_origin.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data val = this_cell->data(); +- functor.apply(val, d); +- } +- else +- break; +- ++kernel_iter; +- } +- +- out_cells[i]->set_data(functor.result()); +- } +- } +- +- // "Convolves" kernel with class tree, storing the output in an output octree. +- template +- void operate(F functor, bvpl_kernel_sptr kernel, short level, double cell_length); +- +- private: +- tree_type * tree_in_; +-}; +- +-template template +-void bvpl_octree_kernel_operator::operate(F functor, bvpl_kernel_sptr kernel, short level, double cell_length) +-{ +- // get all (leaf) cells at given scale/tree level +- std::vector cells = tree_in_->leaf_cells_at_level(level); +- +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- +- // iterate, through all cells +- for (unsigned i = 0; i < cells.size();i++) +- { +- // iterate through vector and compute result +- cell_type* center_cell = cells[i]; +- +- if (center_cell->level()!=level) +- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is not at the right level\n"; +- +- if (!center_cell->is_leaf()) +- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is a not a leaf\n"; +- +- vgl_point_3d this_cell_origin = tree_in_->local_origin(center_cell); +- +- // TODO: check bounds. Is it more efficient to check bounds for every kernel or to let is run and store a dummy value in it? +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d this_cell_idx(this_cell_origin.x() + (double)kernel_idx.x()*cell_length, +- this_cell_origin.y() + (double)kernel_idx.y()*cell_length, +- this_cell_origin.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data val = this_cell->data(); +- functor.apply(val, d); +- } +- else +- break; +- ++kernel_iter; +- } +- +- center_cell->set_data(functor.result()); +- } +- +-} +- +-#endif // bvpl_octree_kernel_operator_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h +deleted file mode 100644 +index be5efb6238..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h ++++ /dev/null +@@ -1,78 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h +-#ifndef bvpl_octree_neighbors_h +-#define bvpl_octree_neighbors_h +-//: +-// \file +-// \brief A class that operates a bvpl_kernel on an octree or boxm scene to find all the neighbor cells that correspond to that kernel, and returns a list of pointers to those neighbors +-// \author Gamze Tunali Gamze_Tunali@brown.edu +-// \date March 18, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-template +-class bvpl_octree_neighbors +-{ +- public: +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- //Constructor from a bvpl functor +- bvpl_octree_neighbors(tree_type* tree_in): tree_in_(tree_in){} +- +- // "Convolves" kernel with class tree, storing the output in an output octree. +- void neighbors(bvpl_kernel_sptr kernel, cell_type* cell, +- std::vector& neighb_cells) +- { +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- short level = cell->level(); +- double cell_length = tree_in_->cell_length(cell); +- // iterate through vector and find the neighbors +- vgl_point_3d cell_origin = tree_in_->local_origin(cell); +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- vgl_point_3d this_cell_idx(cell_origin.x() + (double)kernel_idx.x()*cell_length, +- cell_origin.y() + (double)kernel_idx.y()*cell_length, +- cell_origin.z() + (double)kernel_idx.z()*cell_length); +- +- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true); +- if (this_cell) { +- // check if this cell is an internal node, if so get the children +- if (!this_cell->is_leaf()) { +- std::vector children; +- this_cell->leaf_children(children); +- neighb_cells.insert(neighb_cells.end(), children.begin(), children.end()); +- } +- else { +- // make sure that the same cell is not added more than once +- bool found=false; +- for (unsigned i=0; i +-// \endverbatim +- +-#include "bvpl_octree_kernel_operator.h" +-#include +-#include +-#include +-#include +- +- +-//: A class with a template operation (as in template method pattern) to apply a vector of bvpl_kernel on an octree +-// The class also contains abstract methods to be specialized in the subclasses +-template +-class bvpl_octree_vector_operator +-{ +- public: +- +- //: Applies a vector of kernels and functor to a grid. Returns a grid that combines the responses of the kernels as specified in the subclass +- template +- bool operate(boct_tree* tree_in, +- F functor, +- bvpl_kernel_vector_sptr kernel_vector, +- boct_tree >* tree_out, +- short level, double cell_length) +- { +- bvpl_local_max_functor func_max; +- boct_tree* temp_tree = tree_in->clone(); +- bvpl_octree_kernel_operator oper(tree_in); +- for (unsigned int id = 0; id < kernel_vector->kernels_.size(); ++id) +- { +- temp_tree->init_cells(func_max.min_response()); +- bvpl_kernel_sptr kernel = kernel_vector->kernels_[id]; +- oper.operate(functor, kernel, temp_tree,level, cell_length); +- combine_kernel_responses(tree_out, temp_tree, id); +- } +- +- return true; +- } +- +- protected: +- //: Abstract function to be implemented on children on how to combine current kernel response with output response +- +- virtual void combine_kernel_responses(boct_tree >* tree_out, boct_tree* tree_curr, +- int id_curr)=0; +- +- //: Compares response grids and stores in out, the maximum responses. This function gets called in subclasses when implementing combine_kernel_responses +- +- void keep_max_response_tree(boct_tree >* tree_out, boct_tree* new_tree, +- int new_id); +-}; +- +- +-//: Compares response grids and stores in grid1, the wining responses. +-template +-void bvpl_octree_vector_operator::keep_max_response_tree(boct_tree >* tree_out, +- boct_tree* new_tree, +- int new_id) +-{ +- bvpl_local_max_functor func_max; +- +- std::vector*> new_leaves = new_tree->leaf_cells(); +- std::vector >*> leaves_out = tree_out->leaf_cells(); +- +- for (unsigned i=0; i< new_leaves.size(); i++) +- { +- T_data val1 = new_leaves[i]->data(); +- T_data val2 = leaves_out[i]->data().response_; +- if (func_max.greater_than(val1, val2)) +- leaves_out[i]->set_data(bvpl_octree_sample(new_leaves[i]->data(), new_id)); +- } +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h +deleted file mode 100644 +index e01a23ca65..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h +-#ifndef bvpl_octree_vector_operator_impl_h +-#define bvpl_octree_vector_operator_impl_h +-//: +-// \file +-// \brief Subclasses that implement the abstract interface of bvpl_octree_vector_operator. They can be used to queue operations +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date November 30, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include "bvpl_octree_vector_operator.h" +- +- +-//: Class to apply a vector of kernels and functor to a grid, returning a grid containing at each voxel the max response +-template +-class bvpl_max_vector_operator: public bvpl_octree_vector_operator +-{ +- public: +- void combine_kernel_responses(boct_tree >* tree_out, boct_tree* tree_curr, +- int id_curr) override +- { +- this->keep_max_response_tree(tree_out, tree_curr, id_curr); +- } +-}; +- +-#endif // bvpl_octree_vector_operator_impl_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h +deleted file mode 100644 +index ec024dfe41..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h ++++ /dev/null +@@ -1,84 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h +-#ifndef bvpl_octree_vrml_util_h +-#define bvpl_octree_vrml_util_h +-//: +-// \file +-// \brief VRML utilities for scenes with bvpl_octree samples +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date December 10, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-class bvpl_octree_vrml_util +-{ +- public: +- //: Writes direction of kernel and magnitude of the response as disks of different sizes +- template +- static void write_scene_as_disks(std::ofstream &vrml_os, +- boxm_scene > > *scene, +- bvpl_kernel_vector_sptr kernel_vector); +-}; +- +-template +-void bvpl_octree_vrml_util::write_scene_as_disks(std::ofstream &vrml_os, +- boxm_scene > > *scene, +- bvpl_kernel_vector_sptr kernel_vector) +-{ +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- +- bvrml_write::write_vrml_header(vrml_os); +- +- // iterate through the scene +- boxm_block_iterator iter= scene->iterator(); +- iter.begin(); +- +- for (; !iter.end(); iter++) +- { +- scene->load_block(iter.index()); +- tree_type *tree = (*iter)->get_tree(); +- +- // iterate through the tree +- std::vector cells = tree->leaf_cells(); +- unsigned lines = 0; +- float max_response =bvpl_cell_to_float(cells[0]); +- for (unsigned i = 0; i < cells.size(); i+=10) +- { +- int id = cells[i]->data().id_; +- if (id < 0) +- continue; +- bvpl_kernel_sptr kernel = kernel_vector->kernels_[id]; +- float response = bvpl_cell_to_float(cells[i]); +- if (response > max_response) { +- max_response = response; +- } +- std::cout << "response " << response << std::endl; +- vgl_vector_3d dir((kernel->axis())[0],(kernel->axis())[1],(kernel->axis())[2]); +- vgl_point_3d coord = tree->global_origin(cells[i]); +- if (response > 3.5f) { +- bvrml_write::write_vrml_line(vrml_os, coord, dir, .1f*response, 1, 0, 0); +- lines++; +- } +-#ifdef DEBUG +- bvrml_write::write_vrml_disk(vrml_os, coord, dir, 2*response-.5f, 0, .5f, 0); +-#endif +- } +- std::cout << "max response " << max_response << std::endl +- << "number of lines: " << lines << std::endl; +- } +-} +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx +deleted file mode 100644 +index 1d72f41d58..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 18-Feb-2011 +- +-#include +-#include +-#include "bvpl_pca_error_scenes.h" +- +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +- +-bvpl_pca_error_scenes::bvpl_pca_error_scenes(const boxm_scene_base_sptr& data_scene_base, const std::string& pca_path, unsigned dim) +-{ +- typedef boct_tree tree_type; +- for (unsigned i =0; i* > (data_scene_base.as_pointer()); +- if (!data_scene) +- std::cerr << "In bvpl_pca_error_scenes: Null Scene\n"; +- +- for (unsigned i = 0; i *error_scene = +- new boxm_scene(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level()); +- error_scene->set_appearance_model(BOXM_FLOAT); +- +- std::string scene_name = "error_scene"; +- error_scene->set_paths(error_path, scene_name); +- +- if (!vul_file::exists(error_path + "/" + scene_name + ".xml")) +- error_scene->write_scene("/" +scene_name + ".xml"); +- +- //data_scene->clone_blocks(*error_scene, -1.0); +- +- scenes_[i] = error_scene; +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h +deleted file mode 100644 +index a50c851c2f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h ++++ /dev/null +@@ -1,39 +0,0 @@ +-// This is bvpl_pca_error_scenes.h +-#ifndef bvpl_pca_error_scenes_h +-#define bvpl_pca_error_scenes_h +- +-//: +-// \file +-// \brief A class to hold the smartpointers to pca error scenes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-// Forward declarations +-class bvpl_pca_error_scenes; +- +-typedef vbl_smart_ptr bvpl_pca_error_scenes_sptr; +- +-//: A class to hold the smartpointers to response scenes and their corresponding names +-class bvpl_pca_error_scenes : public vbl_ref_count +-{ +-public: +- +- bvpl_pca_error_scenes(const boxm_scene_base_sptr& data_scene_base, const std::string& taylor_path, unsigned dim); +- +- //: Return the error scene associated with a number of components used for reconstruction +- boxm_scene_base_sptr get_scene(unsigned ncomponent) {return scenes_[ncomponent];} +- +-private: +- std::vector scenes_; +- +-}; +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h +deleted file mode 100644 +index 2217b22966..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h ++++ /dev/null +@@ -1,213 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h +-#ifndef bvpl_scene_kernel_operator_h +-#define bvpl_scene_kernel_operator_h +-//: +-// \file +-// \brief A class that operates a bvpl_kernel on a boxm_scene +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date November 18, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include "bvpl_octree_kernel_operator.h" +-#ifdef _MSC_VER +-# include +-#endif +- +-class bvpl_scene_kernel_operator +-{ +- public: +- //: "Convolves" kernel with an input octree, storing the output in an output octree. +- // This function only iterate through leaf_cells at level 0; +- template +- void operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel, +- boxm_scene > &scene_out); +- +- //: Performs in-situ non-maxima suppression over the area occupied by the kernel +- template +- void local_non_maxima_suppression(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel); +- +-#if 0 //Depracated +- // "Convolves" kernel with an input octree, storing the output in an output octree. +- template +- void operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel, +- boxm_scene > &scene_out, +- short level) +- { +- typedef boct_tree tree_type; +- boxm_block_iterator iter_in = scene_in.iterator(); +- boxm_block_iterator iter_out = scene_out.iterator(); +- iter_in.begin(); +- iter_out.begin(); +- for (; !iter_in.end(); iter_in++, iter_out++) { +- //Isa: change to load block and neighbors +- scene_in.load_block(iter_in.index()); +- scene_out.load_block(iter_out.index()); +- tree_type *tree_in= (*iter_in)->get_tree(); +- tree_type *tree_out = tree_in->clone(); +- +- // output tree has the same shape but is initialized to have response zero +- T_data zero_val = T_data(); +- std::cout << "Response tree is initialized to: " << zero_val << std::endl; +- tree_out->init_cells(zero_val); +- +- bvpl_octree_kernel_operator oper(tree_in); +- double cell_length = 1.0/(double)(1<<(tree_in->root_level() -level)); +- oper.operate(functor, kernel, tree_out, level, cell_length); +- (*iter_out)->init_tree(tree_out); +- scene_out.write_active_block(); +- } +- } +-#endif +-}; +- +-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_scene_kernel_operator::operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel, +- boxm_scene > &scene_out) +-{ +- double cell_length = kernel->voxel_length(); +- short finest_level = scene_in.finest_level(); +- std::cout << "bvpl_scene_kernel_operator: Operating on cells at level: " << finest_level << " and length: " << cell_length << std::endl; +- +- scene_in.clone_blocks(scene_out, T_data()); +- +- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0; +- boxm_cell_iterator > iterator = scene_in.cell_iterator(&boxm_scene >::load_block_and_neighbors); +- iterator.begin(); +- +- boxm_cell_iterator > out_iter = scene_out.cell_iterator(&boxm_scene >::load_block); +- out_iter.begin(); +- +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- +- while ( !(iterator.end() || out_iter.end()) ) +- { +- boct_tree_cell *center_cell = *iterator; +- boct_tree_cell *out_center_cell = *out_iter; +- boct_loc_code out_code = out_center_cell->get_code(); +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){ +- std::cerr << " Input and output cells don't have the same structure\n"; +- ++iterator; +- ++out_iter; +- continue; +- } +- +- //we are only interested in finest resolution +- if ((!(center_cell->level() == finest_level)) || !center_cell->is_leaf()){ +- ++iterator; +- ++out_iter; +- continue; +- } +- +- vgl_point_3d center_cell_origin = iterator.global_origin(); +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d kernel_cell_origin(center_cell_origin.x() + (double)kernel_idx.x()*cell_length + 1.0e-7, +- center_cell_origin.y() + (double)kernel_idx.y()*cell_length + 1.0e-7, +- center_cell_origin.z() + (double)kernel_idx.z()*cell_length + 1.0e-7); +- +- boct_tree_cell *this_cell = scene_in.locate_point_in_memory(kernel_cell_origin); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data val = this_cell->data(); +- functor.apply(val, d); +- } +- else { +- break; +- } +- +- ++kernel_iter; +- } +- +- out_center_cell->set_data(functor.result()); +- ++iterator; +- ++out_iter; +- } +-} +- +-//: Applies non-maxima suppression on the region occupied by the kernel. The output is stored in situ. +-//(1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_scene_kernel_operator::local_non_maxima_suppression(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_sptr kernel) +-{ +- short finest_level = scene_in.finest_level(); +- double cell_length = kernel->voxel_length(); +- +- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0; +- boxm_cell_iterator > iterator = scene_in.cell_iterator(&boxm_scene >::load_block_and_neighbors); +- iterator.begin(); +- +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- +- while ( !(iterator.end()) ) +- { +- boct_tree_cell *center_cell = *iterator; +- +- //we are only interested in finest resolution +- if (!center_cell->level() == finest_level || !center_cell->is_leaf()){ +- ++iterator; +- continue; +- } +- T_data this_data = center_cell->data(); +- +- //vgl_point_3d center_cell_origin = iterator.global_origin(); +- vgl_point_3d center_cell_center = this_data.location(); +- if (!functor.init(this_data)){ +- ++iterator; +- continue; +- } +- +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d kernel_cell_center(center_cell_center.x() + (double)kernel_idx.x()*cell_length, +- center_cell_center.y() + (double)kernel_idx.y()*cell_length, +- center_cell_center.z() + (double)kernel_idx.z()*cell_length); +- +- boct_tree_cell *this_cell = scene_in.locate_point_in_memory(kernel_cell_center); +- +- if (this_cell) { +- //bvpl_kernel_dispatch d = *kernel_iter; +- T_data val = this_cell->data(); +- functor.apply(val); +- } +- else { +- break; +- } +- +- ++kernel_iter; +- } +- +- center_cell->set_data(functor.result()); +- ++iterator; +- } +-} +- +-#endif // bvpl_scene_kernel_operator_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx +deleted file mode 100644 +index c6fabe14e2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include "bvpl_scene_neighborhood_operator.h" +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h +deleted file mode 100644 +index 5f8e43f92f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h ++++ /dev/null +@@ -1,97 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h +-#ifndef bvpl_scene_neighborhood_operator_h +-#define bvpl_scene_neighborhood_operator_h +-//: +-// \file +-// \brief A class to perform neighborhood operations on a boxm_scene. +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 13-Aug-2010. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +- +-#include +- +-//: A class to perform neighborhood operations on a bvxm_scene. +-// This class operates on all leaf cells within a region +-class bvpl_scene_neighborhood_operator +-{ +- public: +- bvpl_scene_neighborhood_operator()= default; +- +- //: Applies the region-based functor on every leaf cell of the scene. The output is stored on a separate scene +- template +- void operate(boxm_scene > *scene_in, +- F functor, +- vgl_box_3d roi, +- boxm_scene > *scene_out); +- +- //: Applies the region-based functor on every leaf cell of the scene. The region is obtained from scen2. +- // The output is stored on a separate scene +- template +- void operate(boxm_scene > *scene_in1, +- boxm_scene > *scene_in2, +- F functor, +- vgl_box_3d roi, +- boxm_scene > *scene_out); +- +- //: Applies a non-maxima suppression functor on every leaf cell of the scene. The output is stored in situ +- template +- void local_non_maxima_suppression(boxm_scene > &scene_in, +- F functor, +- vgl_box_3d &roi); +-}; +- +- +-//: Applies the region-based functor on every leaf cell of the scene. The output is stored in situ. The ROI must be in scene-coordinates +-//(1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_scene_neighborhood_operator::local_non_maxima_suppression(boxm_scene > &scene_in, +- F functor,vgl_box_3d &roi) +-{ +- short finest_level = scene_in.finest_level(); +- +- //(1) Traverse the scene +- boxm_cell_iterator > iterator = scene_in.cell_iterator(&boxm_scene >::load_block_and_neighbors); +- +- iterator.begin(); +- +- while (!iterator.end()) +- { +- boct_tree_cell *cell = *iterator; +- if ((!(cell->level() == finest_level)) || !cell->is_leaf()){ +- ++iterator; +- continue; +- } +- // the region is located with subvoxel accuracy so datastructure should contain subvoxel localization +- roi.set_centroid((cell->data()).location()); +- +- T_data this_data= cell->data(); +- functor.init(this_data, roi); +- +- // get all cells that intersect a region +- std::vector* > cells_in_roi; +- +- //Return all cells that intersec the region +- scene_in.leaves_in_region(roi,cells_in_roi); +- +- for (unsigned i = 0; i *this_cell = cells_in_roi[i]; +- if (!this_cell) +- continue; +- T_data val = this_cell->data(); +- functor.apply(val); +- } +- +- cell->set_data(functor.result()); +- ++iterator; +- } +-} +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx +deleted file mode 100644 +index 5f43040cc0..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx ++++ /dev/null +@@ -1,80 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 22-Sep-2010 +- +-#include "bvpl_scene_statistics.h" +- +- +-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k, unsigned long tree_nsamples) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- auto * scene = dynamic_cast* > (scene_base.as_pointer()); +- +- scene->load_block(block_i, block_j, block_k); +- +- //get the leaves +- float_tree_type* tree = scene->get_block(block_i, block_j, block_k)->get_tree(); +- std::vector leaves = tree->leaf_cells(); +- +- int tree_ncells = leaves.size(); +- //unsigned long tree_nsamples = (tree_ncells/scene_ncells)*(float)nsamples_; +- +- double avg_val = 0.0; +- vnl_random rng(9667566ul); +- for (unsigned i=0; i *center_cell = leaves[sample]; +- // vgl_point_3d center_cell_centroid = tree->global_centroid(center_cell); +- +- //if neighborhood is not inclusive we would have missing features +- if ((double)center_cell->data()< -0.5) { +- i--; +- continue; +- } +- else { +- avg_val+=(double)center_cell->data(); +- } +- } +- +- return avg_val/tree_nsamples; +-} +- +-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- auto * scene = dynamic_cast* > (scene_base.as_pointer()); +- if (!scene) { +- std::cerr << "Error in bvpl_average_value: Error scene is of incorrect type\n"; +- return false; +- } +- scene->load_block(block_i, block_j, block_k); +- +- //get the leaves +- float_tree_type* tree = scene->get_block(block_i, block_j, block_k)->get_tree(); +- std::vector leaves = tree->leaf_cells(); +- +- double actual_samples = 0.0; +- double avg_val = 0.0; +- for (auto center_cell : leaves) +- { +- // vgl_point_3d center_cell_centroid = tree->global_centroid(center_cell); +- +- //if neighborhood is not inclusive we would have missing features +- if ((double)center_cell->data()< -0.5) { +- continue; +- } +- else { +- avg_val+=(double)center_cell->data(); +- actual_samples = actual_samples +1.0; +- } +- } +- +- std::cout << "Adding errors of : " << actual_samples << " samples" << std::endl; +- +- return avg_val/actual_samples; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h +deleted file mode 100644 +index f14813bc74..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h ++++ /dev/null +@@ -1,102 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h +-#ifndef bvpl_scene_statistics_h +-#define bvpl_scene_statistics_h +-//: +-// \file +-// \brief A set of functions to provide statistics about response scenes +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 22-Sep-2010. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-template +-bool bvpl_compute_scene_statistics(boxm_scene< boct_tree > > *scene, bsta_histogram &response_hist ) +-{ +- typedef boct_tree > tree_type; +- +- //(1) Traverse the leaves of the scene +- boxm_cell_iterator iterator = scene->cell_iterator(&boxm_scene::load_block, true); +- +- iterator.begin(); +- float cell_count = 0; +- float max = (*iterator)->data().magnitude(); +- float min = max; +- float mag = max; +- while (!iterator.end()) { +- cell_count++; +- mag = (*iterator)->data().magnitude(); +- if ( mag > max) max = mag; +- if ( mag < min) min = mag; +- ++iterator; +- } +- +- unsigned int nbins = (unsigned int)std::floor(std::sqrt(cell_count)); +- response_hist = bsta_histogram(min, max, nbins); +- +- iterator.begin(); +- +- while (!iterator.end()) { +- response_hist.upcount(static_cast((*iterator)->data().magnitude()), 1.0f); +- ++iterator; +- } +- +- scene->unload_active_blocks(); +- +- return true; +-} +- +- +-template +-bool bvpl_compute_scene_statistics(boxm_scene >* scene, bsta_histogram& response_hist, unsigned int nbins = 0 ) +- //, bsta_histogram& level_hist, unsigned& n_leaves) +-{ +- typedef boct_tree tree_type; +- typedef boct_tree_cell cell_type; +- +- //(1) Traverse the leaves of the scene +- boxm_cell_iterator iterator = scene->cell_iterator(&boxm_scene::load_block, true); +- +- iterator.begin(); +- float cell_count = 0; +- T_data max = (*iterator)->data(); +- T_data min = max; +- T_data this_val = max; +- while (!iterator.end()) { +- cell_count++; +- this_val = (*iterator)->data(); +- if ( this_val > max) max = this_val; +- if ( this_val < min) min = this_val; +- ++iterator; +- } +- +- if (nbins == 0) +- nbins = (unsigned int)std::floor(std::sqrt(cell_count)); +- response_hist = bsta_histogram(min, max, nbins); +- scene->unload_active_blocks(); +- iterator.begin(); +- while (!iterator.end()) { +- response_hist.upcount(static_cast((*iterator)->data()), 1.0f); +- ++iterator; +- } +- +- scene->unload_active_blocks(); +- +- return true; +-} +- +-//: Function that compute average value of a fraction of samples in the specified block. +-// Datatype is assumed to be float, but if could be templated to expand to other types +-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k, unsigned long tree_nsamples); +- +-//: Function that compute average value of all positive samples in the specified block. +-// Datatype is assumed to be float, but if could be templated to expand to other types +-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k); +- +- +-#endif // bvpl_scene_statistics_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h +deleted file mode 100644 +index 49e7066a5c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h ++++ /dev/null +@@ -1,178 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h +-#ifndef bvpl_scene_vector_operator_h +-#define bvpl_scene_vector_operator_h +-//: +-// \file +-// \brief A class that applies a vector of bvpl_kernels on a boxm_scene +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date November 30, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +- +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-class bvpl_scene_vector_operator +-{ +- public: +- +- //: "Convolves" a vector of kernel with an input octree, storing the output in an output octree. +- // The shape of the output is determined by a templated function +- // This function only iterate through leaf_cells at level 0; +- template +- void operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_vector_sptr kernel_vector, +- boxm_scene > &scene_out); +- +- protected: +- +- //:Function incharged of combining results +- template +- void combine_kernel_responses(const std::vector& responses, vnl_vector_fixed &response_out); +- +- //:Function incharged of combining results +- template +- void combine_kernel_responses(const std::vector& responses, bvpl_octree_sample &response_out); +-}; +- +- +-//: Operates a vector of kernels on a scene by : (1)Traversing input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor +-template +-void bvpl_scene_vector_operator::operate(boxm_scene > &scene_in, +- F functor, +- bvpl_kernel_vector_sptr kernel_vector, +- boxm_scene > &scene_out) +-{ +- short finest_level = scene_in.finest_level(); +- // CAUTION: kernel is run at finest resolution, but this may not always be desired +- double cell_length = scene_in.finest_cell_length(); +- +- std::cout << "bvpl_scene_kernel_operator: Operating on cells at level: " << finest_level << " and length: " << cell_length << std::endl; +- +- T_data_out zero; +- scene_in.template clone_blocks_to_type >(scene_out, zero); +- std::cout << "The initial zero-value for all cells is : " << zero << std::endl; +- +- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0; +- boxm_cell_iterator > iterator = scene_in.cell_iterator(&boxm_scene >::load_block_and_neighbors); +- iterator.begin(); +- +- boxm_cell_iterator > out_iter = scene_out.cell_iterator(&boxm_scene >::load_block); +- out_iter.begin(); +- +- while ( !(iterator.end() || out_iter.end()) ) +- { +- boct_tree_cell *center_cell = *iterator; +- boct_tree_cell *out_center_cell = *out_iter; +- boct_loc_code out_code = out_center_cell->get_code(); +- boct_loc_code in_code = center_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) { +- std::cerr << " Input and output cells don't have the same structure " << std::endl; +- ++iterator; +- ++out_iter; +- continue; +- } +- +- //we are only interested in finest resolution +- if ((!(center_cell->level() == finest_level)) || !center_cell->is_leaf()) { +- ++iterator; +- ++out_iter; +- continue; +- } +- +- vgl_point_3d center_cell_centroid = iterator.global_centroid(); +- +- //(2) Run vector of kernels +- +- std::vector responses; +- for (auto kernel : kernel_vector->kernels_) +- { +- bvpl_kernel_iterator kernel_iter = kernel->iterator(); +- kernel_iter.begin(); // reset the kernel iterator +- while (!kernel_iter.isDone()) +- { +- vgl_point_3d kernel_idx = kernel_iter.index(); +- +- vgl_point_3d kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length, +- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length, +- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length); +- +- boct_tree_cell *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid); +- +- if (this_cell) { +- bvpl_kernel_dispatch d = *kernel_iter; +- T_data_in val = this_cell->data(); +- functor.apply(val, d); +- } +- +- ++kernel_iter; +- } +- +- responses.push_back(functor.result()); +- } +- +- T_data_out data_out; +- combine_kernel_responses(responses, data_out); +- out_center_cell->set_data(data_out); +- ++iterator; +- ++out_iter; +- } +- return; +-} +- +-template +-void bvpl_scene_vector_operator::combine_kernel_responses(const std::vector& responses, vnl_vector_fixed &response_out) +-{ +- if (responses.size() != 3) { +- std::cerr << "Wrong number of responses" << std::endl; +- return; +- } +- +- for (unsigned i = 0 ; i < 3; i++) +- { +- response_out[i] = responses[i]; +- } +- return; +-} +- +-template +-void bvpl_scene_vector_operator::combine_kernel_responses(const std::vector& responses, bvpl_octree_sample &response_out) +-{ +- if (responses.size() != 3) { +- std::cerr << "Wrong number of responses" << std::endl; +- return; +- } +- +- bvpl_local_max_functor func_max; +- +- T_data max= responses[0]; +- int max_id =0; +- for (unsigned i = 1 ; i < responses.size(); i++) +- { +- if (func_max.greater_than(max, responses[i])){ +- max = responses[i]; +- max_id = i; +- } +- } +- response_out.response_=max; +- response_out.id_ = max_id; +- return; +-} +- +-#endif // bvpl_scene_vector_operator_h +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx +deleted file mode 100644 +index e8cac33615..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx ++++ /dev/null +@@ -1,258 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 31-Jan-2011 +- +-#include "bvpl_taylor_basis.h" +-#include +- +-#include +- +-bool bvpl_taylor_basis::compute_approximation_error(const boxm_scene_base_sptr& data_scene_base, +- const boxm_scene_base_sptr& basis_scene_base, +- const boxm_scene_base_sptr& error_scene_base, +- const bvpl_taylor_basis_loader& loader, +- int block_i, int block_j, int block_k, double cell_length) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- typedef boct_tree taylor_tree_type; +- typedef boct_tree_cell taylor_cell_type; +- //cast the scenes +- auto* data_scene = dynamic_cast* > (data_scene_base.as_pointer()); +- auto* basis_scene = dynamic_cast* > (basis_scene_base.as_pointer()); +- auto * error_scene = dynamic_cast* > (error_scene_base.as_pointer()); +- +- if (!(data_scene && basis_scene &&error_scene)){ +- std::cerr << "Error in compute_approximation_error: Faild to cast scene\n"; +- return false; +- } +- +- //load blocks of interest +- data_scene->load_block_and_neighbors(block_i, block_j, block_k); +- basis_scene->load_block(block_i, block_j, block_k); +- error_scene->load_block(block_i, block_j, block_k); +- +- //get the leaves +- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree(); +- float_tree_type* error_tree = data_tree->clone(); +- +- //error is always positive, therefore cells with negative errors can be identified as uninitialized. +- error_tree->init_cells(-1.0f); +- taylor_tree_type* basis_tree = basis_scene->get_block(block_i, block_j, block_k)->get_tree(); +- +- std::vector data_leaves = data_tree->leaf_cells(); +- std::vector error_leaves = error_tree->leaf_cells(); +- std::vector basis_leaves = basis_tree->leaf_cells(); +- +- vgl_point_3d min_point = loader.min_point(); +- vgl_point_3d max_point = loader.max_point(); +- +- +- for (unsigned i =0; i data_code = data_cell->get_code(); +- boct_loc_code basis_code = basis_cell->get_code(); +- +- //check cells are at the same location +- if (! data_code.isequal(basis_code)){ +- std::cerr << "Error in compute_approximation_error: Cells don't have the same location in the tree\n" +- << "Data Code: " << data_code << '\n' +- << "Basis Code: " << basis_code << '\n'; +- +- return false; +- } +- +- //create a region around the center cell +- vgl_point_3d centroid = data_tree->global_centroid(data_cell); +- +- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene +- vgl_point_3d min_point_global(centroid.x() + (double)min_point.x()*cell_length, centroid.y() + (double)min_point.y()*cell_length, centroid.z() + (double)min_point.z()*cell_length); +- vgl_point_3d max_point_global(centroid.x() + (double)max_point.x()*cell_length, centroid.y() + (double)max_point.y()*cell_length, centroid.z() + (double)max_point.z()*cell_length); +- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) +- continue; +- +- //retrieve basis +- double I0 = basis_cell->data().I0; +- vnl_double_3 G= basis_cell->data().G; +- vnl_double_3x3 H = basis_cell->data().H; +- double error = 0.0; +- for (int x = min_point.x(); x<= max_point.x(); x++) { +- for (int y = min_point.y(); y<=max_point.y(); y++) { +- for (int z = min_point.z(); z<=max_point.z(); z++) { +- vgl_point_3d point2visit(centroid.x()+(double)x*cell_length, centroid.y()+ (double)y*cell_length, centroid.z() + (double)z*cell_length); +- boct_tree_cell *this_cell = data_scene->locate_point_in_memory(point2visit); +- if (this_cell) { +- vnl_double_3 X((double)x,(double)y, (double)z); +- double approx = I0 + dot_product(X,G) + 0.5* (dot_product(X,(H*X))); +- error = error + (this_cell->data() - approx)*(this_cell->data() - approx); +- //std::cout << "Taylor Error :\n" << "This centroid: " << this_centroid << ", box_centroid: " <set_data((float)error); +- } +- +- // write and release memory +- error_scene->get_block(block_i, block_j, block_k)->set_tree(error_tree); +- error_scene->write_active_block(); +- data_scene->unload_active_blocks(); +- basis_scene->unload_active_blocks(); +- +- return true; +-} +- +- +-double bvpl_taylor_basis::sum_errors(const boxm_scene_base_sptr& error_scene_base, +- int block_i, int block_j, int block_k, unsigned long tree_nsamples) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree_cell float_cell_type; +- auto * error_scene = dynamic_cast* > (error_scene_base.as_pointer()); +- +- error_scene->load_block(block_i, block_j, block_k); +- +- //get the leaves +- float_tree_type* error_tree = error_scene->get_block(block_i, block_j, block_k)->get_tree(); +- std::vector error_leaves = error_tree->leaf_cells(); +- +- int tree_ncells = error_leaves.size(); +- //unsigned long tree_nsamples = (unsigned long)((float)tree_ncells/scene_ncells*nsamples_); +- +- double error = 0.0; +- vnl_random rng(9667566ul); +- for (unsigned i=0; i *center_cell = error_leaves[sample]; +- // vgl_point_3d center_cell_centroid = error_tree->global_centroid(center_cell); +- +- //if neighborhood is not inclusive we would have missing features +- if ((double)center_cell->data()< -0.5){ +- i--; +- continue; +- } +- else { +- error+=(double)center_cell->data(); +- } +- } +- +- return error/tree_nsamples; +-} +- +-//: Reads the values of basis responses and assembles them into matrices and vectors +-bool bvpl_taylor_basis::assemble_basis(const bvpl_taylor_scenes_map_sptr& taylor_scenes,int block_i, int block_j, int block_k) +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree taylor_tree_type; +- typedef boct_tree_cell float_cell_type; +- typedef boct_tree_cell taylor_cell_type; +- +- std::cerr << "Caution: Using hardcoded size for taylor reconstruction\n"; +- +- //load output scene +- boxm_scene* basis_scene = dynamic_cast* > (taylor_scenes->get_scene("basis").as_pointer()); +- if (!basis_scene) +- { +- std::cerr << "Error in reconstruct: Faild to cast output scene\n"; +- return false; +- } +- +- //retieve basis scenes +- //zeroth derivative scene +- boxm_scene* I0_scene = dynamic_cast* > (taylor_scenes->get_scene("I0").as_pointer()); +- boxm_scene* Ix_scene = dynamic_cast* > (taylor_scenes->get_scene("Ix").as_pointer()); +- boxm_scene* Iy_scene = dynamic_cast* > (taylor_scenes->get_scene("Iy").as_pointer()); +- boxm_scene* Iz_scene = dynamic_cast* > (taylor_scenes->get_scene("Iz").as_pointer()); +- boxm_scene* Ixx_scene = dynamic_cast* > (taylor_scenes->get_scene("Ixx").as_pointer()); +- boxm_scene* Ixy_scene = dynamic_cast* > (taylor_scenes->get_scene("Ixy").as_pointer()); +- boxm_scene* Ixz_scene = dynamic_cast* > (taylor_scenes->get_scene("Ixz").as_pointer()); +- boxm_scene* Iyy_scene = dynamic_cast* > (taylor_scenes->get_scene("Iyy").as_pointer()); +- boxm_scene* Iyz_scene = dynamic_cast* > (taylor_scenes->get_scene("Iyz").as_pointer()); +- boxm_scene* Izz_scene = dynamic_cast* > (taylor_scenes->get_scene("Izz").as_pointer()); +- +- +- if (!(I0_scene && Ix_scene && Iy_scene && Iz_scene && Ixx_scene && Iyy_scene && Izz_scene && Ixy_scene && Ixz_scene && Iyz_scene)) +- { +- std::cerr << "Error in assemble_basis: Faild to load taylor scenes\n"; +- return false; +- } +- +- //load the blocks +- basis_scene->load_block(block_i, block_j,block_k); +- I0_scene->load_block(block_i, block_j,block_k); +- Ix_scene->load_block(block_i, block_j,block_k); +- Iy_scene->load_block(block_i, block_j,block_k); +- Iz_scene->load_block(block_i, block_j,block_k); +- Ixx_scene->load_block(block_i, block_j,block_k); +- Ixy_scene->load_block(block_i, block_j,block_k); +- Ixz_scene->load_block(block_i, block_j,block_k); +- Iyy_scene->load_block(block_i, block_j,block_k); +- Iyz_scene->load_block(block_i, block_j,block_k); +- Izz_scene->load_block(block_i, block_j,block_k); +- +- +- float_tree_type *treeI0 = I0_scene->get_block(block_i, block_j, block_k)->get_tree(); +- taylor_tree_type *basis_tree = treeI0->clone_to_type(); +- basis_tree->init_cells(bvpl_taylor_basis2_sample()); +- std::vector leaves_basis = basis_tree->leaf_cells(); +- std::vector leaves_I0 = treeI0->leaf_cells(); +- std::vector leaves_Ix = Ix_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Iy = Iy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Iz = Iz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Ixx =Ixx_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Ixy =Ixy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Ixz =Ixz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Iyy =Iyy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Iyz =Iyz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- std::vector leaves_Izz =Izz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells(); +- +- +- //iterate gathering and assembling the data +- for (unsigned i=0; idata(); +- vnl_double_3 G((double)leaves_Ix[i]->data(),(double)leaves_Iy[i]->data(),(double)leaves_Iz[i]->data()); +- +- vnl_double_3x3 H; +- H.put(0,0,(double)leaves_Ixx[i]->data()); +- H.put(0,1,(double)leaves_Ixy[i]->data()); +- H.put(0,2,(double)leaves_Ixz[i]->data()); +- H.put(1,0,(double)leaves_Ixy[i]->data()); +- H.put(1,1,(double)leaves_Iyy[i]->data()); +- H.put(1,2,(double)leaves_Iyz[i]->data()); +- H.put(2,0,(double)leaves_Ixz[i]->data()); +- H.put(2,1,(double)leaves_Iyz[i]->data()); +- H.put(2,2,(double)leaves_Izz[i]->data()); +- +- bvpl_taylor_basis2_sample sample(I0, G, H); +- +- leaves_basis[i]->set_data(sample); +- } +- +- //write basis block +- basis_scene->get_block(block_i, block_j, block_k)->set_tree(basis_tree); +- basis_scene->write_active_block(); +- +- //free up memory +- basis_scene->unload_active_blocks(); +- I0_scene->unload_active_blocks(); +- Ix_scene->unload_active_blocks(); +- Iy_scene->unload_active_blocks(); +- Iz_scene->unload_active_blocks(); +- Ixx_scene->unload_active_blocks(); +- Ixy_scene->unload_active_blocks(); +- Ixz_scene->unload_active_blocks(); +- Iyy_scene->unload_active_blocks(); +- Iyz_scene->unload_active_blocks(); +- Izz_scene->unload_active_blocks(); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h +deleted file mode 100644 +index 6d35064025..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h ++++ /dev/null +@@ -1,50 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h +-#ifndef bvpl_taylor_basis_h +-#define bvpl_taylor_basis_h +- +-//: +-// \file +-// \brief A class with utilities to apply taylor kernels to a scene +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 31-Jan-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include "bvpl_taylor_scenes_map.h" +-#include +- +- +-class bvpl_taylor_basis +-{ +- +-public: +- // bvpl_taylor_basis(boxm_scene_base_sptr scene_base, bvpl_taylor_basis_loader loader, std::string path_out): +- // kernel_loader_(loader), scene_base_(scene_base), path_out_(path_out){} +- // +- static bool assemble_basis(const bvpl_taylor_scenes_map_sptr& taylor_scenes,int block_i, int block_j, int block_k); +- +- //: Computes the square errors between the scene and the taylor approximation at every voxel +- // This function operates on a block specified by an index +- static bool compute_approximation_error(const boxm_scene_base_sptr& data_scene_base, +- const boxm_scene_base_sptr& basis_scene_base, +- const boxm_scene_base_sptr& error_scene_base, +- const bvpl_taylor_basis_loader& loader, +- int block_i, int block_j, int block_k, double cell_length); +- +- //: Sums the square errors for a percenatge of random samples +- static double sum_errors(const boxm_scene_base_sptr& error_scene_base, +- int block_i, int block_j, int block_k, unsigned long tree_nsamples); +- +-protected: +- +- // +- // bvpl_taylor_basis_loader kernel_loader_; +- // boxm_scene_base_sptr scene_base_; +- // std::string path_out_; +-}; +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx +deleted file mode 100644 +index 92128f59d6..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx ++++ /dev/null +@@ -1,61 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include "bvpl_taylor_scenes_map.h" +-#include +-#include +-#include +- +-#include +- +-bvpl_taylor_scenes_map::bvpl_taylor_scenes_map(bvpl_taylor_basis_loader loader) +-{ +- loader_ = loader; +- typedef boct_tree tree_type; +- +- std::vector kernel_names; +- loader.files(kernel_names); +- +- //Load scenes one-by-one an insert them in the map +- for (auto & kernel_name : kernel_names) +- { +- std::string scene_in_file = loader.path() + '/' + kernel_name + "/float_response_scene.xml"; +- boxm_scene_parser parser; +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- scene_ptr->load_scene(scene_in_file, parser); +- +- if (scene_ptr->appearence_model() != BOXM_FLOAT) { +- std::cerr << " bvpl_taylor_scenes, scenes must be of type float\n"; +- } +- +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- +- this->scenes_.insert(std::pair( kernel_name, scene_ptr)); +- } +- +- // Create a scene to later save the taylor reconstruction (parameters of the scene are the same as those of the input scene) +- auto* scene_in = static_cast* > (scenes_[kernel_names[0]].as_pointer()); +- { +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(loader.path(), "error"); +- scene_out->set_appearance_model(BOXM_FLOAT); +- if (!vul_file::exists(loader.path() + "/error_scene.xml")) +- scene_out->write_scene("error_scene.xml"); +- this->scenes_.insert(std::pair( "error", scene_out)); +- } +- +- { +- boxm_scene > *scene_out = +- new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(loader.path(), "basis"); +- scene_out->set_appearance_model(BOXM_FLOAT); +- if (!vul_file::exists(loader.path() + "/basis_scene.xml")) +- scene_out->write_scene("basis_scene.xml"); +- this->scenes_.insert(std::pair( "basis", scene_out)); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h +deleted file mode 100644 +index 51f783da43..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-// This is bvpl_taylor_scenes_map.h +-#ifndef bvpl_taylor_scenes_map_h +-#define bvpl_taylor_scenes_map_h +- +-//: +-// \file +-// \brief A class to hold the smartpointers to response scenes and their corresponding names +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-// Forward declarations +-class bvpl_taylor_scenes_map; +- +-typedef vbl_smart_ptr bvpl_taylor_scenes_map_sptr; +- +-//: A class to hold the smartpointers to response scenes and their corresponding names +-class bvpl_taylor_scenes_map : public vbl_ref_count +-{ +-public: +- +- bvpl_taylor_scenes_map(bvpl_taylor_basis_loader loader); +- +- boxm_scene_base_sptr get_scene(std::string basis) {return scenes_[basis];} +- +- const bvpl_taylor_basis_loader& loader() {return loader_ ;} +- +-private: +- std::map scenes_; +- bvpl_taylor_basis_loader loader_; +- +-}; +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt +deleted file mode 100644 +index e1264a0f5c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt ++++ /dev/null +@@ -1,20 +0,0 @@ +-# contrib/brl/bseg/bvpl/io/CMakeLists.txt +- +-set(bvpl_octree_io_sources +- bvpl_io_taylor_scenes_map.h bvpl_io_taylor_scenes_map.cxx +- bvpl_io_pca_error_scenes.h bvpl_io_pca_error_scenes.cxx +- bvpl_io_discover_pca_kernels.h bvpl_io_discover_pca_kernels.cxx +- bvpl_io_global_pca.h bvpl_io_global_pca.cxx +- bvpl_io_global_taylor.h +- bvpl_io_global_corners.h bvpl_io_global_corners.cxx +- +-) +- +-aux_source_directory(Templates bvpl_octree_io_sources) +- +-vxl_add_library(LIBRARY_NAME bvpl_octree_io LIBRARY_SOURCES ${bvpl_octree_io_sources}) +-target_link_libraries(bvpl_octree_io bvpl_octree ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vsl) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx +deleted file mode 100644 +index 45954e1337..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_discover_pca_kernels); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx +deleted file mode 100644 +index ed29b40a54..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_corners); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx +deleted file mode 100644 +index fc4656672f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +- +-typedef bvpl_global_pca<125> bvpl_global_pca_125; +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_pca_125); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx +deleted file mode 100644 +index ff9d7dc465..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +-#include +- +-typedef bvpl_global_taylor bvpl_global_taylor_double_10; +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_taylor_double_10); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx +deleted file mode 100644 +index 427e3937d4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_pca_error_scenes); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx +deleted file mode 100644 +index 25a60ca12c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx +deleted file mode 100644 +index 05fe44152d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include "bvpl_io_discover_pca_kernels.h" +- +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_discover_pca_kernels const & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_discover_pca_kernels & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream & /*os*/, const bvpl_discover_pca_kernels & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_discover_pca_kernels* /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_discover_pca_kernels* & /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream& os, const bvpl_discover_pca_kernels* &p) +-{ +- if (p==nullptr) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h +deleted file mode 100644 +index b52e2355b2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-// This is bvpl_io_discover_pca_kernels.h +-#ifndef bvpl_io_discover_pca_kernels_h +-#define bvpl_io_discover_pca_kernels_h +- +-//: +-// \file +-// \brief Binary IO for bvpl_discover_pca_kernels. Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & os, bvpl_discover_pca_kernels const &); +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & is, bvpl_discover_pca_kernels &m); +- +- +-void vsl_print_summary(std::ostream &os, const bvpl_discover_pca_kernels &m); +- +- +-void vsl_b_read(vsl_b_istream& is, bvpl_discover_pca_kernels* m); +- +- +-void vsl_b_write(vsl_b_ostream& os, const bvpl_discover_pca_kernels* &m); +- +-void vsl_print_summary(std::ostream& os, const bvpl_discover_pca_kernels* &m); +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx +deleted file mode 100644 +index ef10f3ad61..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 21-Jul-2011 +- +-#include "bvpl_io_global_corners.h" +- +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_global_corners const & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_global_corners & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream & /*os*/, const bvpl_global_corners & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_global_corners* /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_global_corners* & /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream& os, const bvpl_global_corners* &p) +-{ +- if (p==nullptr) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h +deleted file mode 100644 +index ac64d773d4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h ++++ /dev/null +@@ -1,44 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h +-#ifndef bvpl_io_global_cornerss_h +-#define bvpl_io_global_cornerss_h +-//: +-// \file +-// \brief Binary IO for bvpl_global_corners_125. Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-typedef bvpl_global_corners bvpl_global_corners; +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & os, bvpl_global_corners const &); +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & is, bvpl_global_corners &m); +- +- +-void vsl_print_summary(std::ostream &os, const bvpl_global_corners &m); +- +- +-void vsl_b_read(vsl_b_istream& is, bvpl_global_corners* m); +- +- +-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_corners* &m); +- +-void vsl_print_summary(std::ostream& os, const bvpl_global_corners* &m); +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx +deleted file mode 100644 +index cac12cb25b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include "bvpl_io_global_pca.h" +- +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_global_pca_125 const & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_global_pca_125 & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream & /*os*/, const bvpl_global_pca_125 & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_global_pca_125* /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_global_pca_125* & /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream& os, const bvpl_global_pca_125* &p) +-{ +- if (p==nullptr) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h +deleted file mode 100644 +index 2858d03895..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h ++++ /dev/null +@@ -1,44 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h +-#ifndef bvpl_io_global_pca_h +-#define bvpl_io_global_pca_h +-//: +-// \file +-// \brief Binary IO for bvpl_global_pca_125. Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-typedef bvpl_global_pca<125> bvpl_global_pca_125; +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & os, bvpl_global_pca_125 const &); +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & is, bvpl_global_pca_125 &m); +- +- +-void vsl_print_summary(std::ostream &os, const bvpl_global_pca_125 &m); +- +- +-void vsl_b_read(vsl_b_istream& is, bvpl_global_pca_125* m); +- +- +-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_pca_125* &m); +- +-void vsl_print_summary(std::ostream& os, const bvpl_global_pca_125* &m); +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h +deleted file mode 100644 +index 8c57308415..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h ++++ /dev/null +@@ -1,75 +0,0 @@ +-// This is bvpl_io_global_taylor.h +-#ifndef bvpl_io_global_taylor_h +-#define bvpl_io_global_taylor_h +- +-//: +-// \file +-// \brief Binary IO for bvpl_global_taylor. Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +- +-//: Binary save parameters to stream. +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_global_taylor const &) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-//: Binary load parameters from stream. +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_global_taylor &p) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-template +-void vsl_print_summary(std::ostream &os, const bvpl_global_taylor &p) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-template +-void vsl_b_read(vsl_b_istream& is, bvpl_global_taylor* p) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-template +-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_taylor* &mp) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-template +-void vsl_print_summary(std::ostream& os, const bvpl_global_taylor* &p) +-{ +- if (p==0) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx +deleted file mode 100644 +index ff1de28596..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include "bvpl_io_pca_error_scenes.h" +- +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_pca_error_scenes const & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_pca_error_scenes & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream & /*os*/, const bvpl_pca_error_scenes & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_pca_error_scenes* /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_pca_error_scenes* & /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream& os, const bvpl_pca_error_scenes* &p) +-{ +- if (p==nullptr) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h +deleted file mode 100644 +index b0e98d6299..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-// This is bvpl_io_pca_error_scenes.h +-#ifndef bvpl_io_pca_error_scenes_h +-#define bvpl_io_pca_error_scenes_h +- +-//: +-// \file +-// \brief Binary IO for bvpl_pca_error_scenes. Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & os, bvpl_kernel const &bvpl_pca_error_scenes); +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & is, bvpl_pca_error_scenes &m); +- +- +-void vsl_print_summary(std::ostream &os, const bvpl_pca_error_scenes &m); +- +- +-void vsl_b_read(vsl_b_istream& is, bvpl_pca_error_scenes* m); +- +- +-void vsl_b_write(vsl_b_ostream& os, const bvpl_pca_error_scenes* &m); +- +-void vsl_print_summary(std::ostream& os, const bvpl_pca_error_scenes* &m); +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx +deleted file mode 100644 +index ba4155da13..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include "bvpl_io_taylor_scenes_map.h" +- +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_taylor_scenes_map const & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_taylor_scenes_map & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream & /*os*/, const bvpl_taylor_scenes_map & ) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_taylor_scenes_map* /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_taylor_scenes_map* & /*p*/) +-{ +- std::cerr << "Error: Trying to save but binary io not implemented\n"; +- return; +-} +- +-void vsl_print_summary(std::ostream& os, const bvpl_taylor_scenes_map* &p) +-{ +- if (p==nullptr) +- os << "NULL PTR"; +- else { +- os << "T: "; +- vsl_print_summary(os, *p); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h +deleted file mode 100644 +index 3900318cd2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h ++++ /dev/null +@@ -1,38 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h +-#ifndef bvpl_io_taylor_scenes_map_h +-#define bvpl_io_taylor_scenes_map_h +-//: +-// \file +-// \brief Binary IO for bvpl_taylor_scenes_map. +-// Not implemented, only declared so it can be stored in the database +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 15-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-//: Binary save parameters to stream. +-void vsl_b_write(vsl_b_ostream & os, bvpl_kernel const &bvpl_taylor_scenes_map); +- +-//: Binary load parameters from stream. +-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_scenes_map &m); +- +-void vsl_print_summary(std::ostream &os, const bvpl_taylor_scenes_map &m); +- +-void vsl_b_read(vsl_b_istream& is, bvpl_taylor_scenes_map* m); +- +-void vsl_b_write(vsl_b_ostream& os, const bvpl_taylor_scenes_map* &m); +- +-void vsl_print_summary(std::ostream& os, const bvpl_taylor_scenes_map* &m); +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt +deleted file mode 100644 +index 8c8f573ab9..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( bvpl_octree_io_test_include test_include.cxx ) +-target_link_libraries( bvpl_octree_io_test_include bvpl_octree_io) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx +deleted file mode 100644 +index 4ddefe5f48..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt +deleted file mode 100644 +index bbc90f7cea..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt ++++ /dev/null +@@ -1,31 +0,0 @@ +-# This is contrib/brl/bseg/bvpl/pro/CMakeLists.txt +-# bvxm's Process Library +- +-# bprb depends on expat and bvxm_pro depends on bprb primarily +-FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +-if(EXPAT_FOUND) +-include_directories( ${BRL_INCLUDE_DIR}/bpro ) +-include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb ) +- +-set(bvpl_octree_pro_sources +- bvpl_octree_processes.h +- bvpl_octree_register.h bvpl_octree_register.cxx +- ) +- +-aux_source_directory(Templates bvpl_octree_pro_sources) +-aux_source_directory(processes bvpl_octree_pro_sources) +-aux_source_directory(processes/pca bvpl_octree_pro_sources) +-aux_source_directory(processes/taylor bvpl_octree_pro_sources) +-aux_source_directory(processes/corners bvpl_octree_pro_sources) +-aux_source_directory(processes/steerable_filters bvpl_octree_pro_sources) +- +- +-vxl_add_library(LIBRARY_NAME bvpl_octree_pro LIBRARY_SOURCES ${bvpl_octree_pro_sources}) +-target_link_libraries(bvpl_octree_pro bvpl_octree_io bvpl_octree bvpl_kernels_io boxm boct boxm_algo_pro boxm_sample boxm_util bprb brdb ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +- +-endif() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx +deleted file mode 100644 +index 5de38b0662..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +-#include +-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx +deleted file mode 100644 +index 9cf83eebc4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_discover_pca_kernels_sptr, "bvpl_discover_pca_kernels_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx +deleted file mode 100644 +index b2e7fa3fed..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_global_corners_sptr, "bvpl_global_corners_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx +deleted file mode 100644 +index f911ce4589..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_global_pca_125_sptr, "bvpl_global_pca_125_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx +deleted file mode 100644 +index 1a079ac413..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_pca_error_scenes_sptr, "bvpl_pca_error_scenes_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx +deleted file mode 100644 +index ee1188aea5..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_taylor_scenes_map_sptr, "bvpl_taylor_scenes_map_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx +deleted file mode 100644 +index 600668ef3f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx ++++ /dev/null +@@ -1,8 +0,0 @@ +-#include +- +-#include +-#include +- +-typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +-BRDB_VALUE_INSTANTIATE(bvpl_global_taylor_sptr, "bvpl_global_taylor_sptr"); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h +deleted file mode 100644 +index 89d5581af3..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h ++++ /dev/null +@@ -1,61 +0,0 @@ +-#ifndef bvpl_octree_processes_h_ +-#define bvpl_octree_processes_h_ +- +-#include +-#include +- +-DECLARE_FUNC_CONS(bvpl_scene_vector_operator_process); +-DECLARE_FUNC_CONS(bvpl_scene_kernel_operator_process); +-DECLARE_FUNC_CONS(bvpl_block_kernel_operator_process); +-DECLARE_FUNC_CONS(bvpl_save_vrml_process); +-DECLARE_FUNC_CONS(bvpl_create_scene_process); +-DECLARE_FUNC_CONS(bvpl_plane_propagate_process); +-DECLARE_FUNC_CONS(bvpl_nonmax_supp_process); +-DECLARE_FUNC_CONS(bvpl_compute_gauss_gradients); +-DECLARE_FUNC_CONS(bvpl_scene_histogram_process); +-DECLARE_FUNC_CONS(bvpl_block_avg_value_process); +-DECLARE_FUNC_CONS(bvpl_grad_scene_to_bin_process); +- +- +-//PCA related +-DECLARE_FUNC_CONS(bvpl_discover_pca_features_process); +-DECLARE_FUNC_CONS(bvpl_compute_pca_test_error_process); +-DECLARE_FUNC_CONS(bvpl_compute_pca_error_scene_process); +-DECLARE_FUNC_CONS(bvpl_compute_pca_error_block_process); +-DECLARE_FUNC_CONS(bvpl_load_pca_error_scenes_process); +-DECLARE_FUNC_CONS(bvpl_add_pca_errors_process); +-DECLARE_FUNC_CONS(bvpl_load_pca_info_process); +-DECLARE_FUNC_CONS(bvpl_pca_project_process); +-DECLARE_FUNC_CONS(bvpl_normalize_pca_training_error_process); +-DECLARE_FUNC_CONS(bvpl_pca_global_statistics_process); +-DECLARE_FUNC_CONS(bvpl_combine_pairwise_statistics_process); +-DECLARE_FUNC_CONS(bvpl_global_pca_process); +-DECLARE_FUNC_CONS(bvpl_init_global_pca_process); +-DECLARE_FUNC_CONS(bvpl_load_global_pca_125_process); +-DECLARE_FUNC_CONS(bvpl_pca_global_proj_error_process); +-DECLARE_FUNC_CONS(bvpl_pca_global_add_error_process); +- +-//Taylor related +-DECLARE_FUNC_CONS(bvpl_load_taylor_scenes_process); +-DECLARE_FUNC_CONS(bvpl_compute_taylor_error_process); +-DECLARE_FUNC_CONS(bvpl_add_taylor_errors_process); +-DECLARE_FUNC_CONS(bvpl_init_global_taylor_process); +-DECLARE_FUNC_CONS(bvpl_compute_taylor_coefficients_process); +-DECLARE_FUNC_CONS(bvpl_explore_coefficient_scene_process); +-DECLARE_FUNC_CONS(bvpl_load_global_taylor_process); +-DECLARE_FUNC_CONS(bvpl_taylor_global_proj_error_process); +-DECLARE_FUNC_CONS(bvpl_taylor_global_add_error_process); +- +-//Corner related +-DECLARE_FUNC_CONS(bvpl_compute_harris_measure_process); +-DECLARE_FUNC_CONS(bvpl_load_global_corners_process); +-DECLARE_FUNC_CONS(bvpl_corner_statistics_process); +-DECLARE_FUNC_CONS(bvpl_threshold_corners_process); +-DECLARE_FUNC_CONS(bvpl_compute_beaudet_measure_process); +- +-//Steerable filters +-DECLARE_FUNC_CONS(bvpl_init_sf_response_scene_process); +-DECLARE_FUNC_CONS(bvpl_compute_sf_raw_response_process); +- +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx +deleted file mode 100644 +index 189cb04ae3..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx ++++ /dev/null +@@ -1,81 +0,0 @@ +-#include "bvpl_octree_register.h" +- +-#include +-#include +-#include +- +-#include "bvpl_octree_processes.h" +-#include +-#include +-#include +-#include +-#include +-#include +- +-void bvpl_octree_register::register_datatype() +-{ +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- REGISTER_DATATYPE(bvpl_taylor_scenes_map_sptr); +- REGISTER_DATATYPE(bvpl_pca_error_scenes_sptr); +- REGISTER_DATATYPE(bvpl_discover_pca_kernels_sptr); +- REGISTER_DATATYPE(bvpl_global_pca_125_sptr); +- REGISTER_DATATYPE(bvpl_global_taylor_sptr); +- REGISTER_DATATYPE(bvpl_global_corners_sptr); +- +-} +- +-void bvpl_octree_register::register_process() +-{ +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_vector_operator_process, "bvplSceneVectorOperatorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_kernel_operator_process, "bvplSceneKernelOperatorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_block_kernel_operator_process, "bvplBlockKernelOperatorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_save_vrml_process, "bvplSaveVrmlProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_scene_process, "bvplCreateSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_plane_propagate_process, "bvplPlanePropagateProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_nonmax_supp_process, "bvplNonmaxSuppProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_gauss_gradients, "bvplComputeGaussGradients"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_test_error_process, "bvplComputeTestErrorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_histogram_process, "bvplSceneHistorgramProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_grad_scene_to_bin_process, "bvplGradSceneToBinProcess"); +- +- //PCA related +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_discover_pca_features_process, "bvplDiscoverPCAFeaturesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_error_scene_process, "bvplComputePCAErrorSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_error_block_process, "bvplComputePCAErrorBlockProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_pca_error_scenes_process, "bvplLoadPCAErrorSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_block_avg_value_process, "bvplBlockAvgValueProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_add_pca_errors_process, "bvplAddPCAErrorsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_pca_info_process, "bvplLoadPCAInfoProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_pca_project_process, "bvplPCAProjectProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_normalize_pca_training_error_process, "bvplNormalizePCATrainingErrorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_pca_global_statistics_process, "bvplPCAGlobalStatisticsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_combine_pairwise_statistics_process, "bvplCombinePairwiseStatisticsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_global_pca_process, "bvplGlobalPCAProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_global_pca_process, "bvplInitGlobalPCAProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_pca_125_process, "bvplLoadGlobalPCA125Process"); +- REG_PROCESS_FUNC_CONS2(bvpl_pca_global_proj_error_process); +- REG_PROCESS_FUNC_CONS2(bvpl_pca_global_add_error_process); +- +- //Taylor related +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_taylor_scenes_process, "bvplLoadTaylorScenesProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_taylor_error_process, "bvplComputeTaylorErrorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_add_taylor_errors_process, "bvplAddTaylorErrorsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_global_taylor_process, "bvplInitGlobalTaylorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_taylor_coefficients_process, "bvplComputeTaylorCoefficients"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_explore_coefficient_scene_process, "bvplExploreCoefficientSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_taylor_process, "bvplLoadGlobalTaylorProcess"); +- REG_PROCESS_FUNC_CONS2(bvpl_taylor_global_proj_error_process); +- REG_PROCESS_FUNC_CONS2(bvpl_taylor_global_add_error_process); +- +- //Corner related +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_threshold_corners_process, "bvplThresholdCornersProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_harris_measure_process, "bvplComputeHarrisMeasureProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_corners_process, "bvplLoadGlobalCornersProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_corner_statistics_process, "bvplCornerStatisticsProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_beaudet_measure_process, "bvplComputeBeaudetMeasureProcess"); +- +- //Steerable filters +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_sf_response_scene_process, "bvplInitSFResponseSceneProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_sf_raw_response_process, "bvplComputeSFRawResponseProcess"); +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h +deleted file mode 100644 +index a72acdd9a2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-#ifndef bvpl_octree_register_h_ +-#define bvpl_octree_register_h_ +- +-class bvpl_octree_register +-{ +- public: +- static void register_datatype(); +- static void register_process(); +-}; +- +-#endif // bvpl_octree_register_h_ +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx +deleted file mode 100644 +index 5a37180f2d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx ++++ /dev/null +@@ -1,81 +0,0 @@ +-//: +-// \file +-// \brief A process to add taylor error at a percentage of voxels in a block +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace bvpl_block_avg_value_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_block_avg_value_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_block_avg_value_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation +- input_types_[i++] = "int" ; //block index in x-dimension +- input_types_[i++] = "int" ; //block index in y-dimension +- input_types_[i++] = "int" ; //block index in z-dimension +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "double"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_block_avg_value_process(bprb_func_process& pro) +-{ +- using namespace bvpl_block_avg_value_process_globals; +- +- //get inputs +- unsigned i =0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- auto fraction_nsamples = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!scene_base){ +- std::cerr << "Error in bvpl_block_avg_value_process: Null error scene\n"; +- return false; +- } +- auto* scene = dynamic_cast >*> (scene_base.as_pointer()); +- if (!scene){ +- std::cerr << "Error in bvpl_block_avg_value_process: Error scene is of incorrect type\n"; +- return false; +- } +- //sum errors within block +- auto scene_ncells = (double)scene->size(); +- scene->load_block(block_i,block_j,block_k); +- auto tree_ncells = (double)scene->get_block(block_i,block_j,block_k)->get_tree()->size(); +- double nsamples = scene_ncells * fraction_nsamples; +- +- //number of samples - 10% of total number of leaf-cells +- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples); +- std::cout << "Number of samples in the scene " << scene_ncells << '\n' +- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << std::endl; +- double avg_value = bvpl_average_value(scene,block_i, block_j, block_k, tree_nsamples); +- +- //store output +- pro.set_output_val(0, avg_value); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx +deleted file mode 100644 +index 0602d6d2ed..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx ++++ /dev/null +@@ -1,208 +0,0 @@ +-//: +-// \file +-// \brief +-// \author Isabel Restrepo +-// \date 1-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#include +- +-namespace bvpl_block_kernel_operator_process_globals +-{ +- constexpr unsigned n_inputs_ = 8; +- constexpr unsigned n_outputs_ = 0; +-} +- +-//: process takes 6 inputs and has 1 output. +-// * input[0]: The boxm_scene +-// * input[1]: The kernels; bvpl_kernel_vector_sptr +-// * input[2,3,4]: block index (i,j,k); +-// * input[5]: String identifying functor type +-// * input[6]: Output path to a dir where to store response blocks +- +- +-bool bvpl_block_kernel_operator_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_block_kernel_operator_process_globals; +- +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "bvpl_kernel_sptr"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "vcl_string"; +- input_types_[i++] = "vcl_string"; +- input_types_[i++] = "double"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool bvpl_block_kernel_operator_process(bprb_func_process& pro) +-{ +- using namespace bvpl_block_kernel_operator_process_globals; +- +- if (pro.n_inputs() < n_inputs_) +- { +- std::cerr << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << '\n'; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- bvpl_kernel_sptr kernel = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- std::string functor_name = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- auto cell_length = pro.get_input(i++); +- //short level = 0; +- +- //print inputs +- std::cout << "In bvpl_block_kernel_operator:\n" +- << "Index(i,j,k) : (" << block_i << ',' << block_j << ',' << block_k << ")\n" +- << "Functor Name: " << functor_name << '\n' +- << "Output path: " << output_path << '\n' +- << "Cell length" << cell_length << std::endl; +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cerr << " :-- Grid is not valid!\n"; +- return false; +- } +- +- if (!kernel) { +- std::cerr << pro.name() << " :-- Kernel is not valid!\n"; +- return false; +- } +- +- +- switch (scene_base->appearence_model()) +- { +- case BSTA_GAUSS_F1: +- { +- typedef bsta_num_obs gauss_type; +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- +- +- //parameters of the output scene are the same as those of the input scene +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "gauss_response_scene"); +- scene_out->set_appearance_model(BSTA_GAUSS_F1); +- if (!vul_file::exists(output_path + "/gauss_response_scene.xml")) +- scene_out->write_scene("/gauss_response_scene.xml"); +- +- //parameters of the output scene are the same as those of the input scene +- boxm_scene > *valid_scene = +- new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- valid_scene->set_paths(output_path, "valid_scene"); +- valid_scene->set_appearance_model(BOXM_BOOL); +- if (!vul_file::exists(output_path + "/valid_scene.xml")) +- valid_scene->write_scene("/valid_scene.xml"); +- +- if (functor_name == "gauss_convolution") { +- bvpl_gauss_convolution_functor functor; +- bvpl_block_kernel_operator block_oper; +- //operate on scene +- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length); +- //clean memory +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- +- return true; +- } +- else if (functor_name == "positive_gauss_convolution") { +- bvpl_positive_gauss_conv_functor functor; +- bvpl_block_kernel_operator block_oper; +- //operate on scene +- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length); +- //clean memory +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- +- return true; +- } +- else +- return false; +- +- break; +- } +- case BOXM_FLOAT: +- { +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- +- //parameters of the output scene are the same as those of the input scene +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "response_scene"); +- scene_out->set_appearance_model(BOXM_FLOAT); +- if (!vul_file::exists(output_path + "/float_response_scene.xml")) +- scene_out->write_scene("/float_response_scene.xml"); +- +- boxm_scene > *valid_scene = +- new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- valid_scene->set_paths(output_path, "valid_scene"); +- valid_scene->set_appearance_model(BOXM_BOOL); +- if (!vul_file::exists(output_path + "/valid_scene.xml")) +- valid_scene->write_scene("/valid_scene.xml"); +- +- if (functor_name == "edge_algebraic_mean") +- { +- bvpl_edge_algebraic_mean_functor functor; +- bvpl_block_kernel_operator block_oper; +- //operate on scene +- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length); +- +- //clean memory +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- return true; +- } +- else if (functor_name == "algebraic") +- { +- bvpl_algebraic_functor functor; +- bvpl_block_kernel_operator block_oper; +- //operate on scene +- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length); +- +- //clean memory +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- return true; +- } +- else +- return false; +- +- break; +- } +- default: +- std::cout << "bvpl_block_kernel_operator_process: undefined APM type" << std::endl; +- return false; +- } +- return false; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx +deleted file mode 100644 +index 126deb3ac8..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx ++++ /dev/null +@@ -1,86 +0,0 @@ +-//: +-// \file +-// \brief A process to run derivatives of gaussian in 3 dimensions - x, y, x +-// \author Isabel Restrepo +-// \date 13-Oct-2010 +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +- +-#include +- +-//: global variables +-namespace bvpl_compute_gauss_gradients_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//: sets input and output types +-bool bvpl_compute_gauss_gradients_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_gauss_gradients_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; //input scene +- input_types_[1] = "vcl_string"; //output path +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; //output scene +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_compute_gauss_gradients(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_gauss_gradients_globals; +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- +- //Create the factory and get the vector of kernels +- bvpl_gauss3d_x_kernel_factory factory(1.0f,1.0f,1.0f); +- bvpl_create_directions_xyz dir; +- bvpl_kernel_vector_sptr kernels = factory.create_kernel_vector(dir); +- +- //get scene +- typedef boct_tree float_tree_type; +- typedef boct_tree > grad_tree_type; +- +- if (auto *scene_in = dynamic_cast* >(scene_base.as_pointer())) +- { +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "float_gradient_scene"); +- scene_out->set_appearance_model(VNL_FLOAT_3); +- scene_out->write_scene("float_gradient_scene.xml"); +- +- bvpl_algebraic_functor functor; +- bvpl_scene_vector_operator vector_oper; +- vector_oper.operate(*scene_in, functor, kernels, *scene_out); +- //store output +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- +- bsta_histogram magnitude_hist; +- bvpl_compute_scene_statistics(scene_out, magnitude_hist); +- std::cout << "Histogram:\n" << magnitude_hist << std::endl; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx +deleted file mode 100644 +index e175191e55..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx ++++ /dev/null +@@ -1,88 +0,0 @@ +-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx +-#include +-#include +-#include +-//: +-// \file +-// \brief A process loading xml parameters of a boxm_scene of types specific to bvpl_octree +-// +-// \author Isabel Restrepo +-// \date Nov 15, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +-#include +-//:global variables +-namespace bvpl_create_scene_process_globals +-{ +- //this process takes no inputs +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//:sets input and output types +-bool bvpl_create_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_create_scene_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-//:creates a scene from parameters +-bool bvpl_create_scene_process(bprb_func_process& pro) +-{ +- using namespace bvpl_create_scene_process_globals; +- std::string fname = pro.get_input(0); +- +- boxm_scene_parser parser; +- +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- scene_ptr->load_scene(fname, parser); +- if (scene_ptr->appearence_model() == BVPL_SAMPLE_FLOAT) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else if (scene_ptr->appearence_model() == BVPL_SAMPLE_BSTA_GAUSS_F1) { +- if (!scene_ptr->multi_bin()) +- { +- typedef boct_tree > > tree_type; +- auto* scene = new boxm_scene(); +- scene->load_scene(parser); +- scene_ptr = scene; +- } +- } +- else { +- std::cerr << "bvpl_create_scene_process: undefined datatype\n"; +- return false; +- } +- +- //store output +- pro.set_output_val(0, scene_ptr); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx +deleted file mode 100644 +index 39195ec048..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx ++++ /dev/null +@@ -1,136 +0,0 @@ +-//: +-// \file +-// \brief A process to save a gradient scene to a flat binary file +-// \author Isabel Restrepo +-// \date 3-Aug-2011 +- +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-//:global variables +-namespace bvpl_grad_scene_to_bin_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_grad_scene_to_bin_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_grad_scene_to_bin_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i =0; +- input_types_[i++] = "boxm_scene_base_sptr"; //alpha scene +- input_types_[i++] = "boxm_scene_base_sptr"; //gradient scene +- input_types_[i++] = "vcl_string"; //output binary file +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_grad_scene_to_bin_process(bprb_func_process& pro) +-{ +- using namespace bvpl_grad_scene_to_bin_process_globals; +- +- //get inputs +- unsigned i = 0; +- boxm_scene_base_sptr alpha_scene_base = pro.get_input(i++); +- boxm_scene_base_sptr grad_scene_base = pro.get_input(i++); +- std::string output_file = pro.get_input(i++); +- +- //get scene +- typedef boct_tree float_tree_type; +- typedef boct_tree > grad_tree_type; +- +- std::ofstream os(output_file.c_str(), std::ios::out); +- +- if (auto *alpha_scene = dynamic_cast* >(alpha_scene_base.as_pointer())) +- { +- if (auto *grad_scene = dynamic_cast* >(grad_scene_base.as_pointer())) +- { +- double cell_length = alpha_scene->finest_cell_length(); +- short finest_level = alpha_scene->finest_level(); +- +- bool read_only = true; +- +- boxm_cell_iterator alpha_iter = alpha_scene->cell_iterator(&boxm_scene::load_block_and_neighbors, read_only); +- alpha_iter.begin(); +- +- boxm_cell_iterator grad_iter = grad_scene->cell_iterator(&boxm_scene::load_block, read_only); +- grad_iter.begin(); +- +- long unsigned n_grads = 0; +- +- while ( !(alpha_iter.end() || grad_iter.end()) ) +- { +- boct_tree_cell *alpha_cell = *alpha_iter; +- boct_tree_cell > *grad_cell = *grad_iter; +- +- boct_loc_code grad_code = grad_cell->get_code(); +- boct_loc_code alpha_code = alpha_cell->get_code(); +- +- //if level and location code of cells isn't the same then continue +- if ((alpha_cell->level() != grad_cell->level()) || !(alpha_code.isequal(&grad_code))) { +- std::cerr << " Input and output cells don't have the same structure\n"; +- ++alpha_iter; +- ++grad_iter; +- continue; +- } +- +- //we are only interested in finest resolution +- if ((!(alpha_cell->level() == finest_level)) || !alpha_cell->is_leaf()) { +- ++alpha_iter; +- ++grad_iter; +- continue; +- } +- +- vgl_point_3d centroid = alpha_iter.global_centroid(); +- vnl_vector_fixed< float,3 > grad = grad_cell->data(); +- float p_x = 1.0f - (float)std::exp(- (alpha_cell->data() * cell_length )); +-#if 0 +- vsl_b_write(os, (float)centroid.x()); +- vsl_b_write(os, (float)centroid.y()); +- vsl_b_write(os, (float)centroid.z()); +- vsl_b_write(os, grad[0]); +- vsl_b_write(os, grad[1]); +- vsl_b_write(os, grad[2]); +- vsl_b_write(os, p_x); +-#endif +- +- os << (float)centroid.x() << ' ' +- << (float)centroid.y() << ' ' +- << (float)centroid.z() << ' ' +- << grad[0] << ' ' +- << grad[1] << ' ' +- << grad[2] << ' ' +- << p_x << '\n'; +- +- ++alpha_iter; +- ++grad_iter; +- n_grads++; +- } +- +- grad_scene->unload_active_blocks(); +- alpha_scene->unload_active_blocks(); +- os.close(); +- std::cout << "Wrote " << n_grads << " gradients\n"; +- } +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx +deleted file mode 100644 +index b53398692b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx ++++ /dev/null +@@ -1,178 +0,0 @@ +-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for spreading the plane information of the cell to the neighbors +-// \author Gamze Tunali +-// \date Mar 19, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +- +-namespace bvpl_nonmax_supp_process_globals +-{ +- constexpr unsigned int n_inputs_ = 4; +- constexpr unsigned int n_outputs_ = 1; +- //Define parameters here +-} +- +- +-//: set input and output types +-bool bvpl_nonmax_supp_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_nonmax_supp_process_globals; +- +- // process takes 4 inputs: +- //input[0]: The scene +- //input[1]: the scene path for the output scene +- //input[2]: block prefix for the output scene +- //input[3]: the filename for the new scene xml file +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "vcl_string"; +- +- // process has 1 output: +- // output[0]: the new scene with updated cell information +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool bvpl_nonmax_supp_process(bprb_func_process& pro) +-{ +- using namespace bvpl_nonmax_supp_process_globals; +- +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string scene_path = pro.get_input(1); +- std::string block_prefix = pro.get_input(2); +- std::string scene_filename = pro.get_input(3); +- boxm_scene_base_sptr output_scene_sptr; +- +- // only applies to the edge_line type of scenes +- if (scene_base->appearence_model() == BOXM_EDGE_LINE) { +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- auto *scene=dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- +- auto *output_scene=new boxm_scene(*scene); +- output_scene->set_paths(scene_path, block_prefix); +- output_scene_sptr = output_scene; +- +- // create a kernel for 3x3 neighborhood +- bvpl_kernel_iterator k_iter; +- vgl_point_3d min_pt(-1,-1,-1); +- vgl_point_3d max_pt(1,1,1); +- for (int i=min_pt.x(); i<=max_pt.x(); i++) { +- for (int j=min_pt.y(); j<=max_pt.y(); j++) { +- for (int k=min_pt.z(); k<=max_pt.z(); k++) { +- k_iter.insert(vgl_point_3d(i,j,k),bvpl_kernel_dispatch(1.0f)); +- } +- } +- } +- bvpl_kernel_sptr kernel= new bvpl_kernel(k_iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0), 0.0f, vgl_vector_3d(3,3,3),min_pt,max_pt); +- +- boxm_block_iterator iter(scene); +- boxm_block_iterator output_iter(output_scene); +- iter.begin(); +- output_iter.begin(); +- +- while (!iter.end()) +- { +- scene->load_block(iter.index()); +- output_scene->load_block(iter.index()); +- boxm_block* block = *iter; +- boxm_block* output_block = *output_iter; +- +- tree_type* tree = block->get_tree(); +- std::vector cells = tree->leaf_cells(); +- +- tree_type* output_tree=tree->clone(); +- std::vector output_cells = output_tree->leaf_cells(); +- +- bvpl_octree_neighbors > oper(tree); +- for (unsigned i=0; i neighb_cells; +- oper.neighbors(kernel, cells[i], neighb_cells); +- +- float residual = cell->data().residual_; +- +- bool min=true; +- for (unsigned n=0; n cell_code=cell->code_; +- boct_loc_code n_code = neighbor->code_; +- bool itself = n_code.isequal(&cell_code); +- // do not include itself in the list +- if (!itself) { +- float r = neighbor->data().residual_; +- if ( r < residual) +- min=false; +- } +- +- if (min) { +- boxm_inf_line_sample data = cell->data(); +- output_cell->set_data(data); +- } +- } +- } +- output_block->delete_tree(); +- output_block->set_tree(output_tree); +- output_scene->write_active_block(); +- iter++; +- } +- output_scene->write_scene(scene_filename); +- } +- +- //store output +- pro.set_output_val(0, output_scene_sptr); +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx +deleted file mode 100644 +index 2c503cdbf2..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx ++++ /dev/null +@@ -1,209 +0,0 @@ +-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx +-#include +-#include +-#include +-#include +-#include +-//: +-// \file +-// \brief A process for spreading the plane information of the cell to the neighbors +-// \author Gamze Tunali +-// \date Mar 19, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#ifdef _MSC_VER +-# include +-#endif +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +- +-struct ltstr +-{ +- bool operator()(const boxm_plane_obs & p1, const boxm_plane_obs & p2) const +- { +- if(p1.plane_.a()p2.plane_.a()) +- return false; +- else +- { +- if(p1.plane_.b()p2.plane_.b()) +- return false; +- else +- { +- if(p1.plane_.c()p2.plane_.c()) +- return false; +- else +- { +- if(p1.plane_.d() input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "vcl_string"; +- +- // process has 1 output: +- // output[0]: the new scene with updated cell information +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- if (!pro.set_input_types(input_types_)) +- return false; +- +- if (!pro.set_output_types(output_types_)) +- return false; +- +- return true; +-} +- +-//: Execute the process +-bool bvpl_plane_propagate_process(bprb_func_process& pro) +-{ +- using namespace bvpl_plane_propagate_process_globals; +- +- +- // check number of inputs +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl; +- return false; +- } +- +- // get the inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string scene_path = pro.get_input(1); +- std::string block_prefix = pro.get_input(2); +- std::string scene_filename = pro.get_input(3); +- boxm_scene_base_sptr output_scene_sptr; +- // only applies to the edge_line type of scenes +- if (scene_base->appearence_model() == BOXM_EDGE_TANGENT_LINE) { +- typedef boct_tree > tree_type; +- typedef boct_tree_cell > cell_type; +- auto *scene=dynamic_cast*>(scene_base.ptr()); +- if (!scene) { +- std::cerr << "error casting scene_base to scene\n"; +- return false; +- } +- +- auto *output_scene=new boxm_scene(*scene); +- output_scene->set_paths(scene_path, block_prefix); +- output_scene_sptr = output_scene; +- // create a kernel for 3x3 neighborhood +- bvpl_kernel_iterator k_iter; +- vgl_point_3d min_pt(-1,-1,-1); +- vgl_point_3d max_pt(1,1,1); +- for (int i=min_pt.x(); i<=max_pt.x(); i++) { +- for (int j=min_pt.y(); j<=max_pt.y(); j++) { +- for (int k=min_pt.z(); k<=max_pt.z(); k++) { +- k_iter.insert(vgl_point_3d(i,j,k),bvpl_kernel_dispatch(1.0f)); +- } +- } +- } +- bvpl_kernel_sptr kernel= new bvpl_kernel(k_iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0), 0.0f, vgl_vector_3d(3,3,3),min_pt,max_pt); +- +- boxm_block_iterator iter(scene); +- boxm_block_iterator output_iter(output_scene); +- iter.begin(); +- output_iter.begin(); +- +- while (!iter.end()) +- { +- scene->load_block(iter.index()); +- output_scene->load_block(iter.index()); +- boxm_block* block = *iter; +- boxm_block* output_block = *output_iter; +- +- tree_type* tree = block->get_tree(); +- std::vector cells = tree->leaf_cells(); +- +- tree_type* output_tree=tree->clone(); +- std::vector output_cells = output_tree->leaf_cells(); +- +- bvpl_octree_neighbors > oper(tree); +- for (unsigned i=0; i neighb_cells; +- oper.neighbors(kernel, cells[i], neighb_cells); +- std::set,ltstr> planes; +- +- for (auto neighbor : neighb_cells) { +- boct_loc_code cell_code=cell->code_; +- boct_loc_code n_code = neighbor->code_; +- bool itself = n_code.isequal(&cell_code); +- if (!itself) { +- std::vector > observations = neighbor->data().obs_list(); +- boxm_edge_tangent_sample data=output_cell->data(); +- data.insert(observations); +- output_cell->set_data(data); +- } +- } +- } +- // std::set,ltstr >::iterator iter1=planes.begin(); +- // boxm_edge_tangent_sample data; +- // for(;iter1!=planes.end();iter1++) +- // { +- // data.insert(*iter1); +- // } +- // output_cell->set_data(data); +- //} +- output_block->delete_tree(); +- output_block->set_tree(output_tree); +- output_scene->write_active_block(); +- iter++; +- } +- output_scene->write_scene(scene_filename); +- } +- +- //store output +- pro.set_output_val(0, output_scene_sptr); +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx +deleted file mode 100644 +index 5adb8cc4ec..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx ++++ /dev/null +@@ -1,89 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx +-#include +-//: +-// \file +-// \brief process saves a boxm_scene of kernel responses to a vrml file +-// +-// \author Isabel Restrepo +-// \date December 10, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#include +-#include +- +- +-namespace bvpl_save_vrml_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 0; +-} +- +-//: process takes 3 inputs and has no outputs. +-// input[0]: The scene +-// input[1]: The vector of kernels +-// input[2]: Path to output vrml file +-// No outputs +- +-bool bvpl_save_vrml_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_save_vrml_process_globals; +- +- //process takes 3 inputs but has no outputs +- std::vector output_types_(n_outputs_); +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "bvpl_kernel_vector_sptr"; +- input_types_[2] = "vcl_string"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool bvpl_save_vrml_process(bprb_func_process& pro) +-{ +- using namespace bvpl_save_vrml_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- bvpl_kernel_vector_sptr kernel_vector = pro.get_input(1); +- std::string vrml_path = pro.get_input(2); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed +- +- std::ofstream ofs(vrml_path.c_str()); +- +- if (auto *scene_in = +- dynamic_cast > >* > (scene_base.as_pointer())) +- { +- bvpl_octree_vrml_util::write_scene_as_disks(ofs, scene_in, kernel_vector); +- } +- else if (auto *scene_in = +- dynamic_cast > > >* >(scene_base.as_pointer())) +- { +- bvpl_octree_vrml_util::write_scene_as_disks(ofs, scene_in, kernel_vector); +- } +- else { +- std::cerr << "In bvpl_save_vrml_process: Unsupported scene type\n"; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx +deleted file mode 100644 +index f3d93180ba..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx ++++ /dev/null +@@ -1,66 +0,0 @@ +-//: +-// \file +-// \brief Process to explore the histogram of a scene +-// \author Isabel Restrepo +-// \date 18-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_scene_histogram_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_scene_histogram_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_histogram_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_scene_histogram_process(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_histogram_process_globals; +- +- //get inputs +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- +- if (!scene_base){ +- std::cerr << "Null scene\n"; +- return false; +- } +- +- switch (scene_base->appearence_model()) +- { +- case BOXM_FLOAT: +- { +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- bsta_histogram hist; +- bvpl_compute_scene_statistics(scene_in, hist); +- hist.pretty_print(); +- break; +- } +- default: +- std::cout << "bvpl_block_kernel_operator_process: undefined APM type" << std::endl; +- return false; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx +deleted file mode 100644 +index 9d7c20ba2c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx ++++ /dev/null +@@ -1,179 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx +-#include +-//: +-// \file +-// \brief A class for running a kernel to a boxm_scene +-// \author Isabel Restrepo +-// \date January 29, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-#include +-#include +- +-namespace bvpl_scene_kernel_operator_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: process takes 5 inputs and has 1 output. +-// * input[0]: The boxm_scene +-// * input[1]: The kernel +-// * input[2]: The grid type: +-// - float +-// - opinion +-// - ... +-// * input[3]: String identifying functor type +-// * input[4]: Output path to a dir where to store, id octree and response octree +-// +-// * output[0]: Output scene with response and kernel id +- +-bool bvpl_scene_kernel_operator_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_kernel_operator_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "bvpl_kernel_sptr"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool bvpl_scene_kernel_operator_process(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_kernel_operator_process_globals; +- +- if (pro.n_inputs() < n_inputs_) +- { +- std::cerr << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << '\n'; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- bvpl_kernel_sptr kernel = pro.get_input(i++); +- std::string datatype = pro.get_input(i++); +- std::string functor_name = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- //short level = 0; +- +- //print inputs +- std::cout << "In bvpl_scene_kernel_operator:\n" +- << "Datatype: " << datatype << std::endl +- << "Functor Name: " << functor_name << std::endl; +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cerr << " :-- Grid is not valid!\n"; +- return false; +- } +- +- if ( !kernel ) { +- std::cerr << pro.name() << " :-- Kernel is not valid!\n"; +- return false; +- } +- +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- +- if (datatype == "bsta_gauss_f1") +- { +- typedef bsta_num_obs gauss_type; +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- double finest_cell_length = scene_in->finest_cell_length(); +- kernel->set_voxel_length(finest_cell_length); +- +- //parameters of the output scene are the same as those of the input scene +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "gauss_response_scene"); +- scene_out->set_appearance_model(BSTA_GAUSS_F1); +- scene_out->write_scene("/gauss_response_scene.xml"); +- +- if (functor_name == "gauss_convolution") { +- bvpl_gauss_convolution_functor functor; +- bvpl_scene_kernel_operator scene_oper; +- //operate on scene +- scene_oper.operate(*scene_in, functor, kernel, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- return true; +- } +- else if (functor_name == "positive_gauss_convolution") { +- bvpl_positive_gauss_conv_functor functor; +- bvpl_scene_kernel_operator scene_oper; +- //operate on scene +- scene_oper.operate(*scene_in, functor, kernel, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- +- //clean memory +- scene_in->unload_active_blocks(); +- scene_out->unload_active_blocks(); +- +- return true; +- } +- return false; +- } +- else if (datatype == "float") +- { +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- double finest_cell_length = scene_in->finest_cell_length(); +- kernel->set_voxel_length(finest_cell_length); +- //parameters of the output scene are the same as those of the input scene +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "response_scene"); +- scene_out->set_appearance_model(BOXM_FLOAT); +- scene_out->write_scene("/float_response_scene.xml"); +- +- if (functor_name == "edge_algebraic_mean") { +- bvpl_edge_algebraic_mean_functor functor; +- bvpl_scene_kernel_operator scene_oper; +- //operate on scene +- scene_oper.operate(*scene_in, functor, kernel, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- return true; +- } +- else if (functor_name == "algebraic") { +- bvpl_algebraic_functor functor; +- bvpl_scene_kernel_operator scene_oper; +- //operate on scene +- scene_oper.operate(*scene_in, functor, kernel, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- return true; +- } +- else +- return false; +- } +- else +- return false; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx +deleted file mode 100644 +index 74762468c1..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx ++++ /dev/null +@@ -1,151 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx +-#include +-//: +-// \file +-// \brief A class for successively running a kernel(of a vector), applying non-max suppression and combining with previous result +-// \author Isabel Restrepo +-// \date December 2, 2009 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-namespace bvpl_scene_vector_operator_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: process takes 6 inputs and has 1 output. +-// * input[0]: The boxm_scene +-// * input[1]: The kernels; bvpl_kernel_vector_sptr +-// * input[2]: The grid type: +-// - float +-// - opinion +-// - ... +-// * input[3]: String identifying octree_vector_operator (e.g. max) +-// * input[4]: String identifying functor type +-// * input[5]: Output path to a dir where to store, id octree and response octree +-// +-// * output[0]: Output scene with response and kernel id +- +- +-bool bvpl_scene_vector_operator_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_vector_operator_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "bvpl_kernel_vector_sptr"; +- input_types_[2] = "vcl_string"; +- input_types_[3] = "vcl_string"; +- input_types_[4] = "vcl_string"; +- input_types_[5] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool bvpl_scene_vector_operator_process(bprb_func_process& pro) +-{ +- using namespace bvpl_scene_vector_operator_process_globals; +- +- if (pro.n_inputs() < n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- bvpl_kernel_vector_sptr kernel_vec = pro.get_input(i++); +- std::string datatype = pro.get_input(i++); +- std::string operator_name = pro.get_input(i++); +- std::string functor_name = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Grid is not valid!\n"; +- return false; +- } +- +- if ( !kernel_vec ) { +- std::cout << pro.name() << " :-- Kernel is not valid!\n"; +- return false; +- } +- +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- +- if (datatype == "float") +- { +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- +- //parameters of the output scene are the same as thos of the input scene +- boxm_scene > > *scene_out = +- new boxm_scene > >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim()); +- scene_out->set_paths(output_path, "response_scene"); +- scene_out->set_appearance_model(BVPL_SAMPLE_FLOAT); +- scene_out->write_scene("/response_scene.xml"); +- if (operator_name == "max_vector_operator") +- { +- bvpl_max_vector_operator max_oper; +- +- if (functor_name == "edge_geometric_mean") { +- bvpl_edge_geometric_mean_functor functor; +- bvpl_scene_vector_operator scene_oper; +- scene_oper.operate(*scene_in, functor, kernel_vec, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- return true; +- } +- } +- } +- if (datatype == "bsta_gauss_f1") +- { +- typedef bsta_num_obs gauss_type; +- typedef boct_tree tree_type; +- auto *scene_in = static_cast* > (scene_base.as_pointer()); +- +- //parameters of the output scene are the same as thos of the input scene +- boxm_scene > > *scene_out = +- new boxm_scene > >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim()); +- scene_out->set_paths(output_path, "response_scene"); +- scene_out->set_appearance_model(BVPL_SAMPLE_BSTA_GAUSS_F1); +- scene_out->write_scene("/response_scene.xml"); +- if (operator_name == "max_vector_operator") +- { +- bvpl_max_vector_operator max_oper; +- +- if (functor_name == "gauss_convolution") { +- bvpl_gauss_convolution_functor functor; +- bvpl_scene_vector_operator scene_oper; +- scene_oper.operate(*scene_in, functor, kernel_vec, *scene_out); +- scene_ptr = scene_out; +- pro.set_output_val(0, scene_ptr); +- return true; +- } +- } +- return false; +- } +- else +- return false; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx +deleted file mode 100644 +index 93af3679c8..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx ++++ /dev/null +@@ -1,64 +0,0 @@ +-//: +-// \file +-// \brief A process to compute corner measure (beaudet) +-// \author Isabel Restrepo +-// \date 27-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_compute_beaudet_measure_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_compute_beaudet_measure_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_beaudet_measure_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; +- input_types_[i++] = "bvpl_global_corners_sptr" ; +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_beaudet_measure_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_beaudet_measure_process_globals; +- +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- bvpl_global_corners_sptr global_corners = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!(global_taylor && global_corners)) +- return false; +- +- global_corners->compute_beaudet_corners(global_taylor, scene_id, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx +deleted file mode 100644 +index 94d872196d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx ++++ /dev/null +@@ -1,65 +0,0 @@ +-//: +-// \file +-// \brief A process to compute corner measure (Harris) +-// \author Isabel Restrepo +-// \date 20-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_compute_harris_measure_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_compute_harris_measure_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_harris_measure_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; +- input_types_[i++] = "bvpl_global_corners_sptr" ; +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_harris_measure_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_harris_measure_process_globals; +- +- //get inputs +- unsigned i = 0; +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- bvpl_global_corners_sptr global_corners = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- +- if (!(global_taylor && global_corners)) +- return false; +- +- global_corners->compute_laptev_corners(global_taylor, scene_id, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx +deleted file mode 100644 +index 16f6bd1cd0..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx ++++ /dev/null +@@ -1,57 +0,0 @@ +-//: +-// \file +-// \brief A process to compute corner measure (Harris) +-// \author Isabel Restrepo +-// \date 20-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_corner_statistics_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_corner_statistics_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_corner_statistics_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; +- input_types_[i++] = "bvpl_global_corners_sptr" ; +- input_types_[i++] = "int"; //scene id +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_corner_statistics_process(bprb_func_process& pro) +-{ +- using namespace bvpl_corner_statistics_process_globals; +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- bvpl_global_corners_sptr global_corners = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- +- if (!(global_taylor && global_corners)) +- return false; +- +- global_corners->explore_corner_statistics(global_taylor, scene_id); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx +deleted file mode 100644 +index 9c003728ca..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \brief +-// \author Isabel Restrepo +-// \date 21-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//: global variables +-namespace bvpl_load_global_corners_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//: sets input and output types +-bool bvpl_load_global_corners_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_global_corners_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_global_corners_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_load_global_corners_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_global_corners_process_globals; +- +- // get inputs +- std::string corners_file = pro.get_input(0); +- auto *global_corners = new bvpl_global_corners(corners_file); +- +- // store output +- pro.set_output_val(0, global_corners); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx +deleted file mode 100644 +index af283e13ec..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx ++++ /dev/null +@@ -1,61 +0,0 @@ +-//: +-// \file +-// \brief A process to compute corner measure (Harris) +-// \author Isabel Restrepo +-// \date 20-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_threshold_corners_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_threshold_corners_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_threshold_corners_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; +- input_types_[i++] = "bvpl_global_corners_sptr" ; +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "float"; //threshold +- input_types_[i++] = "vcl_string"; //output path for thresholded scenes +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_threshold_corners_process(bprb_func_process& pro) +-{ +- using namespace bvpl_threshold_corners_process_globals; +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- bvpl_global_corners_sptr global_corners = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- auto corner_thresh = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- +- if (!(global_taylor && global_corners)) +- return false; +- +- global_corners->threshold_laptev_corners(global_taylor, scene_id, corner_thresh, output_path); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx +deleted file mode 100644 +index c4eebb2560..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx ++++ /dev/null +@@ -1,94 +0,0 @@ +-//: +-// \file +-// \brief A process to add Taylor error at a percentage of voxels in a block +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-//:global variables +-namespace bvpl_add_pca_errors_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_add_pca_errors_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_add_pca_errors_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_pca_error_scenes_sptr"; +- input_types_[i++] = "unsigned"; //dimension +- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation +- input_types_[i++] = "int" ; //block index in x-dimension +- input_types_[i++] = "int" ; //block index in y-dimension +- input_types_[i++] = "int" ; //block index in z-dimension +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "double"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_add_pca_errors_process(bprb_func_process& pro) +-{ +- using namespace bvpl_add_pca_errors_process_globals; +- +- //get inputs +- unsigned i =0; +- bvpl_pca_error_scenes_sptr error_scenes = pro.get_input(i++); +- auto dim = pro.get_input(i++); +- auto fraction_nsamples = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!error_scenes) { +- std::cerr << "Error in bvpl_add_pca_errors_process: Null error scene\n"; +- return false; +- } +- boxm_scene >* error_scene = dynamic_cast >*> (error_scenes->get_scene(dim).as_pointer()); +- if (!error_scene) { +- std::cerr << "Error in bvpl_add_pca_errors_process: Error scene is of incorrect type\n"; +- return false; +- } +- //sum errors within block +- double error = 0; +- if (fraction_nsamples < 0.95) +- { +- auto scene_ncells = (double)error_scene->size(); +- error_scene->load_block(block_i,block_j,block_k); +- auto tree_ncells = (double)error_scene->get_block(block_i,block_j,block_k)->get_tree()->size(); +- double nsamples = scene_ncells * fraction_nsamples; +- +- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples); +- std::cout << "Number of samples in the scene " << scene_ncells << '\n' +- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << '\n'; +- error = bvpl_average_value(error_scene,block_i, block_j, block_k, tree_nsamples); +- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") and dim: " << dim << "is: " << error << '\n'; +- } +- else +- { +- error = bvpl_average_value(error_scene,block_i, block_j, block_k); +- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") and dim: " << dim << "is: " << error << '\n'; +- } +- +- //store output +- pro.set_output_val(0, error); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx +deleted file mode 100644 +index f6fb2f5d0a..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx ++++ /dev/null +@@ -1,95 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 17-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-//:global variables +-namespace bvpl_combine_pairwise_statistics_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_combine_pairwise_statistics_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_combine_pairwise_statistics_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i=0; +- input_types_[i++] = "vcl_string" ; //stats_file1 +- input_types_[i++] = "vcl_string" ; //stats_file2 +- input_types_[i++] = "vcl_string" ; //stats_file_out +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_combine_pairwise_statistics_process(bprb_func_process& pro) +-{ +- using namespace bvpl_combine_pairwise_statistics_process_globals; +- +- //get inputs +- unsigned i= 0; +- std::string stats_file1 = pro.get_input(i++); +- std::string stats_file2 = pro.get_input(i++); +- std::string stats_file_out = pro.get_input(i++); +- +- //load files +- vnl_matrix_fixed S1(0.0); +- vnl_vector_fixed mean1(0.0); +- unsigned long nfeatures1 =0; +- { +- std::ifstream stats_ifs(stats_file1.c_str()); +- if (!stats_ifs.is_open()) { +- std::cerr << "Error: Failed to open file1\n"; +- return false; +- } +- stats_ifs >> nfeatures1 >> mean1 >> S1; +- stats_ifs.close(); +- +- } +- +- vnl_matrix_fixed S2(0.0); +- vnl_vector_fixed mean2(0.0); +- unsigned long nfeatures2 =0; +- +- { +- std::ifstream stats_ifs(stats_file2.c_str()); +- if (!stats_ifs.is_open()) { +- std::cerr << "Warning: Failed to open file2 - output file will be identical to file1\n"; +- std::ofstream stats_ofs(stats_file_out.c_str()); +- stats_ofs.precision(15); +- stats_ofs << nfeatures1 << '\n' << mean1 << '\n' << S1; +- return true; +- } +- stats_ifs >> nfeatures2 >> mean2 >> S2; +- stats_ifs.close(); +- } +- +- vnl_matrix_fixed S_out(0.0); +- vnl_vector_fixed mean_out(0.0); +- double nfeatures_out =0.0; +- bvpl_global_pca<125>::combine_pairwise_statistics(mean1, S1, (double)nfeatures1, mean2, S2, (double)nfeatures2, mean_out, S_out, nfeatures_out); +- +- std::ofstream stats_ofs(stats_file_out.c_str()); +- stats_ofs.precision(15); +- stats_ofs << nfeatures_out << '\n' << mean_out << '\n' << S_out; +- stats_ofs.close(); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx +deleted file mode 100644 +index e6acd1accd..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx ++++ /dev/null +@@ -1,69 +0,0 @@ +-//: +-// \file +-// \brief A process to compute reconstruction error over all samples in a scene (test + train) +-// \author Isabel Restrepo +-// \date 13-Jan-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace bvpl_compute_pca_error_block_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; //directory path, where pca_info.xml is +- constexpr unsigned n_outputs_ = 0; //error file +-} +- +- +-//:sets input and output types +-bool bvpl_compute_pca_error_block_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_error_block_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_discover_pca_kernels_sptr" ; //directory path +- input_types_[i++] = "bvpl_pca_error_scenes_sptr"; +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "unsigned"; //num_components +- +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_pca_error_block_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_error_block_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_discover_pca_kernels_sptr pca_extractor = pro.get_input(i++); +- bvpl_pca_error_scenes_sptr pca_error_scenes = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- auto num_components = pro.get_input(i++); +- +- if (!pca_extractor) +- return false; +- +- if (!pca_error_scenes) +- return false; +- +- //bvpl_discover_pca_kernels pca_extractor(pca_dir); +- boxm_scene >* error_scene = dynamic_cast >*> (pca_error_scenes->get_scene(num_components).as_pointer()); +- pca_extractor->compute_testing_error(error_scene, num_components, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx +deleted file mode 100644 +index 70d9cf1a4b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx ++++ /dev/null +@@ -1,132 +0,0 @@ +-//: +-// \file +-// \brief A process to compute reconstruction error over all samples in a scene (test + train) +-// \author Isabel Restrepo +-// \date 13-Jan-2011 +- +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-// global variables +-namespace bvpl_compute_pca_error_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; //directory path, where pca_info.xml is +- constexpr unsigned n_outputs_ = 0; //error file +-} +- +- +-// sets input and output types +-bool bvpl_compute_pca_error_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_error_scene_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "vcl_string" ; //directory path +- input_types_[i++] = "bvpl_pca_error_scenes_sptr"; +- input_types_[i++] = "unsigned"; //num_components +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-#if BVPL_OCTREE_HAS_PTHREADS +-// helper code to launch and manage pthreads +-namespace { +- struct pthread_data +- { +- bvpl_discover_pca_kernels* pca_extractor; +- boxm_scene > * error_scene; +- vgl_point_3d block_idx; +- unsigned num_components; +- }; +- +- void* pthread_launcher(void *arg) +- { +- pthread_data *pd = reinterpret_cast(arg); +- vgl_point_3d block_idx = pd->block_idx; +- pd->pca_extractor->compute_testing_error_thread_safe(pd->error_scene, pd->num_components, block_idx.x(), block_idx.y(), block_idx.z()); +- //delete pd; +- return arg; +- } +-} +-#endif +- +-// the process +-bool bvpl_compute_pca_error_scene_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_error_scene_process_globals; +- +- //get inputs +- unsigned i = 0; +- std::string pca_dir = pro.get_input(i++); +- bvpl_pca_error_scenes_sptr pca_error_scenes = pro.get_input(i++); +- auto num_components = pro.get_input(i++); +- +- if (!vul_file::is_directory(pca_dir)) +- return false; +- +- if (!pca_error_scenes) +- return false; +- +- auto *pca_extractor = new bvpl_discover_pca_kernels(pca_dir); +- vgl_vector_3d num_blocks = pca_extractor->data_scene_dim(); +- boxm_scene >* error_scene = dynamic_cast >*> (pca_error_scenes->get_scene(num_components).as_pointer()); +- +-#if BVPL_OCTREE_HAS_PTHREADS +- pca_extractor->load_all_scene_blocks(); +- error_scene->read_all_blocks(); +- unsigned num_threads = 0; +- std::vector > block_indices; +- for (unsigned block_i = 0; block_i < num_blocks.x(); ++block_i) { +- for (unsigned block_j = 0; block_j < num_blocks.y(); ++block_j) { +- for (unsigned block_k = 0; block_k < num_blocks.z(); ++block_k) { +- block_indices.push_back(vgl_point_3d(block_i,block_j,block_k)); +- ++num_threads; +- } +- } +- } +- +- pthread_t* thread_id = new pthread_t[num_threads]; // beware of memory leaks ... +- +- for (unsigned i =0; i < num_threads; ++i) +- { +- pthread_data* pd = new pthread_data(); +- pd->pca_extractor = pca_extractor; +- pd->error_scene = error_scene; +- pd->num_components = num_components; +- pd->block_idx= block_indices[i]; +- int rc = pthread_create(&thread_id[i], NULL, pthread_launcher, (void*) pd ); +- //pthread_detach(thread_id[i]); +- if (rc) +- { +- std::cerr << "Error creating pthread, return code: "< +-#include +- +-#include +- +-#include +- +- +-//:global variables +-namespace bvpl_compute_pca_test_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; //directory path, where pca_info.xml is +- constexpr unsigned n_outputs_ = 1; //error file +-} +- +- +-//:sets input and output types +-bool bvpl_compute_pca_test_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_test_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string" ; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "vcl_string"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_pca_test_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_pca_test_error_process_globals; +- +- //get inputs +- std::string pca_dir = pro.get_input(0); +- +- bvpl_discover_pca_kernels pca_extractor(pca_dir); +- +- vnl_vector t_error; +- pca_extractor.compute_testing_error(t_error); +- std::ofstream error_ofs((pca_dir+ "/test_error.txt").c_str()); +- +- if (error_ofs) +- error_ofs << t_error; +- +- //store output +- pro.set_output_val(0, pca_dir+ "/test_error.txt"); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx +deleted file mode 100644 +index e76b7b5d98..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx ++++ /dev/null +@@ -1,98 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 17-Nov-2010 +- +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_discover_pca_features_process_globals +-{ +- constexpr unsigned n_inputs_ = 9; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_discover_pca_features_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_discover_pca_features_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i =0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "vcl_string"; //directory to save PCA matrices +- input_types_[i++] = "double"; //fraction of the total number of leaves +- input_types_[i++] = "int"; // min and max of kernel +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- +- return pro.set_input_types(input_types_); +-} +- +- +-//:the process +-bool bvpl_discover_pca_features_process(bprb_func_process& pro) +-{ +- using namespace bvpl_discover_pca_features_process_globals; +- if (pro.n_inputs() != n_inputs_) +- { +- std::cout << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs +- unsigned i =0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- std::string pca_dir = pro.get_input(i++); +- auto frac = pro.get_input(i++); +- int min_x = pro.get_input(i++); +- int min_y = pro.get_input(i++); +- int min_z = pro.get_input(i++); +- int max_x = pro.get_input(i++); +- int max_y = pro.get_input(i++); +- int max_z = pro.get_input(i++); +- +- +- //check input's validity +- if (!scene_base.ptr()) { +- std::cout << " :-- Base Scene is not valid!\n"; +- return false; +- } +- +- //neighborhood box for volume "patches" 5x5x5 for now - this could be an input to the process +- vgl_box_3d neighborhood(vgl_point_3d(min_x,min_y, min_z), vgl_point_3d(max_x, max_y, max_z)); +- +- //cast scene +- auto *scene= dynamic_cast >* > (scene_base.as_pointer()); +- if (!scene) { +- std::cout << " :-- Input Scene is not of supported type\n"; +- return false; +- } +- std::cout << "Scene path: " << scene->filename()<< std::endl;; +- +- +- //number of samples - 10% of total number of leaf-cells +- auto nsamples = (unsigned long)((double)scene->size() * frac); +- std::cout << "Number of samples: " << nsamples << std::endl; +- +- //bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene); +- bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene, pca_dir); +- +- //write matrices to disk +- pca_extractor.xml_write(); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx +deleted file mode 100644 +index 365a0eb791..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx ++++ /dev/null +@@ -1,64 +0,0 @@ +-//: +-// \file +-// \brief A process that performs PCA analysis given the statistics collected from various scenes using bvpl_pca_global +-// \author Isabel Restrepo +-// \date 23-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_global_pca_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_global_pca_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_global_pca_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; //path pca_global_info file +- input_types_[1] = "vcl_string"; //path to statistics file +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_global_pca_process(bprb_func_process& pro) +-{ +- using namespace bvpl_global_pca_process_globals; +- +- //get inputs +- std::string pca_file = pro.get_input(0); +- std::string stats_file = pro.get_input(1); +- +- //load file into matrices +- vnl_matrix_fixed S(0.0); +- vnl_vector_fixed mean(0.0); +- unsigned long nfeatures =0; +- { +- std::ifstream stats_ifs(stats_file.c_str()); +- if (!stats_ifs.is_open()) { +- std::cerr << "Error: Failed to open stats file\n"; +- return false; +- } +- stats_ifs >> nfeatures >> mean >> S; +- } +- +- bvpl_global_pca<125> global_pca(pca_file); +- +- global_pca.set_up_pca_evd(S,mean,nfeatures); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx +deleted file mode 100644 +index 10e35faddb..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \brief A process to init auxiliary scenes and other variables +-// \author Isabel Restrepo +-// \date 23-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_init_global_pca_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_init_global_pca_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_init_global_pca_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; // path to pca_global_info file +- input_types_[1] = "unsigned"; //id of the scene to initialize +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_init_global_pca_process(bprb_func_process& pro) +-{ +- using namespace bvpl_init_global_pca_process_globals; +- +- //get inputs +- std::string pca_dir = pro.get_input(0); +- auto scene_id = pro.get_input(1); +- +- bvpl_global_pca<125> global_pca(pca_dir); +- global_pca.init(scene_id); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx +deleted file mode 100644 +index 8b2070e215..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx ++++ /dev/null +@@ -1,50 +0,0 @@ +-//: +-// \file +-// \brief +-// \author Isabel Restrepo +-// \date 15-May-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//: global variables +-namespace bvpl_load_global_pca_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//: sets input and output types +-bool bvpl_load_global_pca_125_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_global_pca_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_global_pca_125_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_load_global_pca_125_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_global_pca_process_globals; +- +- // get inputs +- std::string pca_file = pro.get_input(0); +- auto *global_pca = new bvpl_global_pca<125>(pca_file); +- +- // store output +- pro.set_output_val(0, global_pca); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx +deleted file mode 100644 +index 39161edf02..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx ++++ /dev/null +@@ -1,58 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 21-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_load_pca_error_scenes_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_load_pca_error_scenes_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_pca_error_scenes_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i =0; +- input_types_[i++] = "boxm_scene_base_sptr"; //data scene +- input_types_[i++] = "vcl_string"; //pca path +- input_types_[i++] = "unsigned"; //dimension pca feture +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_pca_error_scenes_sptr" ; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_load_pca_error_scenes_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_pca_error_scenes_process_globals; +- +- //get inputs +- unsigned i = 0; +- boxm_scene_base_sptr data_scene_base = pro.get_input(i++); +- std::string pca_path = pro.get_input(i++); +- auto feature_dim = pro.get_input(i++); +- +- if (!data_scene_base) +- return false; +- +- bvpl_pca_error_scenes *error_scenes = new bvpl_pca_error_scenes(data_scene_base, pca_path, feature_dim); +- //store output +- pro.set_output_val(0, error_scenes); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx +deleted file mode 100644 +index 48082ecb75..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx ++++ /dev/null +@@ -1,55 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 3-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_load_pca_info_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_load_pca_info_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_pca_info_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string" ; //directory path +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_discover_pca_kernels_sptr"; //pca info +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_load_pca_info_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_pca_info_process_globals; +- +- //get inputs +- std::string pca_dir = pro.get_input(0); +- +- if (!vul_file::is_directory(pca_dir)) +- return false; +- +- bvpl_discover_pca_kernels_sptr pca_extractor = new bvpl_discover_pca_kernels(pca_dir); +- +- //store output +- pro.set_output_val(0, pca_extractor); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx +deleted file mode 100644 +index fb29aeaa8c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx ++++ /dev/null +@@ -1,61 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 4-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_normalize_pca_training_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; //directory path +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_normalize_pca_training_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_normalize_pca_training_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_normalize_pca_training_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_normalize_pca_training_error_process_globals; +- +- //get inputs +- std::string pca_dir = pro.get_input(0); +- +- if (!vul_file::is_directory(pca_dir)){ +- std::cerr << " Invalid pca directory\n"; +- return false; +- } +- +- +- bvpl_discover_pca_kernels pca_extractor(pca_dir); +- +- vnl_vector error; +- pca_extractor.compute_normalized_training_error(error); +- +- std::ofstream ofs((pca_dir + "/normalized_training_error.txt").c_str()); +- ofs.precision(15); +- ofs << error; +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx +deleted file mode 100644 +index 40149c3411..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx ++++ /dev/null +@@ -1,77 +0,0 @@ +-//: +-// \file +-// \brief A process to compute pca projection coeffiecients +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +- +-//:global variables +-namespace bvpl_pca_global_add_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_pca_global_add_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_add_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "double"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_pca_global_add_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_add_error_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_pca_125_sptr global_pca = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!global_pca) +- { +- std::cerr << "Global PCA is NULL\n"; +- return false; +- } +- +- boxm_scene_base_sptr error_scene_base = global_pca->load_error_scene(scene_id); +- if (!error_scene_base) { +- std::cerr << "Error in bvpl_add_pca_errors_process: Error scene is of incorrect type\n"; +- return false; +- } +- +- double error = bvpl_average_value(error_scene_base,block_i, block_j, block_k); +- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << '\n'; +- +- //store output +- pro.set_output_val(0, error); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx +deleted file mode 100644 +index 0e127a6a1c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx ++++ /dev/null +@@ -1,63 +0,0 @@ +-//: +-// \file +-// \brief A process to compute pca projection coeffiecients +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_pca_global_proj_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_pca_global_proj_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_proj_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_pca_global_proj_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_proj_error_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_pca_125_sptr global_pca = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!global_pca) +- { +- std::cerr << "Global PCA is NULL\n"; +- return false; +- } +- +- global_pca->projection_error(scene_id, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx +deleted file mode 100644 +index fc2e46ff3e..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx ++++ /dev/null +@@ -1,75 +0,0 @@ +-//: +-// \file +-// \brief A process that computes pca statistics (scatter matrix and mean) on a per block basis +-// \author Isabel Restrepo +-// \date 14-Mar-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_pca_global_statistics_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_pca_global_statistics_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_statistics_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i =0; +- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class +- input_types_[i++] = "int"; //scene_id (this can be confirmed in xml file pca_info.xml) +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "vcl_string"; //path to file to hold statistics of this block +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_pca_global_statistics_process(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_global_statistics_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_pca_125_sptr global_pca = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- std::string stats_file = pro.get_input(i++); +- +- if(!global_pca) +- { +- std::cerr << "Global PCA is NULL \n"; +- return false; +- } +- vnl_matrix_fixed S(0.0); +- vnl_vector_fixed mean(0.0); +- unsigned long nfeatures = 0; +- +- +- if(global_pca->sample_statistics(scene_id, block_i, block_j, block_k, S, mean, nfeatures)) +- { +- std::ofstream stats_ofs(stats_file.c_str()); +- stats_ofs.precision(15); +- stats_ofs << nfeatures << '\n' << mean << '\n' << S; +- stats_ofs.close(); +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx +deleted file mode 100644 +index 341a8e76ac..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx ++++ /dev/null +@@ -1,63 +0,0 @@ +-//: +-// \file +-// \brief A process to compute pca projection coeffiecients +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_pca_project_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_pca_project_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_project_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_pca_project_process(bprb_func_process& pro) +-{ +- using namespace bvpl_pca_project_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_pca_125_sptr global_pca = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!global_pca) +- { +- std::cerr << "Global PCA is NULL\n"; +- return false; +- } +- +- global_pca->project(scene_id, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx +deleted file mode 100644 +index 3f4d2adf17..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx ++++ /dev/null +@@ -1,70 +0,0 @@ +-//: +-// \file +-// \brief A process to run derivatives of gaussian in 3 dimensions - x, y, x +-// \author Isabel Restrepo +-// \date 13-Oct-2010 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +- +-#include +- +-//: global variables +-namespace bvpl_compute_sf_raw_response_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//: sets input and output types +-bool bvpl_compute_sf_raw_response_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_sf_raw_response_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; //input/response scene +- input_types_[i++] = "boxm_scene_base_sptr"; //valid scene +- +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_compute_sf_raw_response_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_sf_raw_response_process_globals; +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- boxm_scene_base_sptr valid_scene_base = pro.get_input(i++); +- +- //get scene +- typedef boct_tree > response_tree_type; +- typedef boct_tree valid_tree_type; +- +- +- if (auto *scene_in = dynamic_cast* >(scene_base.as_pointer())) +- { +- double cell_length = scene_in->finest_cell_length(); +- +- if (auto *valid_scene = dynamic_cast* >(valid_scene_base.as_pointer())) +- { +- bvpl_gauss3D_steerable_filters sf; +- sf.basis_response_at_leaves(scene_in,valid_scene, cell_length); +- } +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx +deleted file mode 100644 +index 3ceffbbc47..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx ++++ /dev/null +@@ -1,87 +0,0 @@ +-//: +-// \file +-// \brief A process to initialize the response scene for steerable filter bank +-// \author Isabel Restrepo +-// \date 22-Aug-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +- +-#include +- +-//: global variables +-namespace bvpl_init_sf_response_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 2; +-} +- +- +-//: sets input and output types +-bool bvpl_init_sf_response_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_init_sf_response_scene_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; //input scene +- input_types_[1] = "vcl_string"; //output path +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; //response scene +- output_types_[1] = "boxm_scene_base_sptr"; //valid scene +- +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_init_sf_response_scene_process(bprb_func_process& pro) +-{ +- using namespace bvpl_init_sf_response_scene_process_globals; +- +- //get inputs: +- unsigned i = 0; +- boxm_scene_base_sptr scene_base = pro.get_input(i++); +- std::string output_path = pro.get_input(i++); +- +- //get scene +- typedef boct_tree float_tree_type; +- typedef boct_tree > out_tree_type; +- +- if (auto *scene_in = dynamic_cast* >(scene_base.as_pointer())) +- { +- boxm_scene *scene_out = +- new boxm_scene(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- scene_out->set_paths(output_path, "steerable_gauss_3d_scene"); +- scene_out->set_appearance_model(VNL_FLOAT_10); +- scene_out->write_scene("steerable_gauss_3d_scene.xml"); +- scene_in->clone_blocks_to_vector<10>(*scene_out); +- +- boxm_scene > *valid_scene = +- new boxm_scene >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level()); +- valid_scene->set_paths(output_path, "valid_scene"); +- valid_scene->set_appearance_model(BOXM_BOOL); +- valid_scene->write_scene("valid_scene.xml"); +- +- +- //store output +- boxm_scene_base_sptr scene_ptr=new boxm_scene_base(); +- scene_ptr = scene_out; +- boxm_scene_base_sptr valid_scene_ptr=new boxm_scene_base(); +- valid_scene_ptr = valid_scene; +- pro.set_output_val(0, scene_ptr); +- pro.set_output_val(1, valid_scene_ptr); +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx +deleted file mode 100644 +index c1b1c309c0..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx ++++ /dev/null +@@ -1,90 +0,0 @@ +-//: +-// \file +-// \brief A process to add Taylor error at a percentage of voxels in a block +-// \author Isabel Restrepo +-// \date 15-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +-//:global variables +-namespace bvpl_add_taylor_errors_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_add_taylor_errors_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_add_taylor_errors_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; +- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation +- input_types_[i++] = "int" ; //block index in x-dimension +- input_types_[i++] = "int" ; //block index in y-dimension +- input_types_[i++] = "int" ; //block index in z-dimension +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "double"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_add_taylor_errors_process(bprb_func_process& pro) +-{ +- using namespace bvpl_add_taylor_errors_process_globals; +- +- //get inputs +- unsigned i =0; +- boxm_scene_base_sptr error_scene_base = pro.get_input(i++); +- auto fraction_nsamples = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!error_scene_base) { +- std::cerr << "Error in bvpl_add_taylor_errors_process: Null error scene\n"; +- return false; +- } +- auto* error_scene = dynamic_cast >*> (error_scene_base.as_pointer()); +- if (!error_scene) { +- std::cerr << "Error in bvpl_add_taylor_errors_process: Error scene is of incorrect type\n"; +- return false; +- } +- //sum errors within block +- auto scene_ncells = (double)error_scene->size(); +- error_scene->load_block(block_i,block_j,block_k); +- auto tree_ncells = (double)error_scene->get_block(block_i,block_j,block_k)->get_tree()->size(); +- double nsamples = scene_ncells * fraction_nsamples; +- +- //number of samples - 10% of total number of leaf-cells +- double error = 0.0; +- if (fraction_nsamples < 0.95) { +- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples); +- std::cout << "Number of samples in the scene " << scene_ncells << '\n' +- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << std::endl; +- error = bvpl_taylor_basis::sum_errors(error_scene,block_i, block_j, block_k, tree_nsamples); +- } +- else { +- error = bvpl_average_value(error_scene,block_i, block_j, block_k); +- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << std::endl; +- } +- +- //store output +- pro.set_output_val(0, error); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx +deleted file mode 100644 +index 50c28a393e..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx ++++ /dev/null +@@ -1,80 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 12-Apr-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_compute_taylor_coefficients_process_globals +-{ +- constexpr unsigned n_inputs_ = 6; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_compute_taylor_coefficients_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_taylor_coefficients_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "vcl_string" ; //path of taylor_global_info.xml +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; // dimension (3 for xyz derivatives, 10 for all 1st and 2nd order derivatives) +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_taylor_coefficients_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_taylor_coefficients_process_globals; +- +- //get inputs +- unsigned i = 0; +- std::string taylor_dir = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- int dim = pro.get_input(i++); +- +- if (!vul_file::is_directory(taylor_dir)) +- return false; +- +- switch (dim) { +- case 3: +- { +- std::string kernel_names[] = {"Ix", "Iy", "Iz"}; +- bvpl_global_taylor global_taylor(taylor_dir, kernel_names); +- global_taylor.compute_taylor_coefficients(scene_id, block_i, block_j, block_k); +- break; +- } +- case 10: +- { +- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" }; +- bvpl_global_taylor global_taylor(taylor_dir, kernel_names); +- global_taylor.compute_taylor_coefficients(scene_id, block_i, block_j, block_k); +- break; +- } +- default: +- break; +- } +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx +deleted file mode 100644 +index b992c1b5ae..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx ++++ /dev/null +@@ -1,78 +0,0 @@ +-//: +-// \file +-// \brief A process to compute the Taylor reconstruction error of a block (Assumes, basis has been applied) +-// \author Isabel Restrepo +-// \date 9-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace bvpl_compute_taylor_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_compute_taylor_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_taylor_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "boxm_scene_base_sptr"; //the original data scene +- input_types_[i++] = "bvpl_taylor_scenes_map_sptr" ; //scenes needed for Taylor operations +- input_types_[i++] = "int" ; //block index in x-dimension +- input_types_[i++] = "int" ; //block index in y-dimension +- input_types_[i++] = "int" ; //block index in z-dimension +- +- std::vector output_types_(n_outputs_); +- i=0; +- output_types_[i++] = "boxm_scene_base_sptr"; //the error for this block +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_compute_taylor_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_compute_taylor_error_process_globals; +- +- //get inputs +- unsigned i = 0; +- boxm_scene_base_sptr data_scene_base = pro.get_input(i++); +- bvpl_taylor_scenes_map_sptr taylor_scenes = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- if (!data_scene_base) { +- std::cerr << "Error in bvpl_compute_taylor_error_process: Null data scene\n"; +- return false; +- } +- if (!taylor_scenes) { +- std::cerr << "Error in bvpl_compute_taylor_error_process: Null scenes map\n"; +- return false; +- } +- +- //assemble the Taylor basis +- bvpl_taylor_basis::assemble_basis(taylor_scenes, block_i, block_j, block_k); +- +- //compute the error block +- boxm_scene >* error_scene = dynamic_cast >*> (taylor_scenes->get_scene("error").as_pointer()); +- auto* data_scene = dynamic_cast >*> (data_scene_base.as_pointer()); +- double cell_length = data_scene->finest_cell_length(); +- bvpl_taylor_basis::compute_approximation_error(data_scene, taylor_scenes->get_scene("basis"), +- error_scene,taylor_scenes->loader(), +- block_i, block_j, block_k, cell_length); +- +- pro.set_output_val(0, error_scene); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx +deleted file mode 100644 +index 0b57bb488d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx ++++ /dev/null +@@ -1,77 +0,0 @@ +-//: +-// \file +-// \brief A process to extract a Taylor coefficient from the 10-d vector +-// \author Isabel Restrepo +-// \date 12-Apr-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_explore_coefficient_scene_process_globals +-{ +- constexpr unsigned n_inputs_ = 3; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_explore_coefficient_scene_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_explore_coefficient_scene_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "vcl_string"; //path to Taylor info file +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //coefficient +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "boxm_scene_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_explore_coefficient_scene_process(bprb_func_process& pro) +-{ +- using namespace bvpl_explore_coefficient_scene_process_globals; +- +- //get inputs +- std::string taylor_dir = pro.get_input(0); +- int scene_id = pro.get_input(1); +- int coeff_id = pro.get_input(2); +- +- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" }; +- bvpl_global_taylor taylor(taylor_dir, kernel_names); +- +- boxm_scene_base_sptr valid_scene_base = taylor.load_valid_scene(scene_id); +- auto* valid_scene = dynamic_cast >*> (valid_scene_base.as_pointer()); +- if (!valid_scene) { +- std::cerr << "Error in bvpl_explore_coefficient_scene_process: Could not cast valid scene\n"; +- return false; +- } +- +- std::stringstream scene_ss; +- scene_ss << "coefficient_" << coeff_id << "_scene_" << scene_id ; +- std::string scene_path = taylor.aux_dirs(scene_id) + "/" + scene_ss.str() + ".xml"; +- +- std::cout << "Initializing " << scene_path << '\n' +- << "Scene: " << scene_path << " does not exist, initializing xml" << std::endl; +- boxm_scene > *scene = +- new boxm_scene >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level()); +- scene->set_appearance_model(BOXM_FLOAT); +- scene->set_paths(taylor.aux_dirs(scene_id), scene_ss.str()); +- scene->write_scene("/" + scene_ss.str() + ".xml"); +- taylor.extract_coefficient_scene(scene_id, coeff_id, scene); +- +- //store output +- pro.set_output_val(0, scene); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx +deleted file mode 100644 +index c900aeef5d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx ++++ /dev/null +@@ -1,68 +0,0 @@ +-//: +-// \file +-// \brief A process to init auxiliary scenes and other variables +-// \author Isabel Restrepo +-// \date 12-Apr-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_init_global_taylor_process_globals +-{ +- constexpr unsigned n_inputs_ = 2; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_init_global_taylor_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_init_global_taylor_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; // path to taylor_global_info file +- input_types_[1] = "int"; // dimension (3 for xyz derivatives, 10 for all 1st and 2nd order derivatives) +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_init_global_taylor_process(bprb_func_process& pro) +-{ +- using namespace bvpl_init_global_taylor_process_globals; +- +- //get inputs +- std::string taylor_dir = pro.get_input(0); +- int dim = pro.get_input(1); +- +- switch (dim) { +- case 3: +- { +- std::string kernel_names[] = {"Ix", "Iy", "Iz"}; +- bvpl_global_taylor global_taylor(taylor_dir, kernel_names); +- global_taylor.init(); +- break; +- } +- case 10: +- { +- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" }; +- bvpl_global_taylor global_taylor(taylor_dir, kernel_names); +- global_taylor.init(); +- break; +- } +- default: +- break; +- } +- +- +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx +deleted file mode 100644 +index 0e5713c4dc..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx ++++ /dev/null +@@ -1,52 +0,0 @@ +-//: +-// \file +-// \brief +-// \author Isabel Restrepo +-// \date 21-Jul-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//: global variables +-namespace bvpl_load_global_taylor_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//: sets input and output types +-bool bvpl_load_global_taylor_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_global_taylor_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_global_taylor_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//: the process +-bool bvpl_load_global_taylor_process(bprb_func_process& pro) +-{ +- typedef vbl_smart_ptr > bvpl_global_taylor_sptr; +- using namespace bvpl_load_global_taylor_process_globals; +- +- // get inputs +- std::string taylor_file = pro.get_input(0); +- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" }; +- auto *global_taylor = new bvpl_global_taylor(taylor_file, kernel_names); +- +- // store output +- pro.set_output_val(0, global_taylor); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx +deleted file mode 100644 +index 0b405689b0..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx ++++ /dev/null +@@ -1,72 +0,0 @@ +-//: +-// \file +-// \brief A process to load to memory all smart pointers of scenes needed for Taylor reconstruction +-// \author Isabel Restrepo +-// \date 14-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_load_taylor_scenes_process_globals +-{ +- constexpr unsigned n_inputs_ = 7; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_load_taylor_scenes_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_taylor_scenes_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "vcl_string"; //dir to Taylor scenes +- input_types_[i++] = "int"; // min and max of Taylor kernel +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- std::vector output_types_(n_outputs_); +- i = 0; +- output_types_[i++] = "bvpl_taylor_scenes_map_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_load_taylor_scenes_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_taylor_scenes_process_globals; +- +- //get inputs +- unsigned i = 0; +- std::string taylor_dir = pro.get_input(i++); +- int min_x = pro.get_input(i++); +- int min_y = pro.get_input(i++); +- int min_z = pro.get_input(i++); +- int max_x = pro.get_input(i++); +- int max_y = pro.get_input(i++); +- int max_z = pro.get_input(i++); +- +- if (!vul_file::is_directory(taylor_dir)) { +- std::cerr<<"Error in bvpl_load_taylor_scenes_process_process: Taylor directory doesn't exist\n"; +- } +- +- bvpl_taylor_basis_loader loader(taylor_dir, vgl_point_3d(min_x,min_y, min_z), vgl_point_3d(max_x, max_y, max_z)); +- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader); +- +- //store output +- pro.set_output_val(0, taylor_scenes); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx +deleted file mode 100644 +index 6fe31b4168..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx ++++ /dev/null +@@ -1,77 +0,0 @@ +-//: +-// \file +-// \brief A process to compute taylor projection coeffiecients +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +- +-//:global variables +-namespace bvpl_taylor_global_add_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_taylor_global_add_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_taylor_global_add_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; //global taylor class +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "double"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_taylor_global_add_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_taylor_global_add_error_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!global_taylor) +- { +- std::cerr << "Global taylor is NULL\n"; +- return false; +- } +- +- boxm_scene_base_sptr error_scene_base = global_taylor->load_error_scene(scene_id); +- if (!error_scene_base) { +- std::cerr << "Error in bvpl_add_taylor_errors_process: Error scene is of incorrect type\n"; +- return false; +- } +- +- double error = bvpl_average_value(error_scene_base,block_i, block_j, block_k); +- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << '\n'; +- +- //store output +- pro.set_output_val(0, error); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx +deleted file mode 100644 +index 3f3ca0a701..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx ++++ /dev/null +@@ -1,63 +0,0 @@ +-//: +-// \file +-// \brief A process to compute taylor projection coeffiecients +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +- +-//:global variables +-namespace bvpl_taylor_global_proj_error_process_globals +-{ +- constexpr unsigned n_inputs_ = 5; +- constexpr unsigned n_outputs_ = 0; +-} +- +- +-//:sets input and output types +-bool bvpl_taylor_global_proj_error_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_taylor_global_proj_error_process_globals ; +- +- std::vector input_types_(n_inputs_); +- unsigned i = 0; +- input_types_[i++] = "bvpl_global_taylor_sptr" ; //global taylor class +- input_types_[i++] = "int"; //scene id +- input_types_[i++] = "int"; //block Indices +- input_types_[i++] = "int"; +- input_types_[i++] = "int"; +- +- std::vector output_types_(n_outputs_); +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_taylor_global_proj_error_process(bprb_func_process& pro) +-{ +- using namespace bvpl_taylor_global_proj_error_process_globals; +- +- //get inputs +- unsigned i = 0; +- bvpl_global_taylor_sptr global_taylor = pro.get_input(i++); +- int scene_id = pro.get_input(i++); +- int block_i = pro.get_input(i++); +- int block_j = pro.get_input(i++); +- int block_k = pro.get_input(i++); +- +- if (!global_taylor) +- { +- std::cerr << "Global taylor is NULL\n"; +- return false; +- } +- +- global_taylor->compute_approximation_error(scene_id, block_i, block_j, block_k); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt +deleted file mode 100644 +index 320399fb72..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt ++++ /dev/null +@@ -1,16 +0,0 @@ +-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree ) +-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree/pro) +- +-add_executable( bvpl_octree_pro_test_all +- test_driver.cxx +- test_bvpl_plane_propagation_process.cxx +-) +- +-target_link_libraries( bvpl_octree_pro_test_all ${VXL_LIB_PREFIX}testlib bvpl_octree_pro bvpl_octree boxm boxm_pro boxm_sample boxm_util boct bvpl bprb brdb sdet ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl) +- +-if(SEGFAULT_FIXED) +-add_test( NAME bvpl_octree_pro_plane_propagation_process COMMAND $ test_bvpl_plane_propagation_process) +-endif() +- +-add_executable( bvpl_octree_pro_test_include test_include.cxx ) +-target_link_libraries( bvpl_octree_pro_test_include bvpl_octree_pro sdet ) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx +deleted file mode 100644 +index 1073b2e437..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx ++++ /dev/null +@@ -1,144 +0,0 @@ +-#include +-#include +-#include +-//: +-// \file +-// \brief This test creates a tree with 8 leaf cells and inserts only one plane to each +-// After the boxm_plane_propagation_process is applied, each cell will insert their +-// neighbors' observation planes and insert into itself. At the end each cell should +-// have 8 planes in the observation list since each cell has 7 neighbors (all the +-// other cells in the tree) +-// +-// \author Gamze Tunali +-// \date March 24, 2010 +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +- +-static void test_bvpl_plane_propagation_process() +-{ +- typedef boxm_edge_tangent_sample data_type; +- typedef boct_tree tree_type; +- typedef boxm_scene > scene_type; +- +- // create the main scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- vgl_vector_3d block_dim(10,10,10); +- vgl_vector_3d world_dim(1,1,1); +- scene_type scene(lvcs, origin, block_dim, world_dim); +- scene.set_octree_levels(3,2); +- scene.set_paths("./boxm_scene", "block"); +- scene.set_appearance_model(BOXM_EDGE_LINE); +- x_write(std::cout, scene, "scene"); +- vul_file::make_directory("./boxm_scene"); +- scene.write_scene(); +- +- boxm_block_iterator > iter(&scene); +- while (!iter.end()) +- { +- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z()); +- boxm_block > * block=scene.get_active_block(); +- boct_tree * tree= block->get_tree(); +- +- // get the leaf nodes and insert one plane to each +- std::vector*> cells=tree->leaf_cells(); +- for (unsigned i=0; i p(vgl_homg_plane_3d(float(i+1),0.f,0.f,1.f), 1.0f); +- data_type data = cells[i]->data(); +- data.insert(p); +- cells[i]->set_data(data); +- } +- block->init_tree(tree); +- block->get_tree()->print(); +- scene.write_active_block(); +- iter++; +- } +- +- DECLARE_FUNC_CONS(bvpl_plane_propagate_process); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_plane_propagate_process, "bvplPlanePropagateProcess"); +- REGISTER_DATATYPE(boxm_scene_base_sptr); +- +- //: set the inputs +- brdb_value_sptr v0 = new brdb_value_t(new boxm_scene >(scene)); +- brdb_value_sptr v1 = new brdb_value_t(scene.path()); +- brdb_value_sptr v2 = new brdb_value_t("new_scene"); +- brdb_value_sptr v3 = new brdb_value_t("new_scene.xml"); +- +- //: inits with the default params +- bool good = bprb_batch_process_manager::instance()->init_process("bvplPlanePropagateProcess"); +- good = good && bprb_batch_process_manager::instance()->set_input(0, v0); +- good = good && bprb_batch_process_manager::instance()->set_input(1, v1); +- good = good && bprb_batch_process_manager::instance()->set_input(2, v2); +- good = good && bprb_batch_process_manager::instance()->set_input(3, v3); +- good = good && bprb_batch_process_manager::instance()->run_process(); +- +- unsigned id; +- good = good && bprb_batch_process_manager::instance()->commit_output(0, id); +- TEST("process commits output", good, true); +- +- // check if the results are in DB +- brdb_query_aptr Q = brdb_query_comp_new("id", brdb_query::EQ, id); +- brdb_selection_sptr S = DATABASE->select("boxm_scene_base_sptr_data", std::move(Q)); +- if (S->size()!=1){ +- std::cout << "in bprb_batch_process_manager::set_input_from_db(.) -" +- << " no selections\n"; +- } +- brdb_value_sptr value; +- if (!S->get_value(std::string("value"), value)) { +- std::cout << "in bprb_batch_process_manager::set_input_from_db(.) -" +- << " didn't get value\n"; +- } +- bool non_null = (value != nullptr); +- TEST("the output scene non-null", non_null, true); +- +- auto* result=static_cast* >(value.ptr()); +- boxm_scene_base_sptr scene_sptr = result->value(); +- +- // get the new scene with updated cells +- auto *scene2 = static_cast(scene_sptr.as_pointer()); +- boxm_block_iterator > iter2(scene2); +- +- bool obs_num_ok=true; +- while (!iter2.end()) +- { +- scene2->load_block(iter2.index().x(),iter2.index().y(),iter2.index().z()); +- boxm_block * block=scene2->get_active_block(); +- tree_type * tree= block->get_tree(); +- +- // get the leaf nodes and insert one plane to each +- std::vector*> nodes=tree->leaf_cells(); +- for (auto & node : nodes) { +- unsigned num=node->data().num_obs(); +- // each node has 8 neighbors in the 3x3 neighborhood including itself +- if (num != 8) +- obs_num_ok = false; +- } +- iter2++; +- } +- TEST("The number of expected observations at each cell", obs_num_ok, true); +-} +- +-TESTMAIN(test_bvpl_plane_propagation_process); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx +deleted file mode 100644 +index 9fae26da90..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +- +-DECLARE( test_bvpl_plane_propagation_process ); +- +-void register_tests() +-{ +- REGISTER( test_bvpl_plane_propagation_process ); +-} +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx +deleted file mode 100644 +index 407d98e94a..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt +deleted file mode 100644 +index 79b3a2bcb4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt ++++ /dev/null +@@ -1,7 +0,0 @@ +-Each of the subfolders contains scripts for different experiments: +- +-reconstruction error: Finds the reconstruction error using PCA kernels of a scene. The error is computed for a fixed fraction of training samples and varying number of dimensions. +- +-training error: Finds the reconstruction error using PCA kernels of a scene. The error is computed for a fixed dimension and varying number of training samples +- +-Note: *.sh calls the python scripts with appropriate inputs. You only need to adjust *.sh for your system +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py +deleted file mode 100644 +index 133a5822ed..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py ++++ /dev/null +@@ -1,193 +0,0 @@ +-# -*- coding: utf-8 -*- +-""" +-Created on Mon Feb 21, 2011 +- +-@author:Isabel Restrepo +- +-Adds the error of a portion of voxels. Each block is processed in a separate thread. +-This script assumes that the reconstruction error at each voxel has been computed +-""" +-import os +-import multiprocessing +-import Queue +-import time +-import random +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class pca_error_job(): +- +- def __init__(self, pca_scenes, dim, fraction, block_i, block_j, block_k): +- self.pca_scenes = pca_scenes +- self.dim = dim +- self.fraction = fraction +- self.block_i = block_i +- self.block_j = block_j +- self.block_k = block_k +- +- +-def execute_jobs(jobs, num_procs=4): +- # load up work queue +- work_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- # create a queue to pass to workers to store the results +- result_queue = multiprocessing.Queue() +- +- # spawn workers +- for i in range(num_procs): +- worker = pca_error_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- # collect the results off the queue +- # all_results=[]; +-# results = [] +-# while len(results) < len(jobs): +-# result = result_queue.get() +-# results.append(result) +-# all_results[job.dim].append(result); +-# +-# return all_results; +- +- # collect the results off the queue +- results = [] +- while len(results) < len(jobs): +- result = result_queue.get() +- results.append(result) +- +- return results +- +- +-class pca_error_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Adding Errors") +- batch.init_process("bvplAddPCAErrorsProcess") +- batch.set_input_from_db(0, job.pca_scenes) +- batch.set_input_unsigned(1, job.dim) +- batch.set_input_double(2, job.fraction) +- batch.set_input_int(3, job.block_i) +- batch.set_input_int(4, job.block_j) +- batch.set_input_int(5, job.block_k) +- batch.run_process() +- (id, type) = batch.commit_output(0) +- error_val = dbvalue(id, type) +- error = batch.get_output_double(id) +- +- self.result_queue.put(error) +- +- print("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +- +-#***************** The Main Algorithm ************************# +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute PCA Error Scene') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- parser.add_option('--fraction', action="store", +- dest="fraction", type="float", default=0.0) +- parser.add_option('--nblocks_x', action="store", +- dest="nblocks_x", type="int") +- parser.add_option('--nblocks_y', action="store", +- dest="nblocks_y", type="int") +- parser.add_option('--nblocks_z', action="store", +- dest="nblocks_z", type="int") +- parser.add_option('--dimension', action="store", +- dest="dimension", type="int") +- +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- pca_dir = options.pca_dir +- fraction = options.fraction +- nblocks_x = options.nblocks_x +- nblocks_y = options.nblocks_y +- nblocks_z = options.nblocks_z +- num_cores = options.num_cores +- dimension = options.dimension +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(pca_dir + "/"): +- print "Invalid PCA Dir" +- sys.exit(-1) +- +- print("Loading Data Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- data_scene = dbvalue(scene_id, scene_type) +- +- # Load PCA scenes +- pca_feature_dim = 125 +- print("Loading PCA Error Scenes") +- batch.init_process("bvplLoadPCAErrorSceneProcess") +- batch.set_input_from_db(0, data_scene) +- batch.set_input_string(1, pca_dir) +- batch.set_input_unsigned( +- 2, pca_feature_dim) # dimension pca feature +- batch.run_process() +- (id, type) = batch.commit_output(0) +- pca_scenes = dbvalue(id, type) +- +- # Begin multiprocessing +- # Enqueue jobs +- job_list = [] +- # for dim in range(0, pca_feature_dim): +- for block_i in range(0, nblocks_x): +- for block_j in range(0, nblocks_y): +- for block_k in range(0, nblocks_z): +- current_job = pca_error_job( +- pca_scenes, dimension, fraction, block_i, block_j, block_k) +- job_list.append(current_job) +- +- # run +- results = execute_jobs(job_list, num_cores) +- +- # dump results +- total_error = 0 +- for r in results: +- total_error = total_error + r +- +- int_frac = int(fraction * 100) +- error_file = pca_dir + "/error_" + str(dimension) + "/error.txt" +- fd = open(error_file, "w") +- print >>fd, total_error / len(results) +- print >>fd, results +- fd.close() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py +deleted file mode 100644 +index c8ede20327..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py ++++ /dev/null +@@ -1,164 +0,0 @@ +-# -*- coding: utf-8 -*- +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-Compuets PCA reconstruction error. Each block is processed in a separate thread. +-This script assumes that the pca basis has been computed as gone by extract_pca_kernels.py +-""" +-import os +-import multiprocessing +-import Queue +-import time +-import random +-import optparse +-import sys +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class pca_error_job(): +- +- def __init__(self, pca_info, pca_error_scenes, block_i, block_j, block_k, dim): +- self.pca_info = pca_info +- self.pca_error_scenes = pca_error_scenes +- self.block_i = block_i +- self.block_j = block_j +- self.block_k = block_k +- self.dim = dim +- +- +-def execute_jobs(jobs, num_procs=4): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = pca_error_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class pca_error_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Computing Error Scene") +- batch.init_process("bvplComputePCAErrorBlockProcess") +- batch.set_input_from_db(0, job.pca_info) +- batch.set_input_from_db(1, job.pca_error_scenes) +- batch.set_input_int(2, job.block_i) +- batch.set_input_int(3, job.block_j) +- batch.set_input_int(4, job.block_k) +- batch.set_input_unsigned(5, job.dim) +- batch.run_process() +- +- print("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +-#*******************The Main Algorithm ************************# +-if __name__ == "__main__": +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute PCA Error Scene') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- parser.add_option('--nblocks_x', action="store", +- dest="nblocks_x", type="int") +- parser.add_option('--nblocks_y', action="store", +- dest="nblocks_y", type="int") +- parser.add_option('--nblocks_z', action="store", +- dest="nblocks_z", type="int") +- parser.add_option('--dimension', action="store", +- dest="dimension", type="int") +- +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- pca_dir = options.pca_dir +- nblocks_x = options.nblocks_x +- nblocks_y = options.nblocks_y +- nblocks_z = options.nblocks_z +- num_cores = options.num_cores +- dimension = options.dimension +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(pca_dir + "/"): +- print "Invalid PCA Dir" +- sys.exit(-1) +- +- print("Loading Data Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- data_scene = dbvalue(scene_id, scene_type) +- +- # Load pca scenes +- pca_feature_dim = 125 +- print("Loading PCA Error Scenes") +- batch.init_process("bvplLoadPCAErrorSceneProcess") +- batch.set_input_from_db(0, data_scene) +- batch.set_input_string(1, pca_dir) +- batch.set_input_unsigned( +- 2, pca_feature_dim) # dimension pca feature +- batch.run_process() +- (id, type) = batch.commit_output(0) +- pca_scenes = dbvalue(id, type) +- +- print("Loading PCA Info") +- batch.init_process("bvplLoadPCAInfoProcess") +- batch.set_input_string(0, pca_dir) +- batch.run_process() +- (id, type) = batch.commit_output(0) +- pca_info = dbvalue(id, type) +- +- # Begin multiprocessing +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- # Enqueue jobs +- all_indices = [] +- for block_i in range(0, nblocks_x): +- for block_j in range(0, nblocks_y): +- for block_k in range(0, nblocks_z): +- idx = [block_i, block_j, block_k] +- all_indices.append(idx) +- +- random.shuffle(all_indices) +- +- for i in range(0, len(all_indices)): +- idx = all_indices[i] +- current_job = pca_error_job(pca_info, pca_scenes, idx[ +- 0], idx[1], idx[2], dimension) +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py +deleted file mode 100644 +index 5d8b2b7910..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py ++++ /dev/null +@@ -1,61 +0,0 @@ +-# Computes the gaussian gradients on a boxm_alpha_scene +- +-import os +-import optparse +-import time +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute PCA basis') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--train_fraction', action="store", +- dest="train_fraction", type="float", default=0.0) +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- pca_dir = options.pca_dir +- train_fraction = options.train_fraction +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(pca_dir + "/"): +- os.makedirs(pca_dir + "/") +- +- print("Extracting Principal Components patches") +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- start_time = time.time() +- +- print("Extract PC") +- batch.init_process("bvplDiscoverPCAFeaturesProcess") +- batch.set_input_from_db(0, scene) +- batch.set_input_string(1, pca_dir) +- batch.set_input_double(2, train_fraction) +- batch.set_input_int(3, -2) # min and max points of the kernel +- batch.set_input_int(4, -2) +- batch.set_input_int(5, -2) +- batch.set_input_int(6, 2) +- batch.set_input_int(7, 2) +- batch.set_input_int(8, 2) +- batch.run_process() +- +- print("Runing time forbvplDiscoverPCAFeaturesProcess:") +- print(time.time() - start_time) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh +deleted file mode 100755 +index 61f3346338..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh ++++ /dev/null +@@ -1,68 +0,0 @@ +-#!/bin/bash +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-A script that encapsulates all steps needed to computer pca reconstruction error as a function of number of components used +-""" +- +-if [ $1 = "-r" ] ; then +- export PYTHONPATH=/Projects/vxl/bin/release/lib +-else +- if [ $1 = "-d" ] ; then +- export PYTHONPATH=/Projects/vxl/bin/Debug/lib +- else +- echo "Need a flag, either -d or -r"; +- fi +-fi +- +-echo "PYTHONPATH=" $PYTHONPATH +- +-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall"; +-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXMSmall/10"; +-#nblocks_x=1; +-#nblocks_y=1; +-#nblocks_z=1; +- +- +-#model_dir="/Users/isa/Experiments/CapitolBOXM_6_4_4"; +-#model_name="capitol_scene"; +-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXM_6_4_4/10"; +-#nblocks_x=6; +-#nblocks_y=4; +-#nblocks_z=4; +- +- +-model_dir="/Users/isa/Experiments/DowntownBOXM_3_3_1"; +-model_name="downtown_scene"; +-pca_dir="/Users/isa/Experiments/PCA/DowntownBOXM_3_3_1/10"; +-nblocks_x=3; +-nblocks_y=3; +-nblocks_z=1; +- +-train_fraction=0.1; +-test_fraction=1.0; +-num_cores=5; +- +- +-##************Compute Expected Color Scene +-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name +- +-#Compute PCA basis +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/extract_pca_kernels.py --model_dir $model_dir --pca_dir $pca_dir --train_fraction $train_fraction +- +-#Compute reconstruction at each voxel in the scene +-for ((dim = 45; dim <125; dim++)) +-do +- python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/compute_pca_error_scene.py --model_dir $model_dir --pca_dir $pca_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --dimension $dim +- +- #Add error of fraction of voxels +- +- python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/add_pca_error.py --model_dir $model_dir --pca_dir $pca_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --fraction $test_fraction --dimension $dim +-done +- +-# #Save all scenes to drishti raw file +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/save_pca_raw.py --pca_dir $pca_dir --num_cores $num_cores +- +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/reconstruction_error/explore_histogram.py --pca_dir $pca_dir --num_cores $num_cores +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py +deleted file mode 100644 +index 15d23e5ebf..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py ++++ /dev/null +@@ -1,108 +0,0 @@ +-import multiprocessing +-import Queue +-import time +-import os +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class save_scene_job(): +- +- def __init__(self, input_scene_path, output_scene_path): +- self.input_scene_path = input_scene_path +- self.output_scene_path = output_scene_path +- +- +-def execute_jobs(jobs, num_procs=5): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = save_scene_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class save_scene_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, job.input_scene_path) +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- print("Save Scene") +- batch.init_process("boxmSaveSceneRawProcess") +- batch.set_input_from_db(0, scene) +- batch.set_input_string(1, job.output_scene_path) +- batch.set_input_unsigned(2, 0) +- batch.set_input_unsigned(3, 1) +- batch.run_process() +- +- print ("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +- +-#*********************The Main Algorithm ****************************# +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- parser = optparse.OptionParser( +- description='Save taylor responses to raw file') +- +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- +- options, args = parser.parse_args() +- +- pca_dir = options.pca_dir +- num_cores = options.num_cores +- +- if not os.path.isdir(pca_dir + "/"): +- print "Invalid Taylor Dir" +- sys.exit(-1) +- +- # Begin multiprocessing +- t1 = time.time() +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- # Enqueue jobs +- pca_feature_dim = 125 +- for dim in range(0, pca_feature_dim): +- +- scene_in_path = pca_dir + "/error_" + str(dim) + "/error_scene.xml" +- scene_out_path = pca_dir + "/error_" + str(dim) + "/error_scene" +- +- current_job = save_scene_job(scene_in_path, scene_out_path) +- +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py +deleted file mode 100644 +index 1616b7850a..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py ++++ /dev/null +@@ -1,66 +0,0 @@ +-# Computes the gaussian gradients on a boxm_alpha_scene +- +-import os +-import optparse +-import time +-import sys +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute PCA basis') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--train_fraction', action="store", +- dest="train_fraction", type="float", default=0.0) +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- pca_dir = options.pca_dir +- train_fraction = (options.train_fraction) / 10 +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(pca_dir + "/"): +- os.makedirs(pca_dir + "/") +- +- pca_dir = pca_dir + "/" + str(int(train_fraction * 100)) +- if not os.path.isdir(pca_dir + "/"): +- os.makedirs(pca_dir + "/") +- +- print("Extracting Principal Components patches") +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- start_time = time.time() +- +- print("Extract PC") +- batch.init_process("bvplDiscoverPCAFeaturesProcess") +- batch.set_input_from_db(0, scene) +- batch.set_input_string(1, pca_dir) +- batch.set_input_double(2, train_fraction) +- batch.set_input_int(3, -2) # min and max points of the kernel +- batch.set_input_int(4, -2) +- batch.set_input_int(5, -2) +- batch.set_input_int(6, 2) +- batch.set_input_int(7, 2) +- batch.set_input_int(8, 2) +- batch.run_process() +- +- print ("Runing time for bvplDiscoverPCAFeaturesProcess:") +- print(time.time() - start_time) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py +deleted file mode 100644 +index e151f95144..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py ++++ /dev/null +@@ -1,42 +0,0 @@ +-# Computes normalized pca training error +- +-import os +-import optparse +-import time +-import sys +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute PCA basis') +- +- parser.add_option('--pca_dir', action="store", dest="pca_dir") +- parser.add_option('--train_fraction', action="store", +- dest="train_fraction", type="float", default=0.0) +- options, args = parser.parse_args() +- +- pca_dir = options.pca_dir +- train_fraction = (options.train_fraction) / 10 +- +- if not os.path.isdir(pca_dir + "/"): +- os.makedirs(pca_dir + "/") +- +- pca_dir = pca_dir + "/" + str(int(train_fraction * 100)) +- if not os.path.isdir(pca_dir + "/"): +- os.makedirs(pca_dir + "/") +- +- start_time = time.time() +- +- batch.init_process("bvplNormalizePCATrainingErrorProcess") +- batch.set_input_string(0, pca_dir) +- batch.run_process() +- +- print ("Runing time for bvplNormalizePCATrainingErrorProcess:") +- print(time.time() - start_time) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh +deleted file mode 100755 +index 82b0a516d8..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh ++++ /dev/null +@@ -1,42 +0,0 @@ +-#!/bin/bash +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-A script that encapsulates all steps needed to computer pca training error as a the number of training samples varies +-""" +- +-if [ $1 = "-r" ] ; then +- export PYTHONPATH=/projects/vxl/bin/release/lib +-else +- if [ $1 = "-d" ] ; then +- export PYTHONPATH=/projects/vxl/bin/Debug/lib +- else +- echo "Need a flag, either -d or -r"; +- fi +-fi +- +-echo "PYTHONPATH=" $PYTHONPATH +- +-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall"; +-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXMSmall"; +- +-model_dir="/homelocal/isa/Experiments/CapitolBOXM_6_4_4"; +-pca_dir="/homelocal/isa/Experiments/PCA/CapitolBOXM_6_4_4"; +- +- +-#model_dir="/Users/isa/Experiments/DowntownBOXM_3_3_1"; +-#pca_dir="/Users/isa/Experiments/PCA/DowntownBOXM_3_3_1"; +- +- +-##Compute Expected Color Scene +-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name +- +-#Compute reconstruction at each voxel in the scene +-for ((dim = 2; dim <11; dim++)) +-do +- #Compute PCA basis +- python extract_pca_kernels.py --model_dir $model_dir --pca_dir $pca_dir --train_fraction $dim +-done +- +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt b/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt +deleted file mode 100644 +index 5030ca4508..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt ++++ /dev/null +@@ -1 +0,0 @@ +-This folder contains Python scripts that use the main processes of bvpl_octree +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py +deleted file mode 100644 +index a7084e3cbe..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py ++++ /dev/null +@@ -1,183 +0,0 @@ +-# -*- coding: utf-8 -*- +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-Adds the error of a portion of voxels. Each block is processed in a separate thread. +-This script assumes that the reconstruction error at each voxel has been computed +-""" +-import os +-import multiprocessing +-import Queue +-import time +-import random +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class taylor_error_job(): +- +- def __init__(self, error_scene, fraction, block_i, block_j, block_k): +- self.error_scene = error_scene +- self.fraction = fraction +- self.block_i = block_i +- self.block_j = block_j +- self.block_k = block_k +- +- +-def execute_jobs(jobs, num_procs=4): +- # load up work queue +- work_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- # create a queue to pass to workers to store the results +- result_queue = multiprocessing.Queue() +- +- # spawn workers +- for i in range(num_procs): +- worker = taylor_error_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- # collect the results off the queue +- results = [] +- while len(results) < len(jobs): +- result = result_queue.get() +- results.append(result) +- +- return results +- +- +-class taylor_error_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Adding Errors") +- batch.init_process("bvplAddTaylorErrorsProcess") +- batch.set_input_from_db(0, job.error_scene) +- batch.set_input_double(1, job.fraction) +- batch.set_input_int(2, job.block_i) +- batch.set_input_int(3, job.block_j) +- batch.set_input_int(4, job.block_k) +- batch.run_process() +- (id, type) = batch.commit_output(0) +- error_val = dbvalue(id, type) +- error = batch.get_output_double(id) +- +- self.result_queue.put(error) +- +- print("error") +- print(error) +- +- print("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +- +-#***************** The Main Algorithm ************************# +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Add Taylor Errors in a Scene') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--taylor_dir', action="store", dest="taylor_dir") +- parser.add_option('--fraction', action="store", +- dest="fraction", type="float", default=0.0) +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- parser.add_option('--nblocks_x', action="store", +- dest="nblocks_x", type="int", default=1) +- parser.add_option('--nblocks_y', action="store", +- dest="nblocks_y", type="int", default=1) +- parser.add_option('--nblocks_z', action="store", +- dest="nblocks_z", type="int", default=1) +- +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- taylor_dir = options.taylor_dir +- nblocks_x = options.nblocks_x +- nblocks_y = options.nblocks_y +- nblocks_z = options.nblocks_z +- num_cores = options.num_cores +- fraction = options.fraction +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(taylor_dir + "/"): +- print "Invalid Taylor Dir" +- sys.exit(-1) +- +- print("Loading Error Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, taylor_dir + "/error_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- error_scene = dbvalue(scene_id, scene_type) +- +- # Begin multiprocessing +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- blocks_x = [i for i in range(0, nblocks_x)] +- blocks_y = [i for i in range(0, nblocks_y)] +- blocks_z = [i for i in range(0, nblocks_z)] +- +- random.shuffle(blocks_x) +- random.shuffle(blocks_y) +- random.shuffle(blocks_y) +- +- # Enqueue jobs +- for i in range(0, len(blocks_x)): +- for j in range(0, len(blocks_y)): +- for k in range(0, len(blocks_z)): +- block_i = blocks_x[i] +- block_j = blocks_y[j] +- block_k = blocks_z[k] +- current_job = taylor_error_job( +- error_scene, fraction, block_i, block_j, block_k) +- job_list.append(current_job) +- +- # run +- results = execute_jobs(job_list, num_cores) +- +- # dump results +- total_error = 0 +- for r in results: +- print(r) +- total_error = total_error + r +- +- # write schedule file +- int_frac = int(fraction * 100) +- error_file = taylor_dir + "/error_" + str(int_frac) + ".txt" +- fd = open(error_file, "w") +- print >>fd, total_error / len(results) +- print >>fd, results +- fd.close() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py +deleted file mode 100644 +index 11386b774c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py ++++ /dev/null +@@ -1,156 +0,0 @@ +-# -*- coding: utf-8 -*- +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-Compuets Taylor reconstruction error. Each block is processed in a separate thread. +-This script assumes that the taylor kernels have been run on the data scene as done in run_taylor_kernels.py +-""" +-import os +-import multiprocessing +-import Queue +-import time +-import random +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class taylor_error_job(): +- +- def __init__(self, data_scene, taylor_scenes, block_i, block_j, block_k): +- self.data_scene = data_scene +- self.taylor_scenes = taylor_scenes +- self.block_i = block_i +- self.block_j = block_j +- self.block_k = block_k +- +- +-def execute_jobs(jobs, num_procs=4): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = taylor_error_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class taylor_error_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Computing Error Scene") +- batch.init_process("bvplComputeTaylorErrorProcess") +- batch.set_input_from_db(0, job.data_scene) +- batch.set_input_from_db(1, job.taylor_scenes) +- batch.set_input_int(2, job.block_i) +- batch.set_input_int(3, job.block_j) +- batch.set_input_int(4, job.block_k) +- batch.run_process() +- +- print("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +-#*******************The Main Algorithm ************************# +-if __name__ == "__main__": +- batch.register_processes() +- batch.register_datatypes() +- +- # Parse inputs +- parser = optparse.OptionParser(description='Compute Taylor Error Scene') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--taylor_dir', action="store", dest="taylor_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- parser.add_option('--nblocks_x', action="store", +- dest="nblocks_x", type="int") +- parser.add_option('--nblocks_y', action="store", +- dest="nblocks_y", type="int") +- parser.add_option('--nblocks_z', action="store", +- dest="nblocks_z", type="int") +- +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- taylor_dir = options.taylor_dir +- nblocks_x = options.nblocks_x +- nblocks_y = options.nblocks_y +- nblocks_z = options.nblocks_z +- num_cores = options.num_cores +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(taylor_dir + "/"): +- print "Invalid Taylor Dir" +- sys.exit(-1) +- +- print("Loading Data Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- data_scene = dbvalue(scene_id, scene_type) +- +- # Load taylor scenes +- print("Loading Taylor Scenes") +- batch.init_process("bvplLoadTaylorScenesProcess") +- batch.set_input_string(0, taylor_dir) +- batch.set_input_int(1, -2) # min and max points of the kernel +- batch.set_input_int(2, -2) +- batch.set_input_int(3, -2) +- batch.set_input_int(4, 2) +- batch.set_input_int(5, 2) +- batch.set_input_int(6, 2) +- batch.run_process() +- (id, type) = batch.commit_output(0) +- taylor_scenes = dbvalue(id, type) +- +- # Begin multiprocessing +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- blocks_x = [i for i in range(0, nblocks_x)] +- blocks_y = [i for i in range(0, nblocks_y)] +- blocks_z = [i for i in range(0, nblocks_z)] +- +- random.shuffle(blocks_x) +- random.shuffle(blocks_y) +- random.shuffle(blocks_y) +- +- # Enqueue jobs +- for i in range(0, len(blocks_x)): +- for j in range(0, len(blocks_y)): +- for k in range(0, len(blocks_z)): +- block_i = blocks_x[i] +- block_j = blocks_y[j] +- block_k = blocks_z[k] +- current_job = taylor_error_job( +- data_scene, taylor_scenes, block_i, block_j, block_k) +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py +deleted file mode 100644 +index 40fcac4910..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py ++++ /dev/null +@@ -1,113 +0,0 @@ +-import os +-import multiprocessing +-import Queue +-import time +-import random +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class histogram_job(): +- +- def __init__(self, scene_path): +- self.scene_path = scene_path +- +- +-def execute_jobs(jobs, num_procs=4): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = histogram_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class histogram_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, job.scene_path) +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- print("Explore Histogram") +- batch.init_process("bvplSceneHistorgramProcess") +- batch.set_input_from_db(0, scene) +- batch.run_process() +- +- print("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +-#*******************The Main Algorithm ************************# +- +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- parser = optparse.OptionParser(description='Run Taylor Kernels') +- +- parser.add_option('--taylor_dir', action="store", dest="taylor_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- +- options, args = parser.parse_args() +- +- taylor_dir = options.taylor_dir +- num_cores = options.num_cores +- +- if not os.path.isdir(taylor_dir + "/"): +- print "Invalid Taylor Dir" +- sys.exit(-1) +- +- # Kernel names for 2-degree approximation +- kernel_list = [] +- kernel_list.append("I0") +- kernel_list.append("Ix") +- kernel_list.append("Iy") +- kernel_list.append("Iz") +- kernel_list.append("Ixx") +- kernel_list.append("Iyy") +- kernel_list.append("Izz") +- kernel_list.append("Ixy") +- kernel_list.append("Ixz") +- kernel_list.append("Iyz") +- +- # Begin multiprocessing +- t1 = time.time() +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- # Enqueue jobs +- for curr_kernel in range(0, len(kernel_list)): +- scene_path = taylor_dir + "/" + \ +- kernel_list[curr_kernel] + "/float_response_scene.xml" +- current_job = histogram_job(scene_path) +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py +deleted file mode 100644 +index 76a0beacab..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py ++++ /dev/null +@@ -1,98 +0,0 @@ +-import os +-from multiprocessing import Queue +-from taylor_kernel_threads import taylor_kernel_job, execute_jobs +-import time +-import optparse +-import random +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +-if __name__ == "__main__": +- parser = optparse.OptionParser(description='Run Taylor Kernels') +- +- parser.add_option('--model_dir', action="store", dest="model_dir") +- parser.add_option('--taylor_dir', action="store", dest="taylor_dir") +- parser.add_option('--kernel_path', action="store", dest="kernel_path") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- parser.add_option('--nblocks_x', action="store", +- dest="nblocks_x", type="int") +- parser.add_option('--nblocks_y', action="store", +- dest="nblocks_y", type="int") +- parser.add_option('--nblocks_z', action="store", +- dest="nblocks_z", type="int") +- +- options, args = parser.parse_args() +- +- model_dir = options.model_dir +- taylor_dir = options.taylor_dir +- kernel_path = options.kernel_path +- nblocks_x = options.nblocks_x +- nblocks_y = options.nblocks_y +- nblocks_z = options.nblocks_z +- num_cores = options.num_cores +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Model Dir" +- sys.exit(-1) +- +- if not os.path.isdir(model_dir + "/"): +- print "Invalid Kernel Path" +- sys.exit(-1) +- +- if not os.path.isdir(taylor_dir + "/"): +- os.mkdir(taylor_dir + "/") +- +- # Kernel names for 2-degree approximation +- kernel_list = [] +- kernel_list.append("I0") +- kernel_list.append("Ix") +- kernel_list.append("Iy") +- kernel_list.append("Iz") +- kernel_list.append("Ixx") +- kernel_list.append("Iyy") +- kernel_list.append("Izz") +- kernel_list.append("Ixy") +- kernel_list.append("Ixz") +- kernel_list.append("Iyz") +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, model_dir + "/mean_color_scene.xml") +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- # Begin multiprocessing +- t1 = time.time() +- work_queue = Queue() +- job_list = [] +- +- blocks_x = [i for i in range(0, nblocks_x)] +- blocks_y = [i for i in range(0, nblocks_y)] +- blocks_z = [i for i in range(0, nblocks_z)] +- +- random.shuffle(blocks_x) +- random.shuffle(blocks_y) +- random.shuffle(blocks_y) +- +- # Enqueue jobs +- for curr_kernel in range(0, len(kernel_list)): +- for i in range(0, len(blocks_x)): +- for j in range(0, len(blocks_y)): +- for k in range(0, len(blocks_z)): +- block_i = blocks_x[i] +- block_j = blocks_y[j] +- block_k = blocks_z[k] +- curr_kernel_path = kernel_path + "/" + \ +- kernel_list[curr_kernel] + ".txt" +- output_path = taylor_dir + "/" + kernel_list[curr_kernel] +- if not os.path.isdir(output_path + "/"): +- os.mkdir(output_path + "/") +- current_job = taylor_kernel_job( +- scene, curr_kernel_path, block_i, block_j, block_k, output_path) +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py +deleted file mode 100644 +index 1694729229..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py ++++ /dev/null +@@ -1,146 +0,0 @@ +-import multiprocessing +-import Queue +-import time +-import os +-import optparse +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class save_scene_job(): +- +- def __init__(self, input_scene_path, output_scene_path): +- self.input_scene_path = input_scene_path +- self.output_scene_path = output_scene_path +- +- +-def execute_jobs(jobs, num_procs=5): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = save_scene_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class save_scene_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Creating a Scene") +- batch.init_process("boxmCreateSceneProcess") +- batch.set_input_string(0, job.input_scene_path) +- batch.run_process() +- (scene_id, scene_type) = batch.commit_output(0) +- scene = dbvalue(scene_id, scene_type) +- +- print("Save Scene") +- batch.init_process("boxmSaveSceneRawProcess") +- batch.set_input_from_db(0, scene) +- batch.set_input_string( +- 1, job.output_scene_path + "_float") +- batch.set_input_unsigned(2, 0) +- batch.set_input_unsigned(3, 1) +- batch.run_process() +- +-# resolution = 0; +-# enforce_level = 1; +- +-# print("Convert to regular grid"); +-# batch.init_process("boxmSceneToBvxmGridProcess"); +-# batch.set_input_from_db(0,scene); +-# batch.set_input_string(1, job.output_scene_path + ".vox"); +-# batch.set_input_unsigned(2, resolution); +-# batch.set_input_bool(3, enforce_level); +-# batch.run_process(); +-# (grid_id, grid_type) = batch.commit_output(0); +-# grid = dbvalue(grid_id, grid_type); +-# +-# print("Save Grid"); +-# batch.init_process("bvxmSaveGridRawProcess"); +-# batch.set_input_from_db(0,grid); +-# batch.set_input_string(1,job.output_scene_path + ".raw"); +-# batch.run_process(); +- +- print ("Runing time for worker:", self.name) +- print(time.time() - start_time) +- +- +-#*********************The Main Algorithm ****************************# +-if __name__ == "__main__": +- +- batch.register_processes() +- batch.register_datatypes() +- +- parser = optparse.OptionParser( +- description='Save taylor responses to raw file') +- +- parser.add_option('--taylor_dir', action="store", dest="taylor_dir") +- parser.add_option('--num_cores', action="store", +- dest="num_cores", type="int", default=4) +- +- options, args = parser.parse_args() +- +- taylor_dir = options.taylor_dir +- num_cores = options.num_cores +- +- if not os.path.isdir(taylor_dir + "/"): +- print "Invalid Taylor Dir" +- sys.exit(-1) +- +- kernel_list = [] +- +- kernel_list.append("I0") +- kernel_list.append("Ix") +- kernel_list.append("Iy") +- kernel_list.append("Iz") +- kernel_list.append("Ixx") +- kernel_list.append("Iyy") +- kernel_list.append("Izz") +- kernel_list.append("Ixy") +- kernel_list.append("Ixz") +- kernel_list.append("Iyz") +- +- # Begin multiprocessing +- t1 = time.time() +- work_queue = multiprocessing.Queue() +- job_list = [] +- +- # Enqueue jobs +-# for i in range(0, len(kernel_list)): +-# +-# scene_in_path = taylor_dir + "/" + kernel_list[i] + "/float_response_scene.xml"; +-# scene_out_path = taylor_dir + "/" + kernel_list[i]+ "/float_response_scene"; +-# +-# current_job = save_scene_job(scene_in_path, scene_out_path); +-# +-# job_list.append(current_job); +- +- # append error scene +- scene_in_path = taylor_dir + "/error_scene.xml" +- scene_out_path = taylor_dir + "/error_scene" +- current_job = save_scene_job(scene_in_path, scene_out_path) +- job_list.append(current_job) +- +- execute_jobs(job_list, num_cores) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh +deleted file mode 100755 +index db27ee1939..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh ++++ /dev/null +@@ -1,67 +0,0 @@ +-#!/bin/bash +-""" +-Created on Mon Feb 14, 2011 +- +-@author:Isabel Restrepo +- +-A script that encapsulates all steps needed to computer taylor reconstruction error +-""" +- +-if [ $1 = "-r" ] ; then +- export PYTHONPATH=/Projects/vxl/bin/Release/lib +-else +- if [ $1 = "-d" ] ; then +- export PYTHONPATH=/Projects/vxl/bin/Debug/lib +- else +- echo "Need a flag, either -d or -r"; +- fi +-fi +- +-echo "PYTHONPATH=" $PYTHONPATH +- +-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall"; +-#taylor_dir="/Users/isa/Experiments/Taylor/CapitolBOXMSmall_test"; +-#kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5"; +-#nblocks_x=1; +-#nblocks_y=1; +-#nblocks_z=1; +- +- +-#model_dir="/Users/isa/Experiments/CapitolBOXM_6_4_4"; +-#model_name="capitol_scene"; +-#taylor_dir="/Users/isa/Experiments/Taylor/CapitolBOXM_6_4_4"; +-#kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5"; +-#nblocks_x=6; +-#nblocks_y=4; +-#nblocks_z=4; +- +- +-model_dir="/Users/isa/Experiments/DowntownBOXM_12_12_4"; +-model_name="downtown_scene"; +-taylor_dir="/Users/isa/Experiments/Taylor/DowntownBOXM_12_12_4"; +-kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5"; +-nblocks_x=12; +-nblocks_y=12; +-nblocks_z=4; +- +-fraction=1.0; +-num_cores=10; +- +-cd "/Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor" +- +-# #Compute Expected Color Scene +-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name +-# +-# #Compute Responses to Taylor Kernels +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/run_taylor_kernels.py --model_dir $model_dir --taylor_dir $taylor_dir --kernel_path $kernel_path --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z +-# +-# #Compute reconstruction at each voxel in the scene +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/compute_taylor_error_scene.py --model_dir $model_dir --taylor_dir $taylor_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z +-# +-# #Add error of fraction of voxels +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/add_taylor_error.py --model_dir $model_dir --taylor_dir $taylor_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --fraction $fraction +-# +-# #Save all scenes to drishti raw file +-python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/save_taylor_raw.py --taylor_dir $taylor_dir --num_cores $num_cores +- +-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/explore_histogram.py --taylor_dir $taylor_dir --num_cores $num_cores +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py +deleted file mode 100644 +index 029ce9315d..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py ++++ /dev/null +@@ -1,72 +0,0 @@ +-import multiprocessing +-import Queue +-import time +- +-import brl_init +-import bvpl_octree_batch as batch +-dbvalue = brl_init.register_batch(batch) +- +- +-class taylor_kernel_job(): +- +- def __init__(self, scene, kernel_path, block_i, block_j, block_k, output_path): +- self.scene = scene +- self.kernel_path = kernel_path +- self.block_i = block_i +- self.block_j = block_j +- self.block_k = block_k +- self.output_path = output_path +- +- +-def execute_jobs(jobs, num_procs=5): +- work_queue = multiprocessing.Queue() +- result_queue = multiprocessing.Queue() +- for job in jobs: +- work_queue.put(job) +- +- for i in range(num_procs): +- worker = taylor_kernel_worker(work_queue, result_queue) +- worker.start() +- print("worker with name ", worker.name, " started!") +- +- +-class taylor_kernel_worker(multiprocessing.Process): +- +- def __init__(self, work_queue, result_queue): +- # base class initialization +- multiprocessing.Process.__init__(self) +- # job management stuff +- self.work_queue = work_queue +- self.result_queue = result_queue +- self.kill_received = False +- +- def run(self): +- while not self.kill_received: +- # get a task +- try: +- job = self.work_queue.get_nowait() +- except Queue.Empty: +- break +- +- start_time = time.time() +- +- print("Creating taylor kernel") +- batch.init_process("bvplLoadTaylorKernelProcess") +- batch.set_input_string(0, job.kernel_path) +- batch.run_process() +- (kernel_id, kernel_type) = batch.commit_output(0) +- kernel = dbvalue(kernel_id, kernel_type) +- +- print("Running Kernel") +- batch.init_process("bvplBlockKernelOperatorProcess") +- batch.set_input_from_db(0, job.scene) +- batch.set_input_from_db(1, kernel) +- batch.set_input_int(2, job.block_i) +- batch.set_input_int(3, job.block_j) +- batch.set_input_int(4, job.block_k) +- batch.set_input_string(5, "algebraic") +- batch.set_input_string(6, job.output_path) +- batch.run_process() +- +- print ("Runing time for worker:", self.name) +- print(time.time() - start_time) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt +deleted file mode 100644 +index 0784ff8eea..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt ++++ /dev/null +@@ -1,16 +0,0 @@ +-# contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt +- +-set(bvpl_octree_sample_sources +- bvpl_octree_sample.h bvpl_octree_sample.hxx +- bvpl_taylor_basis_sample.h bvpl_taylor_basis_sample.cxx +- bvpl_pca_basis_sample.h bvpl_pca_basis_sample.hxx +- ) +- +-aux_source_directory(Templates bvpl_octree_sample_sources) +- +-vxl_add_library(LIBRARY_NAME bvpl_octree_sample LIBRARY_SOURCES ${bvpl_octree_sample_sources}) +-target_link_libraries(bvpl_octree_sample ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl) +- +-if( BUILD_TESTING ) +- add_subdirectory(tests) +-endif() +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx +deleted file mode 100644 +index 8cdbd4476b..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BSTA_GAUSSIAN_SPHERE_INSTANTIATE(float, 1); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx +deleted file mode 100644 +index da403deee4..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx ++++ /dev/null +@@ -1,7 +0,0 @@ +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-BVPL_OCTREE_SAMPLE_INSTANTIATE(gauss_type); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx +deleted file mode 100644 +index f88db3342c..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BVPL_OCTREE_SAMPLE_INSTANTIATE(float); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx +deleted file mode 100644 +index fcaa1db057..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-BVPL_PCA_BASIS_SAMPLE_INSTANTIATE(10); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h +deleted file mode 100644 +index 8f1cc33b1f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h ++++ /dev/null +@@ -1,57 +0,0 @@ +-// This is brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h +-#ifndef bvpl_octree_sample_h +-#define bvpl_octree_sample_h +-//: +-// \file +-// \brief A data structure to contain bvpl_kernel response, and id corresponding to axis of rotations and rotation around axis +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date December 9, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-template +-class bvpl_octree_sample +-{ +- public: +- //: Default Constructor. Be careful when using default constructor, the value of response may be nonsense +- // This is indicated by the negative id. +- bvpl_octree_sample():response_(),id_(-1){} +- +- //: Constructor from response and id +- bvpl_octree_sample(const T_data& response, const int& id): +- response_(response),id_(id){} +- +- short version_no() const{ return 1; } +- +- void print(std::ostream& os) const; +- +- //Member variables +- T_data response_; +- int id_; +-}; +- +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample *&sample); +- +-template +-std::ostream& operator << (std::ostream& os, const bvpl_octree_sample& sample); +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx +deleted file mode 100644 +index fdc4d34d4a..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx ++++ /dev/null +@@ -1,70 +0,0 @@ +-#ifndef bvpl_octree_sample_hxx_ +-#define bvpl_octree_sample_hxx_ +- +-#include "bvpl_octree_sample.h" +- +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.response_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.response_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +- +-template +-void bvpl_octree_sample::print(std::ostream& os) const +-{ +- os << "(response=" << response_ << " id=" << id_ <<')'; +-} +- +-template +-std::ostream& operator << (std::ostream& os, const bvpl_octree_sample& sample) +-{ +- sample.print(os); +- return os; +-} +- +-#define BVPL_OCTREE_SAMPLE_INSTANTIATE(T) \ +-template class bvpl_octree_sample; \ +-template std::ostream& operator << (std::ostream&, const bvpl_octree_sample&); \ +-template void vsl_b_write(vsl_b_ostream &, bvpl_octree_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, bvpl_octree_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, bvpl_octree_sample &); \ +-template void vsl_b_read(vsl_b_istream &, bvpl_octree_sample *&) +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h +deleted file mode 100644 +index 64e29dd1fd..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h ++++ /dev/null +@@ -1,57 +0,0 @@ +-// This is bvpl_pca_basis_sample.h +-#ifndef bvpl_pca_basis_sample_h +-#define bvpl_pca_basis_sample_h +- +-//: +-// \file +-// \brief A data structure that contains the vector of projections on pca space +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 28-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-template +-class bvpl_pca_basis_sample{ +- +-public: +- bvpl_pca_basis_sample(){ +- pca_projections_.fill(0); +- } +- +- bvpl_pca_basis_sample(vnl_vector_fixed pp){ +- pca_projections_ = pp; +- } +- inline short version_no() const{ return 1; } +- +- //: Vector of projections on pca space +- vnl_vector_fixed pca_projections_; +- +-}; +- +- +-template +-std::ostream& operator << (std::ostream& os, const bvpl_pca_basis_sample& sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample const &sample); +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample const * &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample &sample); +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample *&sample); +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx +deleted file mode 100644 +index 93769db3f7..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx ++++ /dev/null +@@ -1,72 +0,0 @@ +-#ifndef bvpl_pca_basis_sample_hxx_ +-#define bvpl_pca_basis_sample_hxx_ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 28-Feb-2011 +- +-#include "bvpl_pca_basis_sample.h" +- +-#include +-#include +- +- +-template +-std::ostream& operator << (std::ostream& os, const bvpl_pca_basis_sample& sample) +-{ +- os << "PCA projection = " << sample.pca_projections_ << std::endl; +- return os; +-} +- +-//I/O +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample const &sample) +-{ +- vsl_b_write(os, sample.version_no()); +- vsl_b_write(os, sample.pca_projections_); +-} +- +-template +-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample const * &sample) +-{ +- if (sample) { +- vsl_b_write(os, *sample); +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample &sample) +-{ +- if (!is) return; +- +- short version; +- vsl_b_read(is,version); +- switch (version) +- { +- case 1: +- vsl_b_read(is, sample.pca_projections_); +- break; +- default: +- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +-} +- +-template +-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +- +- +-#define BVPL_PCA_BASIS_SAMPLE_INSTANTIATE(T) \ +-template class bvpl_pca_basis_sample; \ +-template std::ostream& operator << (std::ostream&, const bvpl_pca_basis_sample&); \ +-template void vsl_b_write(vsl_b_ostream &, bvpl_pca_basis_sample const &); \ +-template void vsl_b_write(vsl_b_ostream &, bvpl_pca_basis_sample const *&); \ +-template void vsl_b_read(vsl_b_istream &, bvpl_pca_basis_sample &); \ +-template void vsl_b_read(vsl_b_istream &, bvpl_pca_basis_sample *&) +- +-#endif // bvpl_pca_basis_sample_hxx_ +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx +deleted file mode 100644 +index f2d0372181..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx ++++ /dev/null +@@ -1,58 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 10-Feb-2011 +- +-#include "bvpl_taylor_basis_sample.h" +-#include +-#include +- +-std::ostream& operator << (std::ostream& os, const bvpl_taylor_basis2_sample& sample) +-{ +- os << "I0 = " << sample.I0 << ", G= " <&)\n" +- << " Unknown version number "<< version << '\n'; +- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream +- break; +- } +- +-} +- +-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample *&sample) +-{ +- vsl_b_read(is, *sample); +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h +deleted file mode 100644 +index a10ece861f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h ++++ /dev/null +@@ -1,59 +0,0 @@ +-// This is bvpl_taylor_basis_sample.h +-#ifndef bvpl_taylor_basis_sample_h +-#define bvpl_taylor_basis_sample_h +- +-//: +-// \file +-// \brief A data structure that contains vectors and matrices needed for taylor approximation +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date 10-Feb-2011. +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +- +-//: Data structure needed for 2-degree taylor approximation of 3-dimesional volumes +-class bvpl_taylor_basis2_sample +-{ +-public: +- bvpl_taylor_basis2_sample() +- { +- I0 = 0.0f; +- //empty - to save space +- G = vnl_double_3(0.0,0.0,0.0); +- H = vnl_double_3x3(0.0); +- } +- +- bvpl_taylor_basis2_sample(double zeroth_dev, vnl_double_3 grad, vnl_double_3x3 hess): I0(zeroth_dev), G(grad), H(hess){} +- +- short version_no() const{ return 1; } +- //: Approximation to zeroth derivative +- double I0; +- //: Approximation to the Gradient Vector +- vnl_double_3 G; +- //: Approximation to the Hessian +- vnl_double_3x3 H; +-}; +- +-std::ostream& operator << (std::ostream& os, const bvpl_taylor_basis2_sample& sample); +- +-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const &sample); +- +-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const * &sample); +- +-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample &sample); +- +-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample *&sample); +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt +deleted file mode 100644 +index a5ca7c7bdf..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt ++++ /dev/null +@@ -1,4 +0,0 @@ +-add_executable( bvpl_octree_sample_test_include test_include.cxx ) +-target_link_libraries( bvpl_octree_sample_test_include bvpl_octree_sample) +-add_executable( bvpl_octree_sample_test_template_include test_template_include.cxx ) +-target_link_libraries( bvpl_octree_sample_test_template_include bvpl_octree_sample) +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx +deleted file mode 100644 +index df8d03d364..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx ++++ /dev/null +@@ -1,5 +0,0 @@ +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx +deleted file mode 100644 +index 075d4723fb..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt +deleted file mode 100644 +index 5781fd45ca..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt ++++ /dev/null +@@ -1,35 +0,0 @@ +-include_directories( ${MUL_INCLUDE_DIR} ) +- +-add_executable( bvpl_octree_test_all +- test_driver.cxx +- test_octree_kernel_operator.cxx +- test_octree_neighbors.cxx +-#Test EXHIBITS PATH ERRORS -- FIX_ME +-# test_pca_kernels.cxx +-#Test FAILS -- FIX_ME +-# test_taylor_basis.cxx +-# Test FAILS FIX_ME +-# test_gauss3D_steerable_filters.cxx +- ) +- +-set(bvpl_octree_test_all_sources +- test_utils.h test_utils.cxx +- ) +- +-vxl_add_library(LIBRARY_NAME bvpl_octree_tests_util LIBRARY_SOURCES ${bvpl_octree_test_all_sources}) +- +-target_link_libraries( bvpl_octree_tests_util bvpl_octree_io bvpl_octree bvpl boct boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul) +-target_link_libraries( bvpl_octree_test_all bvpl_octree_tests_util bvpl_octree_io bvpl_octree bvpl boct boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul) +- +-add_test( NAME bvpl_octree_test_kernel_operator COMMAND $ test_octree_kernel_operator ) +-add_test( NAME bvpl_octree_test_neighbors COMMAND $ test_octree_neighbors ) +-#add_test( NAME bvpl_octree_test_pca COMMAND $ test_pca_kernels ) +-#add_test( NAME bvpl_octree_test_taylor_basis COMMAND $ test_taylor_basis ) +-#add_test( NAME test_gauss3D_steerable_filters COMMAND $ test_gauss3D_steerable_filters ) +- +-add_executable( bvpl_octree_test_include test_include.cxx ) +-target_link_libraries( bvpl_octree_test_include bvpl_octree) +- +-add_executable( bvpl_octree_test_template_include test_template_include.cxx ) +-target_link_libraries( bvpl_octree_test_template_include bvpl_octree) +- +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx +deleted file mode 100644 +index b1b39e0bed..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx ++++ /dev/null +@@ -1,19 +0,0 @@ +-#include +- +-DECLARE( test_octree_kernel_operator ); +-DECLARE( test_octree_neighbors ); +-//DECLARE( test_pca_kernels );//TEST EXHIBITS PATH ERRORS +-//DECLARE( test_taylor_basis );//TEST FAILS FIX_ME +-//DECLARE( test_gauss3D_steerable_filters );//TEST FAILS FIX_ME +- +-void register_tests() +-{ +- REGISTER( test_octree_kernel_operator ); +- REGISTER( test_octree_neighbors ); +- // REGISTER( test_pca_kernels ); +- // REGISTER( test_taylor_basis ); +- // REGISTER( test_gauss3D_steerable_filters ); +-} +- +- +-DEFINE_MAIN; +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx +deleted file mode 100644 +index 47ec04a8ef..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx ++++ /dev/null +@@ -1,127 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 24-Aug-2011 +- +-#include +- +-#include "test_utils.h" +- +-#include +- +-void test_gauss3D_steerable_filters() +-{ +- typedef boct_tree float_tree_type; +- typedef boct_tree > out_tree_type; +- +- clean_up(); +- +- //create scene +- boxm_scene > *mean_scene = create_scene(2,2,2); +- +- //Explore mean scene +- std::cout << "Exploring mean scene \n"; +- { +- boxm_cell_iterator > iterator = mean_scene->cell_iterator(&boxm_scene >::load_block); +- iterator.begin(); +- +- while (!iterator.end()) { +- boct_tree_cell *cell = *iterator; +- //if(cell->data().mean() > 0.6) +- { +- boct_loc_code code =cell->get_code(); +- std::cout << " Code: " <data() << std::endl; +- +- } +- ++iterator; +- } +- } +- +- //create the output scenes +- boxm_scene *scene_out = +- new boxm_scene(mean_scene->lvcs(), mean_scene->origin(), mean_scene->block_dim(), mean_scene->world_dim(), mean_scene->max_level(), mean_scene->init_level()); +- scene_out->set_paths(".", "steerable_gauss_3d_scene"); +- scene_out->set_appearance_model(VNL_FLOAT_10); +- scene_out->write_scene("steerable_gauss_3d_scene.xml"); +- mean_scene->clone_blocks_to_vector<10>(*scene_out); +- +- //Explore Initial Response scene +- std::cout << "Exploring initial response scene \n"; +- { +- boxm_cell_iterator iterator = scene_out->cell_iterator(&boxm_scene::load_block); +- iterator.begin(); +- +- while (!iterator.end()) { +- boct_tree_cell > *cell = *iterator; +- //if(cell->data().mean() > 0.6) +- { +- boct_loc_code code =cell->get_code(); +- std::cout << " Code: " <data() << std::endl; +- +- } +- ++iterator; +- } +- } +- +- boxm_scene > *valid_scene = +- new boxm_scene >(mean_scene->lvcs(), mean_scene->origin(), mean_scene->block_dim(), mean_scene->world_dim(), mean_scene->max_level(), mean_scene->init_level()); +- valid_scene->set_paths(".", "valid_scene"); +- valid_scene->set_appearance_model(BOXM_BOOL); +- valid_scene->write_scene("valid_scene.xml"); +- +- //operate on scene +- double cell_length = scene_out->finest_cell_length(); +- bvpl_gauss3D_steerable_filters sf; +- +- sf.basis_response_at_leaves(scene_out, valid_scene, cell_length); +- +- +- //Explore Response scene +- std::cout << "Exploring response scene \n"; +- { +- boxm_cell_iterator iterator = scene_out->cell_iterator(&boxm_scene::load_block); +- iterator.begin(); +- +- while (!iterator.end()) { +- boct_tree_cell > *cell = *iterator; +- //if(cell->data().mean() > 0.6) +- { +- boct_loc_code code =cell->get_code(); +- std::cout << " Code: " <data() << std::endl; +- +- } +- ++iterator; +- } +- } +- +- //rotate features according to gradient +- sf.rotation_invariant_interpolation(scene_out, valid_scene); +- +- //Explore Invariant Response scene +- std::cout << "Exploring rotation invariant response scene \n"; +- { +- boxm_cell_iterator iterator = scene_out->cell_iterator(&boxm_scene::load_block); +- iterator.begin(); +- +- while (!iterator.end()) { +- boct_tree_cell > *cell = *iterator; +- //if(cell->data().mean() > 0.6) +- { +- boct_loc_code code =cell->get_code(); +- std::cout << " Code: " <data() << std::endl; +- +- } +- ++iterator; +- } +- } +- +- bool result = true; +- TEST("Valid Test", result, true); +-} +- +- +-TESTMAIN(test_gauss3D_steerable_filters); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx +deleted file mode 100644 +index a3b8a060e7..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx ++++ /dev/null +@@ -1,24 +0,0 @@ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx +deleted file mode 100644 +index 73b0ddef0f..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx ++++ /dev/null +@@ -1,352 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date Nov. 16, 2009. +- +-#include +- +-#include "../bvpl_octree_kernel_operator.h" +-#include "../bvpl_scene_kernel_operator.h" +-#include "../bvpl_octree_vector_operator_impl.h" +-#include "../bvpl_scene_vector_operator.h" +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-static bool debug = false; +-typedef boct_tree tree_type; +-typedef boct_tree_cell cell_type; +- +- +-void fill_sample_octree(boct_tree* tree) +-{ +- std::cout << "Creating Octree" << std::endl; +- +- //Create tree +- tree->split(); +- +- { +- std::vector*> leaves = tree->leaf_cells(); +- tree->init_cells(0.1f); +- leaves[1]->set_data(0.5); +- if (debug) +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->data() << std::endl; +- } +- +- leaves[1]->split(); +- //leaves[1]->set_data(0.6); +- } +- +-#if 0 +- { +- std::vector*> leaves = tree->cells_at_level((short)0); +- for (unsigned i=0; iget_code().x_loc_ << ',' +- << leaves[i]->get_code().y_loc_ << ',' +- << leaves[i]->get_code().z_loc_ << ',' +- << tree->local_origin(leaves[i]) << ',' +- << leaves[i]->get_code().level << ',' +- << tree->cell_size(leaves[i]) << ',' +- << leaves[i]->data() << std::endl; +- } +- } +-#endif +-} +- +-void fill_edge3d_tree(boct_tree* tree) +-{ +- tree-> split(); +- std::vector*> leaves = tree->leaf_cells(); +- for (unsigned i= 0; i<4; i++) +- { +- leaves[i]->set_data(0.2f); +- leaves[i]->split(); +- { +- boct_tree_cell* cc =leaves[i]->children(); +- for (unsigned j1=0; j1<8; j1++) +- cc[j1].split(); +- } +- leaves[i+4]->set_data(0.9f); +- leaves[i+4]->split(); +- { +- boct_tree_cell* cc =leaves[i+4]->children(); +- for (unsigned j1=0; j1<8; j1++) +- cc[j1].split(); +- } +- //split children +- std::vector*> leaves = tree->leaf_cells(); +- } +-} +- +-void octree_kernel() +-{ +- //Create kernel +- bvpl_edge3d_kernel_factory edge_factory(-1,1,-1,0,-1,0); +- bvpl_kernel_sptr kernel = new bvpl_kernel(edge_factory.create()); +-#ifdef DEBUG +- kernel->print(); +-#endif +- //Create functor +- bvpl_edge_geometric_mean_functor functor; +- +- //Create the octree +- auto *tree = new boct_tree(3); +- fill_sample_octree(tree); +- +- //operate kernel on octree +- bvpl_octree_kernel_operator oper(tree); +- +- boct_tree *tree_out = tree->clone(); +-#ifdef DEBUG +- tree_out->print(); +-#endif +- oper.operate(functor, kernel, tree_out, 1, 0.5); +-#ifdef DEBUG +- tree_out->print(); +-#endif +- +- TEST("Octree kernel", true, true); +- delete tree; +- delete tree_out; +-} +- +-void scene_kernel_operator() +-{ +- //Create kernel +- bvpl_edge3d_kernel_factory edge_factory(-1,0,-1,0,-1,0); +- bvpl_kernel_sptr kernel = new bvpl_kernel(edge_factory.create()); +- +- //kernel->print(); +- +- //Create functor +- bvpl_edge_geometric_mean_functor functor; +- +- +- /***********Part1 operate on tree*******************/ +- +- //Create tree +- typedef boct_tree tree_type; +- auto *tree = new boct_tree(3); +- +- fill_sample_octree(tree); +- +- //operate on octree +- bvpl_octree_kernel_operator oper(tree); +- +- +- //Create output trees +- boct_tree *tree_out = tree->clone(); +- tree_out->init_cells(0.0f); +- short level = 0; +- double cell_length = 1.0/(double)(1<<(tree->root_level() -level)); +- +- // void operate(F functor, bvpl_kernel_sptr kernel, tree_type* out_tree, short level, double cell_length) +- oper.operate(functor,kernel, tree_out, level, cell_length); +- +- +- /***********Part2 operate on scene*******************/ +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- +- //world coordinate dimensions of a block +- vgl_vector_3d block_dim(1,1,1); +- +- //number of blocks in a scene +- vgl_vector_3d world_dim(1,1,1); +- boxm_scene scene(lvcs, origin, block_dim, world_dim); +- std::string scene_path="./"; +- scene.set_paths(scene_path, "in_block"); +- +- boxm_block_iterator iter =scene.iterator(); +- iter.begin(); +- for (; !iter.end(); iter++) { +- scene.load_block(iter.index()); +- boxm_block *block = scene.get_active_block(); +- block->init_tree(tree->clone()); +- scene.write_active_block(); +- } +- +- //Create the output scenes +- boxm_scene > scene_out(lvcs, origin, block_dim, world_dim); +- scene_out.set_paths(scene_path, "response_scene"); +- +- //operate on scene +- bvpl_scene_kernel_operator scene_oper; +- scene_oper.operate(scene,functor, kernel, scene_out); +- +- //compare blocks of scene with single tree, result should be the same +- std::vector* > leaves_out = tree_out->leaf_cells(); +- boxm_block_iterator iter2 =scene_out.iterator(); +- bool eq=true; +- iter2.begin(); +- for (; !iter2.end(); iter2++) { +- scene_out.load_block(iter2.index()); +- boxm_block *block = scene_out.get_active_block(); +- tree_type *temp_tree = block->get_tree(); +- std::vector* > temp_leaves = temp_tree->leaf_cells(); +- // compare tree values +- for (unsigned i=0; idata() == leaves_out[i]->data()))) +- { +- std::cout << "scene data: " << temp_leaves[i]->data() << " grid data: " << leaves_out[i]->data() << std::endl; +- eq = false; +- } +- } +- } +- TEST("tree operator == scene operator", eq, true); +- //clean temporary files +- vul_file_iterator file_it("./*.bin"); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it());//file_it() is deleted here +- // vul_file::delete_file_glob(file_it()); +- } +-} +- +-void octree_vector_operator() +-{ +- //Create the vector of kernels +- bvpl_edge3d_kernel_factory kernels_3d(-3,2, -3,2,-3,2); +- bvpl_create_directions_a dir; +- bvpl_kernel_vector_sptr kernel_vec = kernels_3d.create_kernel_vector(dir); +- +- //Create functor +- bvpl_edge_geometric_mean_functor functor; +- +- //Create tree. this tree is initialized with 4 leves as a regular grid +- auto *tree = new boct_tree(4); +- +- fill_edge3d_tree(tree); +- +- boct_tree > *tree_out = tree->clone_to_type >(); +- tree_out->init_cells(bvpl_octree_sample(0.0f, -1)); +- short level = 0; +- double cell_length = 1.0/(double)(1<<(3 -level)); +- +- bvpl_max_vector_operator vector_op; +- +- vector_op.operate(tree, functor, kernel_vec, tree_out, level, cell_length); +- +- //test response at the center is correct +- boct_loc_code loc_code; +- +- bool result = true; +- for (short x=3; x<5; x++) +- for (short y=3; y<5; y++) +- for (short z=3; z<5; z++) +- { +- loc_code.set_code(x,y,z); +- loc_code.set_level(0); +- result = result && tree_out->get_cell(loc_code)->data().id_ == 0; +- } +- TEST("Octree vector operator", result, true); +-} +- +-void scene_vector_operator() +-{ +- //Create the vector of kernels +- bvpl_edge3d_kernel_factory kernels_3d(-3,2,-3,2,-3,2); +- bvpl_create_directions_a dir; +- bvpl_kernel_vector_sptr kernel_vec = kernels_3d.create_kernel_vector(dir); +- +- //Create functor +- bvpl_edge_geometric_mean_functor functor; +- +- /***********Part1 operate on tree*******************/ +- +- //Create tree. this tree is initialized with 4 leves as a regular grid +- auto *tree = new boct_tree(4); +- fill_edge3d_tree(tree); +- +- //Create output trees +- boct_tree > *tree_out = tree->clone_to_type >(); +- tree_out->init_cells(bvpl_octree_sample(0.0f, -1)); +- short level = 0; +- double cell_length = 1.0/(double)(1<<(3 -level)); +- +- //operate vector on tree +- bvpl_max_vector_operator vector_op; +- +- vector_op.operate(tree, functor, kernel_vec, tree_out, level, cell_length); +- +- /***********Part2 operate on scene*******************/ +- +- //Crete the input scene +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(10,10,20); +- +- vgl_vector_3d block_dim(1,1,1); //world coordinate dimensions of a block +- vgl_vector_3d world_dim(2,2,2); //number of blocks in a scene +- +- boxm_scene scene(lvcs, origin, block_dim, world_dim); +- std::string scene_path("./"); +- scene.set_paths(scene_path, "scene_in"); +- +- boxm_block_iterator iter =scene.iterator(); +- iter.begin(); +- for (; !iter.end(); iter++) { +- scene.load_block(iter.index()); +- boxm_block *block = scene.get_active_block(); +- block->init_tree(tree->clone()); +- scene.write_active_block(); +- } +- +- //Create the output scenes +- boxm_scene > > scene_out(lvcs, origin, block_dim, world_dim); +- scene_out.set_paths(scene_path, "response_scene"); +- +- //operate on scene +- bvpl_scene_vector_operator scene_oper; +- scene_oper.operate(scene, functor, kernel_vec, scene_out); +- +- //compare blocks of scene with single tree, result should be the same +- std::vector >* > leaves_out = tree_out->leaf_cells(); +- boxm_block_iterator > > iter2 =scene_out.iterator(); +- bool eq = true; +- iter2.begin(); +- for (; !iter2.end(); iter2++) { +- scene_out.load_block(iter2.index()); +- boxm_block > > *block = scene_out.get_active_block(); +- boct_tree > *temp_tree = block->get_tree(); +- std::vector >* > temp_leaves = temp_tree->leaf_cells(); +- // compare tree values +- for (unsigned i=0; idata().response_ == leaves_out[i]->data().response_)|| +- (temp_leaves[i]->data().id_ == leaves_out[i]->data().id_))) +- { +- std::cout << "scene data: " << temp_leaves[i]->data() << " grid data: " << leaves_out[i]->data() << std::endl; +- eq = false; +- } +- } +- +- TEST("tree operator == scene operator", eq, true); +- +- //clean temporary files +- vul_file_iterator file_it("./*.bin"); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it());//Already deletes file_it() +- // vul_file::delete_file_glob(file_it()); +- } +-} +- +- +-static void test_octree_kernel_operator() +-{ +- octree_kernel(); +- // octree_vector_operator(); //TEST FAIL FIX_ME +- // scene_kernel_operator(); +- // scene_vector_operator(); +- } +- +-TESTMAIN(test_octree_kernel_operator); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx +deleted file mode 100644 +index 20a062b9f9..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx ++++ /dev/null +@@ -1,92 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date Nov. 16, 2009. +- +-#include +- +-#include "../bvpl_octree_neighbors.h" +-#include "../bvpl_scene_kernel_operator.h" +-#include "../bvpl_octree_vector_operator_impl.h" +-#include "../bvpl_scene_vector_operator.h" +-#include +-#include +-#include +- +-#include +- +-static bool debug = false; +-typedef boct_tree tree_type; +-typedef boct_tree_cell cell_type; +- +- +-void fill_octree(boct_tree* tree) +-{ +- std::cout << "Creating Octree" << std::endl; +- +- //Create tree +- //tree->split(); +- +- { +- std::vector*> leaves = tree->leaf_cells(); +- tree->init_cells(0.1f); +- leaves[1]->set_data(0.5); +- if (debug) +- for (auto & leave : leaves) { +- std::cout<< leave->get_code().x_loc_ << ',' +- << leave->get_code().y_loc_ << ',' +- << leave->get_code().z_loc_ << ',' +- << leave->data() << std::endl; +- } +- +- leaves[0]->split(); +- //leaves[1]->set_data(0.6); +- } +- +-#if 0 +- { +- std::vector*> leaves = tree->cells_at_level((short)0); +- for (unsigned i=0; iget_code().x_loc_ << ',' +- << leaves[i]->get_code().y_loc_ << ',' +- << leaves[i]->get_code().z_loc_ << ',' +- << tree->local_origin(leaves[i]) << ',' +- << leaves[i]->get_code().level << ',' +- << tree->cell_size(leaves[i]) << ',' +- << leaves[i]->data() << std::endl; +- } +- } +-#endif +-} +- +-static void test_octree_neighbors() +-{ +- auto* tree = new boct_tree(4,3); +- fill_octree(tree); +- bvpl_kernel_iterator iter; +- vgl_point_3d min_pt(-1,-1,-1); +- vgl_point_3d max_pt(1,1,1); +- for (int i=min_pt.x(); i<=max_pt.x(); i++) { +- for (int j=min_pt.y(); j<=max_pt.y(); j++) { +- for (int k=min_pt.z(); k<=max_pt.z(); k++) { +- iter.insert(vgl_point_3d(i,j,k),bvpl_kernel_dispatch(1.0f)); +- } +- } +- } +- bvpl_kernel_sptr kernel= new bvpl_kernel(iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0),0.0f, vgl_vector_3d(3,3,3), min_pt,max_pt); +- +- std::vector*> leaves = tree->leaf_cells(); +- bvpl_octree_neighbors neighb(tree); +- for (auto cell : leaves) { +- std::cout << cell->code_ +- << "THIS " << tree->local_origin(cell) << std::endl; +- std::vector *> neighb_cells; +- neighb.neighbors(kernel, cell, neighb_cells); +- std::cout << "Number of neighbors: " << neighb_cells.size() << std::endl; +- for (auto & neighb_cell : neighb_cells) { +- std::cout << " " << tree->local_origin(neighb_cell) << std::endl; +- } +- } +-} +- +-TESTMAIN(test_octree_neighbors); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx +deleted file mode 100644 +index 602b9b14c6..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx ++++ /dev/null +@@ -1,304 +0,0 @@ +-//: +-// \file +-// \brief : Tests bvpl/PCA operations +-// \author Isabel Restrepo +-// \date 17-Nov-2010 +- +-#include +- +-#include +-#include +-#include "test_utils.h" +- +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-void test_kernel_set_up() +-{ +- bool result=true;; +- //create scene +- boxm_scene > *scene = create_scene(4,4,4); +- //neighborhood box for volume "patches" 3x3x3 +- vgl_box_3d neighborhood(vgl_point_3d(-1,-1,-1), vgl_point_3d(1,1,1)); +- //number of samples - 10% of total number of leaf-cells +- unsigned long nsamples = (unsigned long)((double)scene->size() * 0.1); +- +- clean_up("./evd", "*.txt"); +- vpl_mkdir("./evd",0777); +- clean_up("./svd", "*.txt"); +- vpl_mkdir("./svd",0777); +- +- bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene, "./evd"); +- bvpl_discover_pca_kernels pca_extractor_svd(neighborhood, nsamples, scene, "./svd", false); +- +- +- //XML write +- pca_extractor.xml_write(); +- pca_extractor_svd.xml_write(); +- +- //training errorr +- vnl_vector verror; +- vnl_vector t_verror; +- vnl_vector testing_error; +- pca_extractor.compute_training_error(verror); +- pca_extractor.theoretical_training_error(t_verror); +- pca_extractor.compute_testing_error(testing_error); +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks at test_pca_kernels - 1 " << boct_tree_cell::nleaks() << '\n'; +-#endif +- +- result = verror[verror.size()-1] < 1.0e-7; +- TEST("Test training error:", result, true); +- +- bvpl_discover_pca_kernels pca_extractor2("./evd"); +- vnl_vector verror2; +- pca_extractor2.compute_training_error(verror2); +- vnl_vector test_error2; +- pca_extractor2.compute_testing_error(test_error2); +- +- //Load from XML file - and check that clases are the same +- result = pca_extractor.principal_comps().is_equal(pca_extractor2.principal_comps(), 1.0e-9); +- TEST("Test xml_write PC:", result, true); +- +- result = pca_extractor.weights().is_equal(pca_extractor2.weights(), 1.0e-9); +- TEST("Test xml_write weights:", result, true); +- +- result = pca_extractor.mean().is_equal(pca_extractor2.mean(), 1.0e-9); +- TEST("Test xml_write mean:", result, true); +- +- result = pca_extractor.feature_dim()== pca_extractor2.feature_dim(); +- TEST("Test xml_write feature dim:", result, true); +- +- result = pca_extractor.nsamples()== pca_extractor2.nsamples(); +- TEST("Test xml_write nsamples :", result, true); +- +- result = verror.is_equal(t_verror, 1.0e-9); +- TEST("Test training errors agrees with theoretical value:", result, true); +- +- result = testing_error.squared_magnitude() > t_verror.squared_magnitude(); +- TEST("Test testing error > training error:", result, true); +- +- result = testing_error.is_equal(test_error2, 1.0e-9); +- TEST("Testing errors are equal:", result, true); +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks at test_pca_kernels - 2 " << boct_tree_cell::nleaks() << '\n'; +-#endif +- +-#if 0 +- std::cout<< "error : " << verror << '\n' +- << "t_error : " << t_verror << '\n' +- << "weights : " << pca_extractor.weights() << '\n' +- +- << "error 1: " << verror << '\n' +- << "error 2: " << verror2 << '\n' +- +- << "mean 1: " << pca_extractor.mean() << '\n' +- << "mean 2: " << pca_extractor2.mean() << '\n' +- +- << "path 1: " << pca_extractor.scene_path() << '\n' +- << "path 2: " << pca_extractor2.scene_path() << std::endl; +-#endif +-} +- +-void test_global() +-{ +- //create scene +- boxm_scene > *scene = create_scene(3,3,3); +- //neighborhood box for volume "patches" 5x5x5 +- vgl_box_3d neighborhood(vgl_point_3d(-2,-2,-2), vgl_point_3d(2,2,2)); +- //number of samples - 10% of total number of leaf-cells +- double training_fraction = 1.0; +- unsigned long nsamples = (unsigned long)((double)scene->size() * training_fraction); +- double finest_cell_length = scene->finest_cell_length(); +- +- clean_up("./pca_info", "*.txt"); +- vpl_mkdir("./pca_info",0777); +- clean_up("./pca_global_info", "*.txt"); +- vpl_mkdir("./pca_global_info",0777); +- +- bvpl_discover_pca_kernels pca_info(neighborhood, nsamples, scene, "./pca_info"); +- pca_info.xml_write(); +- +- std::vector scenes; +- std::vector aux_paths; +- std::vector cell_lengths; +- scenes.push_back("./test_scene.xml"); +- aux_paths.push_back("."); +- cell_lengths.push_back(finest_cell_length); +- +- boxm_scene > *aux_scene = +- new boxm_scene >(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level()); +- aux_scene->set_appearance_model(BOXM_INT); +- +- std::string scene_name = "test_aux_scene"; +- std::string scene_path(vul_file::get_cwd()); +- aux_scene->set_paths(scene_path, scene_name); +- aux_scene->write_scene("./test_aux_scene.xml"); +- +- bvpl_global_pca<125> pca_global_info(scenes, aux_paths,cell_lengths, neighborhood,training_fraction, "./pca_global_info"); +- pca_global_info.xml_write(); +- +- vnl_matrix s1 = pca_info.compute_scatter_matrix(scene); +- +- unsigned file =0; +- for (unsigned i = 0; i < 3; i++) +- for (unsigned j = 0; j < 3; j++) +- for (unsigned k = 0; k < 3; k++) { +- vnl_matrix_fixed S; +- vnl_vector_fixed mean; +- unsigned long nfeature =0L; +- pca_global_info.sample_statistics(0, i, j, k, S, mean, nfeature); +- +- std::stringstream scatter_ss; +- scatter_ss << pca_global_info.path_out() << "/S_" << 0 << '_' < S1(0.0); +- vnl_vector_fixed mean1(0.0); +- unsigned long nfeatures1 =0; +- +- { +- std::stringstream scatter_ss; +- scatter_ss <> S1; +- std::stringstream mean_ss; +- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << file_p << ".txt"; +- std::ifstream mean_ifs ( mean_ss.str().c_str() ); +- mean_ifs >> nfeatures1; +- mean_ifs >> mean1; +-#if 0 +- vul_file::delete(scatter_ss.str()); +- vul_file::delete(mean_ss.str()); +-#endif +- } +- +- vnl_matrix_fixed S2(0.0); +- vnl_vector_fixed mean2(0.0); +- unsigned long nfeatures2 =0; +- +- { +- std::stringstream scatter_ss; +- scatter_ss <> S2; +- std::stringstream mean_ss; +- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << file_p + 1 << ".txt"; +- std::ifstream mean_ifs ( mean_ss.str().c_str() ); +- mean_ifs >> nfeatures2; +- mean_ifs >> mean2; +- } +- +- vnl_matrix_fixed S_out(0.0); +- vnl_vector_fixed mean_out(0.0); +- double nfeatures_out =0.0; +- bvpl_global_pca<125>::combine_pairwise_statistics(mean1, S1, (double)nfeatures1, mean2, S2, (double)nfeatures2, mean_out, S_out, nfeatures_out); +- +- std::stringstream scatter_ss; +- scatter_ss < S_total(0.0); +- vnl_vector_fixed mean_total(0.0); +- unsigned long nfeatures_total =0; +- +- +- std::stringstream scatter_ss; +- scatter_ss <> S_total; +- std::stringstream mean_ss; +- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << 0 << ".txt"; +- std::ifstream mean_ifs ( mean_ss.str().c_str() ); +- mean_ifs >> nfeatures_total; +- mean_ifs >> mean_total; +- +- +- std::cout << "Scatter diff:\n " << ((s1 - S_total).array_two_norm()) << '\n' +- << "Mean diff:\n " << (pca_info.mean() - mean_total).two_norm() << '\n'; +- +- clean_up("./pca_info", "*.txt"); +- clean_up("./pca_global_info", "*.txt"); +-#if 0 +- pca_global_info.compute_statistics(); +-#endif +- //compare results +-} +- +- +-void test_pca_kernels() +-{ +- clean_up(); +- +- //make up a matrix +- vnl_matrix data(2, 10); +- unsigned i =0; +- data.set_column(i++, vnl_vector_fixed(0.69f, 0.49f)); +- data.set_column(i++, vnl_vector_fixed(-1.31f, -1.21f)); +- data.set_column(i++, vnl_vector_fixed(0.39, 0.99)); +- data.set_column(i++, vnl_vector_fixed(0.09, 0.29)); +- data.set_column(i++, vnl_vector_fixed(1.29, 1.09)); +- data.set_column(i++, vnl_vector_fixed(0.49, 0.79)); +- data.set_column(i++, vnl_vector_fixed(0.19, -0.31)); +- data.set_column(i++, vnl_vector_fixed(-0.81, -0.81)); +- data.set_column(i++, vnl_vector_fixed(-0.31, -0.31)); +- data.set_column(i++, vnl_vector_fixed(-0.71, -1.01)); +- +- bvpl_discover_pca_kernels pca_extractor(data); +- +- vnl_matrix pc = pca_extractor.principal_comps(); +- +- vnl_matrix true_pc(2,2); +- i =0; +- true_pc.set_row(i++, vnl_vector_fixed(-0.677873, -0.735179)); +- true_pc.set_row(i++, vnl_vector_fixed(-0.735179, 0.677873)); +- +- bool result = true_pc.is_equal(pc, 0.001); +- TEST("Test pc equals true_pc", result, true); +- +- test_kernel_set_up(); +- test_global(); +- clean_up(); +-} +- +- +-TESTMAIN(test_pca_kernels); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx +deleted file mode 100644 +index 4e5a30d980..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx ++++ /dev/null +@@ -1,143 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date 11-Feb-2011 +- +-#include +-#include +-#include +- +-#include "test_utils.h" +- +-#include +-#include +-#include +- +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-void create_basis(std::string test_dir, std::map &values) +-{ +- //generate basis paths +- if (!vul_file::is_directory(test_dir)) +- vul_file::make_directory(test_dir); +- +- vul_file::change_directory(test_dir); +- +- bvpl_taylor_basis_loader loader(test_dir); +- +- std::vector basis_names; +- loader.files(basis_names); +- +- //make the basis directories +- for (unsigned i= 0; i(basis_names[i], float(i))); +- } +-} +- +-void test_assemble_basis(bvpl_taylor_scenes_map_sptr taylor_scenes, std::map &values) +-{ +- bvpl_taylor_basis::assemble_basis(taylor_scenes, 0, 0, 0); +- +- //retieve the basis seen and check vectors and matrices +- double I0 = values["I0"]; +- +- vnl_vector G(3); +- G[0] = values["Ix"]; +- G[1] = values["Iy"]; +- G[2] = values["Iz"]; +- +- double H_as_vector[6]; +- H_as_vector[0] = values["Ixx"]; +- H_as_vector[1] = values["Ixy"]; +- H_as_vector[2] = values["Iyy"]; +- H_as_vector[3] = values["Ixz"]; +- H_as_vector[4] = values["Iyz"]; +- H_as_vector[5] = values["Izz"]; +- vnl_sym_matrix H(H_as_vector, 3); +- +- std::cout << "IO: " << I0 << "\nG: " << G <<"\nH: " << H.as_matrix() << std::endl; +- +- boxm_scene >* basis_scene = dynamic_cast >* > (taylor_scenes->get_scene("basis").as_pointer()); +- basis_scene->load_block(0, 0, 0); +- +- std::vector* > basis_leaves = basis_scene->get_block(0, 0, 0)->get_tree()->leaf_cells(); +- +- std::vector* >::iterator it = basis_leaves.begin(); +- bool result = true; +- for (; it!= basis_leaves.end(); it++) +- { +- bvpl_taylor_basis2_sample sample = (*it)->data(); +- if (sample.I0!=I0){ +- result = false; +- std::cout << sample << std::endl; +- } +- +- if (!((sample.G.as_vector()).is_equal(G, 1e-7))){ +- result = false; +- std::cout << sample << std::endl; +- } +- +- if (!((sample.H.as_matrix()).is_equal(H.as_matrix(), 1e-7))){ +- result = false; +- std::cout << sample << std::endl; +- } +- } +- +- TEST("Test assemble basis", result, true); +-} +- +- +-void test_taylor_basis() +-{ +- //generate basis +- std::string basis_dir = "./taylor_basis"; +- std::map values; +- create_basis(basis_dir, values); +- +- //load map of scenes into memory +- bvpl_taylor_basis_loader loader(vul_file::get_cwd()); +- std::cout << vul_file::get_cwd() << std::endl; +- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader); +- +- +- //test assembling +- test_assemble_basis(taylor_scenes, values); +- +- //test computing error +- boxm_scene >* data_scene = create_scene(2,2,2, true, 1.0f, "data_scene"); +- boxm_scene >* error_scene = dynamic_cast >*> (taylor_scenes->get_scene("error").as_pointer()); +- double cell_length = data_scene->finest_cell_length(); +- bvpl_taylor_basis::compute_approximation_error(data_scene, taylor_scenes->get_scene("basis"),error_scene,loader,0,0,0, cell_length); +- +- error_scene->load_block(0,0,0); +- std::cout.precision(15); +- error_scene->get_block(0,0,0)->get_tree()->print(); +- +- unsigned long tree_ncells = error_scene->get_block(0,0,0)->get_tree()->size(); +- unsigned long scene_ncells = error_scene->size(); +- unsigned long nsamples = scene_ncells*100L; +- +- //number of samples - 10% of total number of leaf cells +- unsigned long tree_nsamples = (unsigned long)(float(tree_ncells)/scene_ncells*nsamples); +- double error = bvpl_taylor_basis::sum_errors(error_scene,0,0,0, tree_nsamples); +- +- TEST_NEAR("Test average error", error, 131737.5, 1e-7); +-} +- +- +-TESTMAIN(test_taylor_basis); +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx +deleted file mode 100644 +index 2932c2a301..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx +deleted file mode 100644 +index 39bffed911..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx ++++ /dev/null +@@ -1,94 +0,0 @@ +-#include "test_utils.h" +-//: +-// \file +-// \author Isabel Restrepo +-// \date 15-Aug-2010 +- +-#include +-#include +-#include +- +-void init_tree(boct_tree *tree, unsigned i, float init_val) +-{ +- tree-> split(); //now we have 8 cells +- std::vector*> leaves = tree->leaf_cells(); +- leaves[i]->set_data(init_val); +- leaves[i]->split(); +- +- boct_loc_code code = leaves[i]->get_code() ; +- std::cerr<< "Create Scene Code: " << code << std::endl; +-} +- +-boxm_scene >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz, +- bool uniform, float val, const std::string& scene_prefix) +-{ +- float init_val = 0.5f; +- +- if (uniform) +- init_val = val; +- +- //crete the input scene +- unsigned int max_tree_level = 3; +- unsigned int init_level = 1; +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0,0,0); +- +- vgl_vector_3d block_dim(10, 10, 10); //world coordinate dimensions of a block +- +- vgl_vector_3d world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene +- +- auto *scene = new boxm_scene >(lvcs, origin, block_dim, world_dim, max_tree_level, init_level ); +- std::string scene_path(vul_file::get_cwd()); +- scene->set_paths(scene_path, scene_prefix); +- scene->set_appearance_model(BOXM_FLOAT); +- scene->write_scene(scene_prefix + ".xml"); +- unsigned cell_index = 7; +- boxm_block_iterator > iter=scene->iterator(); +- iter.begin(); +- while (!iter.end()) +- { +- scene->load_block(iter.index()); +- boxm_block > *block = scene->get_active_block(); +- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0 +- auto *tree = new boct_tree(init_val, 3, 1); +- //tree->print(); +- if (uniform) +- init_tree(tree, cell_index, init_val); +- else +- init_tree(tree, cell_index); +- //tree->print(); +- block->init_tree(tree); +- scene->write_active_block(); +- if (cell_index == 0) cell_index = 7; +- cell_index--; +- ++iter; +- } +- +-#ifdef DEBUG_LEAKS +- std::cerr << "Leaks Created by create_scene() : " << boct_tree_cell::nleaks() << std::endl; +-#endif +- return scene; +-} +- +- +-void clean_up() +-{ +- //clean temporary files +- vul_file_iterator file_it("./*.bin"); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it());// this deletes the file at file_it() +- // vul_file::delete_file_glob(file_it()); +- } +-} +- +-void clean_up(const std::string& dir, const std::string& ext) +-{ +- //clean temporary files +- vul_file_iterator file_it(dir+"/"+ext); +- for (; file_it; ++file_it) +- { +- vpl_unlink(file_it()); +- vul_file::delete_file_glob(file_it()); +- } +-} +diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h +deleted file mode 100644 +index f2c915a5cb..0000000000 +--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h ++++ /dev/null +@@ -1,20 +0,0 @@ +-#ifndef bvpl_octree_test_utils_h_ +-#define bvpl_octree_test_utils_h_ +-//: +-// \file +-// \brief A file containing utility functions for other tests +-// \author Isabel Restrepo +-// \date 13-Aug-2010 +- +-#include +- +-void init_tree(boct_tree *tree, unsigned i, float init_val = 0.8); +- +-boxm_scene >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2, +- bool uniform = false, float val = 0.5, const std::string& scene_prefix = "test_scene"); +- +-void clean_up(); +- +-void clean_up(const std::string& dir, const std::string& ext); +- +-#endif +diff --git a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt +index 4279f1e47d..3e7108103d 100644 +--- a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt +@@ -19,7 +19,7 @@ if(EXPAT_FOUND) + + vxl_add_library(LIBRARY_NAME bvpl_kernels_pro LIBRARY_SOURCES ${bvpl_kernels_pro_sources}) + +- target_link_libraries(bvpl_kernels_pro bvpl_kernels bvpl_kernels_io bvpl_octree bvpl_octree_io bsta bprb brdb bvpl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io) ++ target_link_libraries(bvpl_kernels_pro bvpl_kernels bvpl_kernels_io bsta bprb brdb bvpl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io) + + if( BUILD_TESTING ) + add_subdirectory(tests) +diff --git a/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx b/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx +deleted file mode 100644 +index ee1188aea5..0000000000 +--- a/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx ++++ /dev/null +@@ -1,6 +0,0 @@ +-#include +- +-#include +-#include +- +-BRDB_VALUE_INSTANTIATE(bvpl_taylor_scenes_map_sptr, "bvpl_taylor_scenes_map_sptr"); +diff --git a/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx +deleted file mode 100644 +index 25a60ca12c..0000000000 +--- a/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx ++++ /dev/null +@@ -1,4 +0,0 @@ +-#include +-#include +- +-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map); +diff --git a/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx b/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx +index 71a463d5d7..cb9febce0d 100644 +--- a/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx ++++ b/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx +@@ -25,7 +25,6 @@ void bvpl_kernels_register::register_process() + REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_corner2d_kernel_process, "bvplCreateCorner2dKernelProcess"); + REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_gauss3d_xx_kernel_vector_process, "bvplCreateGauss3dXXKernelVectorProcess"); + REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_wc_kernel_vector_process, "bvplCreateWCKernelVectorProcess"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_taylor_kernel_process, "bvplLoadTaylorKernelProcess"); + REG_PROCESS_FUNC_CONS2(bvpl_create_gauss3d_kernel_process); + REG_PROCESS_FUNC_CONS2(bvpl_create_generic_kernel_vector_process); + REG_PROCESS_FUNC_CONS2(bvpl_write_generic_kernel_vector_process); +diff --git a/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx b/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx +deleted file mode 100644 +index c56d9cdb15..0000000000 +--- a/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx ++++ /dev/null +@@ -1,53 +0,0 @@ +-//: +-// \file +-// \brief A process to load taylor response scenes into memory +-// \author Isabel Restrepo +-// \date 9-Feb-2011 +- +-#include +-#include +- +-#include +- +-#include +-#include +- +-//:global variables +-namespace bvpl_load_taylor_responses_process_globals +-{ +- constexpr unsigned n_inputs_ = 1; +- constexpr unsigned n_outputs_ = 1; +-} +- +- +-//:sets input and output types +-bool bvpl_load_taylor_responses_process_cons(bprb_func_process& pro) +-{ +- using namespace bvpl_load_taylor_responses_process_globals ; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "vcl_string"; //parent dir of responses +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvpl_taylor_scenes_map_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +- +-//:the process +-bool bvpl_load_taylor_responses_process(bprb_func_process& pro) +-{ +- using namespace bvpl_load_taylor_responses_process_globals; +- +- //get inputs +- std::string parent_dir = pro.get_input(0); +- +- bvpl_taylor_basis_loader loader(parent_dir); +- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader); +- +- //store output +- pro.set_output_val(0, taylor_scenes); +- +- return true; +-} +diff --git a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt b/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt +deleted file mode 100644 +index 3bf956ba6c..0000000000 +--- a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt ++++ /dev/null +@@ -1,44 +0,0 @@ +-# contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt +-include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake ) +-if( PYTHON_FOUND ) +- FIND_PACKAGE(EXPAT REQUIRED) +-FIND_PACKAGE(EXPATPP REQUIRED) +- if( EXPAT_FOUND ) +- include_directories( ${PYTHON_INCLUDE_DIRS} ) +- include_directories( ${BRL_INCLUDE_DIR} ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro ) +- include_directories( ${BRL_INCLUDE_DIR}/bpro/core ) +- include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree) +- include_directories( ${BRL_INCLUDE_DIR}/bseg/brec ) +- +- set(bvpl_octree_batch_sources +- reg_bvpl_octree.h reg_bvpl_octree.cxx +- ) +- if(NOT VXL_BUILD_POSITION_DEPENDENT_CODE) +- vxl_add_library(LIBRARY_NAME bvpl_octree_batch LIBRARY_SOURCES SHARED ${bvpl_octree_batch_sources}) +- +- #In windows, library has to have different name depending on debug or release version. +- if(WIN32) +- set_target_properties(bvpl_octree_batch PROPERTIES OUTPUT_NAME bvpl_octree_batch DEBUG_POSTFIX _d SUFFIX .pyd) +- endif() +- if(APPLE) #This is because python only looks for .so +- set_target_properties(bvpl_octree_batch PROPERTIES OUTPUT_NAME bvpl_octree_batch SUFFIX .so) +- endif() +- set_target_properties(bvpl_octree_batch PROPERTIES PREFIX "") +- +- target_link_libraries(bvpl_octree_batch bvpl_octree_pro bvpl_kernels_pro bpro_batch boxm_pro boxm_algo_pro ${VXL_LIB_PREFIX}vpgl_io vpgl_pro ${VXL_LIB_PREFIX}vil_io vil_pro) +- +- if(PYTHON_DEBUG_LIBRARIES) +- target_link_libraries( bvpl_octree_batch debug ${PYTHON_DEBUG_LIBRARY}) +- endif() +- +- if(PYTHON_LIBRARIES) +- target_link_libraries( bvpl_octree_batch optimized ${PYTHON_LIBRARY}) +- endif() +- +- if( BUILD_TESTING ) +- add_subdirectory(tests) +- endif() +- endif() +- endif() +-endif() +diff --git a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx b/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx +deleted file mode 100644 +index d2df8b6752..0000000000 +--- a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx ++++ /dev/null +@@ -1,61 +0,0 @@ +-#include "reg_bvpl_octree.h" +-#include +-#include +- +-// processes +-#include +-#include +-#include +-#include +-#include +- +-PyObject * +-register_processes(PyObject *self, PyObject *args) +-{ +- bvpl_kernels_register::register_process(); +- bvpl_octree_register::register_process(); +- boxm_register::register_process(); +- boxm_algo_register::register_process(); +- vpgl_register::register_process(); +- Py_INCREF(Py_None); +- return Py_None; +-} +- +-PyObject * +-register_datatypes(PyObject *self, PyObject *args) +-{ +- register_basic_datatypes(); +- bvpl_kernels_register::register_datatype(); +- bvpl_octree_register::register_datatype(); +- boxm_register::register_datatype(); +- boxm_algo_register::register_datatype(); +- vpgl_register::register_datatype(); +- Py_INCREF(Py_None); +- return Py_None; +-} +- +-PyMODINIT_FUNC +-initbvpl_octree_batch(void) +-{ +- PyMethodDef reg_pro; +- reg_pro.ml_name = "register_processes"; +- reg_pro.ml_meth = register_processes; +- reg_pro.ml_doc = "register_processes() create instances of each defined process"; +- reg_pro.ml_flags = METH_VARARGS; +- +- +- PyMethodDef reg_data; +- reg_data.ml_name = "register_datatypes"; +- reg_data.ml_meth = register_datatypes; +- reg_data.ml_doc = "register_datatypes() insert tables in the database for each type"; +- reg_data.ml_flags = METH_VARARGS; +- +- bvpl_octree_batch_methods[0]=reg_pro; +- bvpl_octree_batch_methods[1]=reg_data; +- +- for (int i=0; i +- +-static PyObject *register_processes(PyObject *self, PyObject *args); +-static PyObject *register_datatypes(PyObject *self, PyObject *args); +-static PyMethodDef bvpl_octree_batch_methods[METHOD_NUM+2]; +- +-#endif +diff --git a/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt +deleted file mode 100644 +index 1cc8664ce3..0000000000 +--- a/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-add_executable( bvpl_octree_batch_test_include test_include.cxx ) +-target_link_libraries( bvpl_octree_batch_test_include bvpl_octree_batch) +diff --git a/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx b/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx +deleted file mode 100644 +index 292774691a..0000000000 +--- a/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include +- +-int main() { return 0; } +diff --git a/contrib/brl/bseg/bvxm/algo/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/CMakeLists.txt +index a387778a0c..0505293103 100644 +--- a/contrib/brl/bseg/bvxm/algo/CMakeLists.txt ++++ b/contrib/brl/bseg/bvxm/algo/CMakeLists.txt +@@ -5,14 +5,13 @@ include_directories( ${BRL_INCLUDE_DIR}/bseg/bvxm ) + set(bvxm_algo_sources + bvxm_merge_mog.h bvxm_merge_mog.cxx + bvxm_mog_norm.h bvxm_mog_norm.hxx +- bvxm_boxm_convert.h + ) + + aux_source_directory(Templates bvxm_algo_sources) + + vxl_add_library(LIBRARY_NAME bvxm_algo LIBRARY_SOURCES ${bvxm_algo_sources}) + +-target_link_libraries( bvxm_algo bsta bvxm_grid_io boxm_util ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl) ++target_link_libraries( bvxm_algo bsta ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl) + + add_subdirectory(pro) + +diff --git a/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h b/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h +deleted file mode 100644 +index d2b4e815e6..0000000000 +--- a/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h ++++ /dev/null +@@ -1,152 +0,0 @@ +-// This is brl/bseg/bvxm/algo/bvxm_boxm_convert.h +-#ifndef bvxm_boxm_convert_h +-#define bvxm_boxm_convert_h +-//: +-// \file +-// \brief Set of functions that convert a boxm_scene to a bvxm grid +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date Jan 15, 2009 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +-#include +-#ifdef _MSC_VER +-# include +-#endif +-#include +- +-template +-bvxm_voxel_grid* boxm_scene_to_bvxm_grid(boxm_scene > &scene, +- std::string input_path, +- unsigned int resolution_level, +- bool enforce_level = false ) +-{ +- //Print a little reminder that no inter/extra-polation happens in this function +- std::cout << "Convertion boxm_scene to bvxm_grid\n" +- << "Current resolution level: " << resolution_level << '\n' +- << "Enforcing only level cells ? " << enforce_level << '\n' +- << "Is grid saving internal nodes? " < tree_type; +- +- // create an array for each block, and save in a binary file +- boxm_block_iterator iter(&scene); +- +- unsigned int finest_level=100000; +- // find the finest levels in the blocks +- while (!iter.end()) { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- tree_type* tree = block->get_tree(); +- if (tree->finest_level() < int(finest_level)) { +- finest_level = tree->finest_level(); +- } +- ++iter; +- } +- +- // do not make the resolution smaller than finest level +- if (resolution_level < finest_level) +- resolution_level=finest_level; +- +- +- // make sure the resolution level for all trees is the same +- iter.begin(); +- short root_level = 0; +- { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- tree_type* tree = block->get_tree(); +- root_level = tree->root_level(); +- } +- +- // make sure root level is the same for all the trees +- while (!iter.end()) { +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- tree_type* tree = block->get_tree(); +- if (tree->root_level() != root_level) +- { +- std::cerr << "Error converting boxm_scene to bvxm_grid: blocks have different root level\n"; +- } +- iter++; +- } +- +- // number of cells for each block should be the same, because they have the +- // same tree max_level definitions +- unsigned int ncells = 1 << (root_level - (int)resolution_level); +- +- std::cout << "Number of cells per grid side: " << ncells << '\n'; +- +- //create the regular grid +- vgl_vector_3d dim = scene.world_dim(); //number of blocks in the scene +- unsigned dimx = dim.x()*ncells; // total number of cells in the scene x-dim +- unsigned dimy = dim.y()*ncells; +- unsigned dimz = dim.z()*ncells; +- bvxm_voxel_grid *grid = new bvxm_voxel_grid(input_path,vgl_vector_3d(dimx,dimy,dimz)); +- T_data data_init(boxm_zero_val()); +- grid->initialize_data(data_init); +- +- std::cout << "Grid Size: " << vgl_vector_3d(dimx,dimy,dimz) << '\n' +- << "In boxm_scene_to_bxm_grid, default voxel value for the grid is: " << data_init << std::endl; +- +- //iterate through grid, locate corresponding position in the octree +- typename bvxm_voxel_grid::iterator grid_it=grid->begin(); +- +- //locate point in the tree, for now assume ONLY ONE BLOCK +- iter.begin(); +- vgl_point_3d idx = iter.index(); +- scene.load_block(idx); +- boxm_block* block = scene.get_block(idx); +- tree_type* tree = block->get_tree(); +-#if 0 +- vgl_box_3d block_bb = block->bounding_box(); +- // assume that bounding box is a cube +- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells)); +-#endif +- +- for (unsigned z=0; z slab = (*grid_it); +- std::cout << '.' < p(((double)x/(double)dimx), ((double)y/(double)dimy), (0.99 - (double)z/(double)dimz)); +- //locate the cell containing the point closest to the specified level +- boct_tree_cell* this_cell = tree->locate_point_at_level(p, resolution_level,true); +- +- if (!this_cell) { +- std::cerr << "In boxm_scene_to_bvxm_grid: cell out of bounds\n"; +- continue; +- } +- +- unsigned int level = this_cell->get_code().level; +- T_data cell_val = this_cell->data(); +- +- if (level < resolution_level) +- std::cerr << "In boxm_scene_to_bvxm_grid: current level smaller than target level\n"; +- +- //if enfoce level is true, there is no iter/extrapolation +- if ((enforce_level)&& (level != resolution_level)) +- continue; +- +- // just copy value to output grid +- slab(x,y) = cell_val; +- } +- } +- } +- std::cout << '\n'; +- return grid; +-} +- +-#endif +diff --git a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt +index 4917b6eb59..3a0824d257 100644 +--- a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt ++++ b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt +@@ -18,7 +18,8 @@ FIND_PACKAGE(EXPATPP REQUIRED) + aux_source_directory(processes bvxm_algo_pro_sources) + + vxl_add_library(LIBRARY_NAME bvxm_algo_pro LIBRARY_SOURCES ${bvxm_algo_pro_sources} ) +- target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boxm boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl) ++ #target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boxm boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl) ++ target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl) + + if( BUILD_TESTING ) + add_subdirectory(tests) +diff --git a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h +index 69e97478e7..8b9ad6d7f6 100644 +--- a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h ++++ b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h +@@ -8,6 +8,6 @@ + DECLARE_FUNC_CONS(bvxm_merge_mog_process); + DECLARE_FUNC_CONS(bvxm_mog_to_mpm_process); + DECLARE_FUNC_CONS(bvxm_mog_l2_distance); +-DECLARE_FUNC_CONS(boxm_scene_to_bvxm_grid_process); ++//DECLARE_FUNC_CONS(boxm_scene_to_bvxm_grid_process); + + #endif +diff --git a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx +index a7b2141026..a4f1e49d9d 100644 +--- a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx ++++ b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx +@@ -19,5 +19,5 @@ void bvxm_algo_register::register_process() + REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_merge_mog_process, "bvxmMergeMogProcess"); + REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_mog_to_mpm_process, "bvxmMogToMpmProcess"); + // REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_mog_l2_process, "bvxmMogL2Process"); +- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_scene_to_bvxm_grid_process, "boxmSceneToBvxmGridProcess"); ++ // REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_scene_to_bvxm_grid_process, "boxmSceneToBvxmGridProcess"); + } +diff --git a/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx b/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx +deleted file mode 100644 +index cfc6175b03..0000000000 +--- a/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx ++++ /dev/null +@@ -1,129 +0,0 @@ +-// This is brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx +-#include +-//: +-// \file +-// \brief Process to convert a boxm_scene to a bvxm_voxel_grid +-// \author Isabel Restrepo mir@lems.brown.edu +-// \date Jan 19, 2010 +-// +-// \verbatim +-// Modifications +-// +-// \endverbatim +- +-#include +-#include +-#include +- +- +-#include +-#include +-#include +-#include +- +- +-namespace boxm_scene_to_bvxm_grid_process_globals +-{ +- constexpr unsigned n_inputs_ = 4; +- constexpr unsigned n_outputs_ = 1; +-} +- +-//: process takes 4 inputs and 1 output. +-// input[0]: The scene +-// input[1]: Path to output grid +-// input[2]: Resolution level +-// input[3]: Bool: Enforce only cells at the resolution leve? +-// If true, there is no interpolation +-// output[0]: The output grid +- +-bool boxm_scene_to_bvxm_grid_process_cons(bprb_func_process& pro) +-{ +- using namespace boxm_scene_to_bvxm_grid_process_globals; +- +- std::vector input_types_(n_inputs_); +- input_types_[0] = "boxm_scene_base_sptr"; +- input_types_[1] = "vcl_string"; +- input_types_[2] = "unsigned"; +- input_types_[3] = "bool"; +- +- std::vector output_types_(n_outputs_); +- output_types_[0] = "bvxm_voxel_grid_base_sptr"; +- +- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); +-} +- +-bool boxm_scene_to_bvxm_grid_process(bprb_func_process& pro) +-{ +- using namespace boxm_scene_to_bvxm_grid_process_globals; +- +- if (pro.n_inputs() != n_inputs_) +- { +- std::cerr << pro.name() << ": the input number should be " << n_inputs_ +- << " but instead it is " << pro.n_inputs() << std::endl; +- return false; +- } +- +- //get inputs: +- boxm_scene_base_sptr scene_base = pro.get_input(0); +- std::string filepath = pro.get_input(1); +- unsigned resolution_level = pro.get_input(2); +- bool enforce_level = pro.get_input(3); +- +- static const unsigned int n_gaussian_modes_ = 3; +- typedef bsta_num_obs gauss_type_sf1; +- typedef bsta_num_obs > mix_gauss_sf1_type; +- +- //check input's validity +- if (!scene_base.ptr()) +- { +- std::cerr << pro.name() << ": -- Input scene is not valid!\n"; +- return false; +- } +- +- if ( auto *scene= dynamic_cast > * >(scene_base.as_pointer())) +- { +- bvxm_voxel_grid *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level,enforce_level); +- pro.set_output_val(0, grid); +- return true; +- } +- else if ( auto *scene= dynamic_cast > > * >(scene_base.as_pointer())) +- { +- bvxm_voxel_grid > *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level, enforce_level); +- pro.set_output_val(0, grid); +- return true; +- } +- else if ( auto *scene = +- dynamic_cast > * >(scene_base.as_pointer())) +- { +- bvxm_voxel_grid *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level, enforce_level); +- pro.set_output_val(0, grid); +- return true; +- } +- else +- { +- std::cerr << "It's not possible to convert input scene to a bvxm grid\n"; +- return false; +- } +-} +- +-#include +-#include +-#include +-#include +-#include +- +-typedef bsta_num_obs gauss_type; +-typedef bsta_num_obs > mixture_type; +-typedef boct_tree tree_type; +-typedef boxm_block block_type; +- +-BOCT_TREE_INSTANTIATE(short,mixture_type); +-BOCT_TREE_CELL_INSTANTIATE(short,mixture_type); +-BOXM_SCENE_INSTANTIATE(tree_type); +-BOXM_BLOCK_INSTANTIATE(tree_type); +-VBL_ARRAY_3D_INSTANTIATE(block_type); +- +-void vsl_b_write(vsl_b_ostream&, bsta_mixture_fixed >,3>&) {} +-void vsl_b_read(vsl_b_istream&, bsta_mixture_fixed >,3>&) {} +-void vsl_b_read(vsl_b_istream&, bsta_gaussian_sphere&) {} +-//bool operator==(block_type const&, block_type const&) { return false; } +diff --git a/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt +index 1110054d05..d9d1c54305 100644 +--- a/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt ++++ b/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt +@@ -2,15 +2,12 @@ add_executable( bvxm_algo_test_all + test_driver.cxx + test_merge_mog.cxx + test_mog_norm.cxx +-# causes memory allocation errors (FIX_ME) +-# test_boxm_scene_to_bvxm_grid.cxx + ) + + target_link_libraries( bvxm_algo_test_all bvxm_algo bvxm_grid ${VXL_LIB_PREFIX}testlib bsta) + + add_test( NAME bvxm_algo_test_merge_mog COMMAND $ test_merge_mog ) + add_test( NAME bvxm_algo_test_mog_norm COMMAND $ test_mog_norm ) +-#add_test( NAME bvxm_algo_test_boxm_scene_to_bvxm_grid COMMAND $ test_boxm_scene_to_bvxm_grid) + + add_executable( bvxm_algo_test_include test_include.cxx ) + target_link_libraries( bvxm_algo_test_include bvxm_algo) +diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx +deleted file mode 100644 +index cf5dfe2b40..0000000000 +--- a/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx ++++ /dev/null +@@ -1,111 +0,0 @@ +-//: +-// \file +-// \author Isabel Restrepo +-// \date Jan 19, 2010. +- +-#include +-#include +-#include +- +-const bool debug = true; +- +-void fill_octree(boct_tree* tree) +-{ +- std::cout << "Creating Octree" << std::endl; +- +- //Create tree +- tree->init_cells(0.1f); +- tree->split(); +- std::cout << "Level 1" << std::endl; +- +- { +- std::vector*> leaves = tree->leaf_cells(); +- tree->init_cells(0.1f); +- leaves[1]->set_data(0.5f); +- if (debug) +- for (unsigned i=0; iget_code().x_loc_ << ',' +- << leaves[i]->get_code().y_loc_ << ',' +- << leaves[i]->get_code().z_loc_ << ',' +- << leaves[i]->data() << std::endl; +- } +- +- leaves[1]->split(); +- } +- +- if (debug) +- { +- std::cout << "Level 0" << std::endl; +- std::vector*> leaves = tree->cells_at_level((short)0); +- for (unsigned i=0; iset_data(0.9f); +- std::cout << leaves[i]->get_code().x_loc_ << ',' +- << leaves[i]->get_code().y_loc_ << ',' +- << leaves[i]->get_code().z_loc_ << ',' +- << leaves[i]->get_code().level << ',' +- << leaves[i]->data() << std::endl; +- } +- } +- +- if (debug) +- { +- std::cout << "All Levels" << std::endl; +- std::vector*> leaves = tree->all_cells(); +- for (unsigned i=0; iget_code().x_loc_ << ',' +- << leaves[i]->get_code().y_loc_ << ',' +- << leaves[i]->get_code().z_loc_ << ',' +- << leaves[i]->get_code().level << ',' +- << leaves[i]->data() << std::endl; +- } +- } +-} +- +-static void test_boxm_scene_to_bvxm_grid() +-{ +- //Create a dummy scene +- typedef boct_tree tree_type; +- boct_tree *tree = new boct_tree(3); +- fill_octree(tree); +- +- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS); +- vgl_point_3d origin(0.0,0.0,0.0); +- +- //world coordinate dimensions of a block +- vgl_vector_3d block_dim(10.0,10.0,10.0); +- +- //number of blocks in a scene +- vgl_vector_3d world_dim(1,1,1); +- +- boxm_scene *scene= new boxm_scene(lvcs, origin, block_dim, world_dim,true); +- std::string scene_path="."; +- scene->set_paths(scene_path, "in_block"); +- scene->set_appearance_model(BOXM_FLOAT); +- scene->clean_scene(); +- +- boxm_block_iterator iter =scene->iterator(); +- iter.begin(); +- scene->load_block(iter.index()); +- boxm_block *block = scene->get_active_block(); +- block->init_tree(tree); +- scene->write_active_block(); +- std::string input_path("scene_to_grid.vox"); +- +- bvxm_voxel_grid *grid = boxm_scene_to_bvxm_grid(*scene,input_path, 0); +- +- //Check the grid +- bvxm_voxel_grid::iterator grid_it = grid->slab_iterator(0, grid->grid_size().z()); +- +- for (unsigned z = 0; zgrid_size().z(); ++z) +- for (unsigned y = 0; ygrid_size().y(); ++y) +- for (unsigned x= 0; xgrid_size().x(); ++x) +- { +- std::cout << "Value at " << '(' << x << ',' << y <<',' <clean_scene(); +-} +- +-TESTMAIN(test_boxm_scene_to_bvxm_grid); +diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx +index 73e5836b26..cdb72c7ec2 100644 +--- a/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx ++++ b/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx +@@ -2,15 +2,13 @@ + + DECLARE( test_merge_mog ); + DECLARE( test_mog_norm ); +-//DECLARE( test_boxm_scene_to_bvxm_grid); ++ + + + void register_tests() + { + REGISTER( test_merge_mog ); + REGISTER( test_mog_norm ); +- // test causing memory allocation errors on dashboard build +- //REGISTER( test_boxm_scene_to_bvxm_grid ); + + } + +diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx +index b109456239..2c0b205311 100644 +--- a/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx ++++ b/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx +@@ -1,4 +1,3 @@ +-#include + #include + #include + +-- +2.21.0 + diff --git a/0009-v3.5.0-indent-to-keep-gcc-happy.patch b/0009-v3.5.0-indent-to-keep-gcc-happy.patch deleted file mode 100644 index a743690..0000000 --- a/0009-v3.5.0-indent-to-keep-gcc-happy.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 303abcb68bcc14b04d73460d25d8e4978e5b3617 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 23 Oct 2023 13:27:34 +0100 -Subject: [PATCH 09/18] v3.5.0: indent to keep gcc happy - ---- - core/vpgl/vpgl_tri_focal_tensor.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/core/vpgl/vpgl_tri_focal_tensor.h b/core/vpgl/vpgl_tri_focal_tensor.h -index 21a96688fb..e3f8929767 100644 ---- a/core/vpgl/vpgl_tri_focal_tensor.h -+++ b/core/vpgl/vpgl_tri_focal_tensor.h -@@ -186,7 +186,8 @@ protected: - - - virtual bool get_epipoles(vgl_homg_point_2d& e12, vgl_homg_point_2d& e13) { -- if (!epipoles_valid_) compute_epipoles(); e12 = e12_; e13 = e13_; return epipoles_valid_; -+ if (!epipoles_valid_) compute_epipoles(); -+ e12 = e12_; e13 = e13_; return epipoles_valid_; - } - - bool compute_epipoles(); --- -2.46.1 - diff --git a/0010-v3.5.0-more-linker-fixes.patch b/0010-v3.5.0-more-linker-fixes.patch deleted file mode 100644 index 53c9fcc..0000000 --- a/0010-v3.5.0-more-linker-fixes.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c45defc6a27e344f7d3f69dde806d4b187e2aa27 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 23 Oct 2023 15:55:38 +0100 -Subject: [PATCH 10/18] v3.5.0: more linker fixes - ---- - contrib/brl/bbas/imesh/CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/contrib/brl/bbas/imesh/CMakeLists.txt b/contrib/brl/bbas/imesh/CMakeLists.txt -index b122b33faf..a8a107e574 100644 ---- a/contrib/brl/bbas/imesh/CMakeLists.txt -+++ b/contrib/brl/bbas/imesh/CMakeLists.txt -@@ -22,11 +22,11 @@ aux_source_directory(Templates imesh_sources) - - vxl_add_library(LIBRARY_NAME imesh LIBRARY_SOURCES ${imesh_sources}) - --target_link_libraries(imesh ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl) -+target_link_libraries(imesh ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul brdb ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl) - - # Algorithms - add_subdirectory(algo) - - if( BUILD_TESTING ) - add_subdirectory(tests) --endif() -+endif() -\ No newline at end of file --- -2.46.1 - diff --git a/0011-v3.5.0-fix-for-gcc11.patch b/0011-v3.5.0-fix-for-gcc11.patch deleted file mode 100644 index 7d62d4e..0000000 --- a/0011-v3.5.0-fix-for-gcc11.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 690e4102939836f82afb83bba6120698403fcd43 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 23 Oct 2023 17:05:04 +0100 -Subject: [PATCH 11/18] v3.5.0: fix for gcc11 - ---- - .../brl/bseg/boxm2/pro/processes/boxm2_dem_to_xyz_process.cxx | 1 + - contrib/brl/bseg/bsgm/bsgm_error_checking.h | 1 + - contrib/brl/bseg/bsgm/bsgm_remove_spikes.h | 1 + - contrib/mul/vil3d/algo/vil3d_locally_z_normalise.h | 1 + - core/testlib/testlib_test.h | 1 + - core/vnl/vnl_bignum.cxx | 1 + - 6 files changed, 6 insertions(+) - -diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_dem_to_xyz_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_dem_to_xyz_process.cxx -index 67f6f1582c..185042f4df 100644 ---- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_dem_to_xyz_process.cxx -+++ b/contrib/brl/bseg/boxm2/pro/processes/boxm2_dem_to_xyz_process.cxx -@@ -2,6 +2,7 @@ - #include - #include - #include -+#include - #include - //: - // \file -diff --git a/contrib/brl/bseg/bsgm/bsgm_error_checking.h b/contrib/brl/bseg/bsgm/bsgm_error_checking.h -index 3eb3731a48..69ddb9a659 100644 ---- a/contrib/brl/bseg/bsgm/bsgm_error_checking.h -+++ b/contrib/brl/bseg/bsgm/bsgm_error_checking.h -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - //: - // \file -diff --git a/contrib/brl/bseg/bsgm/bsgm_remove_spikes.h b/contrib/brl/bseg/bsgm/bsgm_remove_spikes.h -index fd1ca2a941..c20cfe8b80 100644 ---- a/contrib/brl/bseg/bsgm/bsgm_remove_spikes.h -+++ b/contrib/brl/bseg/bsgm/bsgm_remove_spikes.h -@@ -2,6 +2,7 @@ - #include - #include - #include -+#include - #include - #include - -diff --git a/contrib/mul/vil3d/algo/vil3d_locally_z_normalise.h b/contrib/mul/vil3d/algo/vil3d_locally_z_normalise.h -index 96654ddac0..762d4598bf 100644 ---- a/contrib/mul/vil3d/algo/vil3d_locally_z_normalise.h -+++ b/contrib/mul/vil3d/algo/vil3d_locally_z_normalise.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #ifdef _MSC_VER - # include - #endif -diff --git a/core/testlib/testlib_test.h b/core/testlib/testlib_test.h -index e070f2aacc..87d5c5ceb1 100644 ---- a/core/testlib/testlib_test.h -+++ b/core/testlib/testlib_test.h -@@ -14,6 +14,7 @@ - - #include - #include -+#include - - //: initialise test counters, check test name 'name' exists - void testlib_test_start(const char* name = nullptr); -diff --git a/core/vnl/vnl_bignum.cxx b/core/vnl/vnl_bignum.cxx -index 26760c2054..0556918395 100644 ---- a/core/vnl/vnl_bignum.cxx -+++ b/core/vnl/vnl_bignum.cxx -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - #include "vnl_bignum.h" - //: - // \file --- -2.46.1 - diff --git a/0012-v3.5.0-link-against-acal.patch b/0012-v3.5.0-link-against-acal.patch deleted file mode 100644 index 6a791c8..0000000 --- a/0012-v3.5.0-link-against-acal.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0cee9d18cd8a652145684ac0c74d905b810e5e0c Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Tue, 24 Oct 2023 12:16:41 +0100 -Subject: [PATCH 12/18] v3.5.0: link against acal - -To fix: -``` -/usr/bin/ld: ../../../../../lib/libbsgm.so.3.5.0.0: undefined reference to `acal_f_utils::read_affine_cameras(std::__cxx11::basic_string, std::allocator >, std::map, std::less, std::allocator > > >&)' -/usr/bin/ld: ../../../../../lib/libbsgm.so.3.5.0.0: undefined reference to `acal_f_utils::datetime_from_iname(std::__cxx11::basic_string, std::allocator > const&, dtime&)' -/usr/bin/ld: ../../../../../lib/libbsgm.so.3.5.0.0: undefined reference to `dtime::time_diff(dtime const&, dtime const&)' -collect2: error: ld returned 1 exit status -``` ---- - contrib/brl/bseg/bsgm/CMakeLists.txt | 2 +- - contrib/brl/bseg/bsgm/bsgm_pair_selector.cxx | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/contrib/brl/bseg/bsgm/CMakeLists.txt b/contrib/brl/bseg/bsgm/CMakeLists.txt -index 44c4637af2..975ed5364c 100644 ---- a/contrib/brl/bseg/bsgm/CMakeLists.txt -+++ b/contrib/brl/bseg/bsgm/CMakeLists.txt -@@ -16,7 +16,7 @@ aux_source_directory(Templates bsgm_sources) - - vxl_add_library(LIBRARY_NAME bsgm LIBRARY_SOURCES ${bsgm_sources}) - --target_link_libraries( bsgm vidl_pro ${VXL_LIB_PREFIX}bpgl_algo ${VXL_LIB_PREFIX}brip ${VXL_LIB_PREFIX}bsta ${VXL_LIB_PREFIX}bjson ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl) -+target_link_libraries( bsgm vidl_pro ${VXL_LIB_PREFIX}acal ${VXL_LIB_PREFIX}bpgl_algo ${VXL_LIB_PREFIX}brip ${VXL_LIB_PREFIX}bsta ${VXL_LIB_PREFIX}bjson ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl) - - add_subdirectory( app ) - -diff --git a/contrib/brl/bseg/bsgm/bsgm_pair_selector.cxx b/contrib/brl/bseg/bsgm/bsgm_pair_selector.cxx -index 6320d290ff..e97e318428 100644 ---- a/contrib/brl/bseg/bsgm/bsgm_pair_selector.cxx -+++ b/contrib/brl/bseg/bsgm/bsgm_pair_selector.cxx -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - - std::string bsgm_pair_selector::remove_crop_postfix(std::string const& iname) - { --- -2.46.1 - diff --git a/0013-v3.5.0-more-linkage-fixes.patch b/0013-v3.5.0-more-linkage-fixes.patch deleted file mode 100644 index ad6cc56..0000000 --- a/0013-v3.5.0-more-linkage-fixes.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2757969a8b0e55c2310d50ef4764d3f81ce1d748 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Tue, 24 Oct 2023 13:50:37 +0100 -Subject: [PATCH 13/18] v3.5.0: more linkage fixes - ---- - contrib/brl/bpro/core/vil_pro/tests/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/contrib/brl/bpro/core/vil_pro/tests/CMakeLists.txt b/contrib/brl/bpro/core/vil_pro/tests/CMakeLists.txt -index 66d543b5c9..0ffff761fd 100644 ---- a/contrib/brl/bpro/core/vil_pro/tests/CMakeLists.txt -+++ b/contrib/brl/bpro/core/vil_pro/tests/CMakeLists.txt -@@ -8,7 +8,7 @@ if(EXPAT_FOUND) - test_vil_crop_image_process.cxx - ) - --target_link_libraries(vil_pro_test_all ${VXL_LIB_PREFIX}testlib vil_pro bprb sdet ${VXL_LIB_PREFIX}vil expat expatpp) -+target_link_libraries(vil_pro_test_all ${VXL_LIB_PREFIX}testlib vil_pro bprb brdb sdet ${VXL_LIB_PREFIX}vil expat expatpp) - - add_test( NAME bpro_vil_test_convert_to_n_planes_process COMMAND $ test_vil_convert_to_n_planes_process ) - add_test( NAME bpro_vil_test_crop_image_process COMMAND $ test_vil_crop_image_process ) --- -2.46.1 - diff --git a/0014-v3.5.0-use-system-zlib-tiff-minizip-compat.patch b/0014-v3.5.0-use-system-zlib-tiff-minizip-compat.patch deleted file mode 100644 index ee8fbbc..0000000 --- a/0014-v3.5.0-use-system-zlib-tiff-minizip-compat.patch +++ /dev/null @@ -1,52 +0,0 @@ -From ea6a4cc7095db5e98728849f6db505952704ca37 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Mon, 22 Jan 2024 11:40:35 +0000 -Subject: [PATCH 14/18] v3.5.0: use system zlib, tiff, minizip-compat - ---- - contrib/brl/bseg/bmdl/CMakeLists.txt | 7 +++++++ - contrib/brl/bseg/bmdl/pro/CMakeLists.txt | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/contrib/brl/bseg/bmdl/CMakeLists.txt b/contrib/brl/bseg/bmdl/CMakeLists.txt -index 4890d2ab29..8db0d2ca1c 100644 ---- a/contrib/brl/bseg/bmdl/CMakeLists.txt -+++ b/contrib/brl/bseg/bmdl/CMakeLists.txt -@@ -1,5 +1,12 @@ - # This is brl/seg/bmdl/CMakeLists.txt - -+FIND_PACKAGE( ZLIB QUIET ) -+if(ZLIB_FOUND) -+ include_directories( ${ZLIB_INCLUDE_DIR} ) -+ include_directories( ${BRL_INCLUDE_DIR}/b3p ) -+ add_definitions(-DHAS_ZLIB=1) -+endif() -+ - if(HAS_GEOTIFF) - include_directories( ${GEOTIFF_INCLUDE_DIR} ) - -diff --git a/contrib/brl/bseg/bmdl/pro/CMakeLists.txt b/contrib/brl/bseg/bmdl/pro/CMakeLists.txt -index 7c73fe1bb0..cc30626c09 100644 ---- a/contrib/brl/bseg/bmdl/pro/CMakeLists.txt -+++ b/contrib/brl/bseg/bmdl/pro/CMakeLists.txt -@@ -1,7 +1,7 @@ - # This is contrib/brl/bseg/bmdl/pro/CMakeLists.txt - # bmdl's Process Library - --include( ${VXL_CMAKE_DIR}/FindZLIB.cmake ) -+FIND_PACKAGE( ZLIB QUIET ) - if(ZLIB_FOUND) - include_directories( ${ZLIB_INCLUDE_DIR} ) - include_directories( ${BRL_INCLUDE_DIR}/b3p ) -@@ -12,7 +12,7 @@ endif() - FIND_PACKAGE(EXPAT REQUIRED) - FIND_PACKAGE(EXPATPP REQUIRED) - if(EXPAT_FOUND) -- include(${VXL_CMAKE_DIR}/FindTIFF.cmake) -+ FIND_PACKAGE(TIFF) - if(TIFF_FOUND) - include( ${VXL_CMAKE_DIR}/FindGEOTIFF.cmake) - if(GEOTIFF_FOUND) --- -2.46.1 - diff --git a/0015-v3.5.0-fix-linking.patch b/0015-v3.5.0-fix-linking.patch deleted file mode 100644 index 91cdb04..0000000 --- a/0015-v3.5.0-fix-linking.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4f74f5343ff3595872d045c4bf5025e347d18438 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Tue, 23 Jan 2024 16:54:51 +0000 -Subject: [PATCH 15/18] v3.5.0: fix linking - ---- - contrib/brl/bpro/core/brip_pro/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/contrib/brl/bpro/core/brip_pro/CMakeLists.txt b/contrib/brl/bpro/core/brip_pro/CMakeLists.txt -index cfa7d46af8..b8d557cdb9 100644 ---- a/contrib/brl/bpro/core/brip_pro/CMakeLists.txt -+++ b/contrib/brl/bpro/core/brip_pro/CMakeLists.txt -@@ -14,7 +14,7 @@ aux_source_directory(Templates brip_pro_sources) - aux_source_directory(processes brip_pro_sources) - - vxl_add_library(LIBRARY_NAME brip_pro LIBRARY_SOURCES ${brip_pro_sources}) --target_link_libraries(brip_pro bprb brdb brip vil_pro ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vsl bil_algo) -+target_link_libraries(brip_pro bprb brdb brip vpgl_pro vil_pro ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vsl bil_algo) - - if( BUILD_TESTING ) - add_subdirectory(tests) --- -2.46.1 - diff --git a/0016-v3.5.0-fix-linking.patch b/0016-v3.5.0-fix-linking.patch deleted file mode 100644 index 02410cf..0000000 --- a/0016-v3.5.0-fix-linking.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4de179f888a8c0ce9bbec7a63c4e86015598a809 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Tue, 1 Oct 2024 16:00:35 +0100 -Subject: [PATCH 16/18] v3.5.0: fix linking - ---- - contrib/brl/bpro/core/vil_pro/CMakeLists.txt | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/contrib/brl/bpro/core/vil_pro/CMakeLists.txt b/contrib/brl/bpro/core/vil_pro/CMakeLists.txt -index 5298c63727..ba36c765bb 100644 ---- a/contrib/brl/bpro/core/vil_pro/CMakeLists.txt -+++ b/contrib/brl/bpro/core/vil_pro/CMakeLists.txt -@@ -17,7 +17,8 @@ aux_source_directory(processes vil_pro_sources) - - vxl_add_library(LIBRARY_NAME vil_pro LIBRARY_SOURCES ${vil_pro_sources}) - --target_link_libraries(vil_pro bbas_pro bprb bil bil_algo brip sdet ${VXL_LIB_PREFIX}vil_algo ${VXL_LIB_PREFIX}vil_io ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vsl bsta_vis) -+target_link_libraries(vil_pro bbas_pro bprb bil bil_algo brip sdet ${VXL_LIB_PREFIX}vil_algo ${VXL_LIB_PREFIX}vil_io ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vsl bsta_vis vpgl_pro) -+# Need vpgl_pro only for the instantiation of brdb_value_t > > - - if( BUILD_TESTING ) - add_subdirectory(tests) --- -2.46.1 - diff --git a/0017-v3.5.0-remove-boxm2-processes-that-use-sdnet-that-re.patch b/0017-v3.5.0-remove-boxm2-processes-that-use-sdnet-that-re.patch deleted file mode 100644 index 1c58efb..0000000 --- a/0017-v3.5.0-remove-boxm2-processes-that-use-sdnet-that-re.patch +++ /dev/null @@ -1,894 +0,0 @@ -From a002d34fee7a0c86de360de5792dbffbbb5255d9 Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Tue, 1 Oct 2024 16:26:23 +0100 -Subject: [PATCH 17/18] v3.5.0: remove boxm2 processes that use sdnet that - require triangle - ---- - contrib/brl/bseg/boxm2/pro/boxm2_processes.h | 3 - - contrib/brl/bseg/boxm2/pro/boxm2_register.cxx | 3 - - .../processes/boxm2_export_mesh_process.cxx | 213 ------- - .../boxm2_export_textured_mesh_process.cxx | 523 ------------------ - .../pro/processes/boxm2_load_mesh_process.cxx | 78 --- - 5 files changed, 820 deletions(-) - delete mode 100644 contrib/brl/bseg/boxm2/pro/processes/boxm2_export_mesh_process.cxx - delete mode 100644 contrib/brl/bseg/boxm2/pro/processes/boxm2_export_textured_mesh_process.cxx - delete mode 100644 contrib/brl/bseg/boxm2/pro/processes/boxm2_load_mesh_process.cxx - -diff --git a/contrib/brl/bseg/boxm2/pro/boxm2_processes.h b/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -index 4d68be95b0..7094c03fb5 100644 ---- a/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -+++ b/contrib/brl/bseg/boxm2/pro/boxm2_processes.h -@@ -13,8 +13,6 @@ DECLARE_FUNC_CONS(boxm2_create_cache_process); - DECLARE_FUNC_CONS(boxm2_create_scene_process); - DECLARE_FUNC_CONS(boxm2_write_scene_xml_process); - DECLARE_FUNC_CONS(boxm2_add_block_process); --DECLARE_FUNC_CONS(boxm2_export_textured_mesh_process); --DECLARE_FUNC_CONS(boxm2_export_mesh_process); - DECLARE_FUNC_CONS(boxm2_describe_scene_process); - DECLARE_FUNC_CONS(boxm2_create_stream_cache_process); - DECLARE_FUNC_CONS(boxm2_roi_init_process); -@@ -57,7 +55,6 @@ DECLARE_FUNC_CONS(boxm2_label_to_xyz_process); - DECLARE_FUNC_CONS(boxm2_label_to_xyz_process2); - DECLARE_FUNC_CONS(boxm2_prune_scene_blocks_process); - DECLARE_FUNC_CONS(boxm2_prune_scene_blocks_by_dem_process); --DECLARE_FUNC_CONS(boxm2_load_mesh_process); - DECLARE_FUNC_CONS(boxm2_create_camera_from_kml_path_process); // August 23, 2013 Yi Dong - - DECLARE_FUNC_CONS(boxm2_ortho_geo_cam_from_scene_process); -diff --git a/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx b/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -index a05b9e5c58..e1cefa5765 100644 ---- a/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -+++ b/contrib/brl/bseg/boxm2/pro/boxm2_register.cxx -@@ -33,8 +33,6 @@ void boxm2_register::register_process() - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_create_scene_process, "boxm2CreateSceneProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_write_scene_xml_process, "boxm2WriteSceneXMLProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_add_block_process, "boxm2AddBlockProcess"); -- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_export_textured_mesh_process,"boxm2ExportTexturedMeshProcess"); -- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_export_mesh_process,"boxm2ExportMeshProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_describe_scene_process,"boxm2DescribeSceneProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_create_stream_cache_process, "boxm2CreateStreamCacheProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_roi_init_process, "boxm2RoiInitProcess"); -@@ -58,7 +56,6 @@ void boxm2_register::register_process() - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_scene_from_box_cams_process, "boxm2SceneFromBoxCamsProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_scene_from_nvm_txt_process, "boxm2SceneFromNVMtxtProcess"); - -- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_load_mesh_process, "boxm2LoadMeshProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_compactify_mog6_view_process, "boxm2CompactifyMog6ViewProcess"); - REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm2_scene_statistics_process, "boxm2SceneStatisticsProcess"); - -diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_mesh_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_mesh_process.cxx -deleted file mode 100644 -index bdc59a32e7..0000000000 ---- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_mesh_process.cxx -+++ /dev/null -@@ -1,213 +0,0 @@ --// This is brl/bseg/boxm2/pro/processes/boxm2_export_mesh_process.cxx --#include --#include --#include --//: --// \file --// \brief A process for exporting a texture mapped mesh of a scene --// --// \author Vishal Jain --// \date Mar 15, 2011 -- --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif --#include "vul/vul_file.h" --#include --#include -- --//vil includes --#include "vil/vil_image_view.h" --#include "vil/vil_new.h" --#include "vil/vil_math.h" -- --//vgl --#include "vgl/vgl_point_3d.h" --#include -- --//det and imesh includes --#include --#include --#include --#include -- --namespace boxm2_export_mesh_process_globals --{ -- constexpr unsigned n_inputs_ = 4; -- constexpr unsigned n_outputs_ = 1; --} -- --bool boxm2_export_mesh_process_cons(bprb_func_process& pro) --{ -- using namespace boxm2_export_mesh_process_globals; -- -- //process takes 2 inputs -- int i=0; -- std::vector input_types_(n_inputs_); -- input_types_[i++] = "vil_image_view_base_sptr"; //depth image -- input_types_[i++] = "vil_image_view_base_sptr"; //x image -- input_types_[i++] = "vil_image_view_base_sptr"; //y image -- input_types_[i++] = "vcl_string"; //output dir of saved mesh -- -- // process has 1 output -- std::vector output_types_(n_outputs_); -- output_types_[0] = "imesh_mesh_sptr"; -- -- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); --} -- --bool boxm2_export_mesh_process(bprb_func_process& pro) --{ -- using namespace boxm2_export_mesh_process_globals; -- if ( pro.n_inputs() < n_inputs_ ) { -- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; -- return false; -- } -- -- //get the inputs -- unsigned argIdx = 0; -- vil_image_view_base_sptr img = pro.get_input(argIdx++); -- vil_image_view_base_sptr ximg = pro.get_input(argIdx++); -- vil_image_view_base_sptr yimg = pro.get_input(argIdx++); -- std::string out_dir = pro.get_input(argIdx++); -- -- //create the mesh directory -- if (out_dir != "") { -- if (!vul_file::make_directory_path(out_dir.c_str())) { -- std::cout<<"Couldn't make directory path "<*) img.ptr(); -- auto* x_img = (vil_image_view*) ximg.ptr(); -- auto* y_img = (vil_image_view*) yimg.ptr(); -- -- //determine size of depth image -- unsigned ni = z_img->ni(); -- unsigned nj = z_img->nj(); -- -- //create new resource sptr -- vil_image_resource_sptr z_img_res = vil_new_image_resource_of_view(*z_img); -- -- //initialize some sdet_image_mesh parameters -- sdet_image_mesh_params imp; -- // sigma of the Gaussian for smoothing the image prior to edge detection -- imp.smooth_ = 1.0f; -- // the edge detection threshold -- imp.thresh_ = 1.68f; -- // the shortest edgel chain that is considered for line fitting -- imp.min_fit_length_ = 5; -- -- // the threshold on rms pixel distance of edgels to the line -- imp.rms_distance_ = 0.11; -- // the width in pixels of the transition of a step edge -- imp.step_half_width_ = 0.0; -- -- // the mesh processor -- sdet_image_mesh im(imp); -- im.set_image(z_img_res); -- if (!im.compute_mesh()) { -- std::cout<<"mesh could not be computed"<& verts = mesh.vertices<3>(); -- unsigned nverts = mesh.num_verts(); -- for (unsigned iv = 0; iv(verts[iv][0]); -- auto j = static_cast(verts[iv][1]); -- if (i sel_faces; -- double maxLen = (maxz-minz) / 3.0; -- auto& faces = (imesh_regular_face_array<3>&) mesh.faces(); -- imesh_vertex_array<3>& verts = mesh.vertices<3>(); -- -- unsigned nfaces = mesh.num_faces(); -- for (unsigned iface = 0; iface > points; -- for (int i=0; i<3; ++i) { -- unsigned vertexId = faces[iface][i]; -- double x = verts[vertexId][0]; -- double y = verts[vertexId][1]; -- double z = verts[vertexId][2]; -- points.emplace_back(x,y,z ); -- } -- -- // if any one side of the triangle is too long, cut it -- double lenA = (points[0]-points[1]).sqr_length(); // vgl_vector length == distance -- double lenB = (points[1]-points[2]).sqr_length(); -- double lenC = (points[0]-points[2]).sqr_length(); -- maxLen *= maxLen; // sqr -- if (lenA > maxLen || lenB > maxLen || lenC > maxLen) { -- sel_faces.insert(iface); -- } -- } -- -- //if the divide face set is not empty, divide the faces -- if ( !sel_faces.empty() ) { --// did_divide = true; -- -- std::cout<<"Subdividing mesh"<(argIdx++, mesh_sptr); -- return true; --} -diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_textured_mesh_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_textured_mesh_process.cxx -deleted file mode 100644 -index 73e67b8bb6..0000000000 ---- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_export_textured_mesh_process.cxx -+++ /dev/null -@@ -1,523 +0,0 @@ --// This is brl/bseg/boxm2/pro/processes/boxm2_export_textured_mesh_process.cxx --#include --#include --#include --#include --//: --// \file --// \brief A process for exporting a texture mapped mesh of a scene --// --// \author Vishal Jain --// \date Mar 15, 2011 -- --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif --#include "vul/vul_file.h" --#include "vul/vul_timer.h" --#include --#include -- --//vil includes --#include "vil/vil_image_view.h" --#include "vil/vil_save.h" --#include "vil/vil_new.h" -- --//vgl --#include "vgl/vgl_distance.h" --#include "vgl/vgl_ray_3d.h" --#include "vgl/vgl_point_3d.h" --#include -- --//vpgl camera stuff --#include "vpgl/vpgl_perspective_camera.h" -- --//det and imesh includes --#include --#include --#include --#include -- --namespace boxm2_export_textured_mesh_process_globals --{ -- constexpr unsigned n_inputs_ = 6; -- constexpr unsigned n_outputs_ = 0; -- -- //helper texture map methods -- void boxm2_texture_mesh_from_imgs(std::string im_dir, -- std::string cam_dir, -- imesh_mesh& in_mesh, -- std::map& meshes); -- -- //populates a vector of visibility images (by face id int) -- void boxm2_visible_faces( std::vector* >& cameras, -- std::vector* >& vis_images, -- imesh_mesh& in_mesh); -- -- -- //checks if a triangle in UV space is visible. us and vs are double buffers of length 3 -- bool face_is_visible( vpgl_perspective_camera* cam, -- vil_image_view* vis_img, -- const double* us, -- const double* vs, -- int face_id); --} -- --bool boxm2_export_textured_mesh_process_cons(bprb_func_process& pro) --{ -- using namespace boxm2_export_textured_mesh_process_globals; -- -- //process takes 2 inputs -- int i=0; -- std::vector input_types_(n_inputs_); -- input_types_[i++] = "vil_image_view_base_sptr"; //depth image -- input_types_[i++] = "vpgl_camera_double_sptr"; //depth image cam -- input_types_[i++] = "boxm2_scene_sptr"; //scene object -- input_types_[i++] = "vcl_string"; //directory of scene images -- input_types_[i++] = "vcl_string"; //directory of corresponding cams -- input_types_[i++] = "vcl_string"; //output dir of saved mesh -- -- // process has 1 output -- std::vector output_types_(n_outputs_); -- //output_types_[0] = "boxm2_scene_sptr"; -- -- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); --} -- --bool boxm2_export_textured_mesh_process(bprb_func_process& pro) --{ -- using namespace boxm2_export_textured_mesh_process_globals; -- if ( pro.n_inputs() < n_inputs_ ) { -- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; -- return false; -- } -- -- //get the inputs -- unsigned argIdx = 0; -- vil_image_view_base_sptr img = pro.get_input(argIdx++); -- vpgl_camera_double_sptr cam = pro.get_input(argIdx++); -- boxm2_scene_sptr scene = pro.get_input(argIdx++); -- std::string img_dir = pro.get_input(argIdx++); -- std::string cam_dir = pro.get_input(argIdx++); -- std::string out_dir = pro.get_input(argIdx++); -- -- if (img->pixel_format() == VIL_PIXEL_FORMAT_BYTE) -- { -- auto* inim = (vil_image_view*) img.ptr(); -- auto* fimg = new vil_image_view(img->ni(), img->nj()); -- for (unsigned int i=0; ini(); ++i) -- for (unsigned int j=0; jnj(); ++j) -- (*fimg)(i,j) = (float) (*inim)(i,j) / 255.0f; -- img = vil_image_view_base_sptr(fimg); -- } -- -- //create the mesh directory -- if (!vul_file::make_directory_path(out_dir.c_str())) { -- std::cout<<"Couldn't make directory path "<*) cam.ptr(); -- auto* depth = (vil_image_view*) img.ptr(); -- -- //determine size of depth image -- unsigned ni = img->ni(); -- unsigned nj = img->nj(); -- -- //calculate XYZ image image that corresponds to depth image -- auto* xyz_img = new vil_image_view >(ni, nj); -- auto* z_img = new vil_image_view(ni,nj); -- for (unsigned int i=0; i ray = pcam->backproject_ray( (double) i+.5, (double) j+.5); -- -- //ray o -- float ray_ox = float(ray.origin().x()), -- ray_oy = float(ray.origin().y()), -- ray_oz = float(ray.origin().z()); -- -- //ray dir -- float dray_x = float(ray.direction().x()), -- dray_y = float(ray.direction().y()), -- dray_z = float(ray.direction().z()); -- -- //expected ray depth -- float ray_t = (*depth)(i,j); -- -- //calculate x,y,z position at expected depth -- (*xyz_img)(i,j) = vil_rgba(ray_ox - ray_t*dray_x, -- ray_oy - ray_t*dray_y, -- ray_oz - ray_t*dray_z, -- 0.0f); -- (*z_img)(i,j) = ray_oz - ray_t*dray_z; -- } -- } -- -- ////////////////////////////////////////////////////////////////////////////// -- // Generate 3d mesh from depth image -- ////////////////////////////////////////////////////////////////////////////// -- std::cout<<"Generating image mesh"<& verts = mesh.vertices<3>(); -- unsigned nverts = mesh.num_verts(); -- for (unsigned iv = 0; iv(verts[iv][0]); -- auto j = static_cast(verts[iv][1]); -- double scene_x=0, scene_y=0,scene_z = 0.0; -- if (i meshes; -- boxm2_texture_mesh_from_imgs(img_dir, cam_dir, mesh, meshes); -- -- //////////////////////////////////////////////////////////////////////////////// -- //// Write out in VRML format -- //////////////////////////////////////////////////////////////////////////////// -- //output file and stream -- std::string vrfile = out_dir + "/vrmesh.wrl"; -- std::ofstream os(vrfile.c_str()); -- -- //write each submesh into one file -- std::map::iterator subMesh; -- for (subMesh = meshes.begin(); subMesh != meshes.end(); ++subMesh) -- { -- imesh_mesh& sMesh = subMesh->second; -- std::cout<<"Writing sub mesh: "<& meshes) --{ -- //////////////////////////////////////////////////////////////////////////////// -- // BEGIN TEXTURE MAPPING -- // Gather cameras and iamges that will contribute to the texture -- //////////////////////////////////////////////////////////////////////////////// -- std::vector camfiles = boxm2_util::camfiles_from_directory(std::move(cam_dir)); -- std::vector imfiles = boxm2_util::images_from_directory(std::move(im_dir)); -- -- std::vector* > cameras; -- for (auto & camfile : camfiles) { -- //build the camera from file -- std::ifstream ifs(camfile.c_str()); -- auto* icam = new vpgl_perspective_camera; -- if (!ifs.is_open()) { -- std::cerr << "Failed to open file " << camfile << '\n'; -- return; -- } -- ifs >> *icam; -- cameras.push_back(icam); -- std::cout<principal_axis()<&) in_mesh.faces(); -- unsigned nfaces = in_mesh.num_faces(); -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- -- //////////////////////////////////////////////////////////////////////////////// -- // Render Visibility Images -- //////////////////////////////////////////////////////////////////////////////// -- std::vector* > vis_images; -- boxm2_visible_faces(cameras, vis_images, in_mesh); -- -- //////////////////////////////////////////////////////////////////////////////// -- // For each Face: -- // determine which image is closest in normal and visible, store face index in a map[image_str, vectorface] -- //////////////////////////////////////////////////////////////////////////////// -- //texture index -- std::cout<<"Populating faces for each texture"< > app_faces; //image_name to face_list -- std::map* > texture_cams; -- for (unsigned iface = 0; iface* > visible_views; -- for (unsigned int i=0; iproject(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- } -- if ( face_is_visible( cameras[i], vis_images[i], us, vs, iface) ) -- visible_views.push_back(cameras[i]); -- } -- -- //now compare the normal to each of the visible view cameras -- vgl_vector_3d& normal = in_faces.normal(iface); -- -- //find camera with the closest look vector to this normal -- int closeIdx = boxm2_util::find_nearest_cam(normal, visible_views); -- vpgl_perspective_camera* closest = nullptr; -- std::string im_name = "empty"; -- if (closeIdx >= 0) { -- closest = cameras[closeIdx]; -- im_name = imfiles[closeIdx]; -- } -- -- //grab appropriate face list (create it if it's not there) -- auto iter = app_faces.find(im_name); -- if ( iter == app_faces.end() ) { -- std::cout<<"Adding image: "< faceList; -- faceList.push_back(iface); -- app_faces[im_name] = faceList; -- -- //keep track of the camera -- texture_cams[im_name] = closest; -- } -- else { -- app_faces[im_name].push_back(iface); -- } -- } -- -- //////////////////////////////////////////////////////////////////////////////// -- // For each image/appearance: -- // - create a vert list -- // - create a face list -- // - create a sub mesh that is textured -- //////////////////////////////////////////////////////////////////////////////// -- -- //for each appearance (texture image), create an imesh_mesh (subMesh); -- std::cout<<"Creating Sub Meshes for each texture"< >::iterator apps; -- for (apps = app_faces.begin(); apps != app_faces.end(); ++apps) -- { -- //for each appearance, we're creating a whole new mesh -- // first create the face list -- auto* flist = new imesh_regular_face_array<3>(); -- -- //now create the vertex list -- auto* verts3 = new imesh_vertex_array<3>(); -- -- //get faces list corresponding to this texture -- std::vector& face_list = apps->second; -- for (unsigned int i=0; ipush_back( imesh_vertex<3>(in_verts[v1][0], in_verts[v1][1], in_verts[v1][2]) ); -- verts3->push_back( imesh_vertex<3>(in_verts[v2][0], in_verts[v2][1], in_verts[v2][2]) ); -- verts3->push_back( imesh_vertex<3>(in_verts[v3][0], in_verts[v3][1], in_verts[v3][2]) ); -- -- imesh_tri tri(3*i, 3*i+1, 3*i+2); -- flist->push_back(tri); -- } -- -- //create the submesh using the auto ptrs -- std::unique_ptr v3(verts3); -- std::unique_ptr f3(flist); -- imesh_mesh subMesh(std::move(v3), std::move(f3)); -- -- std::cout<<"Setting tex source: "<first<first] = subMesh; -- meshes[apps->first].set_tex_source(apps->first); -- } -- -- ////////////////////////////////////////////////////////////////////////////// -- //For each mesh, map each vertex -- ////////////////////////////////////////////////////////////////////////////// -- std::cout<<"Mapping sub meshes for each texture"<::iterator subMesh; -- auto txCam = texture_cams.begin(); -- for (subMesh = meshes.begin(); subMesh != meshes.end(); ++subMesh, ++txCam) -- { -- imesh_mesh& mesh = subMesh->second; -- imesh_vertex_array<3>& verts = mesh.vertices<3>(); -- unsigned nverts = mesh.num_verts(); -- -- //texture map the non empty appearances -- if (txCam->first != "empty") -- { -- std::vector > tex_coords(nverts, vgl_point_2d(0.0,0.0)); -- for (unsigned iv = 0; iv* closest = txCam->second; -- vgl_point_2d principal_point = closest->get_calibration().principal_point(); -- double ni = principal_point.x()*2.0; -- double nj = principal_point.y()*2.0; -- -- //project the vertex onto the camera, store the texture coordinate -- double x = verts[iv][0]; -- double y = verts[iv][1]; -- double z = verts[iv][2]; -- double u,v; -- closest->project(x, y, z, u, v); -- -- //flip v about the y axis -- v=nj-v; -- -- //store the tex_coordinate -- vgl_point_2d uv(u/ni,v/nj); -- tex_coords[iv] = uv; -- } -- mesh.set_tex_coords(tex_coords); -- } -- } --} -- --bool boxm2_export_textured_mesh_process_globals::face_is_visible( vpgl_perspective_camera* /*cam*/, -- vil_image_view* vis_img, -- const double* us, -- const double* vs, -- int face_id) --{ -- //now create a polygon, and find the integer image coordinates (U,V) that this polygon covers -- int ni = vis_img->ni(); -- int nj = vis_img->nj(); -- -- vgl_triangle_scan_iterator tsi; -- tsi.a.x = us[0]; tsi.a.y = vs[0]; -- tsi.b.x = us[1]; tsi.b.y = vs[1]; -- tsi.c.x = us[2]; tsi.c.y = vs[2]; -- for (tsi.reset(); tsi.next(); ) { -- int y = tsi.scany(); -- if (y<0 || y>=nj) continue; -- int min_x = tsi.startx(); -- int max_x = tsi.endx(); -- if (min_x >= ni || max_x < 0) -- continue; -- if (min_x < 0) min_x = 0; -- if (max_x >= ni) max_x = ni-1; -- for (int x = min_x; x <= max_x; ++x) { -- if ( (*vis_img)(x,y) != face_id ) -- return false; -- } -- } -- -- //if it made it this far, it's completely visible -- return true; --} -- -- --void boxm2_export_textured_mesh_process_globals::boxm2_visible_faces( std::vector* >& cameras, -- std::vector* >& vis_images, -- imesh_mesh& in_mesh) --{ -- auto& in_faces = (imesh_regular_face_array<3>&) in_mesh.faces(); -- unsigned nfaces = in_mesh.num_faces(); -- imesh_vertex_array<3>& in_verts = in_mesh.vertices<3>(); -- -- //iterate over each camera, creating a visibility image for each -- for (auto pcam : cameras) -- { -- //get the principal point of the cam for image size -- vgl_point_2d principal_point = pcam->get_calibration().principal_point(); -- auto ni = (unsigned) (principal_point.x()*2.0); -- auto nj = (unsigned) (principal_point.y()*2.0); -- -- // render the face_id/distance image -- vil_image_view depth_im(ni, nj); -- auto* face_im = new vil_image_view(ni, nj); -- depth_im.fill(10e100); //Initial depth is huge, -- face_im->fill(-1); //initial face id is -1 -- for (unsigned iface = 0; ifaceproject(x, y, z, u, v); -- us[vIdx] = u; -- vs[vIdx] = v; -- -- //keep track of distance to each vertex -- dists[vIdx] = vgl_distance(vgl_point_3d(x,y,z), pcam->get_camera_center()); -- } -- -- //render the triangle label onto the label image, using the depth image -- vgl_point_3d v1(us[0], vs[0], dists[0]); -- vgl_point_3d v2(us[1], vs[1], dists[1]); -- vgl_point_3d v3(us[2], vs[2], dists[2]); -- imesh_render_triangle_label(v1, v2, v3, (int) iface, (*face_im), depth_im); -- } //end for iface -- -- //keep the vis_image just calculated -- vis_images.push_back(face_im); -- vil_save(depth_im, "/media/VXL/mesh/downtown/dist_im.tif"); -- } --} -diff --git a/contrib/brl/bseg/boxm2/pro/processes/boxm2_load_mesh_process.cxx b/contrib/brl/bseg/boxm2/pro/processes/boxm2_load_mesh_process.cxx -deleted file mode 100644 -index 78c545a3fd..0000000000 ---- a/contrib/brl/bseg/boxm2/pro/processes/boxm2_load_mesh_process.cxx -+++ /dev/null -@@ -1,78 +0,0 @@ --// This is brl/bseg/boxm2/pro/processes/boxm2_load_mesh_process.cxx --#include --#include --#include --//: --// \file --// \brief A process for loading a mesh --// --// \author Vishal Jain --// \date Mar 15, 2013 -- --#ifdef _MSC_VER --# include "vcl_msvc_warnings.h" --#endif --#include "vul/vul_file.h" --#include "vul/vul_timer.h" --#include "vnl/vnl_random.h" --#include --#include -- --//vil includes --#include "vil/vil_image_view.h" --#include "vil/vil_save.h" --#include -- --//vgl --#include "vgl/vgl_distance.h" --#include "vgl/vgl_triangle_scan_iterator.h" --#include -- --//vpgl camera stuff --#include "vpgl/vpgl_perspective_camera.h" -- --//det and imesh includes --#include --#include --#include --#include -- --namespace boxm2_load_mesh_process_globals --{ -- constexpr unsigned n_inputs_ = 1; -- constexpr unsigned n_outputs_ = 1; --} -- --bool boxm2_load_mesh_process_cons(bprb_func_process& pro) --{ -- using namespace boxm2_load_mesh_process_globals; -- -- //process takes 2 inputs -- int i=0; -- std::vector input_types_(n_inputs_); -- input_types_[i++] = "vcl_string"; //mesh filename -- -- // process has 1 output -- std::vector output_types_(n_outputs_); -- output_types_[0] = "imesh_mesh_sptr"; -- -- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_); --} -- --bool boxm2_load_mesh_process(bprb_func_process& pro) --{ -- using namespace boxm2_load_mesh_process_globals; -- if ( pro.n_inputs() < n_inputs_ ) { -- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl; -- return false; -- } -- unsigned argIdx = 0; -- std::string mesh_filename = pro.get_input(argIdx++); -- imesh_mesh_sptr mesh = new imesh_mesh(); -- imesh_read(mesh_filename, *(mesh.ptr())); -- std::cout<<"# of faces "<num_faces()<(0,mesh); -- -- -- return true; --} --- -2.46.1 - diff --git a/0018-chore-remove-ctest-dashboard-config.patch b/0018-chore-remove-ctest-dashboard-config.patch deleted file mode 100644 index e43d5b3..0000000 --- a/0018-chore-remove-ctest-dashboard-config.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 99f96d0e6d18996ad58d34998d08f022585ae77b Mon Sep 17 00:00:00 2001 -From: "Ankur Sinha (Ankur Sinha Gmail)" -Date: Wed, 2 Oct 2024 14:39:51 +0100 -Subject: [PATCH 18/18] chore: remove ctest dashboard config - ---- - CMakeLists.txt | 4 ---- - CTestConfig.cmake | 8 -------- - 2 files changed, 12 deletions(-) - delete mode 100644 CTestConfig.cmake - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e1aa0390d4..810a1f4b21 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -322,10 +322,6 @@ configure_file( ${VXL_CMAKE_DIR}/UseVXL.cmake - # For use in client projects that call UseVXL.cmake - set(VXL_LIBRARY_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STATIC "Where all the vxl libraries are, for clients to use." ) - --# Copy CTestCustom.cmake to top of build tree --configure_file( ${VXL_CMAKE_DIR}/CTestCustom.cmake -- ${VXL_BINARY_DIR}/CTestCustom.cmake COPYONLY ) -- - # This command must be the last command in this file - if(NOT VXL_NO_EXPORT) - include(${CMAKE_CURRENT_LIST_DIR}/config/cmake/export/VXLCreateProject.cmake) -diff --git a/CTestConfig.cmake b/CTestConfig.cmake -deleted file mode 100644 -index f2620f7bf6..0000000000 ---- a/CTestConfig.cmake -+++ /dev/null -@@ -1,8 +0,0 @@ --# CTest Configuration for VXL --set(CTEST_PROJECT_NAME "VXL") --set(CTEST_NIGHTLY_START_TIME "22:00:00 EST") -- --set(CTEST_DROP_METHOD "http") --set(CTEST_DROP_SITE "open.cdash.org") --set(CTEST_DROP_LOCATION "/submit.php?project=vxl") --set(CTEST_DROP_SITE_CDASH TRUE) --- -2.46.1 - diff --git a/changelog b/changelog deleted file mode 100644 index 6b9f2cf..0000000 --- a/changelog +++ /dev/null @@ -1,203 +0,0 @@ -* Tue Nov 15 2022 Sandro Mani - 2.0.2-15 -- Rebuild (minizip-ng) - -* Sat Jul 23 2022 Fedora Release Engineering - 2.0.2-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sat Jan 22 2022 Fedora Release Engineering - 2.0.2-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Fri Jul 23 2021 Fedora Release Engineering - 2.0.2-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Feb 09 2021 Miro Hrončok - 2.0.2-11 -- Rebuilt for minizip 3.0.0 - -* Wed Jan 27 2021 Fedora Release Engineering - 2.0.2-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Sat Oct 17 2020 Jeff Law - 2.0.2-9 -- Fix missing #includes for gcc-11 - -* Mon Jul 27 2020 Ankur Sinha - 2.0.2-8 -- Rebuild for libdc1394 soname bump - -* Fri Jan 31 2020 Fedora Release Engineering - 2.0.2-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Sun Sep 15 2019 Ankur Sinha - 2.0.2-6 -- Fix failing build: update patch to fix minizip include - -* Sat Jul 27 2019 Fedora Release Engineering - 2.0.2-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Tue May 28 2019 Ankur Sinha - 2.0.2-4 -- Remove obsolete boxm library (was also causing arm build to fail) -- Remove obsolete octree library - -* Tue May 28 2019 Ankur Sinha - 2.0.2-3 -- Fix 32 bit arch builds: https://github.com/vxl/vxl/issues/638 -- Remove invalid comments -- Do not make docs require the base package - -* Fri Apr 26 2019 Ankur Sinha - 2.0.2-2 -- Add complete file list -- Remove no longer needed BR: klt -- Remove more unneeded patches -- Add patch to include FindRPLY.cmake -- Use system shapelib and expat -- More patches to complete build -- Document failing tests, do not let them fail build - -* Fri Apr 19 2019 Ankur Sinha - 2.0.2-2 -- Enable OUL---why was it disabled? -- Remove rply include patch: build seems to find it just fine. -- Remove uneeded rply function call fix patch. -- Remove Coin3D cmake config patch---included in cmake distribution now. -- Remove SIMVoleon cmake patch---seems to find it just fine. -- Correct CMake flags. -- Enable BRL build -- add Python BR -- Add expatpp bits manually -- File upstream issue and use bundled openjpeg2: https://github.com/vxl/vxl/issues/627 -- Remove unneeded xerces BR, and corresponding patch. - -* Thu Apr 18 2019 Ankur Sinha - 2.0.2-1 -- Update to latest upstream release -- Temporarily use bundled dcmtk (https://github.com/vxl/vxl/issues/550) -- Use new github upstream -- Remove uneeded patches -- Explicitly list all shared objects - -* Sat Mar 09 2019 Antonio Trande - 1.17.0-31 -- Rebuild for dcmtk-3.6.4 - -* Sun Feb 17 2019 Ankur Sinha - 1.17.0-30 -- Use autosetup macro -- Remove whitespaces, use space instead of tabs for cleanliness - -* Sun Feb 03 2019 Fedora Release Engineering - 1.17.0-29 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Tue Aug 28 2018 Patrik Novotný - 1.17.0-28 -- change requires to minizip-compat(-devel), rhbz#1609830, rhbz#1615381 - -* Sat Jul 14 2018 Fedora Release Engineering - 1.17.0-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Mar 07 2018 Adam Williamson - 1.17.0-26 -- Rebuild to fix GCC 8 mis-compilation - See https://da.gd/YJVwk ("GCC 8 ABI change on x86_64") - -* Fri Feb 09 2018 Fedora Release Engineering - 1.17.0-25 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Thu Aug 03 2017 Fedora Release Engineering - 1.17.0-24 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Thu Jul 27 2017 Fedora Release Engineering - 1.17.0-23 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Mon May 15 2017 Fedora Release Engineering - 1.17.0-22 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild - -* Sat Feb 11 2017 Fedora Release Engineering - 1.17.0-21 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Feb 25 2016 Tom Callaway - 1.17.0-20 -- remove non-free lena image file from source tarball (bz1310388) -- fix FTBFS (bz1303695, bz1308234) - -* Fri Feb 05 2016 Fedora Release Engineering - 1.17.0-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Fri Jun 19 2015 Fedora Release Engineering - 1.17.0-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Sat May 16 2015 Sebastian Pölsterl - 1.17.0-17 -- Rebuilt using hardened build flags: https://fedoraproject.org/wiki/Changes/Harden_All_Packages - -* Mon Feb 16 2015 Ralf Corsépius - 0.17.0-16 -- Add vxl-0.17.0-gcc5.diff (Work-around GCC-5.0.0 FTBFS RHBZ#1192886). -- Fix bogus %%changelog date. - -* Mon Aug 25 2014 Devrim Gündüz - 1.17.0-15 -- Rebuilt for libgeotiff - -* Mon Aug 18 2014 Fedora Release Engineering - 1.17.0-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Sun Jun 08 2014 Fedora Release Engineering - 1.17.0-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sun Aug 04 2013 Fedora Release Engineering - 1.17.0-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Mon Mar 04 2013 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-11 -- Applied upstream patches (25, 26) to ensure compatibility with ITK - -* Fri Feb 15 2013 Fedora Release Engineering - 1.17.0-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Mon Jan 21 2013 Adam Tkac - 1.17.0-9 -- rebuild due to "jpeg8-ABI" feature drop - -* Wed Dec 05 2012 Dan Horák - 1.17.0-8 -- fix build on non-x86 arches - -* Sun Nov 25 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-7%{?dist} -- Changed source0 path to point to vxl 1.17 -- Added missing sonames - -* Fri Nov 02 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-6%{?dist} -- Patched to build BRL -- Updated to last version - -* Mon Oct 29 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-5%{?dist} -- Removed expatpp bundled library and added corresponding BR -- Removed bundled bzip - - -* Thu Oct 18 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-4%{?dist} -- Fixed missing oxl_vrml lib -- Turn on compilation of BRL - -* Sun Oct 14 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-3%{?dist} -- More fixes from Volker's post https://bugzilla.redhat.com/show_bug.cgi?id=567086#c42 - -* Wed Oct 10 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-2%{?dist} -- Added patches 12-16 from https://bugzilla.redhat.com/show_bug.cgi?id=567086#c42 -- Minor rework of the spec file as pointed out by Volker in the previous link - -* Wed Oct 10 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-1%{?dist} -- Updated to new version -- Reworked patches to the new version -- Disabled BRL because it gives a compilation error - -* Fri May 27 2011 Mario Ceresa mrceresa fedoraproject org vxl 1.14.0-1%{?dist} -- Updated to new version -- Added BR doxygen (thanks to Ankur for noticing it) -- Changed patch naming schema -- Work around a rply related bug (patches 3-6) -- Thanks to Thomas Bouffon for patch 7-8 -- Patches 9-10 address http://www.itk.org/pipermail/insight-users/2010-July/037418.html -- Fixed 70 missing sonames in patch 11 -- Removed bundled expact, shapelib, minizip, dcmtk -- Force brl build -- Use system shipped FindEXPAT - - -* Tue Mar 23 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-4%{?dist} -- sed patch to add ${LIB_SUFFIX} to all lib install target -- Added soname version info to vil vil_algo lib - -* Sun Mar 21 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-3%{?dist} -- Applied patch to build against newly packaged rply - -* Tue Mar 2 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-2%{?dist} -- Applied patch from debian distribution to force the generation of versioned lib - -* Fri Feb 19 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-1%{?dist} -- Initial RPM Release - - diff --git a/licenses.txt b/licenses.txt deleted file mode 100644 index eeb2b84..0000000 --- a/licenses.txt +++ /dev/null @@ -1,245 +0,0 @@ -# remove bits unbundled and removed in patches and run -# licensecheck -r . | sed '/UNKNOWN/ d' - -# To get a list, run: -# cat licenses.txt | grep -Ev "^#" | cut -d: -f2 | sort -u - -# additional notes on licenses below (also commented by starting line with #): - -./core/vxl_copyright.h: BSD 3-Clause License -./vcl/vcl_atomic_count.h: Boost Software License 1.0 -./config/cmake/CodeCoverage.cmake: BSD 3-Clause License -./core/vbl/vbl_checked_delete.h: NTP License -./core/vbl/vbl_disjoint_sets.h: *No copyright* MIT License -./core/vbl/vbl_scoped_ptr.h: NTP License -./core/vul/vul_ios_state.h: Boost Software License 1.0 -./scripts/gitsetup/LICENSE: *No copyright* Apache License 2.0 -./scripts/gitsetup/README: *No copyright* Apache License 2.0 -./scripts/gitsetup/git-gerrit-push: Apache License 2.0 -./scripts/gitsetup/setup-gerrit: Apache License 2.0 -./scripts/gitsetup/setup-hooks: Apache License 2.0 -./scripts/gitsetup/setup-sourceforge: Apache License 2.0 -./scripts/gitsetup/setup-ssh: Apache License 2.0 -./scripts/gitsetup/setup-stage: Apache License 2.0 -./scripts/gitsetup/setup-user: Apache License 2.0 -./scripts/gitsetup/tips: Apache License 2.0 -./v3p/clipper/License.txt: *No copyright* Boost Software License 1.0 -./v3p/clipper/clipper.cpp: Boost Software License -./v3p/clipper/clipper.hxx: Boost Software License -./v3p/openjpeg2/bio.c: BSD 2-Clause License -./v3p/openjpeg2/bio.h: BSD 2-Clause License -./v3p/openjpeg2/cio.c: BSD 2-Clause License -./v3p/openjpeg2/cio.h: BSD 2-Clause License -./v3p/openjpeg2/dwt.c: BSD 2-Clause License -./v3p/openjpeg2/dwt.h: BSD 2-Clause License -./v3p/openjpeg2/event.c: BSD 2-Clause License -./v3p/openjpeg2/event.h: BSD 2-Clause License -./v3p/openjpeg2/fix.h: BSD 2-Clause License -./v3p/openjpeg2/function_list.c: BSD 2-Clause License -./v3p/openjpeg2/function_list.h: BSD 2-Clause License -./v3p/openjpeg2/image.c: BSD 2-Clause License -./v3p/openjpeg2/image.h: BSD 2-Clause License -./v3p/openjpeg2/int.h: BSD 2-Clause License -./v3p/openjpeg2/invert.c: BSD 2-Clause License -./v3p/openjpeg2/invert.h: BSD 2-Clause License -./v3p/openjpeg2/j2k.c: BSD 2-Clause License -./v3p/openjpeg2/j2k.h: BSD 2-Clause License -./v3p/openjpeg2/j2k_lib.c: BSD 2-Clause License -./v3p/openjpeg2/j2k_lib.h: BSD 2-Clause License -./v3p/openjpeg2/jp2.c: BSD 2-Clause License -./v3p/openjpeg2/jp2.h: BSD 2-Clause License -./v3p/openjpeg2/jpt.c: BSD 2-Clause License -./v3p/openjpeg2/jpt.h: BSD 2-Clause License -./v3p/openjpeg2/license.txt: BSD 2-Clause License -./v3p/openjpeg2/mct.c: BSD 2-Clause License -./v3p/openjpeg2/mct.h: BSD 2-Clause License -./v3p/openjpeg2/mqc.c: BSD 2-Clause License -./v3p/openjpeg2/mqc.h: BSD 2-Clause License -./v3p/openjpeg2/openjpeg.c: BSD 2-Clause License -./v3p/openjpeg2/openjpeg.h: BSD 2-Clause License -./v3p/openjpeg2/opj_includes.h: BSD 2-Clause License -./v3p/openjpeg2/opj_malloc.h: BSD 2-Clause License -./v3p/openjpeg2/pi.c: BSD 2-Clause License -./v3p/openjpeg2/pi.h: BSD 2-Clause License -./v3p/openjpeg2/profile.c: BSD 2-Clause License -./v3p/openjpeg2/profile.h: BSD 2-Clause License -./v3p/openjpeg2/raw.c: BSD 2-Clause License -./v3p/openjpeg2/raw.h: BSD 2-Clause License -./v3p/openjpeg2/t1.c: BSD 2-Clause License -./v3p/openjpeg2/t1.h: BSD 2-Clause License -./v3p/openjpeg2/t2.c: BSD 2-Clause License -./v3p/openjpeg2/t2.h: BSD 2-Clause License -./v3p/openjpeg2/tcd.c: BSD 2-Clause License -./v3p/openjpeg2/tcd.h: BSD 2-Clause License -./v3p/openjpeg2/tgt.c: BSD 2-Clause License -./v3p/openjpeg2/tgt.h: BSD 2-Clause License -./vcl/internal/vcl_atomic_count_gcc.h: Boost Software License 1.0 -./vcl/internal/vcl_atomic_count_gcc_x86.h: Boost Software License 1.0 -./vcl/internal/vcl_atomic_count_pthreads.h: Boost Software License 1.0 -./vcl/internal/vcl_atomic_count_solaris.h: Boost Software License 1.0 -./vcl/internal/vcl_atomic_count_sync.h: Boost Software License 1.0 -./vcl/internal/vcl_atomic_count_win32.h: Boost Software License 1.0 -./vcl/internal/vcl_interlocked.h: Boost Software License 1.0 -./contrib/rpl/rgtl/CMakeLists.txt: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree_data_fixed.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree_index.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree_link.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree_node_data.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_compact_tree_policy.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_config.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_license_1_0.txt: *No copyright* Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_meta.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_array.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_array_points.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_array_points.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_array_triangles_3d.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_array_triangles_3d.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_closest_polygon_3d.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_once.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_object_once.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_bounds.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_bounds.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_geometry.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_geometry.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_location.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_cell_location.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_data_fixed.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_data_fixed.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_dual.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_dual_element.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_dual_index.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_dual_location.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_dual_visit.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_objects.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_objects.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_point_location.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_octree_point_location.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_separating_axis.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_separating_axis_projection.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize.txt: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_access.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_base.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_direction.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_istream.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_istream.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_ostream.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_ostream.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_split.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_stl_vector.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_vnl_double_3.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_serialize_vnl_vector_fixed.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_base.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_base.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_bounds.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_bounds.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_geometry.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_geometry.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_location.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_cell_location.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_object_array.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_object_array_triangles_3d.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_object_array_triangles_3d.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_objects.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_objects.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_space.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_sqt_space.hxx: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_static_assert.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_tagged_index.h: Boost Software License 1.0 -./contrib/rpl/rgtl/rgtl_tagged_vector.h: Boost Software License 1.0 -./contrib/rpl/rtvl/CMakeLists.txt: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_intpow.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_license_1_0.txt: *No copyright* Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_refine.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_refine.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_tensor.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_tensor.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_tensor_d.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_tensor_d.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_terms.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_tokens.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_vote.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_vote.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_votee.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_votee.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_votee_d.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_votee_d.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_voter.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_voter.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_weight.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_weight_original.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_weight_original.hxx: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_weight_smooth.h: Boost Software License 1.0 -./contrib/rpl/rtvl/rtvl_weight_smooth.hxx: Boost Software License 1.0 -./core/doc/book/chapter_vnl.texi: *No copyright* Public domain -./core/vil/file_formats/viffheader.h.original: NTP License (legal disclaimer) -./core/vil/file_formats/vil_viffheader.h: NTP License (legal disclaimer) -./core/vil1/file_formats/vil1_viff_support.c: NTP License (legal disclaimer) -./core/vil1/file_formats/vil1_viffheader.h: NTP License (legal disclaimer) -./v3p/netlib/libf2c/Notice: Standard ML of New Jersey License -./v3p/netlib/libf2c/arithchk.c: Standard ML of New Jersey License -./v3p/netlib/linalg/lsmrBase.cxx: Apache License 2.0 -./v3p/netlib/linalg/lsmrBase.h: Apache License 2.0 -./v3p/netlib/linalg/lsmrDense.cxx: Apache License 2.0 -./v3p/netlib/linalg/lsmrDense.h: Apache License 2.0 -./v3p/netlib/linalg/lsqrBase.cxx: Apache License 2.0 -./v3p/netlib/linalg/lsqrBase.h: Apache License 2.0 -./v3p/netlib/linalg/lsqrDense.cxx: Apache License 2.0 -./v3p/netlib/linalg/lsqrDense.h: Apache License 2.0 -./v3p/netlib/tests/lsmrTest2.cxx: Apache License 2.0 -./v3p/netlib/tests/lsqrTest1.cxx: Apache License 2.0 -./v3p/netlib/tests/lsqrTest2.cxx: Apache License 2.0 -./v3p/netlib/tests/tricall.c: *No copyright* Public domain -./contrib/brl/bbas/bjson/bjsoncpp.cxx: MIT License -./contrib/brl/bbas/bjson/jsoncpp.cxx: MIT License -./contrib/brl/bbas/bnabo/bnabo.cxx: BSD 3-Clause License -./contrib/brl/bbas/bnabo/bnabo.h: BSD 3-Clause License -./contrib/brl/bbas/bnabo/bnabo_brute_force.cxx: BSD 3-Clause License -./contrib/brl/bbas/bnabo/bnabo_index_heap.h: BSD 3-Clause License -./contrib/brl/bbas/bnabo/bnabo_kdd_tree.cxx: BSD 3-Clause License -./contrib/brl/bbas/bnabo/bnabo_private.h: BSD 3-Clause License -./contrib/mul/doc/book/atexinfo.tex: GNU General Public License v2.0 or later -./contrib/rpl/rgtl/tests/CMakeLists.txt: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_compact_tree_data_fixed.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_driver.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_octree_data_fixed.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_octree_dual_visit.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_octree_objects.cxx: Boost Software License 1.0 -./contrib/rpl/rgtl/tests/test_sqt_base.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_refine+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_refine+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_tensor+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_tensor+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_tensor_d+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_tensor_d+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_vote+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_vote+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_votee+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_votee+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_votee_d+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_votee_d+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_voter+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_voter+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_weight_original+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_weight_original+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_weight_smooth+2-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/Templates/rtvl_weight_smooth+3-.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/examples/rtvl_hello.cxx: Boost Software License 1.0 -./contrib/rpl/rtvl/examples/rtvl_saliency_image.cxx: Boost Software License 1.0 -./contrib/tbl/doc/book/atexinfo.tex: GNU General Public License v2.0 or later -./v3p/dcmtk/ofstd/libsrc/ofstd.cxx: BSD 3-Clause License and/or NTP License - -./contrib/brl/bbas/bil/algo/bil_edt.h: *No copyright* GNU Lesser General Public License [generated file] -# ^ -# Not under this license. The text says: -# // Implementation influenced by the LTI lib, which is licensed under LGPL: -# // http://ltilib.sourceforge.net - -./contrib/brl/bseg/boxm2/doc/book/atexinfo.tex: GNU General Public License v2.0 or later -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/jquery.cookie-min.js: MIT License -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/jquery.disabletextselect-min.js: MIT License -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/jquery.min.js: MIT License -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/jquery.mousewheel-min.js: MIT License -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/jquery.reel-min.js: MIT License -./contrib/brl/bseg/boxm2/ocl/exe/auxiliary/js/miniZoomPan.js: *No copyright* MIT License diff --git a/sources b/sources index c1c5d82..09701af 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (vxl-3.5.0-clean.tar.gz) = cb5eaf88e689216b9de56f9a9e07e2a6a8ce4469d0b990f847e8f1060b0a0d6e621ef128c9878a26cef8816b0efd7e99bcca8bc65a43e091f3650158425ebde9 +SHA512 (vxl-2.0.2-clean.tar.gz) = d8cad8ca6851641bb4c3398b8bf5e3df45a7414fd736acf8e75b79bdd5d18ec3aae4edac5b4c66d98fc499f411a25a443f046859a3544e45228f468052ec79ee diff --git a/vxl.spec b/vxl.spec index 2b71ec8..b04fab0 100644 --- a/vxl.spec +++ b/vxl.spec @@ -1,65 +1,39 @@ -%undefine __cmake_in_source_build - -# shared objects version: API -%global major 3 -%global minor 5 -%global patch 0 - Name: vxl -Version: 3.5.0 -Release: %autorelease +Version: 2.0.2 +Release: 7%{?dist} Summary: C++ Libraries for Computer Vision Research and Implementation - -# see licenses.txt for a complete break down of licenses (using licensecheck) -# other licenses are not included because the files they refer to are not used/included in our build -License: BSD-3-Clause AND NTP AND BSL-1.0 AND BSD-2-Clause AND MIT AND Apache-2.0 AND LicenseRef-Fedora-Public-Domain AND SMLNJ - -# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval -ExcludeArch: %{ix86} - +License: BSD URL: https://vxl.github.io/ # Need to remove the non-free lena image from the sources # tar xf vxl-%%{version}.tar.gz # rm -rf vxl-%%{version}/contrib/prip/vdtop/tests/lena.org.pgm # tar cfz vxl-%%{version}-clean.tar.gz vxl-%%{version}/ -#Source0: https://github.com/vxl/vxl/archive/v%%{version}/%%{name}-%%{version}.tar.gz +# Source0: https://github.com/vxl/vxl/archive/v%%{version}/%%{name}-%%{version}.tar.gz Source0: %{name}-%{version}-clean.tar.gz # Patches generated from tree here: -# https://github.com/sanjayankur31/vxl/tree/fedora-3.5.0 +# https://github.com/sanjayankur31/vxl/tree/fedora-v2.0.2-f32 # use system rply and don't use mpeg2 -Patch: 0001-v3.5.0-unbundle-rply.patch -Patch: 0002-v3.5.0-Use-Fedora-expat-and-expatpp.patch -Patch: 0003-v3.5.0-Use-Fedora-minizip.patch -Patch: 0004-v3.5.0-Add-cmake-module-to-find-RPLY.patch -Patch: 0005-v3.5.0-fix-bkml-test.patch -Patch: 0006-v3.5.0-Correct-rply-includedir.patch -Patch: 0007-v3.5.0-remove-triangle.patch -Patch: 0008-v3.5.0-remove-bits-using-triangle.patch -Patch: 0009-v3.5.0-indent-to-keep-gcc-happy.patch -# otherwise we get: -# /usr/bin/ld: ../../../../../lib/libimesh.so.3.5.0.0: undefined reference to `brdb_value::registrar::registrar(brdb_value const*)' -# collect2: error: ld returned 1 exit status -# gmake[2]: *** [contrib/brl/bseg/baml/tests/CMakeFiles/baml_test_all.dir/build.make:172: bin/baml_test_all] Error 1 -# gmake[2]: Leaving directory '/builddir/build/BUILD/vxl-3.5.0/redhat-linux-build' -# gmake[1]: *** [CMakeFiles/Makefile2:46025: contrib/brl/bseg/baml/tests/CMakeFiles/baml_test_all.dir/all] Error 2 -Patch: 0010-v3.5.0-more-linker-fixes.patch +Patch1: 0001-v2.0.2-unbundle-rply.patch +Patch2: 0002-v2.0.2-Use-Fedora-expat-and-expatpp.patch +Patch3: 0003-v2.0.2-Use-Fedora-minizip.patch +# Submitted upstream https://github.com/vxl/vxl/pull/626 +Patch4: 0004-v2.0.2-Version-shared-objects.patch +Patch5: 0005-v2.0.2-Add-cmake-module-to-find-RPLY.patch +Patch6: 0006-v2.0.2-bbas-baio-Update-function-arguments-in-declar.patch +Patch7: 0007-v2.0.2-fix-bkml-test.patch +Patch8: 0008-v2.0.2-Correct-rply-includedir.patch -# Fix missing #include caught by gcc-11 -Patch: 0011-v3.5.0-fix-for-gcc11.patch -# For linker error -Patch: 0012-v3.5.0-link-against-acal.patch -Patch: 0013-v3.5.0-more-linkage-fixes.patch -Patch: 0014-v3.5.0-use-system-zlib-tiff-minizip-compat.patch -Patch: 0015-v3.5.0-fix-linking.patch -Patch: 0016-v3.5.0-fix-linking.patch -# remove more bits that used triangle -Patch: 0017-v3.5.0-remove-boxm2-processes-that-use-sdnet-that-re.patch -# remove ctest dashboard config -Patch: 0018-chore-remove-ctest-dashboard-config.patch +# Fixes https://github.com/vxl/vxl/issues/638 +# Thanks jjames@fedoraproject.org for pointing it out +Patch9: 0001-BUG-Logic-for-conditional-compilation-was-exactly-wr.patch + +# Remove obsolete boxm library that fails to build on ARM +# https://github.com/vxl/vxl/commit/cdf414000606af4bad322f7ff4c1fcdeaaa286ad +Patch10: 0009-removed-the-obsolete-octree-library-boxm.patch BuildRequires: cmake -BuildRequires: Coin4-devel +BuildRequires: Coin2-devel BuildRequires: doxygen BuildRequires: expat-devel BuildRequires: expatpp-devel @@ -67,11 +41,9 @@ BuildRequires: freeglut-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: git - # Use bundled dcmtk until upstream updates their code to use newer dcmtk # https://github.com/vxl/vxl/issues/550 # BuildRequires: dcmtk-devel - BuildRequires: libpng-devel BuildRequires: libtiff-devel BuildRequires: libXmu-devel @@ -82,22 +54,22 @@ BuildRequires: libdc1394-devel %endif BuildRequires: libgeotiff-devel BuildRequires: libjpeg-turbo-devel -BuildRequires: minizip-ng-compat-devel - +BuildRequires: minizip-devel # Does not build with latest version # https://github.com/vxl/vxl/issues/627 # BuildRequires: openjpeg2-devel -# Bundled -Provides: bundled(libopenjpeg2) = 2.0.0 - # Py2 only from the looks of it # BuildRequires: python3-devel BuildRequires: rply-devel +BuildRequires: SIMVoleon-devel BuildRequires: shapelib-devel BuildRequires: texi2html -BuildRequires: zlib-ng-compat-devel +BuildRequires: zlib-devel + +# Bundled +Provides: bundled(libopenjpeg2) = 2.0.0 #GUI needs wx, a desktop file and an icon @@ -130,18 +102,32 @@ develop code based on VXL. %prep %autosetup -S git -# remove bundled bits -# triangle removed in patch (bad license: https://github.com/vxl/vxl/issues/752#issuecomment-655526696) +# Remove bundled library (let's use FEDORA's ones) +# v3p/netlib (made by f2c) dependency not removed because of heavily modifications +# QV is a Silicon Graphics' VRML parser from the 90s. Now unmantained. -# remove other bits, only leave CMakeLists.txt +# Bundled: dcmtk +# Requires VXL_FORCE_V3P_DCMTK:BOOL=ON + +# Also bundled: openjpeg2 +# Requires VXL_FORCE_V3P_OPENJPEG2:BOOL=ON \ +# Also may be needed +# -DOPENJPEG2_INCLUDE_DIR:PATH=%%{_includedir}/openjpeg-2.3 \ +# -DOPENJPEG2_LIBRARIES:PATH=%%{_libdir}/libopenjp2.so \ + + +# for l in jpeg png zlib tiff geotiff rply dcmtk bzlib openjpeg2 for l in jpeg png zlib tiff geotiff bzlib do - find v3p/$l -type f ! -name 'CMakeLists.txt' -execdir rm -fv {} + + find v3p/$l -type f ! -name 'CMakeLists.txt' -execdir rm {} + done -find contrib/brl/b3p/shapelib -type f ! -name 'CMakeLists.txt' -execdir rm -fv {} + -find contrib/brl/b3p/minizip -type f ! -name 'CMakeLists.txt' -execdir rm -fv {} + -find contrib/brl/b3p/expat -type f ! -name 'CMakeLists.txt' -execdir rm -fv {} + -find contrib/brl/b3p/expatpp -type f ! -name 'CMakeLists.txt' -execdir rm -fv {} + + +find contrib/brl/b3p/shapelib -type f ! -name 'CMakeLists.txt' -execdir rm {} + +find contrib/brl/b3p/minizip -type f ! -name 'CMakeLists.txt' -execdir rm {} + +find contrib/brl/b3p/expat -type f ! -name 'CMakeLists.txt' -execdir rm {} + +find contrib/brl/b3p/expatpp -type f ! -name 'CMakeLists.txt' -execdir rm {} + + +# v3p/mpeg2 lib in fedora is not enough to build the target. Moreover it is in rpmfusion repo # Fix executable permissions on source file # not using "." for find since it sometimes crashes within the .git folder @@ -151,53 +137,55 @@ for f in config contrib core scripts v3p vcl; do find $f -name "*.txx" -execdir chmod -x '{}' \; done +# Do not use bundled minizip +sed -i '/add_subdirectory(minizip)/ d' contrib/brl/b3p/CMakeLists.txt + %build %cmake -DVXL_INSTALL_LIBRARY_DIR:PATH=%{_lib} \ - -DCMAKE_INSTALL_DATAROOTDIR:PATH=%{_datadir}/%{name} \ - -DBUILD_SHARED_LIBS:BOOL=TRUE \ - -DVXL_USE_GEOTIFF:BOOL=TRUE \ - -DVXL_FORCE_B3P_EXPAT:BOOL=FALSE \ - -DVXL_FORCE_V3P_DCMTK:BOOL=TRUE \ - -DVXL_FORCE_V3P_GEOTIFF:BOOL=FALSE \ - -DVXL_FORCE_V3P_JPEG:BOOL=FALSE \ - -DVXL_FORCE_V3P_PNG:BOOL=FALSE \ - -DVXL_FORCE_V3P_TIFF:BOOL=FALSE \ - -DVXL_FORCE_V3P_ZLIB:BOOL=FALSE \ - -DVXL_FORCE_V3P_RPLY:BOOL=FALSE \ - -DVXL_FORCE_V3P_OPENJPEG2:BOOL=TRUE \ - -DVXL_USING_NATIVE_ZLIB:BOOL=TRUE \ - -DVXL_USING_NATIVE_JPEG:BOOL=TRUE \ - -DVXL_USING_NATIVE_PNG:BOOL=TRUE \ - -DVXL_USING_NATIVE_TIFF:BOOL=TRUE \ - -DVXL_USING_NATIVE_GEOTIFF:BOOL=TRUE \ - -DVXL_USING_NATIVE_EXPAT:BOOL=TRUE \ - -DVXL_USING_NATIVE_EXPATPP:BOOL=TRUE \ - -DVXL_USING_NATIVE_SHAPELIB:BOOL=TRUE \ - -DVXL_USING_NATIVE_BZLIB2:BOOL=TRUE \ - -DVXL_BUILD_VGUI:BOOL=FALSE \ - -DVXL_BUILD_BGUI3D:BOOL=FALSE \ - -DVXL_BUILD_OXL:BOOL=TRUE \ - -DVXL_BUILD_BRL:BOOL=TRUE \ - -DVXL_BUILD_BRL_PYTHON:BOOL=FALSE \ - -DVXL_BUILD_GEL:BOOL=TRUE \ - -DVXL_BUILD_PRIP:BOOL=TRUE \ - -DVXL_BUILD_CONVERSIONS:BOOL=TRUE \ - -DVXL_BUILD_CUL:BOOL=TRUE \ - -DVXL_BUILD_RPL:BOOL=TRUE \ - -DVXL_BUILD_CONTRIB:BOOL=TRUE \ - -DVXL_BUILD_CORE_SERIALISATION:BOOL=TRUE \ - -DVXL_BUILD_CORE_GEOMETRY:BOOL=TRUE \ - -DVXL_BUILD_CORE_IMAGING:BOOL=TRUE \ - -DVXL_BUILD_CORE_NUMERICS:BOOL=TRUE \ - -DVXL_BUILD_CORE_PROBABILITY:BOOL=TRUE \ - -DVXL_BUILD_CORE_UTILITIES:BOOL=TRUE \ - -DVXL_BUILD_CORE_VIDEO:BOOL=TRUE \ - -DVXL_BUILD_EXAMPLES:BOOL=FALSE \ - -DBUILD_TESTING:BOOL=TRUE \ - -DVXL_BUILD_DOCUMENTATION:BOOL=TRUE \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DVXL_USE_GEOTIFF:BOOL=ON \ + -DVXL_FORCE_B3P_EXPAT:BOOL=OFF \ + -DVXL_FORCE_V3P_DCMTK:BOOL=ON \ + -DVXL_FORCE_V3P_GEOTIFF:BOOL=OFF \ + -DVXL_FORCE_V3P_JPEG:BOOL=OFF \ + -DVXL_FORCE_V3P_PNG:BOOL=OFF \ + -DVXL_FORCE_V3P_TIFF:BOOL=OFF \ + -DVXL_FORCE_V3P_ZLIB:BOOL=OFF \ + -DVXL_FORCE_V3P_RPLY:BOOL=OFF \ + -DVXL_FORCE_V3P_OPENJPEG2:BOOL=ON \ + -DVXL_USING_NATIVE_ZLIB:BOOL=ON \ + -DVXL_USING_NATIVE_JPEG:BOOL=ON \ + -DVXL_USING_NATIVE_PNG:BOOL=ON \ + -DVXL_USING_NATIVE_TIFF:BOOL=ON \ + -DVXL_USING_NATIVE_GEOTIFF:BOOL=ON \ + -DVXL_USING_NATIVE_EXPAT:BOOL=ON \ + -DVXL_USING_NATIVE_EXPATPP:BOOL=ON \ + -DVXL_USING_NATIVE_SHAPELIB:BOOL=ON \ + -DVXL_USING_NATIVE_BZLIB2:BOOL=ON \ + -DVXL_BUILD_VGUI:BOOL=OFF \ + -DVXL_BUILD_BGUI3D:BOOL=OFF \ + -DVXL_BUILD_OXL:BOOL=ON \ + -DVXL_BUILD_BRL:BOOL=ON \ + -DVXL_BUILD_BRL_PYTHON:BOOL=OFF \ + -DVXL_BUILD_GEL:BOOL=ON \ + -DVXL_BUILD_PRIP:BOOL=ON \ + -DVXL_BUILD_CONVERSIONS:BOOL=ON \ + -DVXL_BUILD_CUL:BOOL=ON \ + -DVXL_BUILD_RPL:BOOL=ON \ + -DVXL_BUILD_CONTRIB:BOOL=ON \ + -DVXL_BUILD_CORE_SERIALISATION:BOOL=ON \ + -DVXL_BUILD_CORE_GEOMETRY:BOOL=ON \ + -DVXL_BUILD_CORE_IMAGING:BOOL=ON \ + -DVXL_BUILD_CORE_NUMERICS:BOOL=ON \ + -DVXL_BUILD_CORE_PROBABILITY:BOOL=ON \ + -DVXL_BUILD_CORE_UTILITIES:BOOL=ON \ + -DVXL_BUILD_CORE_VIDEO:BOOL=ON \ + -DVXL_BUILD_EXAMPLES:BOOL=OFF \ + -DBUILD_TESTING:BOOL=ON \ + -DVXL_BUILD_DOCUMENTATION:BOOL=ON \ -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" \ -DCMAKE_CXX_FLAGS:STRING="$RPM_OPT_FLAGS -fpermissive" \ - -DVNL_CONFIG_LEGACY_METHODS:BOOL=TRUE + -DVNL_CONFIG_LEGACY_METHODS:BOOL=ON . # Other stuff # -DEXPATPP_INCLUDE_DIR:PATH=%%{_includedir} \ @@ -209,589 +197,594 @@ done #wxwidgets seems to be found #Multiple versions of QT found please set DESIRED_QT_VERSION -%cmake_build +%make_build %install -%cmake_install +%make_install # Stray file installed in a random location rm -fv %{buildroot}/usr/contrib/brl/bseg/boxm2/ocl/boxm2_ocl_where_root_dir.h %check -# different tests fail on different arches +# 5/985 fail: +# 713 - bil_algo_test_detect_ridges (SEGFAULT) +# 781 - bkml_test_bkml (Child aborted) +# 801 - volm_test_candidate_region_parser (Child aborted) +# 967 - vifa_test_int_faces_attr (Child aborted) +# 968 - vifa_test_int_faces_adj_attr (Child aborted) -%ifarch x86_64 -# 99% tests passed, 5 tests failed out of 997 -# Total Test time (real) = 23.64 sec -# The following tests FAILED: -# 30 - vul_vul_test_driver (invalid test name) -# 781 - acal_test_metadata (Failed) -# 816 - bkml_test_bkml (Subprocess aborted) -# 836 - volm_test_candidate_region_parser (Subprocess aborted) -# 979 - vifa_test_int_faces_attr (Subprocess aborted) -# 980 - vifa_test_int_faces_adj_attr (Subprocess aborted) -%ctest -E "(acal_test_metadata|bkml_test_bkml|volm_test_candidate_region_parser|vifa_test_int_faces_attr|vifa_test_int_faces_adj_attr|vul_vul_test_driver)" -%else -# A number of test fail, but not deterministically on aarch and ppc64le etc, e.g: +ctest . || exit 0 -# 183 - vgl_test_frustum_3d (Failed) -# 557 - m23d_test_ortho_flexible_builder (Failed) -# 638 - vepl_test_gradient_dir (Failed) -# 732 - bil_test_warp (Failed) -# 748 - vsph_test_camera_bounds (Failed) -# 768 - icam_test_transform (Failed) -# 812 - imesh_test_imls_surface (Failed) -# 886 - breg3d_test_ekf_camera_optimizer (Failed) -# Do not make build fail for this arch -%ctest || true -%endif +%ldconfig_scriptlets %files %doc core/vxl_copyright.h %{_bindir}/octree -%{_libdir}/libacal.so.%{major}.%{minor} -%{_libdir}/libacal.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libacal_io.so.%{major}.%{minor} -%{_libdir}/libacal_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbaio.so.%{major}.%{minor} -%{_libdir}/libbaio.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbaml.so.%{major}.%{minor} -%{_libdir}/libbaml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbapl.so.%{major}.%{minor} -%{_libdir}/libbapl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbapl_io.so.%{major}.%{minor} -%{_libdir}/libbapl_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbapl_pro.so.%{major}.%{minor} -%{_libdir}/libbapl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbbas_pro.so.%{major}.%{minor} -%{_libdir}/libbbas_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbbgm.so.%{major}.%{minor} -%{_libdir}/libbbgm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbbgm_pro.so.%{major}.%{minor} -%{_libdir}/libbbgm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbcvr.so.%{major}.%{minor} -%{_libdir}/libbcvr.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbdgl.so.%{major}.%{minor} -%{_libdir}/libbdgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbdpg.so.%{major}.%{minor} -%{_libdir}/libbdpg.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbetr.so.%{major}.%{minor} -%{_libdir}/libbetr.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbetr_pro.so.%{major}.%{minor} -%{_libdir}/libbetr_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbgrl.so.%{major}.%{minor} -%{_libdir}/libbgrl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbgrl2.so.%{major}.%{minor} -%{_libdir}/libbgrl2.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbgrl2_algo.so.%{major}.%{minor} -%{_libdir}/libbgrl2_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbil.so.%{major}.%{minor} -%{_libdir}/libbil.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbil_algo.so.%{major}.%{minor} -%{_libdir}/libbil_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbjson.so.%{major}.%{minor} -%{_libdir}/libbjson.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbkml.so.%{major}.%{minor} -%{_libdir}/libbkml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbmdl.so.%{major}.%{minor} -%{_libdir}/libbmdl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbmdl_pro.so.%{major}.%{minor} -%{_libdir}/libbmdl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbmsh3d.so.%{major}.%{minor} -%{_libdir}/libbmsh3d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbmsh3d_algo.so.%{major}.%{minor} -%{_libdir}/libbmsh3d_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbmsh3d_pro.so.%{major}.%{minor} -%{_libdir}/libbmsh3d_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbnabo.so.%{major}.%{minor} -%{_libdir}/libbnabo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbnl.so.%{major}.%{minor} -%{_libdir}/libbnl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbnl_algo.so.%{major}.%{minor} -%{_libdir}/libbnl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboct.so.%{major}.%{minor} -%{_libdir}/libboct.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2.so.%{major}.%{minor} -%{_libdir}/libboxm2.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_basic.so.%{major}.%{minor} -%{_libdir}/libboxm2_basic.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_class.so.%{major}.%{minor} -%{_libdir}/libboxm2_class.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_cpp.so.%{major}.%{minor} -%{_libdir}/libboxm2_cpp.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_cpp_algo.so.%{major}.%{minor} -%{_libdir}/libboxm2_cpp_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_cpp_pro.so.%{major}.%{minor} -%{_libdir}/libboxm2_cpp_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_io.so.%{major}.%{minor} -%{_libdir}/libboxm2_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_pro.so.%{major}.%{minor} -%{_libdir}/libboxm2_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_util.so.%{major}.%{minor} -%{_libdir}/libboxm2_util.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_vecf.so.%{major}.%{minor} -%{_libdir}/libboxm2_vecf.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_volm.so.%{major}.%{minor} -%{_libdir}/libboxm2_volm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_volm_conf.so.%{major}.%{minor} -%{_libdir}/libboxm2_volm_conf.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_volm_desc.so.%{major}.%{minor} -%{_libdir}/libboxm2_volm_desc.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_volm_io.so.%{major}.%{minor} -%{_libdir}/libboxm2_volm_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libboxm2_volm_pro.so.%{major}.%{minor} -%{_libdir}/libboxm2_volm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbpgl.so.%{major}.%{minor} -%{_libdir}/libbpgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbpgl_algo.so.%{major}.%{minor} -%{_libdir}/libbpgl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbprb.so.%{major}.%{minor} -%{_libdir}/libbprb.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrad.so.%{major}.%{minor} -%{_libdir}/libbrad.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrad_io.so.%{major}.%{minor} -%{_libdir}/libbrad_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrad_pro.so.%{major}.%{minor} -%{_libdir}/libbrad_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrdb.so.%{major}.%{minor} -%{_libdir}/libbrdb.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrec.so.%{major}.%{minor} -%{_libdir}/libbrec.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrec_pro.so.%{major}.%{minor} -%{_libdir}/libbrec_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbreg3d.so.%{major}.%{minor} -%{_libdir}/libbreg3d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbreg3d_pro.so.%{major}.%{minor} -%{_libdir}/libbreg3d_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbres.so.%{major}.%{minor} -%{_libdir}/libbres.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrip.so.%{major}.%{minor} -%{_libdir}/libbrip.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbrip_pro.so.%{major}.%{minor} -%{_libdir}/libbrip_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsgm.so.%{major}.%{minor} -%{_libdir}/libbsgm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsgm_pro.so.%{major}.%{minor} -%{_libdir}/libbsgm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsl.so.%{major}.%{minor} -%{_libdir}/libbsl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsol.so.%{major}.%{minor} -%{_libdir}/libbsol.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsta.so.%{major}.%{minor} -%{_libdir}/libbsta.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsta_algo.so.%{major}.%{minor} -%{_libdir}/libbsta_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsta_io.so.%{major}.%{minor} -%{_libdir}/libbsta_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsta_pro.so.%{major}.%{minor} -%{_libdir}/libbsta_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsta_vis.so.%{major}.%{minor} -%{_libdir}/libbsta_vis.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm.so.%{major}.%{minor} -%{_libdir}/libbstm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_basic.so.%{major}.%{minor} -%{_libdir}/libbstm_basic.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_cpp_algo.so.%{major}.%{minor} -%{_libdir}/libbstm_cpp_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_cpp_pro.so.%{major}.%{minor} -%{_libdir}/libbstm_cpp_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_io.so.%{major}.%{minor} -%{_libdir}/libbstm_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_multi.so.%{major}.%{minor} -%{_libdir}/libbstm_multi.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_multi_basic.so.%{major}.%{minor} -%{_libdir}/libbstm_multi_basic.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_multi_io.so.%{major}.%{minor} -%{_libdir}/libbstm_multi_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_pro.so.%{major}.%{minor} -%{_libdir}/libbstm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbstm_util.so.%{major}.%{minor} -%{_libdir}/libbstm_util.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsvg.so.%{major}.%{minor} -%{_libdir}/libbsvg.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbsvg_pro.so.%{major}.%{minor} -%{_libdir}/libbsvg_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbtol.so.%{major}.%{minor} -%{_libdir}/libbtol.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbugl.so.%{major}.%{minor} -%{_libdir}/libbugl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbundler.so.%{major}.%{minor} -%{_libdir}/libbundler.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvgl.so.%{major}.%{minor} -%{_libdir}/libbvgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvgl_algo.so.%{major}.%{minor} -%{_libdir}/libbvgl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvgl_pro.so.%{major}.%{minor} -%{_libdir}/libbvgl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl.so.%{major}.%{minor} -%{_libdir}/libbvpl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_functors.so.%{major}.%{minor} -%{_libdir}/libbvpl_functors.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_kernels.so.%{major}.%{minor} -%{_libdir}/libbvpl_kernels.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_kernels_io.so.%{major}.%{minor} -%{_libdir}/libbvpl_kernels_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_kernels_pro.so.%{major}.%{minor} -%{_libdir}/libbvpl_kernels_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_pro.so.%{major}.%{minor} -%{_libdir}/libbvpl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_util.so.%{major}.%{minor} -%{_libdir}/libbvpl_util.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvpl_util_io.so.%{major}.%{minor} -%{_libdir}/libbvpl_util_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvrml.so.%{major}.%{minor} -%{_libdir}/libbvrml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvrml_pro.so.%{major}.%{minor} -%{_libdir}/libbvrml_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm.so.%{major}.%{minor} -%{_libdir}/libbvxm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_algo.so.%{major}.%{minor} -%{_libdir}/libbvxm_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_algo_pro.so.%{major}.%{minor} -%{_libdir}/libbvxm_algo_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_grid.so.%{major}.%{minor} -%{_libdir}/libbvxm_grid.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_grid_io.so.%{major}.%{minor} -%{_libdir}/libbvxm_grid_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_grid_pro.so.%{major}.%{minor} -%{_libdir}/libbvxm_grid_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_io.so.%{major}.%{minor} -%{_libdir}/libbvxm_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbvxm_pro.so.%{major}.%{minor} -%{_libdir}/libbvxm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbwm_video.so.%{major}.%{minor} -%{_libdir}/libbwm_video.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libbxml.so.%{major}.%{minor} -%{_libdir}/libbxml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libclipper.so.%{major}.%{minor} -%{_libdir}/libclipper.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libclsfy.so.%{major}.%{minor} -%{_libdir}/libclsfy.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libdepth_map.so.%{major}.%{minor} -%{_libdir}/libdepth_map.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libfhs.so.%{major}.%{minor} -%{_libdir}/libfhs.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libgeml.so.%{major}.%{minor} -%{_libdir}/libgeml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libgevd.so.%{major}.%{minor} -%{_libdir}/libgevd.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libgmvl.so.%{major}.%{minor} -%{_libdir}/libgmvl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libgst.so.%{major}.%{minor} -%{_libdir}/libgst.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libgtrl.so.%{major}.%{minor} -%{_libdir}/libgtrl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libicam.so.%{major}.%{minor} -%{_libdir}/libicam.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libicam_pro.so.%{major}.%{minor} -%{_libdir}/libicam_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libihog.so.%{major}.%{minor} -%{_libdir}/libihog.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libihog_pro.so.%{major}.%{minor} -%{_libdir}/libihog_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libimesh.so.%{major}.%{minor} -%{_libdir}/libimesh.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libimesh_algo.so.%{major}.%{minor} -%{_libdir}/libimesh_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libipts.so.%{major}.%{minor} -%{_libdir}/libipts.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libm23d.so.%{major}.%{minor} -%{_libdir}/libm23d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmbl.so.%{major}.%{minor} -%{_libdir}/libmbl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmcal.so.%{major}.%{minor} -%{_libdir}/libmcal.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmfpf.so.%{major}.%{minor} -%{_libdir}/libmfpf.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmipa.so.%{major}.%{minor} -%{_libdir}/libmipa.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmmn.so.%{major}.%{minor} -%{_libdir}/libmmn.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmsdi.so.%{major}.%{minor} -%{_libdir}/libmsdi.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmsm.so.%{major}.%{minor} -%{_libdir}/libmsm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmsm_utils.so.%{major}.%{minor} -%{_libdir}/libmsm_utils.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmvl.so.%{major}.%{minor} -%{_libdir}/libmvl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libmvl2.so.%{major}.%{minor} -%{_libdir}/libmvl2.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libopenjpeg2.so.2.%{patch}.0 -%{_libdir}/libopenjpeg2.so.%{major}.%{minor} -%{_libdir}/libosl.so.%{major}.%{minor} -%{_libdir}/libosl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libouel.so.%{major}.%{minor} -%{_libdir}/libouel.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libouml.so.%{major}.%{minor} -%{_libdir}/libouml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/liboxl_vrml.so.%{major}.%{minor} -%{_libdir}/liboxl_vrml.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libpdf1d.so.%{major}.%{minor} -%{_libdir}/libpdf1d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/librgrl.so.%{major}.%{minor} -%{_libdir}/librgrl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/librrel.so.%{major}.%{minor} -%{_libdir}/librrel.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/librsdl.so.%{major}.%{minor} -%{_libdir}/librsdl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libsdet.so.%{major}.%{minor} -%{_libdir}/libsdet.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libsdet_algo.so.%{major}.%{minor} -%{_libdir}/libsdet_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libsdet_pro.so.%{major}.%{minor} -%{_libdir}/libsdet_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libtestlib.so.%{major}.%{minor} -%{_libdir}/libtestlib.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libv3p_netlib.so.%{major}.%{minor} -%{_libdir}/libv3p_netlib.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvbl.so.%{major}.%{minor} -%{_libdir}/libvbl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvbl_io.so.%{major}.%{minor} -%{_libdir}/libvbl_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvcl.so.%{major}.%{minor} -%{_libdir}/libvcl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvcon_pro.so.%{major}.%{minor} -%{_libdir}/libvcon_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvcsl.so.%{major}.%{minor} -%{_libdir}/libvcsl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvdgl.so.%{major}.%{minor} -%{_libdir}/libvdgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvdtop.so.%{major}.%{minor} -%{_libdir}/libvdtop.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvepl.so.%{major}.%{minor} -%{_libdir}/libvepl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvgl.so.%{major}.%{minor} -%{_libdir}/libvgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvgl_algo.so.%{major}.%{minor} -%{_libdir}/libvgl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvgl_io.so.%{major}.%{minor} -%{_libdir}/libvgl_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvgl_xio.so.%{major}.%{minor} -%{_libdir}/libvgl_xio.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvidl.so.%{major}.%{minor} -%{_libdir}/libvidl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvidl_pro.so.%{major}.%{minor} -%{_libdir}/libvidl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvifa.so.%{major}.%{minor} -%{_libdir}/libvifa.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil.so.%{major}.%{minor} -%{_libdir}/libvil.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil1.so.%{major}.%{minor} -%{_libdir}/libvil1.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil3d.so.%{major}.%{minor} -%{_libdir}/libvil3d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil3d_algo.so.%{major}.%{minor} -%{_libdir}/libvil3d_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil3d_io.so.%{major}.%{minor} -%{_libdir}/libvil3d_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil_algo.so.%{major}.%{minor} -%{_libdir}/libvil_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil_io.so.%{major}.%{minor} -%{_libdir}/libvil_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvil_pro.so.%{major}.%{minor} -%{_libdir}/libvil_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvimt.so.%{major}.%{minor} -%{_libdir}/libvimt.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvimt3d.so.%{major}.%{minor} -%{_libdir}/libvimt3d.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvimt_algo.so.%{major}.%{minor} -%{_libdir}/libvimt_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvipl.so.%{major}.%{minor} -%{_libdir}/libvipl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvmal.so.%{major}.%{minor} -%{_libdir}/libvmal.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvmap.so.%{major}.%{minor} -%{_libdir}/libvmap.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvnl.so.%{major}.%{minor} -%{_libdir}/libvnl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvnl_algo.so.%{major}.%{minor} -%{_libdir}/libvnl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvnl_io.so.%{major}.%{minor} -%{_libdir}/libvnl_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvnl_xio.so.%{major}.%{minor} -%{_libdir}/libvnl_xio.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvolm.so.%{major}.%{minor} -%{_libdir}/libvolm.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvolm_conf.so.%{major}.%{minor} -%{_libdir}/libvolm_conf.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvolm_desc.so.%{major}.%{minor} -%{_libdir}/libvolm_desc.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvolm_pro.so.%{major}.%{minor} -%{_libdir}/libvolm_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpdfl.so.%{major}.%{minor} -%{_libdir}/libvpdfl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpdl.so.%{major}.%{minor} -%{_libdir}/libvpdl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl.so.%{major}.%{minor} -%{_libdir}/libvpgl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl_algo.so.%{major}.%{minor} -%{_libdir}/libvpgl_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl_file_formats.so.%{major}.%{minor} -%{_libdir}/libvpgl_file_formats.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl_io.so.%{major}.%{minor} -%{_libdir}/libvpgl_io.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl_pro.so.%{major}.%{minor} -%{_libdir}/libvpgl_pro.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpgl_xio.so.%{major}.%{minor} -%{_libdir}/libvpgl_xio.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpl.so.%{major}.%{minor} -%{_libdir}/libvpl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvpyr.so.%{major}.%{minor} -%{_libdir}/libvpyr.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvsl.so.%{major}.%{minor} -%{_libdir}/libvsl.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvsol.so.%{major}.%{minor} -%{_libdir}/libvsol.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvsph.so.%{major}.%{minor} -%{_libdir}/libvsph.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvtol.so.%{major}.%{minor} -%{_libdir}/libvtol.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvtol_algo.so.%{major}.%{minor} -%{_libdir}/libvtol_algo.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvul.so.%{major}.%{minor} -%{_libdir}/libvul.so.%{major}.%{minor}.%{patch}.0 -%{_libdir}/libvul_io.so.%{major}.%{minor} -%{_libdir}/libvul_io.so.%{major}.%{minor}.%{patch}.0 +%{_libdir}/libclipper.so.2.0 +%{_libdir}/libtestlib.so.2.0 +%{_libdir}/libvcl.so.2.0 +%{_libdir}/libvgl.so.2.0 +%{_libdir}/libvidl.so.2.0 +%{_libdir}/libvil_io.so.2.0 +%{_libdir}/libvnl.so.2.0 +%{_libdir}/libvpgl_file_formats.so.2.0 +%{_libdir}/libvpl.so.2.0 +%{_libdir}/libclipper.so.2.0.2 +%{_libdir}/libtestlib.so.2.0.2 +%{_libdir}/libvcl.so.2.0.2 +%{_libdir}/libvgl.so.2.0.2 +%{_libdir}/libvidl.so.2.0.2 +%{_libdir}/libvil_io.so.2.0.2 +%{_libdir}/libvnl.so.2.0.2 +%{_libdir}/libvpgl_file_formats.so.2.0.2 +%{_libdir}/libvpl.so.2.0.2 +%{_libdir}/libnetlib.so.2.0 +%{_libdir}/libv3p_netlib.so.2.0 +%{_libdir}/libvcsl.so.2.0 +%{_libdir}/libvgl_xio.so.2.0 +%{_libdir}/libvil.so.2.0 +%{_libdir}/libvnl_xio.so.2.0 +%{_libdir}/libvpgl_io.so.2.0 +%{_libdir}/libvsl.so.2.0 +%{_libdir}/libnetlib.so.2.0.2 +%{_libdir}/libv3p_netlib.so.2.0.2 +%{_libdir}/libvcsl.so.2.0.2 +%{_libdir}/libvgl_xio.so.2.0.2 +%{_libdir}/libvil.so.2.0.2 +%{_libdir}/libvnl_xio.so.2.0.2 +%{_libdir}/libvpgl_io.so.2.0.2 +%{_libdir}/libvsl.so.2.0.2 +%{_libdir}/libvbl_io.so.2.0 +%{_libdir}/libvgl_algo.so.2.0 +%{_libdir}/libvil1.so.2.0 +%{_libdir}/libvnl_algo.so.2.0 +%{_libdir}/libvpdl.so.2.0 +%{_libdir}/libvpgl.so.2.0 +%{_libdir}/libvul_io.so.2.0 +%{_libdir}/libvbl_io.so.2.0.2 +%{_libdir}/libvgl_algo.so.2.0.2 +%{_libdir}/libvil1.so.2.0.2 +%{_libdir}/libvnl_algo.so.2.0.2 +%{_libdir}/libvpdl.so.2.0.2 +%{_libdir}/libvpgl.so.2.0.2 +%{_libdir}/libvul_io.so.2.0.2 +%{_libdir}/libvbl.so.2.0 +%{_libdir}/libvgl_io.so.2.0 +%{_libdir}/libvil_algo.so.2.0 +%{_libdir}/libvnl_io.so.2.0 +%{_libdir}/libvpgl_algo.so.2.0 +%{_libdir}/libvpgl_xio.so.2.0 +%{_libdir}/libvul.so.2.0 +%{_libdir}/libvbl.so.2.0.2 +%{_libdir}/libvgl_io.so.2.0.2 +%{_libdir}/libvil_algo.so.2.0.2 +%{_libdir}/libvnl_io.so.2.0.2 +%{_libdir}/libvpgl_algo.so.2.0.2 +%{_libdir}/libvpgl_xio.so.2.0.2 +%{_libdir}/libvul.so.2.0.2 +%{_libdir}/libbaio.so.2.0 +%{_libdir}/libbaio.so.2.0.2 +%{_libdir}/libbaml.so.2.0 +%{_libdir}/libbaml.so.2.0.2 +%{_libdir}/libbapl.so.2.0 +%{_libdir}/libbapl.so.2.0.2 +%{_libdir}/libbapl_io.so.2.0 +%{_libdir}/libbapl_io.so.2.0.2 +%{_libdir}/libbapl_pro.so.2.0 +%{_libdir}/libbapl_pro.so.2.0.2 +%{_libdir}/libbbas_pro.so.2.0 +%{_libdir}/libbbas_pro.so.2.0.2 +%{_libdir}/libbbgm.so.2.0 +%{_libdir}/libbbgm.so.2.0.2 +%{_libdir}/libbbgm_pro.so.2.0 +%{_libdir}/libbbgm_pro.so.2.0.2 +%{_libdir}/libbcvr.so.2.0 +%{_libdir}/libbcvr.so.2.0.2 +%{_libdir}/libbdgl.so.2.0 +%{_libdir}/libbdgl.so.2.0.2 +%{_libdir}/libbdpg.so.2.0 +%{_libdir}/libbdpg.so.2.0.2 +%{_libdir}/libbetr.so.2.0 +%{_libdir}/libbetr.so.2.0.2 +%{_libdir}/libbetr_pro.so.2.0 +%{_libdir}/libbetr_pro.so.2.0.2 +%{_libdir}/libbgrl.so.2.0 +%{_libdir}/libbgrl.so.2.0.2 +%{_libdir}/libbgrl2.so.2.0 +%{_libdir}/libbgrl2.so.2.0.2 +%{_libdir}/libbgrl2_algo.so.2.0 +%{_libdir}/libbgrl2_algo.so.2.0.2 +%{_libdir}/libbil.so.2.0 +%{_libdir}/libbil.so.2.0.2 +%{_libdir}/libbil_algo.so.2.0 +%{_libdir}/libbil_algo.so.2.0.2 +%{_libdir}/libbjson.so.2.0 +%{_libdir}/libbjson.so.2.0.2 +%{_libdir}/libbkml.so.2.0 +%{_libdir}/libbkml.so.2.0.2 +%{_libdir}/libbmdl.so.2.0 +%{_libdir}/libbmdl.so.2.0.2 +%{_libdir}/libbmdl_pro.so.2.0 +%{_libdir}/libbmdl_pro.so.2.0.2 +%{_libdir}/libbmsh3d.so.2.0 +%{_libdir}/libbmsh3d.so.2.0.2 +%{_libdir}/libbmsh3d_algo.so.2.0 +%{_libdir}/libbmsh3d_algo.so.2.0.2 +%{_libdir}/libbmsh3d_pro.so.2.0 +%{_libdir}/libbmsh3d_pro.so.2.0.2 +%{_libdir}/libbnabo.so.2.0 +%{_libdir}/libbnabo.so.2.0.2 +%{_libdir}/libbnl.so.2.0 +%{_libdir}/libbnl.so.2.0.2 +%{_libdir}/libbnl_algo.so.2.0 +%{_libdir}/libbnl_algo.so.2.0.2 +%{_libdir}/libboct.so.2.0 +%{_libdir}/libboct.so.2.0.2 +%{_libdir}/libboxm2.so.2.0 +%{_libdir}/libboxm2.so.2.0.2 +%{_libdir}/libboxm2_basic.so.2.0 +%{_libdir}/libboxm2_basic.so.2.0.2 +%{_libdir}/libboxm2_class.so.2.0 +%{_libdir}/libboxm2_class.so.2.0.2 +%{_libdir}/libboxm2_cpp.so.2.0 +%{_libdir}/libboxm2_cpp.so.2.0.2 +%{_libdir}/libboxm2_cpp_algo.so.2.0 +%{_libdir}/libboxm2_cpp_algo.so.2.0.2 +%{_libdir}/libboxm2_cpp_pro.so.2.0 +%{_libdir}/libboxm2_cpp_pro.so.2.0.2 +%{_libdir}/libboxm2_io.so.2.0 +%{_libdir}/libboxm2_io.so.2.0.2 +%{_libdir}/libboxm2_pro.so.2.0 +%{_libdir}/libboxm2_pro.so.2.0.2 +%{_libdir}/libboxm2_util.so.2.0 +%{_libdir}/libboxm2_util.so.2.0.2 +%{_libdir}/libboxm2_vecf.so.2.0 +%{_libdir}/libboxm2_vecf.so.2.0.2 +%{_libdir}/libboxm2_volm.so.2.0 +%{_libdir}/libboxm2_volm.so.2.0.2 +%{_libdir}/libboxm2_volm_conf.so.2.0 +%{_libdir}/libboxm2_volm_conf.so.2.0.2 +%{_libdir}/libboxm2_volm_desc.so.2.0 +%{_libdir}/libboxm2_volm_desc.so.2.0.2 +%{_libdir}/libboxm2_volm_io.so.2.0 +%{_libdir}/libboxm2_volm_io.so.2.0.2 +%{_libdir}/libboxm2_volm_pro.so.2.0 +%{_libdir}/libboxm2_volm_pro.so.2.0.2 +%{_libdir}/libbpgl.so.2.0 +%{_libdir}/libbpgl.so.2.0.2 +%{_libdir}/libbpgl_algo.so.2.0 +%{_libdir}/libbpgl_algo.so.2.0.2 +%{_libdir}/libbprb.so.2.0 +%{_libdir}/libbprb.so.2.0.2 +%{_libdir}/libbrad.so.2.0 +%{_libdir}/libbrad.so.2.0.2 +%{_libdir}/libbrad_io.so.2.0 +%{_libdir}/libbrad_io.so.2.0.2 +%{_libdir}/libbrad_pro.so.2.0 +%{_libdir}/libbrad_pro.so.2.0.2 +%{_libdir}/libbrdb.so.2.0 +%{_libdir}/libbrdb.so.2.0.2 +%{_libdir}/libbrec.so.2.0 +%{_libdir}/libbrec.so.2.0.2 +%{_libdir}/libbrec_pro.so.2.0 +%{_libdir}/libbrec_pro.so.2.0.2 +%{_libdir}/libbreg3d.so.2.0 +%{_libdir}/libbreg3d.so.2.0.2 +%{_libdir}/libbreg3d_pro.so.2.0 +%{_libdir}/libbreg3d_pro.so.2.0.2 +%{_libdir}/libbrip.so.2.0 +%{_libdir}/libbrip.so.2.0.2 +%{_libdir}/libbrip_pro.so.2.0 +%{_libdir}/libbrip_pro.so.2.0.2 +%{_libdir}/libbsgm.so.2.0 +%{_libdir}/libbsgm.so.2.0.2 +%{_libdir}/libbsgm_pro.so.2.0 +%{_libdir}/libbsgm_pro.so.2.0.2 +%{_libdir}/libbsl.so.2.0 +%{_libdir}/libbsl.so.2.0.2 +%{_libdir}/libbsol.so.2.0 +%{_libdir}/libbsol.so.2.0.2 +%{_libdir}/libbsta.so.2.0 +%{_libdir}/libbsta.so.2.0.2 +%{_libdir}/libbsta_algo.so.2.0 +%{_libdir}/libbsta_algo.so.2.0.2 +%{_libdir}/libbsta_io.so.2.0 +%{_libdir}/libbsta_io.so.2.0.2 +%{_libdir}/libbsta_pro.so.2.0 +%{_libdir}/libbsta_pro.so.2.0.2 +%{_libdir}/libbsta_vis.so.2.0 +%{_libdir}/libbsta_vis.so.2.0.2 +%{_libdir}/libbstm.so.2.0 +%{_libdir}/libbstm.so.2.0.2 +%{_libdir}/libbstm_basic.so.2.0 +%{_libdir}/libbstm_basic.so.2.0.2 +%{_libdir}/libbstm_cpp_algo.so.2.0 +%{_libdir}/libbstm_cpp_algo.so.2.0.2 +%{_libdir}/libbstm_cpp_pro.so.2.0 +%{_libdir}/libbstm_cpp_pro.so.2.0.2 +%{_libdir}/libbstm_io.so.2.0 +%{_libdir}/libbstm_io.so.2.0.2 +%{_libdir}/libbstm_multi.so.2.0 +%{_libdir}/libbstm_multi.so.2.0.2 +%{_libdir}/libbstm_multi_basic.so.2.0 +%{_libdir}/libbstm_multi_basic.so.2.0.2 +%{_libdir}/libbstm_multi_io.so.2.0 +%{_libdir}/libbstm_multi_io.so.2.0.2 +%{_libdir}/libbstm_pro.so.2.0 +%{_libdir}/libbstm_pro.so.2.0.2 +%{_libdir}/libbstm_util.so.2.0 +%{_libdir}/libbstm_util.so.2.0.2 +%{_libdir}/libbsvg.so.2.0 +%{_libdir}/libbsvg.so.2.0.2 +%{_libdir}/libbsvg_pro.so.2.0 +%{_libdir}/libbsvg_pro.so.2.0.2 +%{_libdir}/libbtol.so.2.0 +%{_libdir}/libbtol.so.2.0.2 +%{_libdir}/libbugl.so.2.0 +%{_libdir}/libbugl.so.2.0.2 +%{_libdir}/libbundler.so.2.0 +%{_libdir}/libbundler.so.2.0.2 +%{_libdir}/libbvgl.so.2.0 +%{_libdir}/libbvgl.so.2.0.2 +%{_libdir}/libbvgl_algo.so.2.0 +%{_libdir}/libbvgl_algo.so.2.0.2 +%{_libdir}/libbvgl_pro.so.2.0 +%{_libdir}/libbvgl_pro.so.2.0.2 +%{_libdir}/libbvpl.so.2.0 +%{_libdir}/libbvpl.so.2.0.2 +%{_libdir}/libbvpl_functors.so.2.0 +%{_libdir}/libbvpl_functors.so.2.0.2 +%{_libdir}/libbvpl_kernels.so.2.0 +%{_libdir}/libbvpl_kernels.so.2.0.2 +%{_libdir}/libbvpl_kernels_io.so.2.0 +%{_libdir}/libbvpl_kernels_io.so.2.0.2 +%{_libdir}/libbvpl_kernels_pro.so.2.0 +%{_libdir}/libbvpl_kernels_pro.so.2.0.2 +%{_libdir}/libbvpl_pro.so.2.0 +%{_libdir}/libbvpl_pro.so.2.0.2 +%{_libdir}/libbvpl_util.so.2.0 +%{_libdir}/libbvpl_util.so.2.0.2 +%{_libdir}/libbvpl_util_io.so.2.0 +%{_libdir}/libbvpl_util_io.so.2.0.2 +%{_libdir}/libbvrml.so.2.0 +%{_libdir}/libbvrml.so.2.0.2 +%{_libdir}/libbvrml_pro.so.2.0 +%{_libdir}/libbvrml_pro.so.2.0.2 +%{_libdir}/libbvxm.so.2.0 +%{_libdir}/libbvxm.so.2.0.2 +%{_libdir}/libbvxm_algo.so.2.0 +%{_libdir}/libbvxm_algo.so.2.0.2 +%{_libdir}/libbvxm_algo_pro.so.2.0 +%{_libdir}/libbvxm_algo_pro.so.2.0.2 +%{_libdir}/libbvxm_grid.so.2.0 +%{_libdir}/libbvxm_grid.so.2.0.2 +%{_libdir}/libbvxm_grid_io.so.2.0 +%{_libdir}/libbvxm_grid_io.so.2.0.2 +%{_libdir}/libbvxm_grid_pro.so.2.0 +%{_libdir}/libbvxm_grid_pro.so.2.0.2 +%{_libdir}/libbvxm_io.so.2.0 +%{_libdir}/libbvxm_io.so.2.0.2 +%{_libdir}/libbvxm_pro.so.2.0 +%{_libdir}/libbvxm_pro.so.2.0.2 +%{_libdir}/libbwm_video.so.2.0 +%{_libdir}/libbwm_video.so.2.0.2 +%{_libdir}/libbxml.so.2.0 +%{_libdir}/libbxml.so.2.0.2 +%{_libdir}/libclsfy.so.2.0 +%{_libdir}/libclsfy.so.2.0.2 +%{_libdir}/libdepth_map.so.2.0 +%{_libdir}/libdepth_map.so.2.0.2 +%{_libdir}/libfhs.so.2.0 +%{_libdir}/libfhs.so.2.0.2 +%{_libdir}/libgeml.so.2.0 +%{_libdir}/libgeml.so.2.0.2 +%{_libdir}/libgevd.so.2.0 +%{_libdir}/libgevd.so.2.0.2 +%{_libdir}/libgmvl.so.2.0 +%{_libdir}/libgmvl.so.2.0.2 +%{_libdir}/libgst.so.2.0 +%{_libdir}/libgst.so.2.0.2 +%{_libdir}/libgtrl.so.2.0 +%{_libdir}/libgtrl.so.2.0.2 +%{_libdir}/libicam.so.2.0 +%{_libdir}/libicam.so.2.0.2 +%{_libdir}/libicam_pro.so.2.0 +%{_libdir}/libicam_pro.so.2.0.2 +%{_libdir}/libihog.so.2.0 +%{_libdir}/libihog.so.2.0.2 +%{_libdir}/libihog_pro.so.2.0 +%{_libdir}/libihog_pro.so.2.0.2 +%{_libdir}/libimesh.so.2.0 +%{_libdir}/libimesh.so.2.0.2 +%{_libdir}/libimesh_algo.so.2.0 +%{_libdir}/libimesh_algo.so.2.0.2 +%{_libdir}/libipts.so.2.0 +%{_libdir}/libipts.so.2.0.2 +%{_libdir}/libm23d.so.2.0 +%{_libdir}/libm23d.so.2.0.2 +%{_libdir}/libmbl.so.2.0 +%{_libdir}/libmbl.so.2.0.2 +%{_libdir}/libmcal.so.2.0 +%{_libdir}/libmcal.so.2.0.2 +%{_libdir}/libmfpf.so.2.0 +%{_libdir}/libmfpf.so.2.0.2 +%{_libdir}/libmipa.so.2.0 +%{_libdir}/libmipa.so.2.0.2 +%{_libdir}/libmmn.so.2.0 +%{_libdir}/libmmn.so.2.0.2 +%{_libdir}/libmsdi.so.2.0 +%{_libdir}/libmsdi.so.2.0.2 +%{_libdir}/libmsm.so.2.0 +%{_libdir}/libmsm.so.2.0.2 +%{_libdir}/libmsm_utils.so.2.0 +%{_libdir}/libmsm_utils.so.2.0.2 +%{_libdir}/libmvl.so.2.0 +%{_libdir}/libmvl.so.2.0.2 +%{_libdir}/libmvl2.so.2.0 +%{_libdir}/libmvl2.so.2.0.2 +%{_libdir}/libosl.so.2.0 +%{_libdir}/libosl.so.2.0.2 +%{_libdir}/libouel.so.2.0 +%{_libdir}/libouel.so.2.0.2 +%{_libdir}/libouml.so.2.0 +%{_libdir}/libouml.so.2.0.2 +%{_libdir}/liboxl_vrml.so.2.0 +%{_libdir}/liboxl_vrml.so.2.0.2 +%{_libdir}/libpdf1d.so.2.0 +%{_libdir}/libpdf1d.so.2.0.2 +%{_libdir}/librgrl.so.2.0 +%{_libdir}/librgrl.so.2.0.2 +%{_libdir}/librrel.so.2.0 +%{_libdir}/librrel.so.2.0.2 +%{_libdir}/librsdl.so.2.0 +%{_libdir}/librsdl.so.2.0.2 +%{_libdir}/libsdet.so.2.0 +%{_libdir}/libsdet.so.2.0.2 +%{_libdir}/libsdet_pro.so.2.0 +%{_libdir}/libsdet_pro.so.2.0.2 +%{_libdir}/libvcon_pro.so.2.0 +%{_libdir}/libvcon_pro.so.2.0.2 +%{_libdir}/libvdgl.so.2.0 +%{_libdir}/libvdgl.so.2.0.2 +%{_libdir}/libvdtop.so.2.0 +%{_libdir}/libvdtop.so.2.0.2 +%{_libdir}/libvepl.so.2.0 +%{_libdir}/libvepl.so.2.0.2 +%{_libdir}/libvidl_pro.so.2.0 +%{_libdir}/libvidl_pro.so.2.0.2 +%{_libdir}/libvifa.so.2.0 +%{_libdir}/libvifa.so.2.0.2 +%{_libdir}/libvil3d.so.2.0 +%{_libdir}/libvil3d.so.2.0.2 +%{_libdir}/libvil3d_algo.so.2.0 +%{_libdir}/libvil3d_algo.so.2.0.2 +%{_libdir}/libvil3d_io.so.2.0 +%{_libdir}/libvil3d_io.so.2.0.2 +%{_libdir}/libvil_pro.so.2.0 +%{_libdir}/libvil_pro.so.2.0.2 +%{_libdir}/libvimt.so.2.0 +%{_libdir}/libvimt.so.2.0.2 +%{_libdir}/libvimt3d.so.2.0 +%{_libdir}/libvimt3d.so.2.0.2 +%{_libdir}/libvimt_algo.so.2.0 +%{_libdir}/libvimt_algo.so.2.0.2 +%{_libdir}/libvipl.so.2.0 +%{_libdir}/libvipl.so.2.0.2 +%{_libdir}/libvmal.so.2.0 +%{_libdir}/libvmal.so.2.0.2 +%{_libdir}/libvmap.so.2.0 +%{_libdir}/libvmap.so.2.0.2 +%{_libdir}/libvolm.so.2.0 +%{_libdir}/libvolm.so.2.0.2 +%{_libdir}/libvolm_conf.so.2.0 +%{_libdir}/libvolm_conf.so.2.0.2 +%{_libdir}/libvolm_desc.so.2.0 +%{_libdir}/libvolm_desc.so.2.0.2 +%{_libdir}/libvolm_pro.so.2.0 +%{_libdir}/libvolm_pro.so.2.0.2 +%{_libdir}/libvpdfl.so.2.0 +%{_libdir}/libvpdfl.so.2.0.2 +%{_libdir}/libvpgl_pro.so.2.0 +%{_libdir}/libvpgl_pro.so.2.0.2 +%{_libdir}/libvpyr.so.2.0 +%{_libdir}/libvpyr.so.2.0.2 +%{_libdir}/libvsol.so.2.0 +%{_libdir}/libvsol.so.2.0.2 +%{_libdir}/libvsph.so.2.0 +%{_libdir}/libvsph.so.2.0.2 +%{_libdir}/libvtol.so.2.0 +%{_libdir}/libvtol.so.2.0.2 +%{_libdir}/libvtol_algo.so.2.0 +%{_libdir}/libvtol_algo.so.2.0.2 +# Bundles +%{_libdir}/libopenjpeg2.so.2.0 +%{_libdir}/libopenjpeg2.so.2.0.0 %files devel %{_datadir}/%{name} %{_includedir}/%{name} +%{_libdir}/libclipper.so +%{_libdir}/libvbl_io.so +%{_libdir}/libvcsl.so +%{_libdir}/libvgl.so +%{_libdir}/libvil_algo.so +%{_libdir}/libvnl_algo.so +%{_libdir}/libvnl_xio.so +%{_libdir}/libvpgl_file_formats.so +%{_libdir}/libvpgl_xio.so +%{_libdir}/libvul_io.so +%{_libdir}/libnetlib.so +%{_libdir}/libtestlib.so +%{_libdir}/libvbl.so +%{_libdir}/libvgl_algo.so +%{_libdir}/libvgl_xio.so +%{_libdir}/libvil_io.so +%{_libdir}/libvnl_io.so +%{_libdir}/libvpdl.so +%{_libdir}/libvpgl_io.so +%{_libdir}/libvpl.so +%{_libdir}/libvul.so +%{_libdir}/libopenjpeg2.so +%{_libdir}/libv3p_netlib.so +%{_libdir}/libvcl.so +%{_libdir}/libvgl_io.so +%{_libdir}/libvidl.so +%{_libdir}/libvil1.so +%{_libdir}/libvil.so +%{_libdir}/libvnl.so +%{_libdir}/libvpgl_algo.so +%{_libdir}/libvpgl.so +%{_libdir}/libmipa.so +%{_libdir}/libmfpf.so +%{_libdir}/libmcal.so +%{_libdir}/libmbl.so +%{_libdir}/libm23d.so +%{_libdir}/libipts.so +%{_libdir}/libimesh_algo.so +%{_libdir}/libimesh.so +%{_libdir}/libihog_pro.so +%{_libdir}/libihog.so +%{_libdir}/libicam_pro.so +%{_libdir}/libicam.so +%{_libdir}/libgst.so +%{_libdir}/libgmvl.so +%{_libdir}/libgevd.so +%{_libdir}/libgtrl.so +%{_libdir}/libgeml.so +%{_libdir}/libfhs.so +%{_libdir}/libdepth_map.so +%{_libdir}/libclsfy.so +%{_libdir}/libbxml.so +%{_libdir}/libbwm_video.so +%{_libdir}/libbvxm_pro.so +%{_libdir}/libbvxm_io.so +%{_libdir}/libbvxm_grid_pro.so +%{_libdir}/libbvxm_grid_io.so +%{_libdir}/libbvxm_grid.so +%{_libdir}/libbvxm_algo_pro.so +%{_libdir}/libbvxm_algo.so +%{_libdir}/libbvxm.so +%{_libdir}/libbvrml_pro.so +%{_libdir}/libbvrml.so +%{_libdir}/libbvpl_util_io.so +%{_libdir}/libbvpl_util.so +%{_libdir}/libbvpl_pro.so +%{_libdir}/libbvpl_kernels_pro.so +%{_libdir}/libbvpl_kernels_io.so +%{_libdir}/libbvpl_kernels.so +%{_libdir}/libbvpl_functors.so +%{_libdir}/libbvpl.so +%{_libdir}/libvsl.so +%{_libdir}/libbvgl_pro.so +%{_libdir}/libbvgl_algo.so +%{_libdir}/libbvgl.so +%{_libdir}/libbundler.so +%{_libdir}/libbugl.so +%{_libdir}/libbtol.so +%{_libdir}/libbsvg_pro.so +%{_libdir}/libbsvg.so +%{_libdir}/libbstm_util.so +%{_libdir}/libbstm_pro.so +%{_libdir}/libbstm_multi_io.so +%{_libdir}/libbstm_multi_basic.so +%{_libdir}/libbstm_multi.so +%{_libdir}/libbstm_io.so +%{_libdir}/libbstm_cpp_pro.so +%{_libdir}/libbstm_cpp_algo.so +%{_libdir}/libbstm_basic.so +%{_libdir}/libbstm.so +%{_libdir}/libbsta_vis.so +%{_libdir}/libbsta_pro.so +%{_libdir}/libbsta_io.so +%{_libdir}/libbsta_algo.so +%{_libdir}/libbsta.so +%{_libdir}/libbsol.so +%{_libdir}/libbsl.so +%{_libdir}/libbsgm_pro.so +%{_libdir}/libbsgm.so +%{_libdir}/libbrip_pro.so +%{_libdir}/libbrip.so +%{_libdir}/libbreg3d_pro.so +%{_libdir}/libbreg3d.so +%{_libdir}/libbrec_pro.so +%{_libdir}/libbrec.so +%{_libdir}/libbrdb.so +%{_libdir}/libbrad_pro.so +%{_libdir}/libbrad_io.so +%{_libdir}/libbrad.so +%{_libdir}/libbprb.so +%{_libdir}/libbpgl_algo.so +%{_libdir}/libbpgl.so +%{_libdir}/libboxm2_volm_pro.so +%{_libdir}/libboxm2_volm_io.so +%{_libdir}/libboxm2_volm_conf.so +%{_libdir}/libboxm2_volm.so +%{_libdir}/libboxm2_vecf.so +%{_libdir}/libboxm2_util.so +%{_libdir}/libboxm2_pro.so +%{_libdir}/libboxm2_io.so +%{_libdir}/libboxm2_cpp_pro.so +%{_libdir}/libboxm2_cpp_algo.so +%{_libdir}/libboxm2_cpp.so +%{_libdir}/libboxm2_class.so +%{_libdir}/libboxm2_basic.so +%{_libdir}/libboxm2.so +%{_libdir}/libboct.so +%{_libdir}/libbnl_algo.so +%{_libdir}/libbnl.so +%{_libdir}/libbnabo.so +%{_libdir}/libbmsh3d_pro.so +%{_libdir}/libbmsh3d_algo.so +%{_libdir}/libboxm2_volm_desc.so +%{_libdir}/libbmsh3d.so +%{_libdir}/libbmdl_pro.so +%{_libdir}/libbmdl.so +%{_libdir}/libbkml.so +%{_libdir}/libbjson.so +%{_libdir}/libbil_algo.so +%{_libdir}/libbil.so +%{_libdir}/libbgrl2_algo.so +%{_libdir}/libbgrl2.so +%{_libdir}/libbgrl.so +%{_libdir}/libbetr_pro.so +%{_libdir}/libbetr.so +%{_libdir}/libbdpg.so +%{_libdir}/libbdgl.so +%{_libdir}/libbcvr.so +%{_libdir}/libbbgm_pro.so +%{_libdir}/libbbgm.so %{_libdir}/libbbas_pro.so %{_libdir}/libbapl_pro.so %{_libdir}/libbapl_io.so -%{_libdir}/libacal.so -%{_libdir}/libacal_io.so -%{_libdir}/libbaio.so -%{_libdir}/libbaml.so %{_libdir}/libbapl.so -%{_libdir}/libbbgm.so -%{_libdir}/libbbgm_pro.so -%{_libdir}/libbcvr.so -%{_libdir}/libbdgl.so -%{_libdir}/libbdpg.so -%{_libdir}/libbetr.so -%{_libdir}/libbetr_pro.so -%{_libdir}/libbgrl.so -%{_libdir}/libbgrl2.so -%{_libdir}/libbgrl2_algo.so -%{_libdir}/libbil.so -%{_libdir}/libbil_algo.so -%{_libdir}/libbjson.so -%{_libdir}/libbkml.so -%{_libdir}/libbmdl.so -%{_libdir}/libbmdl_pro.so -%{_libdir}/libbmsh3d.so -%{_libdir}/libbmsh3d_algo.so -%{_libdir}/libbmsh3d_pro.so -%{_libdir}/libbnabo.so -%{_libdir}/libbnl.so -%{_libdir}/libbnl_algo.so -%{_libdir}/libboct.so -%{_libdir}/libboxm2.so -%{_libdir}/libboxm2_basic.so -%{_libdir}/libboxm2_class.so -%{_libdir}/libboxm2_cpp.so -%{_libdir}/libboxm2_cpp_algo.so -%{_libdir}/libboxm2_cpp_pro.so -%{_libdir}/libboxm2_io.so -%{_libdir}/libboxm2_pro.so -%{_libdir}/libboxm2_util.so -%{_libdir}/libboxm2_vecf.so -%{_libdir}/libboxm2_volm.so -%{_libdir}/libboxm2_volm_conf.so -%{_libdir}/libboxm2_volm_desc.so -%{_libdir}/libboxm2_volm_io.so -%{_libdir}/libboxm2_volm_pro.so -%{_libdir}/libbpgl.so -%{_libdir}/libbpgl_algo.so -%{_libdir}/libbprb.so -%{_libdir}/libbrad.so -%{_libdir}/libbrad_io.so -%{_libdir}/libbrad_pro.so -%{_libdir}/libbrdb.so -%{_libdir}/libbrec.so -%{_libdir}/libbrec_pro.so -%{_libdir}/libbreg3d.so -%{_libdir}/libbreg3d_pro.so -%{_libdir}/libbres.so -%{_libdir}/libbrip.so -%{_libdir}/libbrip_pro.so -%{_libdir}/libbsgm.so -%{_libdir}/libbsgm_pro.so -%{_libdir}/libbsl.so -%{_libdir}/libbsol.so -%{_libdir}/libbsta.so -%{_libdir}/libbsta_algo.so -%{_libdir}/libbsta_io.so -%{_libdir}/libbsta_pro.so -%{_libdir}/libbsta_vis.so -%{_libdir}/libbstm.so -%{_libdir}/libbstm_basic.so -%{_libdir}/libbstm_cpp_algo.so -%{_libdir}/libbstm_cpp_pro.so -%{_libdir}/libbstm_io.so -%{_libdir}/libbstm_multi.so -%{_libdir}/libbstm_multi_basic.so -%{_libdir}/libbstm_multi_io.so -%{_libdir}/libbstm_pro.so -%{_libdir}/libbstm_util.so -%{_libdir}/libbsvg.so -%{_libdir}/libbsvg_pro.so -%{_libdir}/libbtol.so -%{_libdir}/libbugl.so -%{_libdir}/libbundler.so -%{_libdir}/libbvgl.so -%{_libdir}/libbvgl_algo.so -%{_libdir}/libbvgl_pro.so -%{_libdir}/libbvpl.so -%{_libdir}/libbvpl_functors.so -%{_libdir}/libbvpl_kernels.so -%{_libdir}/libbvpl_kernels_io.so -%{_libdir}/libbvpl_kernels_pro.so -%{_libdir}/libbvpl_pro.so -%{_libdir}/libbvpl_util.so -%{_libdir}/libbvpl_util_io.so -%{_libdir}/libbvrml.so -%{_libdir}/libbvrml_pro.so -%{_libdir}/libbvxm.so -%{_libdir}/libbvxm_algo.so -%{_libdir}/libbvxm_algo_pro.so -%{_libdir}/libbvxm_grid.so -%{_libdir}/libbvxm_grid_io.so -%{_libdir}/libbvxm_grid_pro.so -%{_libdir}/libbvxm_io.so -%{_libdir}/libbvxm_pro.so -%{_libdir}/libbwm_video.so -%{_libdir}/libbxml.so -%{_libdir}/libclipper.so -%{_libdir}/libclsfy.so -%{_libdir}/libdepth_map.so -%{_libdir}/libfhs.so -%{_libdir}/libgeml.so -%{_libdir}/libgevd.so -%{_libdir}/libgmvl.so -%{_libdir}/libgst.so -%{_libdir}/libgtrl.so -%{_libdir}/libicam.so -%{_libdir}/libicam_pro.so -%{_libdir}/libihog.so -%{_libdir}/libihog_pro.so -%{_libdir}/libimesh.so -%{_libdir}/libimesh_algo.so -%{_libdir}/libipts.so -%{_libdir}/libm23d.so -%{_libdir}/libmbl.so -%{_libdir}/libmcal.so -%{_libdir}/libmfpf.so -%{_libdir}/libmipa.so +%{_libdir}/libbaml.so +%{_libdir}/libbaio.so %{_libdir}/libmmn.so %{_libdir}/libmsdi.so %{_libdir}/libmsm.so %{_libdir}/libmsm_utils.so %{_libdir}/libmvl.so %{_libdir}/libmvl2.so -%{_libdir}/libopenjpeg2.so %{_libdir}/libosl.so %{_libdir}/libouel.so %{_libdir}/libouml.so @@ -801,32 +794,16 @@ rm -fv %{buildroot}/usr/contrib/brl/bseg/boxm2/ocl/boxm2_ocl_where_root_dir.h %{_libdir}/librrel.so %{_libdir}/librsdl.so %{_libdir}/libsdet.so -%{_libdir}/libsdet_algo.so %{_libdir}/libsdet_pro.so -%{_libdir}/libtestlib.so -%{_libdir}/libv3p_netlib.so -%{_libdir}/libvbl.so -%{_libdir}/libvbl_io.so -%{_libdir}/libvcl.so %{_libdir}/libvcon_pro.so -%{_libdir}/libvcsl.so %{_libdir}/libvdgl.so %{_libdir}/libvdtop.so %{_libdir}/libvepl.so -%{_libdir}/libvgl.so -%{_libdir}/libvgl_algo.so -%{_libdir}/libvgl_io.so -%{_libdir}/libvgl_xio.so -%{_libdir}/libvidl.so %{_libdir}/libvidl_pro.so %{_libdir}/libvifa.so -%{_libdir}/libvil.so -%{_libdir}/libvil1.so %{_libdir}/libvil3d.so %{_libdir}/libvil3d_algo.so %{_libdir}/libvil3d_io.so -%{_libdir}/libvil_algo.so -%{_libdir}/libvil_io.so %{_libdir}/libvil_pro.so %{_libdir}/libvimt.so %{_libdir}/libvimt3d.so @@ -834,36 +811,198 @@ rm -fv %{buildroot}/usr/contrib/brl/bseg/boxm2/ocl/boxm2_ocl_where_root_dir.h %{_libdir}/libvipl.so %{_libdir}/libvmal.so %{_libdir}/libvmap.so -%{_libdir}/libvnl.so -%{_libdir}/libvnl_algo.so -%{_libdir}/libvnl_io.so -%{_libdir}/libvnl_xio.so %{_libdir}/libvolm.so %{_libdir}/libvolm_conf.so %{_libdir}/libvolm_desc.so %{_libdir}/libvolm_pro.so %{_libdir}/libvpdfl.so -%{_libdir}/libvpdl.so -%{_libdir}/libvpgl.so -%{_libdir}/libvpgl_algo.so -%{_libdir}/libvpgl_file_formats.so -%{_libdir}/libvpgl_io.so %{_libdir}/libvpgl_pro.so -%{_libdir}/libvpgl_xio.so -%{_libdir}/libvpl.so %{_libdir}/libvpyr.so -%{_libdir}/libvsl.so %{_libdir}/libvsol.so %{_libdir}/libvsph.so %{_libdir}/libvtol.so %{_libdir}/libvtol_algo.so -%{_libdir}/libvul.so -%{_libdir}/libvul_io.so - %files doc %doc core/vxl_copyright.h %doc %{_docdir}/* %changelog -%autochangelog +* Fri Jan 31 2020 Fedora Release Engineering - 2.0.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sun Sep 15 2019 Ankur Sinha - 2.0.2-6 +- Fix failing build: update patch to fix minizip include + +* Sat Jul 27 2019 Fedora Release Engineering - 2.0.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue May 28 2019 Ankur Sinha - 2.0.2-4 +- Remove obsolete boxm library (was also causing arm build to fail) +- Remove obsolete octree library + +* Tue May 28 2019 Ankur Sinha - 2.0.2-3 +- Fix 32 bit arch builds: https://github.com/vxl/vxl/issues/638 +- Remove invalid comments +- Do not make docs require the base package + +* Fri Apr 26 2019 Ankur Sinha - 2.0.2-2 +- Add complete file list +- Remove no longer needed BR: klt +- Remove more unneeded patches +- Add patch to include FindRPLY.cmake +- Use system shapelib and expat +- More patches to complete build +- Document failing tests, do not let them fail build + +* Fri Apr 19 2019 Ankur Sinha - 2.0.2-2 +- Enable OUL---why was it disabled? +- Remove rply include patch: build seems to find it just fine. +- Remove uneeded rply function call fix patch. +- Remove Coin3D cmake config patch---included in cmake distribution now. +- Remove SIMVoleon cmake patch---seems to find it just fine. +- Correct CMake flags. +- Enable BRL build +- add Python BR +- Add expatpp bits manually +- File upstream issue and use bundled openjpeg2: https://github.com/vxl/vxl/issues/627 +- Remove unneeded xerces BR, and corresponding patch. + +* Thu Apr 18 2019 Ankur Sinha - 2.0.2-1 +- Update to latest upstream release +- Temporarily use bundled dcmtk (https://github.com/vxl/vxl/issues/550) +- Use new github upstream +- Remove uneeded patches +- Explicitly list all shared objects + +* Sat Mar 09 2019 Antonio Trande - 1.17.0-31 +- Rebuild for dcmtk-3.6.4 + +* Sun Feb 17 2019 Ankur Sinha - 1.17.0-30 +- Use autosetup macro +- Remove whitespaces, use space instead of tabs for cleanliness + +* Sun Feb 03 2019 Fedora Release Engineering - 1.17.0-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Aug 28 2018 Patrik Novotný - 1.17.0-28 +- change requires to minizip-compat(-devel), rhbz#1609830, rhbz#1615381 + +* Sat Jul 14 2018 Fedora Release Engineering - 1.17.0-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Mar 07 2018 Adam Williamson - 1.17.0-26 +- Rebuild to fix GCC 8 mis-compilation + See https://da.gd/YJVwk ("GCC 8 ABI change on x86_64") + +* Fri Feb 09 2018 Fedora Release Engineering - 1.17.0-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 1.17.0-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 1.17.0-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon May 15 2017 Fedora Release Engineering - 1.17.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 1.17.0-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 25 2016 Tom Callaway - 1.17.0-20 +- remove non-free lena image file from source tarball (bz1310388) +- fix FTBFS (bz1303695, bz1308234) + +* Fri Feb 05 2016 Fedora Release Engineering - 1.17.0-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 1.17.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 16 2015 Sebastian Pölsterl - 1.17.0-17 +- Rebuilt using hardened build flags: https://fedoraproject.org/wiki/Changes/Harden_All_Packages + +* Mon Feb 16 2015 Ralf Corsépius - 0.17.0-16 +- Add vxl-0.17.0-gcc5.diff (Work-around GCC-5.0.0 FTBFS RHBZ#1192886). +- Fix bogus %%changelog date. + +* Mon Aug 25 2014 Devrim Gündüz - 1.17.0-15 +- Rebuilt for libgeotiff + +* Mon Aug 18 2014 Fedora Release Engineering - 1.17.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 1.17.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 1.17.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon Mar 04 2013 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-11 +- Applied upstream patches (25, 26) to ensure compatibility with ITK + +* Fri Feb 15 2013 Fedora Release Engineering - 1.17.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Adam Tkac - 1.17.0-9 +- rebuild due to "jpeg8-ABI" feature drop + +* Wed Dec 05 2012 Dan Horák - 1.17.0-8 +- fix build on non-x86 arches + +* Sun Nov 25 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-7%{?dist} +- Changed source0 path to point to vxl 1.17 +- Added missing sonames + +* Fri Nov 02 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-6%{?dist} +- Patched to build BRL +- Updated to last version + +* Mon Oct 29 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-5%{?dist} +- Removed expatpp bundled library and added corresponding BR +- Removed bundled bzip + + +* Thu Oct 18 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-4%{?dist} +- Fixed missing oxl_vrml lib +- Turn on compilation of BRL + +* Sun Oct 14 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-3%{?dist} +- More fixes from Volker's post https://bugzilla.redhat.com/show_bug.cgi?id=567086#c42 + +* Wed Oct 10 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-2%{?dist} +- Added patches 12-16 from https://bugzilla.redhat.com/show_bug.cgi?id=567086#c42 +- Minor rework of the spec file as pointed out by Volker in the previous link + +* Wed Oct 10 2012 Mario Ceresa mrceresa fedoraproject org vxl 1.17.0-1%{?dist} +- Updated to new version +- Reworked patches to the new version +- Disabled BRL because it gives a compilation error + +* Fri May 27 2011 Mario Ceresa mrceresa fedoraproject org vxl 1.14.0-1%{?dist} +- Updated to new version +- Added BR doxygen (thanks to Ankur for noticing it) +- Changed patch naming schema +- Work around a rply related bug (patches 3-6) +- Thanks to Thomas Bouffon for patch 7-8 +- Patches 9-10 address http://www.itk.org/pipermail/insight-users/2010-July/037418.html +- Fixed 70 missing sonames in patch 11 +- Removed bundled expact, shapelib, minizip, dcmtk +- Force brl build +- Use system shipped FindEXPAT + + +* Tue Mar 23 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-4%{?dist} +- sed patch to add ${LIB_SUFFIX} to all lib install target +- Added soname version info to vil vil_algo lib + +* Sun Mar 21 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-3%{?dist} +- Applied patch to build against newly packaged rply + +* Tue Mar 2 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-2%{?dist} +- Applied patch from debian distribution to force the generation of versioned lib + +* Fri Feb 19 2010 Mario Ceresa mrceresa fedoraproject org vxl 1.13.0-1%{?dist} +- Initial RPM Release +