Hello,

> Currently in my working example for the TriangleSampler I have not validated 
> the
> input is a triangle. I state that if the points are collinear then the 
> distribution of the samples is undefined.

That seems fine to me for the triangle case. If you attempted to validate the 
shape, you'd probably want
to use some sort of epsilon or type like Precision.DoubleEquivalence [1] to 
ensure that floating point errors
don't interfere with the validation. That seems overly complicated to me for 
this use case, though.

> I think that validation of the input shape is out of scope. Are shape
> samplers themselves also out of scope for RNG and would be a better fit in
> commons Geometry?

I agree with Gilles that it seems more out of scope to put RNG in geometry than 
vice versa.
Perhaps RNG could document that the input shapes are not validated or are only 
validated to
the minimum extent necessary to generate samples. Callers could then use 
geometry separately
to generate the correct shapes to supply to RNG.

Regards,
Matt J

[1] I'm starting to get used to the name, Gilles 🙂
________________________________
From: Gilles Sadowski <gillese...@gmail.com>
Sent: Friday, April 23, 2021 6:31 PM
To: Commons Developers List <dev@commons.apache.org>
Subject: Re: [RNG][Geometry] TriangleSampler and other shape samplers

Le ven. 23 avr. 2021 à 23:42, Alex Herbert <alex.d.herb...@gmail.com> a écrit :
>
> I recently added a UnitBallSampler to the sampling module to sample
> coordinates inside a unit ball. I also have a working TriangleSampler to
> sample within a triangle and intend to create a TetrahedronSampler to
> sample within a tetrahedron.
>
> Currently in the released version (1.3) we only have a UnitSphereSampler in:
>
> o.a.c.rng.sampling
>
> The only other package is o.a.c.rng.sampling.distribution for probability
> distributions.
>
> Should new coordinate based samplers be moved to a package inside for
> example:
>
> o.a.c.rng.sampling.geometry
> o.a.c.rng.sampling.shape

Maybe.  I guess that "UnitSphereSampler" would be moved too (and thus
deprecated in the package where it currently resides).

Do you foresee many "shapes"?
And a way to "combine" them?

> These shape samplers also require a valid input for the geometry. Currently
> in my working example for the TriangleSampler I have not validated the
> input is a triangle. I state that if the points are collinear then the
> distribution of the samples is undefined. It will not be uniform on the
> line segment connecting the vertices.
>
> I think that validation of the input shape is out of scope.

I'd tend to agree; otherwise, it would duplicate code that would certainly
also be needed in [Geometry].

> Are shape
> samplers themselves also out of scope for RNG and would be a better fit in
> commons Geometry?

At first sight, sampling codes would seem more out of scope in [Geometry]
than "shape" sampling in [RNG].


Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to