Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, I was going to say that this could easily be done using <code>TriScatteredInterp()</code> on <code>PointsH</code>. I realised that it was not that simple to get it to produce what I wanted. I resorted to adding extra points and moving them around to create the right interpolation triangles.</p> <p>I finally got something that can produce the z-value corresponding to the point (a,b).</p> <p>Here is what I ended up doing...</p> <pre><code>epsilon = 1e-8; PointsL_diff = epsilon*[ [ -1 0 0] % P1 [ 0 -1 0] [ 0 -1 0] [ 1 0 0] [ 0 -1 0] % added [ 1 -1 0] [ 1 0 0] % P5 [ 0 -1 0] [ 1 1 0] [ 1 1 0] [ 0 1 0] [ 1 0 0] % added [ 0 1 0] [ -1 0 0] % P10 [ 0 1 0] % added [ -1 1 0] [ -1 1 0] [ -1 0 0] [ 0 -1 0] % added [ -1 -1 0] [ -1 1 0] % P15 [ -1 0 0] [ 0 1 0] % added [ -1 -1 0] [ -1 -1 0] % P18 ]; PointsL = [ [ 32 0 0] % P1 [ 32 0 0] % added [387 0 0] [475 0 0] [475 0 0] % added [475 30 0] [602 30 0] % P5 [602 30 0] % added [602 220 0] [475 220 0] [475 737 0] [475 737 0] % added [387 737 0] [ 32 737 0] % P10 [ 32 737 0] % added [ 32 555 0] [ 0 555 0] [ 0 277 0] [ 0 277 0] % added [ 27 277 0] [ 27 250 0] % P15 [ 0 250 0] [ 0 250 0] % added [ 0 57 0] [ 32 57 0] % P18 ]; PointsH = [ [ 32 0 270] % P1 [387 0 270] [475 0 183] [475 30 183] [602 30 183] % P5 [602 220 183] [475 220 183] [475+epsilon 220 183] % added [475 220+epsilon 183] % added [475 737 183] [387 737 270] [387 220 270] % added [ 32 737 270] % P10 [ 32 555 270] [ 0 555 270] [ 0 277 270] [ 27 277 270] [ 27 250 270] % P15 [ 0 250 270] [ 0 57 270] [ 32 57 270] % P18 ]; % plot bounds x_min = -200; x_max = 800; y_min = -200; y_max = 800; newPointsL = PointsL + PointsL_diff; x = [PointsH(:,1); newPointsL(:,1); x_min; x_max; x_min; x_max]; y = [PointsH(:,2); newPointsL(:,2); y_min; y_min; y_max; y_max]; z = [PointsH(:,3); newPointsL(:,3); 0; 0; 0; 0]; F = TriScatteredInterp(x,y,z); % default is linear interpolation % find z-value for point (a,b) a = 100; b = 200; z_value = F(a,b) % generate mesh and plot surface ti_x = x_min:10:x_max; ti_y = y_min:10:y_max; [qx,qy] = meshgrid(ti_x,ti_y); qz = F(qx,qy); mesh(qx,qy,qz); hold on; plot3(x,y,z,'o'); </code></pre> <p>... and here is the figure the code produces:</p> <p><img src="https://i.stack.imgur.com/mSB9F.jpg" alt="Mesh of simple building."></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload