# Two-directional mapping / conformal mapping

I’m unsure exactly what to call this, so please bear with me as I try and describe it. Have a look at the image below.

Suppose I’ve designed a repeating patterned design (top image), but I want to fit it to an object which varies in width (e.g. a knife handle). The simple approach I’ve found is to use flow along surface to map the design from its original rectangular shape to the varying-width shape (after using 2-rail sweep to create a surface suitable for flowing onto). This works, but as you can see (second image from top) the design is only stretched vertically to fit into the shape, it isn’t altered horizontally. As a result, the center portion looks stretched vertically, but the right-hand portion looks squashed.

To get around this, I figured out a way of non-uniformly stretching the original design horizontally in such a way (third image from top) that when it’s flowed to the final shape, everything looks correct. For example, I’ve stretched the middle portion horizontally and squashed the right-hand portion. This now looks great (bottom image) but it’s a bit of a pain to do, as it involves creating a curve whose slope is the integral of the width of the shape, then doing several projecting/draping operations to distort the original design.

The proper term for all this seems to be “conformal mapping” which preserves angles but allows the design to scale. However, my searches for conformal mapping all led down a rabbit hole of incomprehensible maths.

If you’re still awake, I’m wondering if there is any simpler way of achieving what I’m trying to do? Given a repeating pattern that’s initially drawn on a regular, square grid, and an arbitrary shape that I want to map it to, how could this be done? I’m guessing there will be some clever trick involving Grasshopper, but I’m afraid I don’t know enough about it to experiment.

Hello- you may be able to get somewhere with a `CageEdit` (using a surface as the control) of the design, to pre-deform

Flowing with history on may then let you adjust the cage till it looks right.
Hm - that almost looks like it might work but the History makes some extra curves so hard to see what is going on - I’ll play some more.

-Pascal

1 Like

Hello, thanks for the tip! That’s exremely helpful - I haven’t actually used Cage Edit much before, but this achieves very close results, and it’s way more direct than the rigmarole I had to go through before. And the ability to have it update live, with the history turned on, very useful.