# Flatten mesh along curve

Say that I have a mesh and a curve. Then I can shrink-wrap the curve so it follows the mesh. Is it possible to flatten the mesh in the perpendicular direction to the curve to make space for a road along the curve.

Original cross-section:

New cross-section:

The road is supposed to go on the shelf.

Notice that this is a cross-section. The cross-section has a flat segment, but it may still have a gradient into the screen plane. This "Bulldozer" may use surface average, surface min, or surface max, computed along each cross-section the road passes, as reference for where to build the road.

In mathematical terms:

Let the initial elevation be z(x, y), and assume that z is differentiable. Then its gradient is

$$\nabla z = \frac{\partial z}{\partial x}\hat{\boldsymbol{x}} + \frac{\partial z}{\partial y}\hat{\boldsymbol{y}}$$

Without loss of generality, assume that the road is going in the $$x$$ direction. With this choice of coordinates, the figures shows the $$yz$$-plane. After the modifier, I want

$$\nabla z = \frac{\partial z}{\partial x}\hat{\boldsymbol{x}}$$

because there should be no slope orthogonal to the road. While the original solution fulfils this criterion (in fact, it sets $$\nabla z = 0$$ along the road), I do want to keep a non-zero $$x$$-derivative. You wouldn't push away an entire mountain to keep the road flat in all directions, would you?

Here is a picture: https://www.epikdrives.com/grossglockner-high-alpine-road, notice that the road keeps flat in one direction, but still has a non-zero derivative in the other direction. The "bulldozer" is required because any road as a non-zero thickness.

• hello could you please show some pictures of what you want? Commented Jun 24, 2022 at 6:11
• is geometry nodes ok as solution? Commented Jun 24, 2022 at 7:36
• @Chris Well, still on Blender 2.9, due to problems with upgrade on Ubuntu 20.04. Commented Jun 24, 2022 at 8:47
• Ok,then my answer makes no sense…but you should improve your question and copy the clarifications from comment into your question. Commented Jun 24, 2022 at 8:49
• @quellenform: Do you know about partial derivatives? Commented Jun 24, 2022 at 18:52

You can try ...

• Add a Curve - ShrinkWrap modifier to Landscape, Smooth modifier. Apply them.
• Add a Cube - Array > Fit Curve modifier, Curve Deform modifier

• For Landscape add Boolean modifier Target > Cube

Notes:

• Position Cube's origin at bottom face so you can easily scale road (be wider or cut higher)
• Delete Cube's front/back faces to avoid errors in boolean operation
• By changing Curve's Tilt you can fix or adjust road angle
• Moving some Curve's control points inside you can easily create a tunnel :)

• When I shrink-wrap a beveled curve, it becomes flat. Otherwise, I think it should work. Commented Jun 25, 2022 at 6:01
• Yes ..sorry for that ... Shrinkwrap was Apply before beveling ... I will edit answer later. Commented Jun 25, 2022 at 6:07
• What about "Modifier only changed to CV points" Commented Jun 25, 2022 at 6:12
• blender.stackexchange.com/questions/77390/…. Enable that, remove interpolation, and subdivide curve. Commented Jun 25, 2022 at 6:22
• Sorry didn't worked for me, but ... I rewrote answer - Cube with single Array and Curve Deform finally works the best for me ... and stay flexible for road adjustments. Origin moved at bottom face of Cube let me delete two other Array modifiers (used before) and simple scale Cube if needed road wider or cut higher. And relax some dramatic curvatures of road eliminated overlapping cubes array, so Remesh and Decimate (that was heaviest calculation I could delete as well (road is more also natural to real road to keep car's speed. Commented Jun 25, 2022 at 16:11