.. page-title: Box example: constriction.box constriction.box ================ DW in ferromagnetic constriction -------------------------------- .. figure:: constriction.png :align: center Just one more example. To run this example you will need the following file(s): `./constriction.box <./constriction.box>`__. If the example requires more than one file, then you should put them into the same directory. You can then launch Box/Boxer with ``box -l g ./constriction.box`` or ``boxer ./constriction.box``. .. raw:: html
   //!BOXER:VERSION:0:1:1
   
   include "g"
   GUI = Void
   Window@GUI[]
   
   
   //!BOXER:REFPOINTS:BEGIN
   gui1 = Point[.x=-48.3426481572, .y=23.8678340517]
   gui2 = Point[.x=48.0946531969, .y=-24.1355860987]
   gui4 = Point[.x=-0.633093684211, .y=-12.8453210526]
   //!BOXER:REFPOINTS:END
   include "arrows"
   
   w = Window[]
   
   [
     \ w.Show[gui1, gui2]
     constr = Point[(30.0, 1.0)]
     bodies = Point[(30.0, 20.0)]
     c = Color[(1, 1, 0.85)]
     c_arrows = Color[(1, 0.2, 0.0)]
   
     x0 = 0.5*constr.x
     x1 = x0 + bodies.x
     y0 = constr.y
     y1 = bodies.y
     \ w.Poly[Style[.Border[0.3, color.black]], c
              (-x1, -y1), (-x1, y1), (-x0, y1), (-x0, y0), (x0, y0), (x0, y1),
              (x1, y1), (x1, -y1), (x0, -y1), (x0, -y0), (-x0, -y0), (-x0, -y1)]
     
     x2 = (4*x0+6*x1)/10
     \ w.Line[c_arrows, v = -(8, 0), 1
              ctr =  (x2, 0), ctr+v, arrow_triangle, ctr-v;
              ctr = (-x2, 0), ctr-v, arrow_triangle, ctr+v]
   
     n = 5, i = -n
     [
       x = x0*i/n
       angle = const.pi*0.5*(1 - Real[i]/n)
       \ w.Line[ctr = (x, 0), 0.5, ,
                v = 8*(Cos[angle], Sin[angle])
                ctr, arrow_triangle, ctr+v]
       For[++i <= n]
     ]
   
     w.Text[.Font["sans", 3]
            gui4, .From[(0.5, -0.2)], "magnetisation\n   rotates by\n 180 degrees"]
   ]
   
   w.Save["constriction.png", Window["rgb24", .Res[Dpi[150]]]]
   
   GUI[w]