Hi Henrik,
Thanks for your post and reply. Your solution does draw a spring compressing and expanding along an arc. However, I'm looking to do this in 2D, not 3D. Is there a way to permanently set the 3D picture from the side so that it appears 2D? I'm not sure a 3D parametric plot will be compatible with the rest of the script, though. The function is a SHO with the position mapped by Cosine and Sine functions, to give the appearance that the mass is oscillating in 2D along an arc. I'm trying to get a TriangleWave (which looks like a spring) to compress and contract with the mass along the 2D arc. When I plot the TriangleWave with Polar plot, I can get the spring to bend along the 2D arc, but I cannot get it to compress and expand. When I plot the TriangleWave with ParametricPlot, I can get it to expand and contract, but not bend along the arc.
The function I'm using to do the oscillation is:
\[Theta]1[m_, k_, t_] = \[Pi]/2 + 1/6 \[Pi] Cos[(Sqrt[2] Sqrt[k] t)/Sqrt[m]];
The graphics I've tried are (just click 'Play' to see what I'm talking about):
Manipulate[
Graphics[{
{
Directive[ RGBColor[0.5, 0.5, 0.5], AbsoluteThickness[3], Opacity[1] ],
Circle[
{0, 0},
1,
{0, Pi}
]
},
{(* Mass-1 *)
Directive[ RGBColor[0, 0, 1], Opacity[0.75] ],
Disk[
{
1*Cos[ \[Theta]1[10, 2, time] ],
1*Sin[ \[Theta]1[10, 2, time] ]
},
1/15
]
(* Mass-1 *)},
{(* Spring-1 *)
PolarPlot[
{
1 + (1/(4*\[Pi]))*TriangleWave[ 2*\[Pi]*sex ]
},
{ sex, 0, \[Theta]1[10, 2, time] },
PlotStyle ->
{
Directive[RGBColor[0, 0, 0.35], AbsoluteThickness[2.5],
Opacity[0.75]]
},
Axes -> None
][[1]],
ParametricPlot[
{
(1/(4*\[Pi]))*sex*\[Theta]1[10, 2, time],
1 + (1/(4*\[Pi]))*TriangleWave[ 2*\[Pi]*sex ]
},
{ sex, 0, \[Theta]1[10, 2, time] },
PlotStyle ->
{
Directive[RGBColor[0, 0, 0.35], AbsoluteThickness[2.5],
Opacity[0.75]]
},
Axes -> None
][[1]]
(* Spring-1 *)},
{(* Spring-2 *)
PolarPlot[
{
1 + (1/(4*\[Pi]))*TriangleWave[ 2*\[Pi]*sex ]
},
{ sex, \[Theta]1[10, 2, time], Pi },
PlotStyle ->
{
Directive[RGBColor[0, 0, 0.35], AbsoluteThickness[2.5],
Opacity[0.75]]
},
Axes -> None
][[1]]
(* Spring-2 *)}
(* Graphics *)}, ImageSize -> Medium],
"", "",
(* Axes *)
"", "",
Style["Axis Parameters", Bold, FontSize -> 14, FontFamily -> "Times"],
{
{time, 10^-20, Style["time", FontSize -> 16, FontFamily -> "Times"]},
10^-20,
120,
ControlType -> Trigger,
DefaultDuration -> 120.0,
DisplayAllSteps -> True,
AnimationRate -> 2.0
},
{
{time, 10^-20, Style["", FontSize -> 16, FontFamily -> "Times"]},
10^-20,
120,
ControlType -> Slider,
ImageSize -> Medium,
Appearance -> "Labeled"
},
ControlPlacement -> Left,
SaveDefinitions -> True,
TrackedSymbols :> {time}
(* Manipulate *)]
I'm open to the idea of using 3D Param Plot, but I don't know how to set the viewing from the side. Any more thoughts are very welcomed! I'm at a loss as to how to fix this.
Best,
Tim