# Sweep, scale, and rotate implicit 3d region or contour plot along an arbitrary curve

Suppose I have a 3d region or contour that is implicitly defined and has no explicit parameterization. This is easy to plot, as RegionPlot3D and ContourPlot3D allow implicit functions.

But now I want to be able to arbitrarily transform the (portion of the) manifold in which this plot lives, stretching and rotating it as I please along an arbitrary curve (which remains embedded in R^3), perhaps in ways that at each point depend on the parameters and values of the curve, or the implicit function, etc., and have the plot of the region or contour follow smoothly along.

In more colloquial terms, I want to be able to wrap, stretch, scale, and/or twist the entire plot of an implicitly defined region or contour along an arbitrary curve. This is of course simple enough if you can parameterize both the region/contour and curve, using transformations and ParametricPlot3D.

This concept is also similar to "sweeping" a shape or surface along a curve, except what I'm sweeping is not a surface, but the coordinate frame in which I want a plot to live. I would also like to be able to do more than sweep the frame, to wit, I would like to be able to scale and rotate the frame (perhaps depending on values of the thing being plotted, or depending on values of the curve being swept along!) as I sweep.

What is the best way to go about doing something like this?

A comment requested an explicit example, and though literally any contour that can be plotted, along with any curve that can be plotted, is an explicit example, here are particular and arbitrary examples of these things:

A particular and arbitrary contour:

ContourPlot3D[

((Sin[2 x] + 2)*Abs[z])^2 + ((Sin[2 x] + 9)/8*Abs[y])^9 == 1

, {x, 0, 2 \[Pi]}
, {y, -1, 1}
, {z, -1, 1}

, MaxRecursion -> 1
, BoxRatios -> {\[Pi], 1, 1}

]


A particular and arbitrary curve:

ParametricPlot3D[

{2 t, (1 - t) Sin[t], (1 - t) Cos[t]}
, {t, 0, 4 \[Pi]}

]


Note: Please don't try to parameterize the contour, unless perhaps it's via some approximate numerical method that works on literally any plottable contour. The example provided is arbitrary, but simple enough to tell at a glance whether a desired frame sweeping/scaling/rotation transformation is taking place. I want to do this with contours that cannot be parameterized.

• Is the transformation always affine, or can it be nonlinear? For instance, translation, rotation, and scaling should not be too hard to do to an implicit equation... – J. M.'s torpor Feb 23 at 21:29
• The transformation can be anything, and can even be implicitly defined itself. Applying the transformation to the underlying implicit function being plotted is not hard, as I mentioned, Evaluate@With readily accomplishes this, and you can use NSolve to approximate the implicit mapping of each point being plotted. The problem is that the manifold doesn't change. If your plot lived in a 1x1x1 cube, your transformed plot still lives in that 1x1x1 cube. I want to transform the entire manifold, along with its contents. I don't want to scale up the Statue of David and see only his big toe. – Nickolas Feb 24 at 2:00
• "your transformed plot still lives in that 1x1x1 cube" - so, using Show[gr, PlotRange -> All] on the result of your transformation (which I called gr here) does not do what you want? It's hard to say anything meaningful without an explicit example other users can investigate. – J. M.'s torpor Feb 24 at 6:47
• Any plot that can exist is an explicit example. I have an implicitly defined point/line/surface/region plot which lives in R^3. Now pretend that my plot is colored clay, and its rectangular hull in R^3 is a solid block of transparent clay in which it is embedded. In the real world I could non-uniformly stretch, bend, and twist the whole shebang along any curve. I could roll it into a cylinder, form a depression with my thumb, even push my thumb through and make a hole. Assuming I can define those transformations (implicitly or parametrically), how do I get Mathematica to reflect them? – Nickolas Feb 24 at 8:56
• "explicit example" here is means you need to supply Mathematica code other people can run, e.g. something generating a plot of the surface you want to transform, and a specific transformation you want to do. Otherwise, there aren't that many people who would pay attention to your question. – J. M.'s torpor Feb 24 at 9:21