Open henry2004y opened 2 years ago
It is a great work, I try it works.
Can we create an oblique slice from any kind of functions in 3 dimension, e.g. f(x,y) = x^2 + y^2 ?
Can we create an oblique slice from any kind of functions in 3 dimension, e.g. f(x,y) = x^2 + y^2 ?
If you mean f(x,y,z) = x^2 + y^2 + z^2
, with this kind of approach we first need to generate a discrete 3d array from the analytical formula. Something like
point = [4.0,4.0,6.0]
normal = [1,1,1]
v = [x^2 + y^2 + z^2 for x in 0:1.0:10, y in 0:1.0:10, z in 0:1.0:10]
slice, XData, YData, ZData = obliqueslice(v, point, normal)
should work? The tricky part may be how to handle the size of oblique slices, and what values to set for outliers.
It works, but I still need to learn oblique slice more.
It maybe nice to have a similar feature like
obliqueslice
in MATLAB. I now have an ugly but working script:A simple comparison shows identical results with MATLAB defaults:
Julia:![obliqueslice_julia](https://user-images.githubusercontent.com/20110816/177791609-33161f67-f583-41cb-8c89-8e17346988cc.png)
MATLAB:![obliqueslice_matlab](https://user-images.githubusercontent.com/20110816/177791666-889a71b0-9903-4be6-ad26-0084de021a5e.jpg)
Is this already available somewhere in Makie? If not, please consider adding a similar feature like this! The sample code above is not so elegant, but simply for demonstration purpose.