<p>You can use this formula on each edge where one point is &lt; isovalue and the other is > .
Then you link together the points belonging to the same square to form the edges of your iso-mesh. 
Then you make polygons by linking edges sharing a vertex. In case of more than 3 sides (could be up to 6), it's up to you to prefer spliting the polygon into triangles.</p>

CC BY-SA 3.0
2016-05-26T09:00:55.963Z
could you apply your thinking to my example as stated above? I did not get the grasp of your method.
john john
CC BY-SA 3.0
2016-05-26T15:50:39.080Z
If fact I'm not sure what you meanhere by "interpolate". If what you aim at is a mesh, your formula directly give the *position* where the isoval cross an edge. Then you obtain the mesh by connecting these points.
Fabrice NEYRET
CC BY-SA 3.0
2016-05-27T08:08:52.733Z
What I do not understand, is where you put what in the formula. I know that in V1 and in V2 I should replace the values from the vertices but in P1 and P2 I have no clue what I should put there? Can you give me a hint how it works in the current example?
john john
CC BY-SA 3.0
2016-05-27T11:18:50.863Z
P1 and P2 are the coordinates of the segment extremities.
Fabrice NEYRET
CC BY-SA 3.0
2016-05-25T21:01:16.457Z
2016-05-25T21:01:16.457Z
Fabrice NEYRET
<p>P1 and P2 in this case represent the actual <em>coordinates</em> of the vertices of the cube in your output mesh. These might be the same as the input coordinates of the function you're using, or they might not be, it's entirely up to you how you output them. A simple way to map them would be to just use integer coords, biased by half the resolution of your sample volume - so a mesh spanning 100^3 cubes would have coordinates from -50 to 50 on each axis.</p>

<p>So in the formula you describe, (iso - V1) / (V2 - V1) gives you the amount to interpolate by, and (P2 - P1) is a vector representing a single cube lattice edge along the axis you want.</p>

<p>Let's assume we're using unit sized cubes, +Y is up, and +Z is 'into' the screen.</p>

<p>In your cube above, you will have crossings on the three edges coming from the left-bottom-front corner. On the X and Z edges you will interpolate by 0.25 : (0 - (-1)) / (3 - (-1)) , and on the Y edge you will interpolate by 0.5.</p>

<p>So if the left-bottom-front corner is at the origin, your three mesh vertices will be at 
&lt;0.25, 0, 0> , 
&lt;0, 0.5, 0> and 
&lt;0, 0, 0.25>.</p>

<p>Apply the same formula to the right-top-back corner and you get &lt;0.5, 1, 1>, &lt;1, 0.5, 1> and &lt;1, 1, 0.5></p>

<p>The only difference is the left-bottom-front corner values will be P1 and V1 in your formula as it is at the 'negative' end of the edges to be interpolated, and the right-top-back values will be P2 and V2 as it is at the 'positive' end.</p>

<p>Hope that all makes sense.</p>

CC BY-SA 3.0
2016-05-27T09:02:37.070Z
I do not understand what you mean though in the last paragraph. Could you elaborate more on that ? For example, what do you mean by 'negative' and 'positive' end ?
john john
CC BY-SA 3.0
2016-05-30T07:30:24.077Z
Say your cube is at position 0 on each axis in your volume, then it will fill the space from position 0 to position 1. So the left side of your cube will be at X=0 and the right side will be at X=1, same for the other two axes. So you use P1 and V1 for the edge end with the lower coordinate value and P2 and V2 for the end with the higher value.
russ
CC BY-SA 3.0
2016-05-27T08:35:44.453Z
2016-05-27T08:44:03.607Z
2016-05-27T08:44:03.607Z
russ
<p>Let's assume I have the following cube.</p>

<p><a href="https://i.sstatic.net/zyfHW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zyfHW.png" alt="enter image description here"></a></p>

<p>Let's assume the isovalue = 0. I would like to draw the resulting triangles of the isosurface.</p>

<p>I know that first I define which values are inside or outside comparing them to the given isovalue and after that we correspond to a particular list of edges.</p>

<p>After that, we have somehow to linearly interpolate the points.
I have read on an article that using this formula $P = P_1 + \frac{(iso -V_1)(P_2-P_1)}{V_2-V_1}$ we can get the interpolated values. </p>

<p>Can someone demonstrate to me how I can interpolate the points in this case ? </p>

<algorithm><interpolation>
Linear interpolation on Plane (Marching Cubes)
john john
# Linear interpolation on Plane (Marching Cubes)

(Asked by: username_0 on 2016-05-25)

Let's assume I have the following cube.

[![enter image description here](https://i.sstatic.net/zyfHW.png)](https://i.sstatic.net/zyfHW.png)

Let's assume the isovalue = 0. I would like to draw the resulting triangles of the isosurface.

I know that first I define which values are inside or outside comparing them to the given isovalue and after that we correspond to a particular list of edges.

After that, we have somehow to linearly interpolate the points.
I have read on an article that using this formula $P = P\_1 + \frac{(iso -V\_1)(P\_2-P\_1)}{V\_2-V\_1}$ we can get the interpolated values.

Can someone demonstrate to me how I can interpolate the points in this case ?

**Tags:** algorithm, interpolation


---

## 2 answers

### Answer by username_2 on 2016-05-27. Score: 2

P1 and P2 in this case represent the actual *coordinates* of the vertices of the cube in your output mesh. These might be the same as the input coordinates of the function you're using, or they might not be, it's entirely up to you how you output them. A simple way to map them would be to just use integer coords, biased by half the resolution of your sample volume - so a mesh spanning 100^3 cubes would have coordinates from -50 to 50 on each axis.

So in the formula you describe, (iso - V1) / (V2 - V1) gives you the amount to interpolate by, and (P2 - P1) is a vector representing a single cube lattice edge along the axis you want.

Let's assume we're using unit sized cubes, +Y is up, and +Z is 'into' the screen.

In your cube above, you will have crossings on the three edges coming from the left-bottom-front corner. On the X and Z edges you will interpolate by 0.25 : (0 - (-1)) / (3 - (-1)) , and on the Y edge you will interpolate by 0.5.

So if the left-bottom-front corner is at the origin, your three mesh vertices will be at
<0.25, 0, 0> ,
<0, 0.5, 0> and
<0, 0, 0.25>.

Apply the same formula to the right-top-back corner and you get <0.5, 1, 1>, <1, 0.5, 1> and <1, 1, 0.5>

The only difference is the left-bottom-front corner values will be P1 and V1 in your formula as it is at the 'negative' end of the edges to be interpolated, and the right-top-back values will be P2 and V2 as it is at the 'positive' end.

Hope that all makes sense.

> **Comments:**
> **username_0**: I do not understand what you mean though in the last paragraph. Could you elaborate more on that ? For example, what do you mean by 'negative' and 'positive' end ?  
> **username_2**: Say your cube is at position 0 on each axis in your volume, then it will fill the space from position 0 to position 1. So the left side of your cube will be at X=0 and the right side will be at X=1, same for the other two axes. So you use P1 and V1 for the edge end with the lower coordinate value and P2 and V2 for the end with the higher value.  

---

### Answer by username_1 on 2016-05-25. Score: 1

You can use this formula on each edge where one point is < isovalue and the other is > .
Then you link together the points belonging to the same square to form the edges of your iso-mesh.
Then you make polygons by linking edges sharing a vertex. In case of more than 3 sides (could be up to 6), it's up to you to prefer spliting the polygon into triangles.

> **Comments:**
> **username_0**: could you apply your thinking to my example as stated above? I did not get the grasp of your method.  
> **username_1**: If fact I'm not sure what you meanhere by "interpolate". If what you aim at is a mesh, your formula directly give the *position* where the isoval cross an edge. Then you obtain the mesh by connecting these points.  
> **username_0**: What I do not understand, is where you put what in the formula. I know that in V1 and in V2 I should replace the values from the vertices but in P1 and P2 I have no clue what I should put there? Can you give me a hint how it works in the current example?  
> **username_1**: P1 and P2 are the coordinates of the segment extremities.  

---

