7

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

a20
  • 912
  • 5
  • 17
Martha97
  • 349
  • 1
  • 7
  • 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) – Ben Izd Nov 08 '21 at 13:51
  • @BenIzd Thanks. The code you mentioned gives me only a set of numbers. – Martha97 Nov 08 '21 at 14:42
  • 2
    You need to include it in your list of Graphics objects. Also, see https://mathematica.stackexchange.com/questions/13547/how-do-i-add-arrowheads-to-circular-arcs – Alan Nov 08 '21 at 15:22
  • What do you mean by applying it in the given code, and what is the reason for this constraint(?) ? – a20 Nov 08 '21 at 15:39
  • @a20 This code is part of another big code, and, I need to apply them in this code to be able to manage them with the rest of the problem. Is not it possible to add them in this code? – Martha97 Nov 08 '21 at 15:44
  • 1
    @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. – a20 Nov 08 '21 at 15:47
  • @a20 No :), your second case is also fine, I mean that for example, I do not know how to combine the two given answers with my code, they only give answers on how to plot an arrow with a circle, I need to, somehow, combine them with my GeometricTransformation code. In other words, I should define them for one circle and then use GeometricTransformation. – Martha97 Nov 08 '21 at 15:51
  • @a20 I need to put two short arrows on both top and bottom of the circles. – Martha97 Nov 08 '21 at 15:54
  • 1
    I have updated the answer to include your particular use case. – Syed Nov 08 '21 at 16:07

3 Answers3

9

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

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
8

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

Syed
  • 52,495
  • 4
  • 30
  • 85
  • +1, but I disagree on the use of Subscript in Subscript[\[Theta], i]. That shouldn't be encouraged, except when formatting displays. – rhermans Nov 08 '21 at 16:30
  • 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. – Syed Nov 08 '21 at 16:33
  • How would it be for Grahpics3D? – Joshua Salazar Apr 24 '22 at 15:37
  • 1
    @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. – Syed Apr 24 '22 at 16:05
5

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

Jagra
  • 14,343
  • 1
  • 39
  • 81
  • 1
    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. – a20 Nov 08 '21 at 15:56