3
$\begingroup$

I'm trying to animate the idea that values of $\sin x$ are concentrated around -1 and 1. Looking at the sine curve from the side, middle should be lighter than the edges.

My first attempt doesn't communicate this properly, color is the same no matter what the thickness is. Any better ideas?

enter image description here

steps = 5;
v1 = {0, 0, 100};
v2 = {100, 0, 0};
blendViewpoints[v1_, v2_, t_] := 
  With[{angle = t*Pi/2}, v1*Cos[angle] + v2*Sin[angle]];
R = ParametricRegion[{{s, Sin[s] + tt}, 
    0 <= s <= 2 Pi && 0 <= tt <= .1}, {s, tt}];

genPlot[t_] := With[{vp = blendViewpoints[v1, v2, t]},
   Plot3D[1, {x, y} \[Element] R, Filling -> Axis, Mesh -> False, 
    Axes -> None, Boxed -> False, ViewPoint -> vp, 
    ViewVertical -> {0, 1, 0}, SphericalRegion -> True]
   ];

ListAnimate[Table[genPlot[t], {t, 0, 1, 1/steps}]]

The density from the side should look more like this (notebook):

enter image description here

$\endgroup$
7
  • $\begingroup$ You'd be best off exporting to blender or some other 3d software and raytracing some 3d linear fog for the extruded part. It's either that or you can figure out how to do it with CUDAVolumetricRender but I don't recommend that pain. $\endgroup$
    – flinty
    Sep 18 '21 at 13:12
  • $\begingroup$ Maybe I misunderstand you, but should your comment not say: "that values of sin x are concentrated around -1 and 1". If so, then I think this idea is better represented by the derivative of Sin[x]. Where it is small, there are a lot of random pts, where it is large, random pts are spread out. $\endgroup$ Sep 18 '21 at 18:55
  • $\begingroup$ Manipulate[Graphics[{Opacity[0.1], Point[Table[{0., Sin[k]}, {k, 0., n}]], PlotRange->1], {n, 1, 10000}]? $\endgroup$
    – Michael E2
    Sep 18 '21 at 21:28
  • $\begingroup$ @MichaelE2 It is too thin. Also, a closing curly brace is missing $\endgroup$ Sep 18 '21 at 21:39
  • 1
    $\begingroup$ @მამუკაჯიბლაძე Neither objection is unfixable. $\endgroup$
    – Michael E2
    Sep 18 '21 at 22:09

Your Answer

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

Browse other questions tagged or ask your own question.