# Objective:

Learn how to blend TPMS (and lattices) without using the Mix block.

• ModelIng
• Lattices

# Procedure:

### Using a Sine Wave transition 1. Create two bodies with the TPMS or Lattice of your choice. Make these the same size.

• For the Field input:
• Create the equation sin (x/10) using Math blocks.
• Add an Absolute (Abs) block and insert your equation so only the absolute values are returned.
• Set the In min to 0
• Set the In max to 1
• Set the Out min to your TPMS body
• Set the Out max to your second TPMS body

When the value is 0, it will be the first TPMS body. When it is at 1, it will be the second TPMS body. You can change the TPMS body for any lattice body. With this method, you can get creative and change the equation around. ### Inverse Distance Weighting

This method uses inverse distance weighting

You provide points (corresponding to the interpolation centers) and an exponent which controls the decay. As the exponents go to minus infinity, one gets a sharp boolean union of the Voronoi regions of the points. In the gif, you can see how the wiggling of the exponents changes the transition regions. Custom block, the Shepard Equation

• Interpolation Point input: the interpolation center for that TPMS.
• Decay Exponent input: the decay exponent. (These values can be the same for each body or vary, depending on the blend you want).

For two TPMS bodies, the equation looks like this:

`(TPMS1 * Shepard Equation1) + (TPMS2 * Shepard Equation2) / (Shepard Equation1 + Shepard Equation2)`

For three TPMS bodies, the equation looks like this:

`(TPMS1 * Shepard Equation1) + (TPMS2 * Shepard Equation2) + (TPMS3 * Shepard Equation3) / (Shepard Equation1 + Shepard Equation2 + Shepard Equation3)`

#### To create this method in nTop:

1. Create three bodies with the TPMS or Lattice of your choice. Make these the same size.

2. Create a Point for each interpolation center. We are using a Polygon to create three points on the same plane, but any method for creating points works.

3. Import the Shepard Equation custom block.

• Right-click on the Decay Exponent to create a variable (we are going to use the same value for each body)

4. Create a Shepard Equation block for each TPMS body. Use the Interpolation point that relates to each body.

5. Create the equation from above to build the TPMS transitions. You can use TPMS equations with an interpolator to create a blend.

We want to interpolate from "x" to "a * x + b".  Therefore, we introduce a parameter t in [0, 1] and produce:

`t * a * x + (1 - t) * x + t * b or (t * a + (1 - t)) * x + t * b When t = 0, the expressions reduce to "x".  When t = 1, it's "a * x + b".`

`1.1*(sin(2*x)*sin(z)*cos(y)+sin(2*y)*sin(x)*cos(z)+sin(2*z)*sin(y)*cos(x))-0.2*(cos(2*x)*cos(2*y)+cos(2*y)*cos(2*z)+cos(2*z)*cos(2*x))-0.4*(cos(2*x) + cos(2*y) +cos(2*z))`

This method implements the expression above, with an interpolator, so it's equivalent to the Gyroid at param = 0 and the Split P at param = 1. Download the example file to see how this method is created in nTop.

And that’s it! You’ve successfully learned several different methods to blend TPMS without the mix block

Are you still having issues? Contact the support team, and we’ll be happy to help!

# Keywords:

tpms blend how-to weighting distance equation mix inverse