Plotting a distribution of planes

A distribution of planes is an map that assigns a plane to each point of space. For example:

A distribution can be defined by giving a field of normal vectors to the planes (more precisely, a one-form). In the case above, the normal vectors are [y,0,1].

How would you create a function for plotting distributions in Julia? Which package would you use?

2 Likes

Hi @mlainz,

Here is a possible approach to construct the array. The packages that I loaded are LazySets.jl, Polyhedra.jl and Makie.jl.

using LazySets, Makie, Polyhedra
using LazySets: HalfSpace, Hyperplane, translate # fix namespace conflicts

# x and y ranges
yrange = range(-2, 2, step=0.4)
xrange = copy(yrange)

# distribution of planes
planes = [Hyperplane([y, 0, 1], 0.0) for y in yrange];

# intersect with bounding box
box = BallInf(zeros(3), 0.1)
patches = [intersection(p, box) for p in planes];

# translate along x and y directions
vec = [translate(p, [x, -y, 0]) for x in xrange for (p, y) in zip(patches, yrange)];

Result:

# plot the array (FIXME: plot3d(vec), etc.)
plot3d(vec[1]); [plot3d!(vec[i]) for i in 2:length(vec)-1]; plot3d!(vec[end])

1 Like

Thank you!
I will try to create a Plot recipe with that code.

1 Like