3
$\begingroup$

I have a circular segment defined as:

    ParametricPlot[5 {Sin[ϕ], 1 - Cos[ϕ]}, {ϕ, -0.2, 0.8}, 
 PlotRange -> All]

which I have to rotate around point 5 {Sin[0.8], 1 - Cos[0.8]} for 0.3 radians and I don't know how to do it.

I tried with Rotate which is not what I needed, because it rotates the whole graphics - axes included. I only want to rotate the circular segment. I had a strong feeling that I should use RotationMatrix and so I tried that too:

ParametricPlot[5*RotationMatrix[0.3].{Sin[ϕ], 1 - Cos[ϕ]}, {ϕ, -0.2, 0.8}, PlotRange -> All]

but here the output is the plot rotated around the origin. But If I try to rotate around a certain point

RotationMatrix[0.3,5 {Sin[.8], 1 - Cos[.8]}]

I get an error saying that the dimensions are wrong. What can I do to rotate the curve?

$\endgroup$

2 Answers 2

8
$\begingroup$

There's actually a built in function RotationTransform for that:

rotation = RotationTransform[0.3, fixedpoint];

ParametricPlot[{5 {Sin[ϕ], 1 - Cos[ϕ]}, 
  rotation[5 {Sin[ϕ], 1 - Cos[ϕ]}]}, {ϕ, -0.2, 0.8}, 
 PlotRange -> All]
$\endgroup$
6
$\begingroup$

As it says here, to rotate about a fixed point, you first translate that point to the origin, apply the rotation matrix, then reverse the translation.

rotateparametric[parfunc_, fixedpoint_, angle_] := 
  RotationMatrix[angle].(parfunc - fixedpoint) + fixedpoint;

 ParametricPlot[{5 {Sin[ϕ], 1 - Cos[ϕ]}, 
   rotateparametric[5 {Sin[ϕ], 1 - Cos[ϕ]}, fixedpoint,0.3]},
   {ϕ, -0.2, 0.8}, PlotRange -> All]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you, big time! This works nicely! $\endgroup$
    – skrat
    Commented Sep 11, 2015 at 8:16
  • 1
    $\begingroup$ @skrat I just edited it to make a function, so that you can easily do this to any 2D parametric function. $\endgroup$
    – Jason B.
    Commented Sep 11, 2015 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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