Skip to content

Commit

Permalink
Merge branch 'poncateam:master' into add_mean_plane
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaleo authored Jun 8, 2023
2 parents c4ec997 + 6023f1e commit 624d73f
Show file tree
Hide file tree
Showing 11 changed files with 2,873 additions and 12 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Ponca changelog

--------------------------------------------------------------------------------
Current head (v.1.1 RC)
This release improves the Spatial Partitioning Package with new features and
improved doc.

- API
- [spatialPartitioning] Add kd-tree traits type (#80)
- [fitting] Add Primitive::getNumNeighbors (#86)

- Bug-fixes and code improvements
- [spatialPartitioning] Fix unwanted function hiding with DryFit::setWeightFunc (#86)
- [fitting] Remove deadcode in Basket (#86)

-Docs
- [spatialPartitioning] Update module page with a minimal doc and examples (#86)
- [spatialPartitioning] Add NanoFlann example (#86)

--------------------------------------------------------------------------------
v.1.0
Expand All @@ -28,7 +42,6 @@ The changes introduced in this version mostly are introduced by PR #56.
- [fitting] Rename normal() as primitiveGradient in MlsSphereFit (#72)
- [fitting] Add new weight kernels (#71,#74)
- [fitting] Add mechanism to check weight derivatives validity (#74)
- [spatialPartitioning] Add kd-tree traits type (#80)

- Bug-fixes and code improvements
- [fitting] Reduce objets sizes by removing unnecessary attributes (#56)
Expand Down
14 changes: 7 additions & 7 deletions Ponca/src/Fitting/basket.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ namespace internal
PONCA_MULTIARCH inline \
FIT_RESULT computeWithIds(IndexRange ids, const PointContainer& points){ \
FIT_RESULT res = UNDEFINED; \
do { \
for (const auto& i : ids){ \
this->addNeighbor(points[i]); \
} \
res = this->finalize(); \
} while ( res == NEED_OTHER_PASS ); \
return res;return Self::computeWithIds(ids, points); \
do { \
for (const auto& i : ids){ \
this->addNeighbor(points[i]); \
} \
res = this->finalize(); \
} while ( res == NEED_OTHER_PASS ); \
return res; \
} \
WRITE_BASKET_SINGLE_HOST_FUNCTIONS

Expand Down
3 changes: 0 additions & 3 deletions Ponca/src/Fitting/dryFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ namespace Ponca
PONCA_FITTING_APIDOC_FINALIZE
PONCA_MULTIARCH inline FIT_RESULT finalize() { return Base::finalize(); }

PONCA_FITTING_APIDOC_SETWFUNC
PONCA_MULTIARCH inline void setWeightFunc (const WFunctor& /*_w*/) { }

//! \brief Simulate Scalar field computation
PONCA_MULTIARCH inline Scalar potential ( ) const { return Scalar(0); }

Expand Down
3 changes: 3 additions & 0 deletions Ponca/src/Fitting/primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class PrimitiveBase
and the result is stable, eq. having more than 6 neighbors) */
PONCA_MULTIARCH inline bool isStable() const { return m_eCurrentState == STABLE; }

/*! \brief Get number of points added in the neighborhood (with non negative weight) */
PONCA_MULTIARCH inline int getNumNeighbors() const { return m_nbNeighbors; }

/*! \return the current test of the fit */
PONCA_MULTIARCH inline FIT_RESULT getCurrentState() const
{
Expand Down
2 changes: 2 additions & 0 deletions doc/src/example.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
- \subpage example_cxx_pcl_page : How to use Ponca with Point cloud library (PCL). A basic example to compute and visualize surface curvature.
- \subpage example_cu_ssc_page : Calculate Screen Space Curvature using CUDA/C++.
- \subpage example_python_ssc_page : Calculate Screen Space Curvature using CUDA/Python.
- @ref spatialpartitioning "Spatial Partitioning Module"
- \subpage example_cxx_nanoflann_page : Comparison between Nanoflann and Ponca KdTree APIs.

*/
53 changes: 53 additions & 0 deletions doc/src/example_cxx_nanoflann.mdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/


/*!
\page example_cxx_nanoflann_page Comparison between Nanoflann and Ponca KdTree APIs

\section nanoflann_intro_sec Introduction

This example demonstrates how to use Ponca and <a href="https://github.com/jlblancoc/nanoflann" target="_blank">
Nanoflann</a> (v1.5.0) KdTrees on the same data, and compare runtime performances.

\subsection nanoflann_compilation_sec Compilation

As for other examples, you need to enable the compilation of the examples with `cmake`, and build the examples:

\code
cmake [..] -DPONCA_CONFIGURE_EXAMPLES=ON
make ponca-examples // or make ponca_nanoflann
\endcode

\section nanoflann_comparison_sec API comparisons

Task | Ponca | Nanoflann
---------------- | ----------------------------------------------------- | -------------
KdTree Creation | \snippet ponca_nanoflann.cpp Create Ponca KdTree | \snippet ponca_nanoflann.cpp Create NanoFlann KdTree
Range Query | \snippet ponca_nanoflann.cpp Use Ponca KdTree | \snippet ponca_nanoflann.cpp Use NanoFlann KdTree

The fitting object is a Ponca::DryFit, an object that filter the neighbors according to their weight (out of scale points
are not counted), but do not perform any other computation:
\snippet ponca_nanoflann.cpp Define Fit Type

\section nanoflann_timings_sec Timings
The example output the time required to collect the neighbors, and the number of neighbors collected:
\code
Timings:
Raw : 0.168698
Ponca : 0.025475
Nanoflann : 0.027746
Number of neighbors:
Raw : 950618
Ponca : 950618
Nanoflann : 950618
\endcode

\section nanoflann_sourcecode_sec Example source code
Source file: `ponca_nanoflann.cpp`
\include ponca_nanoflann.cpp

*/
8 changes: 7 additions & 1 deletion doc/src/ponca_module_spatialpartitioning.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ namespace Ponca
\note As queries are objets that are independent from the KdTree, they can be created and used in parallel from
multiple threads.


\subsection spatialpartitioning_kdtree_examples Examples
KdTree usage is demonstrated both in tests and examples:
- `tests/src/basket.cpp`
- `tests/src/kdtree_knearest.cpp`
- `tests/src/kdtree_nearest.cpp`
- `tests/src/kdtree_range.cpp`
- `examples/cpp/nanoflann/ponca_nanoflann.cpp`

\subsection spatialpartitioning_kdtree_extending Extending KdTree
Ponca::KdTreeBase is a customizable version of Ponca::KdTree, which can be controlled using `Traits`.
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ add_dependencies(ponca-examples ponca_fit_line)
ponca_handle_eigen_dependency(ponca_fit_line)

add_subdirectory(pcl)
add_subdirectory(nanoflann)
8 changes: 8 additions & 0 deletions examples/cpp/nanoflann/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
project(Ponca_Example_Nanoflann LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_executable(ponca_nanoflann ponca_nanoflann.cpp)
target_include_directories(ponca_nanoflann PRIVATE ${PONCA_src_ROOT})
add_dependencies(ponca-examples ponca_nanoflann)
ponca_handle_eigen_dependency(ponca_nanoflann)
Loading

0 comments on commit 624d73f

Please sign in to comment.