7
$\begingroup$

I am using this code

Graphics[{{GeometricTransformation[ 
{ { Thickness[0.0009] , FaceForm[],  Circle[{0, 0}, 1]  } }  ,
 { TranslationTransform[{0, 0}], TranslationTransform[{3, 0}], TranslationTransform[{6, 0}] }  ]} }]

and I get Fig. $1$. How can I add the red arc circular arrows in Fig. 2, such that GeometricTransformation[] will act on them as with the circle?

enter image description here

$\endgroup$
9
  • $\begingroup$ Welcome to the community. Use this code to generate circular arrow Arrow[BezierCurve[Take[CirclePoints[{0, 0}, {1.2, 1.3}, 180], 20]]] (1.2 is radius, 1.3 is rotation, 180 and 20 are for quality and length) $\endgroup$
    – Ben Izd
    Nov 8, 2021 at 13:51
  • $\begingroup$ @BenIzd Thanks. The code you mentioned gives me only a set of numbers. $\endgroup$
    – Martha97
    Nov 8, 2021 at 14:42
  • 2
    $\begingroup$ You need to include it in your list of Graphics objects. Also, see mathematica.stackexchange.com/questions/13547/… $\endgroup$
    – Alan
    Nov 8, 2021 at 15:22
  • 1
    $\begingroup$ @Martha97 I still do not understand your constraint. Do you mean that all the code for generating the arrows needs to be written within your Graphics[] function, or can you e.g. define an arrow-generating function on the lines above and then call this function inside the code above? If the latter is not possible, what is the reason? Both methods are certainly possible, but putting everything within the Graphics[] function will make it very cluttered and non-flexible. $\endgroup$
    – a20
    Nov 8, 2021 at 15:47
  • 1
    $\begingroup$ I have updated the answer to include your particular use case. $\endgroup$
    – Syed
    Nov 8, 2021 at 16:07

3 Answers 3

8
$\begingroup$

Main idea: Circle can be printed from a initial to a final angle, i.e. an arc can be printed. An arrow(head) can be attached at the end.

r = 1;
disp = 0.2;

Define a curved arrow object (an arc + an arrowhead):

curvedArrowObj[x_, y_, r_, disp_, \[Theta]i_, \[Theta]f_] :=
 {
  Circle[{x, y}, r + disp, {\[Theta]i, \[Theta]f}],
  Arrow[{
    {(r + disp) Cos[\[Theta]f - 6 Degree],
     (r + disp)  Sin[\[Theta]f - 6 Degree]},
    {(r + disp)  Cos[\[Theta]f + 6 Degree],
     (r + disp)  Sin[\[Theta]f + 6 Degree]}
    }
   ]
  }

Usage:

Graphics[{
  Blue,
  Circle[{0, 0}, r],
  Red,
  Arrowheads[Medium],
  curvedArrowObj[0, 0, r, disp, \[Pi]/6, \[Pi]/3],
  curvedArrowObj[0, 0, r, disp + 0.2, 120 Degree, 225 Degree],
  Black,
  Arrowheads[Large],
  curvedArrowObj[0, 0, r, disp, 160 Degree, 190 Degree]
  }
 ,
 Frame -> True,
 AspectRatio -> 1,
 PlotRange -> {{-2, 2}, {-2, 2}}
 ]

enter image description here

EDIT1 Example for OP's particular case

Graphics[{
  GeometricTransformation[
   {
    {
     Thickness[0.0009],
     FaceForm[],
     Circle[{0, 0}, 1], 
     Red,
     Arrowheads[Small],
     curvedArrowObj[0, 0, 1, 0.2, 75 Degree, 105 Degree],
     curvedArrowObj[0, 0, 1, 0.2, 255 Degree, 285 Degree]
     }
    },
   {
    TranslationTransform[{0, 0}],
    TranslationTransform[{3, 0}],
    TranslationTransform[{6, 0}]}
   ]
  }
 ]

enter image description here

$\endgroup$
4
  • $\begingroup$ +1, but I disagree on the use of Subscript in Subscript[\[Theta], i]. That shouldn't be encouraged, except when formatting displays. $\endgroup$
    – rhermans
    Nov 8, 2021 at 16:30
  • $\begingroup$ I agree and thanks for the feedback. It started out that way and is not a part of the function. I will update this aspect soon. $\endgroup$
    – Syed
    Nov 8, 2021 at 16:33
  • $\begingroup$ How would it be for Grahpics3D? $\endgroup$ Apr 24 at 15:37
  • 1
    $\begingroup$ @JoshuaSalazar, see SplineCircle for examples. For arrows, you need to replace lines with tubes. If you have a specific application in mind, you can start a new post. $\endgroup$
    – Syed
    Apr 24 at 16:05
9
$\begingroup$

You can use the ResourceFunction "SplineCircle" to create a BSplineCurve version of an arc that can be directly used inside of Arrow:

obj={
    Circle[{0,0}],
    Red, 
    Arrowheads->Small,
    Arrow @ ResourceFunction["SplineCircle"][{0,0}, 1.1, {0,1},{-.3,.3}],
    Arrow @ ResourceFunction["SplineCircle"][{0,0}, 1.1, {0,-1},{-.3,.3}]
};

Using the above object inside of GeometricTransformation:

Graphics[{
    obj, 
    GeometricTransformation[
        obj,
        {TranslationTransform[{2.5,0}],TranslationTransform[{-2.5,0}]}
    ]
}]

enter image description here

$\endgroup$
5
$\begingroup$

A start...

Graphics[{
  Red, Arrow[BSplineCurve[Table[{Cos[x], Sin[x]}, {x, 0, Pi, Pi/10}]]],
  Black, Circle[{0, 0}, 0.9]
  }]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ BSplineCurve[] is no good due to its limited polynomial approximation of the curve. The straight lines at the beginning and end of the curve are very noticable, and if you put the same radius of the inner circle you will see that your BSplineCurve has a smaller radius. $\endgroup$
    – a20
    Nov 8, 2021 at 15:56

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.