Skip to content

Commit

Permalink
Change parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
nzfeng committed Aug 25, 2024
1 parent b97d026 commit aa53792
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docs/docs/surface/algorithms/surface_sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::vector<SurfacePoint> samples = poissonSampler.sample(); // sample using def

// Sample with some different parameters.
PoissonDiskOptions sampleOptions;
sampleOptions.r = 2.;
sampleOptions.minDist = 2.;
std::vector<SurfacePoint> newSamples = poissonSampler.sample(sampleOptions);
```
## Helper Types
Expand All @@ -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<SurfacePoint> pointsToAvoid`| `std::vector<SurfacePoint>()` | 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.
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.
4 changes: 2 additions & 2 deletions include/geometrycentral/surface/poisson_disk_sampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SurfacePoint> pointsToAvoid;
double rAvoidance = 1.0; // radius of avoidance
double minDistAvoidance = 1.0; // radius of avoidance
bool use3DAvoidance = true;
};

Expand Down
4 changes: 2 additions & 2 deletions src/surface/poisson_disk_sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ std::vector<SurfacePoint> 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.
Expand Down
2 changes: 1 addition & 1 deletion test/src/poisson_disk_sampler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit aa53792

Please sign in to comment.