g/s/surface: test first poisson candidate against AcceptT
This commit is contained in:
parent
98d8bd4c8e
commit
b2abc7e7f8
@ -55,7 +55,7 @@ namespace cruft::geom::sample {
|
|||||||
GeneratorT &&gen,
|
GeneratorT &&gen,
|
||||||
AcceptT &&accept,
|
AcceptT &&accept,
|
||||||
DistanceT &&minimum_distance,
|
DistanceT &&minimum_distance,
|
||||||
std::size_t candidates_count
|
std::size_t const candidates_count
|
||||||
) {
|
) {
|
||||||
using point_type = decltype (sampler.eval (gen));
|
using point_type = decltype (sampler.eval (gen));
|
||||||
using value_type = typename point_type::value_type;
|
using value_type = typename point_type::value_type;
|
||||||
@ -63,9 +63,20 @@ namespace cruft::geom::sample {
|
|||||||
std::vector<point_type> selected;
|
std::vector<point_type> selected;
|
||||||
std::vector<point_type> candidates;
|
std::vector<point_type> candidates;
|
||||||
|
|
||||||
// prime the found elements list with an initial point we can
|
// Prime the found elements list with an initial point we can
|
||||||
// perform distance calculations on
|
// perform distance calculations on.
|
||||||
|
for (std::size_t i = 0; i < candidates_count; ++i) {
|
||||||
|
auto const p = sampler.eval (gen);
|
||||||
|
if (!accept (p))
|
||||||
|
continue;
|
||||||
|
|
||||||
selected.push_back (sampler.eval (gen));
|
selected.push_back (sampler.eval (gen));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We couldn't find an initial candidate so abort.
|
||||||
|
if (selected.empty ())
|
||||||
|
return selected;
|
||||||
|
|
||||||
// keep trying to add one more new point
|
// keep trying to add one more new point
|
||||||
while (1) {
|
while (1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user