0

I want to create a 3D volume from the following set of data. Is there a function in Matlab that helps or do I need to construct more data vertices? Tried fill3() but that only creates the top and bottom surface, not the sides.

latitude    longitude   lowerAltitude   upperAltitude
-73.8124    40.6422        100             200 
-73.8119    40.6485        100             200 
-73.8377    40.6597        100             1500 
-73.86      40.6671        100             1600 
-73.8849    40.6377        100             1800 
-73.875     40.6302        100             1800 
-73.8525    40.6518        100             1600 
-73.8401    40.6539        100             1500 
-73.8124    40.6422        100             200 

Regards. BSL

Benjamin Levy
  • 333
  • 6
  • 19
  • Can you explain what does this data represent? (It is not clear to me how it is volumetric). If you can convert it to a voxel grid then you can use this function https://www.mathworks.com/matlabcentral/fileexchange/50802-voxelplotter – itzik Ben Shabat Sep 15 '17 at 12:02
  • Sure. It's supposed (upon completion) to be the volume of airspace with the lower altitude as the bottom surface, and the upper surface is of variable height. I suppose I can create sets of panels for the sides with each panel described as P[ j ] = [ lon[ j ] lat[ j ] lowAlt[ j ] ; lon[ j+1 ] lat[ j+1 ] lowAlt[ j+1 ]; lon[ j+1 ] lat [ j+1 ] upAlt[ j + 1 ] ; lon[ j ] lat[ j ] upAlt[ j ] ; lon[ j ] lat[ j ] lowAlt[ j ] ]; – Benjamin Levy Sep 15 '17 at 12:13
  • `patch` should help. See [this](https://stackoverflow.com/questions/30078436/matlab-3d-surface-plot) – shamalaia Sep 15 '17 at 12:57
  • Re: patch suggestion. I can use that to create my panels. But, to create a 3D object, don't I need to 'stitch' the panels together? End goal is to have a volume with nodal connectivity, s.t. I can test if a 3d point (lat, lon, alt) exists within the volume. I can do this in 2D by testing by slices, but it's a pain. – Benjamin Levy Sep 15 '17 at 13:00
  • If you have the mapping toolbox, you might find [this tutorial on plotting over a globe](https://uk.mathworks.com/help/map/examples/plotting-a-3-d-dome-as-a-mesh-over-a-globe.html) useful, it appears to use lat/long/alt data – Wolfie Sep 15 '17 at 13:06

2 Answers2

0

You can create a convex hull of the points that you have and visualize that surface. Note that you will need to rearrange your data to create two points for each line that you currently have. For example the first line in your example, need to be split in two points as follows. The three columns will be your X, Y, and Z.


latitude    longitude   Altitude 
-73.8124    40.6422        100
-73.8124    40.6422        200
MosGeo
  • 1,012
  • 9
  • 9
  • Convex hull for n-space exists in Matlab, yes. But the 2D projection of the perimeters are not convex in all cases. Some have concavities, so the convex hull will 'drape' a perimeter around the actual boundary and encompass space outside the actual perimeter. – Benjamin Levy Sep 15 '17 at 13:02
  • OK. The 'surf' suggestion makes progress. Question: the example of [ x, y, z ] = sphere( 20 ) creates three 21 x 21 matrices for x, y, z. These are accepted by surf() nicely. Is there some way to take my data and create the needed matrices? – Benjamin Levy Sep 15 '17 at 13:13
-1

Postscript. After due consideration of my goal of detecting a point (x,y,z) inside a 3d volume (X,Y,Z), I decided on a simple two-step approach. 1) detect the presence of the point in the X,Y perimeter with inpolygon. 2) If the x,y point is inside the bottom perimeter of the region as (X,Y, Z=Z0), then test for min(Z) <= z <= max(Z), where Z = f( X,Y) as contoured with X,Y points. Unless someone else has a more elegant solution, this will have to do. BTW, not really crazy about the contour() fxn in Matlab. But, using scattered interpolation for my upper boundary altitude (with lat, lon) would not work with Delaunay fxn (invalid TRI output).

Benjamin Levy
  • 333
  • 6
  • 19