From aa53792b21ca2a1b02ca38a9f14411d721f4c20e Mon Sep 17 00:00:00 2001 From: nzfeng Date: Sun, 25 Aug 2024 10:52:01 -0400 Subject: [PATCH] Change parameter names --- docs/docs/surface/algorithms/surface_sampling.md | 8 ++++---- include/geometrycentral/surface/poisson_disk_sampler.h | 4 ++-- src/surface/poisson_disk_sampler.cpp | 4 ++-- test/src/poisson_disk_sampler_test.cpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/docs/surface/algorithms/surface_sampling.md b/docs/docs/surface/algorithms/surface_sampling.md index 379e0ec4..3eba7d50 100644 --- a/docs/docs/surface/algorithms/surface_sampling.md +++ b/docs/docs/surface/algorithms/surface_sampling.md @@ -46,7 +46,7 @@ std::vector samples = poissonSampler.sample(); // sample using def // Sample with some different parameters. PoissonDiskOptions sampleOptions; -sampleOptions.r = 2.; +sampleOptions.minDist = 2.; std::vector newSamples = poissonSampler.sample(sampleOptions); ``` ## Helper Types @@ -56,10 +56,10 @@ Options are passed in to `options` via a `PoissonDiskOptions` object. | Field | Default value |Meaning| |---|---|---| -| `#!cpp double r`| `1` | The minimum distance between samples, expressed in world-space units. | +| `#!cpp double minDist`| `1` | The minimum distance `r` between samples, expressed in world-space units. | | `#!cpp int kCandidates`| `30` | The number of candidate points chosen from the (`r`,2`r`)-annulus around each sample. | | `#!cpp std::vector pointsToAvoid`| `std::vector()` | Points which samples should avoid. | -| `#!cpp double rAvoidance`| `1` | The radius of avoidance around each point to avoid, expressed in world-space units. | +| `#!cpp double minDistAvoidance`| `1` | The radius of avoidance around each point to avoid, expressed in world-space units. | | `#!cpp bool use3DAvoidance`| `true` | If true, the radius of avoidance will specify a solid ball in 3D space around which samples are avoided. Otherwise, samples are avoided within a geodesic ball on the surface. | -Using the `use3DAvoidance` option, the radius of avoidance `rAvoidance` can specify either the radius in 3D space, or in terms of distance along the surface. The former will produce a radius of avoidance that will appear perfectly round, and is likely more visually pleasing, but for very large radii may occlude samples from opposite sides of the mesh. The latter will restrict the radius of avoidance to only be along the surface, but such a metric ball may not appear perfectly round, especially in areas with very large changes in curvature. \ No newline at end of file +Using the `use3DAvoidance` option, the radius of avoidance `minDistAvoidance` can specify either the radius in 3D space, or in terms of distance along the surface. The former will produce a radius of avoidance that will appear perfectly round, and is likely more visually pleasing, but for very large radii may occlude samples from opposite sides of the mesh. The latter will restrict the radius of avoidance to only be along the surface, but such a metric ball may not appear perfectly round, especially in areas with very large changes in curvature. \ No newline at end of file diff --git a/include/geometrycentral/surface/poisson_disk_sampler.h b/include/geometrycentral/surface/poisson_disk_sampler.h index 2451be05..2d34c821 100644 --- a/include/geometrycentral/surface/poisson_disk_sampler.h +++ b/include/geometrycentral/surface/poisson_disk_sampler.h @@ -8,10 +8,10 @@ namespace geometrycentral { namespace surface { struct PoissonDiskOptions { - double r = 1.0; // minimum distance between samples + double minDist = 1.0; // minimum distance r between samples int kCandidates = 30; // number of candidate points chosen from the (r,2r)-annulus around each sample std::vector pointsToAvoid; - double rAvoidance = 1.0; // radius of avoidance + double minDistAvoidance = 1.0; // radius of avoidance bool use3DAvoidance = true; }; diff --git a/src/surface/poisson_disk_sampler.cpp b/src/surface/poisson_disk_sampler.cpp index 49296dc7..afb70cdd 100644 --- a/src/surface/poisson_disk_sampler.cpp +++ b/src/surface/poisson_disk_sampler.cpp @@ -252,14 +252,14 @@ std::vector PoissonDiskSampler::sample(const PoissonDiskOptions& o clearData(); // Set parameters. - rMinDist = options.r; + rMinDist = options.minDist; sideLength = rMinDist / std::sqrt(3.0); kCandidates = options.kCandidates; pointsToAvoid = options.pointsToAvoid; // Add points to avoid. for (const SurfacePoint& pt : pointsToAvoid) { - addPointToSpatialLookupWithRadius(pt, options.rAvoidance, options.use3DAvoidance); + addPointToSpatialLookupWithRadius(pt, options.minDistAvoidance, options.use3DAvoidance); } // Carry out sampling process for each connected component. diff --git a/test/src/poisson_disk_sampler_test.cpp b/test/src/poisson_disk_sampler_test.cpp index 9e2690c5..71db4aa4 100644 --- a/test/src/poisson_disk_sampler_test.cpp +++ b/test/src/poisson_disk_sampler_test.cpp @@ -24,7 +24,7 @@ size_t sampleSquareDisk(double width, double sampling_distance) { std::tie(mesh, geometry) = makeManifoldSurfaceMeshAndGeometry(simpleMesh.polygons, simpleMesh.vertexCoordinates); PoissonDiskOptions options; - options.r = sampling_distance; + options.minDist = sampling_distance; // make tests reproducible geometrycentral::util_mersenne_twister.seed(101);