Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high level methods for sliceplot and lineplot #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pjaap
Copy link
Member

@pjaap pjaap commented Jan 31, 2025

This is based on WIAS-PDELib/GridVisualizeTools.jl#20

Implementation of high level methods for line and slice plotting.
The user only has to provide a generic line or plane definition to obtain a plot.

The new coordinate systems are created by isometric rotation and therefore the angles are invariant.

Examples:

grid = simplexgrid(-1.0:0.01:1.0, -1.0:0.01:1.0)
f = map(x -> x[2]*x[1], grid)
line = [1,1,0] # plot along x + y = 0
lineplot(grid, f, line, Plotter=GLMakie)

grafik

grid = simplexgrid(-1.0:0.1:1.0, -1.0:0.1:1.0, -1.0:0.1:1.0)
f = map(x -> x[2]*x[1], grid)
plane = [1,1,0,-1.51] # plot along x + y + 0z = 1.51
sliceplot(grid, f, plane, Plotter=GLMakie) 

grafik

Note that the intersection is about of size 2 x 0.75 in the new transformed coordinates.

There is a bug in marching_tetrahedra, creating some holes in the plot if the tetrahedra are sliced along the facets:

plane = [1,1,0,-1.5] # plot along x + y + 0z = 1.5

grafik

@j-fu
Copy link
Member

j-fu commented Feb 3, 2025

Ah cool - this seems to work without need to interfere with the plotting backend code.

As for the naming: in fact, these are still scalarplots after all.

An alternative would be to just use the scalarplot method and to add a hyperplane
kwarg. So we could have

scalarplot(grid, f; hyperplane=[1,1,0],Plotter=GLMakie)

@pjaap
Copy link
Member Author

pjaap commented Feb 10, 2025

Sorry for the late answer. I somehow missed it.

Thanks for the positive feedback. I like your naming suggestion to keep it as scalarplot.
However, a hyperplane is usually used for more than three dimensions, right?
We already have the planes kwarg, which is too similar to plane.

I think the cleanest solution is slice = Plane(a,b,c,d) for an explicit dummy class Plane. And Line(a,b,c) for the line plot.
Then, we can elegantly document the plane equation coefficients.

@j-fu
Copy link
Member

j-fu commented Feb 10, 2025

IMHO "hyperplane" is the dimension independent name for an n-1 dimensional affine subspace.
So a line is a hyperplane in 2D, and a plane is a hyperplane in 3D. I am really a fan of dimension independent naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants