Which package to use as a dependency for geometric primitives?

I need to create method dispatch on geometric primitives: hypersphere and hyperrectangle (i want to create samplers that randomly sample points uniformly within these primitives).

I don’t want to re-define types for the primitives as I am sure there are several around. Which one to use? I want to avoid name clashes if e.g., someone uses Makie, then the same name should be used for a 3-sphere.

Can someone instruct me on which dependency to use, and how are hyperspheres and hyperrectangles called in this dependency?

I suppose you are looking for GeometryBasics.jl ?


The primitives defines therein are used by Makie.

We have all that implemented in Meshes.jl already @Datseris:

Check the latest documentation, which is hosted in a separate repo as we transition to out-of-repo docs:


In particular, check the sampling section:


These sampling algorithms are used in GeoStats.jl to define spatial sthocastic processes:


There you will find examples with samples over the sphere.


There’s DomainSets.jl that provides sets like hyperrects, spheres, and more. It builds on the very widely used IntervalSets.jl. Not sure about Makie and names it uses though.

@juliohm thanks, a question: how does this functionality scale with dimension? I am guessing you also use internally tuples to represent vectors. So this would mean that this functionality does not scale well as the state space dimension increases to much larger than 10?

That is correct @Datseris , our use cases are mainly 2D and 3D geometric processing. We did not aim for higher-dimensional spaces. I think you will not find a package that has this goal currently.

Ehm… (: No problems with arbitrary-dim spaces:

julia> using DomainSets

julia> Ball(10, [1,2,3])
Ball(10, [1, 2, 3])

julia> Ball(10, 1:1000)
Ball(10, [1, 2, 3, 4, ..., 999, 1000])

julia> Rectangle([i..(i+1) for i in 1:10^3])
(1..2) × (2..3) × (3..4) × ... × (1000..1001)

It uses whatever containers you provide: svectors, vectors.
Not that well-documented, but lots of shape definitions there.

1 Like

Sorry, I meant with geometric processing and visualization features. Creating a sphere in D dimensions is trivial indeed :slight_smile: