-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Weighted Sample Elimination #8554
base: master
Are you sure you want to change the base?
Conversation
Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt
Outdated
Show resolved
Hide resolved
…Lists.txt Co-authored-by: Laurent Rineau <[email protected]>
added default file for example
Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt
Outdated
Show resolved
Hide resolved
renamed weight_functor to weight_function changed some default values of named parameters
530a4ee
to
679146f
Compare
smaller fixes
Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt
Outdated
Show resolved
Hide resolved
Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt
Show resolved
Hide resolved
Point_set_processing_3/examples/Point_set_processing_3/poisson_eliminate_example.cpp
Outdated
Show resolved
Hide resolved
Point_set_processing_3/examples/Point_set_processing_3/poisson_eliminate_example.cpp
Outdated
Show resolved
Hide resolved
Point_set_processing_3/test/Point_set_processing_3/test_poisson_eliminate.cpp
Outdated
Show resolved
Hide resolved
continue; | ||
|
||
const Point p2 = get(ipm, res[n]); | ||
double d2 = CGAL::to_double((p - p2).squared_length()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an approximate_something()
?? @sloriot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CGAL::approximate_sqrt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was more wondering if we have an approximate_squared_distance(p,q)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now using Kernel::compute_squared_distance_(2/3)_object or squared_distance_d_object depending on the Ambient_dimension of the Kernel.
integrating reviews
poisson_eliminate now works with d-dimensional points
/build:v0 |
The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/8554/v0/Manual/index.html |
The Poisson sample elimination is a greedy downsampling method that calculates a weight for each input point based on the density of its local neighborhood. Subsequently, the point with the highest weight is removed and the weights of the remaining points around it are updated until the target size is reached. A custom function to calculate the weight of a point can be provided. | ||
|
||
The Poisson sample elimination has the following parameters: | ||
- *dimensions*: The dimensions parameter specifies the dimension of the sampling domain of the point cloud, e.g., 2 if the point cloud is sampled from a surface, while the ambient dimension is typically 3. The default value is 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- *dimensions*: The dimensions parameter specifies the dimension of the sampling domain of the point cloud, e.g., 2 if the point cloud is sampled from a surface, while the ambient dimension is typically 3. The default value is 2. | |
- *dimension*: The dimension of the sampling domain of the point cloud, e.g., 2 if the point cloud is sampled from a surface, while the ambient dimension is typically 3. The default value is 2. |
|
||
The Poisson sample elimination has the following parameters: | ||
- *dimensions*: The dimensions parameter specifies the dimension of the sampling domain of the point cloud, e.g., 2 if the point cloud is sampled from a surface, while the ambient dimension is typically 3. The default value is 2. | ||
- *weight_function*: A custom *weight_function* can be provided to calculate the weight between two points. The type of the functor is as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- *weight_function*: A custom *weight_function* can be provided to calculate the weight between two points. The type of the functor is as follows: | |
- *weight_function*: A custom function can be provided to calculate the weight between two points. The type of the functor is as follows: |
double(*func)(const Point &p, const Point &n, double squared_distance, double r_max) | ||
\endcode | ||
The default weight is \f$\left(1 - \frac{d_{p,n}}{2r_{max}}\right)^8\f$ with \f$d_{p,n}\f$ being the distance between the point p and its neighbor n. | ||
- \f$r_{max}\f$: The \f$r_{max}\f$ parameter specifies the radius of the neighborhood, i.e., the neighboring points that are used to calculate the weight of a point. r_max has to be provided if a custom *weight_function* is used. Only points within a distance of \f$r_{max}\f$ are used to calculate the weight of a point. A large value can thus cause a large running time. The default is calculated based in the bounding volume \f$V\f$ of the input points, the *dimensions* parameter and the number of input points \f$N\f$: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- \f$r_{max}\f$: The \f$r_{max}\f$ parameter specifies the radius of the neighborhood, i.e., the neighboring points that are used to calculate the weight of a point. r_max has to be provided if a custom *weight_function* is used. Only points within a distance of \f$r_{max}\f$ are used to calculate the weight of a point. A large value can thus cause a large running time. The default is calculated based in the bounding volume \f$V\f$ of the input points, the *dimensions* parameter and the number of input points \f$N\f$: | |
- \f$r_{max}\f$: The \f$r_{max}\f$ parameter specifies the radius of the neighborhood, i.e., the neighboring points that are used to calculate the weight of a point. \f$r_{max}\f$ has to be provided if a custom *weight_function* is used. Only points within a distance of \f$r_{max}\f$ are used to calculate the weight of a point. A large value can thus cause a large running time. The default is calculated based in the bounding volume \f$V\f$ of the input points, the *dimensions* parameter and the number of input points \f$N\f$: |
|
||
/** | ||
\ingroup PkgPointSetProcessing3Algorithms | ||
Performs poisson disk elimination with a desired output size. A greedy method that calculates a weight based on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performs poisson disk elimination with a desired output size. A greedy method that calculates a weight based on the | |
performs poisson disk elimination with a desired output size. A greedy method that calculates a weight based on the |
\cgalNamedParamsEnd | ||
*/ | ||
template<class PointRange, class OutputIterator, class NamedParameters = parameters::Default_named_parameters> | ||
void poisson_eliminate(PointRange &points, std::size_t number_of_points, OutputIterator output, const NamedParameters& np = parameters::default_values()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if eliminate is the right word since output points are copied. Also, why is PointRange
not const? is it reordered?
Summary of Changes
For some other package we need a uniform sampling on a triangle mesh. There is a nice code for that in
cyCodeBase
.See also the publication at http://www.cemyuksel.com/research/sampleelimination/.
To get started I only add an example that exposes the
cy
-API, so that we can use the console application right away.Release Management
cyCodeBase
has a MIT license.