11
$\begingroup$

This came up in a different context but some expertise in 3D surfaces or the graphic options would be appreciated. I'm trying to extrapolate the curves from any given surface and things seem to be going quite smoothly. All the curves can be grabbed in one more step as a GraphicsComplex. Perfect for more processing. However, now I'm trying to rotate the isolines to get even more control. This is possible in other software but I'm not sure how it was achieved. I assume there is some way to use the MeshFunction to rotate the Mesh through at least 45 degrees but all my searching hasn't brought up anything helpful. A less practical approach might be to find the intersecting curve of a regularly spaced vertical planes.

Plot3D[Cos[(x y)/2], {x, 0, 4}, {y, 0, 8},
BoxRatios->{4,8,1},
Boxed->False,
Axes->False,
ImageSize->Large,
Mesh->{3,8},
PlotStyle->Directive[Lighting->"Neutral",FaceForm[White,Specularity[0.2,10]]]]

enter image description here

enter image description here

$\endgroup$
13
$\begingroup$

Since we have the identity

RotationMatrix[θ] == {AngleVector[-θ], AngleVector[π/2 - θ]}

one can use this to construct a mesh that is arbitrarily oriented; e.g.

Manipulate[Plot3D[Cos[x y/2], {x, 0, 4}, {y, 0, 8}, BoxRatios -> Automatic, 
                  MeshFunctions -> {AngleVector[-θ].{#, #2} &,
                                    AngleVector[π/2 - θ].{#, #2} &},
                  PlotStyle -> Directive[Lighting -> "Neutral",
                                         FaceForm[White, Specularity[0.2, 10]]]],
           {θ, 0, 2 π}]

Manipulate demo

Note that this rotates the mesh clockwise; use MeshFunctions -> {AngleVector[θ].{#, #2} &, AngleVector[π/2 + θ].{#, #2} &} instead if the anticlockwise version is desired.

$\endgroup$
  • $\begingroup$ (If anyone is kind enough to edit my post to include the resulting image, please do so.) $\endgroup$ – J. M.'s technical difficulties Feb 25 '19 at 6:56
  • $\begingroup$ done (I took the liberty to replace the With with Manipulate to better show the advantages of this method) $\endgroup$ – Lukas Lang Feb 25 '19 at 8:40
  • $\begingroup$ Thanks a lot, @Lukas! The Manipulate[] is indeed much nicer. $\endgroup$ – J. M.'s technical difficulties Feb 25 '19 at 9:31
7
$\begingroup$

You can use MeshFunctions -> (Function /@ (RotationMatrix[θ].{#, #2})) to rotate by angle θ:

θ = 75 Degree;
meshfunctions = Function /@ (RotationMatrix[θ].{#, #2});

Plot3D[Cos[x y/2], {x, 0, 4}, {y, 0, 8}, 
 MeshFunctions -> meshfunctions, Mesh -> {3, 8},
 BoxRatios -> {4, 8, 1}, Boxed -> False, Axes -> False, 
 ImageSize -> Large, 
 PlotStyle -> Directive[Lighting -> "Neutral", FaceForm[White, Specularity[0.2, 10]]]]

enter image description here

For 45 Degree rotation you can use the simpler MeshFunctions -> {# + #2 &, # - #2 &} to get

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.