Ver Fonte

Updates of tutorial.

Hans Petter Langtangen há 11 anos atrás
pai
commit
7d682ed096
39 ficheiros alterados com 7740 adições e 182445 exclusões
  1. 95 0
      doc/src/tut/classes.do.txt
  2. BIN
      doc/src/tut/fig-tut/Arc.pdf
  3. BIN
      doc/src/tut/fig-tut/Arc.png
  4. BIN
      doc/src/tut/fig-tut/Axis.pdf
  5. BIN
      doc/src/tut/fig-tut/Axis.png
  6. BIN
      doc/src/tut/fig-tut/Dashpot.pdf
  7. BIN
      doc/src/tut/fig-tut/Dashpot.png
  8. BIN
      doc/src/tut/fig-tut/Distance_wText.pdf
  9. BIN
      doc/src/tut/fig-tut/Distance_wText.png
  10. BIN
      doc/src/tut/fig-tut/Rectangle.pdf
  11. BIN
      doc/src/tut/fig-tut/Rectangle.png
  12. 0 0
      doc/src/tut/fig-tut/Shape_hierarchy_complete.png
  13. 0 0
      doc/src/tut/fig-tut/Shape_hierarchy_larger.png
  14. 0 0
      doc/src/tut/fig-tut/Shape_hierarchy_small.png
  15. BIN
      doc/src/tut/fig-tut/Spring.pdf
  16. BIN
      doc/src/tut/fig-tut/Spring.png
  17. 0 0
      doc/src/tut/fig-tut/StochasticWavyCurve.pdf
  18. 0 0
      doc/src/tut/fig-tut/StochasticWavyCurve.png
  19. BIN
      doc/src/tut/fig-tut/Triangle.pdf
  20. BIN
      doc/src/tut/fig-tut/Triangle.png
  21. 0 13027
      doc/src/tut/fig-tut/Vehicle0_hier2.eps
  22. BIN
      doc/src/tut/fig-tut/Wavy.pdf
  23. BIN
      doc/src/tut/fig-tut/Wavy.png
  24. 794 0
      doc/src/tut/fig-tut/mpl_code_Arc.py
  25. 122 0
      doc/src/tut/fig-tut/mpl_code_Axis.py
  26. 195 0
      doc/src/tut/fig-tut/mpl_code_Dashpot.py
  27. 149 0
      doc/src/tut/fig-tut/mpl_code_Distance_wText.py
  28. 66 0
      doc/src/tut/fig-tut/mpl_code_Rectangle.py
  29. 2219 0
      doc/src/tut/fig-tut/mpl_code_Spring.py
  30. 30 0
      doc/src/tut/fig-tut/mpl_code_Triangle.py
  31. 4025 0
      doc/src/tut/fig-tut/mpl_code_Wavy.py
  32. 0 40880
      doc/src/tut/fig-tut/vehicle0.eps
  33. 0 40278
      doc/src/tut/fig-tut/vehicle0_dim.eps
  34. 0 9437
      doc/src/tut/fig-tut/vehicle0_hier1.eps
  35. 0 40278
      doc/src/tut/fig-tut/vehicle1.eps
  36. 0 38505
      doc/src/tut/fig-tut/wheel_on_inclined_plane.eps
  37. 2 1
      doc/src/tut/main_sketcher.do.txt
  38. 2 1
      examples/osc1.py
  39. 41 38
      pysketcher/shapes.py

+ 95 - 0
doc/src/tut/classes.do.txt

@@ -0,0 +1,95 @@
+======= Basic Shapes =======
+
+===== Axis =====
+
+The `Axis` object gives the possibility draw a single axis to
+notify a coordinate system. Here is an example where we
+draw $x$ and $y$ axis of three coordinate systems of different
+rotation:
+
+FIGURE: [fig-tut/Axis, width=500 frac=0.7]
+
+The corresponding code looks like this:
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Axis@drawing_tool.savefig\('tmp_Axis'\)
+
+===== Distance with Text =====
+
+The object `Distance_wText` is used to display an arrow, to indicate
+a distance in a sketch, with an additional text in the middle of the arrow.
+
+The figure
+
+FIGURE: [fig-tut/Distance_wText, width=500 frac=0.7]
+
+was produced by this code:
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Distance_wText@drawing_tool.savefig\('tmp_Distance
+Note the use of `Text_wArrow` to write an explaining text with an
+associated arrow, here used to explain how
+the `text_spacing` and `alignment` arguments can be used to adjust
+the appearance of the text that goes with the distance arrow.
+
+===== Rectangle =====
+
+FIGURE: [fig-tut/Rectangle, width=500 frac=0.7]
+
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Rectangle@drawing_tool.savefig\('tmp_Rectangle
+
+The `draw_dimension` method adds explanation of dimensions and various
+important argument in the construction of a shape.
+
+===== Triangle =====
+
+FIGURE: [fig-tut/Triangle, width=500 frac=0.7]
+
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Triangle@drawing_tool.savefig\('tmp_Triangle
+Here, the `draw_dimension` method writes the name of the corners at the
+position of the corners, which does not always look nice (the present figure
+is an example). For a high-quality sketch one would add some spacing
+to the location of the p1, p2, and even p3 texts.
+
+===== Arc =====
+
+FIGURE: [fig-tut/Arc, width=400 frac=0.5]
+
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Arc@drawing_tool.savefig\('tmp_Arc
+
+===== Spring =====
+
+FIGURE: [fig-tut/Spring, width=800 frac=1]
+
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Spring@drawing_tool.savefig\('tmp_Spring
+
+===== Dashpot =====
+
+FIGURE: [fig-tut/Dashpot, width=600 frac=0.8]
+
+
+@@@CODE ../../../pysketcher/shapes.py fromto: def test_Dashpot@drawing_tool.savefig\('tmp_Dashpot
+
+===== Wavy =====
+
+Looks strange. Fix x axis.
+
+===== Stochastic curves =====
+
+The `StochasticWavyCurve` object offers three pre-computed
+graphcs that have a random variation:
+
+FIGURE: [fig-tut/StochasticWavyCurve.png, width=600 frac=1]
+
+The usage is simple. The construction
+
+!bc pycod
+curve = StochasticWavyCurve(curve_no=1, percentage=40)
+!ec
+picks the second curve (the three are numbered 0, 1, and 2),
+and the first 40% of that curve. In case one desires another extent
+of the axis, one can just scale the coordinates directly as these
+are stored in the arrays `curve.x[curve_no]` and
+`curve.y[curve_no]`.

BIN
doc/src/tut/fig-tut/Arc.pdf


BIN
doc/src/tut/fig-tut/Arc.png


BIN
doc/src/tut/fig-tut/Axis.pdf


BIN
doc/src/tut/fig-tut/Axis.png


BIN
doc/src/tut/fig-tut/Dashpot.pdf


BIN
doc/src/tut/fig-tut/Dashpot.png


BIN
doc/src/tut/fig-tut/Distance_wText.pdf


BIN
doc/src/tut/fig-tut/Distance_wText.png


BIN
doc/src/tut/fig-tut/Rectangle.pdf


BIN
doc/src/tut/fig-tut/Rectangle.png


doc/src/tut/fig-tut/Shape2.png → doc/src/tut/fig-tut/Shape_hierarchy_complete.png


doc/src/tut/fig-tut/Shape1b.png → doc/src/tut/fig-tut/Shape_hierarchy_larger.png


doc/src/tut/fig-tut/Shape1a.png → doc/src/tut/fig-tut/Shape_hierarchy_small.png


BIN
doc/src/tut/fig-tut/Spring.pdf


BIN
doc/src/tut/fig-tut/Spring.png


doc/src/tut/fig-tut/StochasticWaveyCurve.pdf → doc/src/tut/fig-tut/StochasticWavyCurve.pdf


doc/src/tut/fig-tut/StochasticWaveyCurve.png → doc/src/tut/fig-tut/StochasticWavyCurve.png


BIN
doc/src/tut/fig-tut/Triangle.pdf


BIN
doc/src/tut/fig-tut/Triangle.png


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 13027
doc/src/tut/fig-tut/Vehicle0_hier2.eps


BIN
doc/src/tut/fig-tut/Wavy.pdf


BIN
doc/src/tut/fig-tut/Wavy.png


+ 794 - 0
doc/src/tut/fig-tut/mpl_code_Arc.py

@@ -0,0 +1,794 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = -2.0, 4.0, -2.0, 6.0
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+
+mpl.grid(True)
+
+# arc
+mpl.arrow(x=-0.509204, y=1.93409, dx=-0.00843419, dy=-0.00224023,
+          facecolor='b', edgecolor='b',
+          linestyle='solid',
+          linewidth=2, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(-0.2, -0.2, 'center',
+        horizontalalignment='center', fontsize=14)
+ax.text(2.68468, 1.55, 'start_angle',
+        horizontalalignment='center', fontsize=14)
+
+# arc
+x = [2.5,
+ 2.4999576921443607,
+ 2.4998307700094053,
+ 2.499619237890978,
+ 2.4993231029486545,
+ 2.4989423752055013,
+ 2.4984770675477392,
+ 2.497927195724303,
+ 2.4972927783463112,
+ 2.4965738368864345,
+ 2.4957703956781705,
+ 2.4948824819150186,
+ 2.4939101256495606,
+ 2.4928533597924436,
+ 2.491712220111265,
+ 2.4904867452293638,
+ 2.489176976624511,
+ 2.4877829586275078,
+ 2.4863047384206833,
+ 2.4847423660362997,
+ 2.4830958943548573,
+ 2.481365379103305,
+ 2.4795508788531544,
+ 2.4776524550184966,
+ 2.475670171853926,
+ 2.473604096452361,
+ 2.4714542987427794,
+ 2.4692208514878446,
+ 2.466903830281448,
+ 2.464503313546149,
+ 2.46201938253052,
+ 2.4594521213063967,
+ 2.4568016167660334,
+ 2.45406795861916,
+ 2.4512512393899484,
+ 2.4483515544138785,
+ 2.4453690018345142,
+ 2.442303682600177,
+ 2.4391557004605358,
+ 2.435925161963088,
+ 2.4326121764495596,
+ 2.4292168560522005,
+ 2.425739315689991,
+ 2.422179673064752,
+ 2.41853804865716,
+ 2.4148145657226707,
+ 2.411009350287347,
+ 2.407122531143594,
+ 2.4031542398457972,
+ 2.3991046107058733,
+ 2.3949737807887224,
+ 2.390761889907589,
+ 2.38646908061933,
+ 2.38209549821959,
+ 2.377641290737884,
+ 2.3731066089325847,
+ 2.3684916062858234,
+ 2.363796438998292,
+ 2.359021265983959,
+ 2.354166248864688,
+ 2.3492315519647713,
+ 2.3442173423053623,
+ 2.339123789598829,
+ 2.3339510662430043,
+ 2.328699347315356,
+ 2.323368810567056,
+ 2.3179596364169686,
+ 2.3124720079455403,
+ 2.306906110888606,
+ 2.3012621336311008,
+ 2.295540267200685,
+ 2.289740705261278,
+ 2.2838636441065026,
+ 2.2779092826530425,
+ 2.2718778224339107,
+ 2.2657694675916247,
+ 2.2595844248713015,
+ 2.2533229036136557,
+ 2.2469851157479175,
+ 2.2405712757846583,
+ 2.2340816008085307,
+ 2.2275163104709197,
+ 2.2208756269825103,
+ 2.214159775105765,
+ 2.2073689821473175,
+ 2.200503477950278,
+ 2.193563494886455,
+ 2.1865492678484895,
+ 2.179461034241906,
+ 2.1722990339770756,
+ 2.165063509461097,
+ 2.157754705589591,
+ 2.1503728697384137,
+ 2.142918251755281,
+ 2.135391103951314,
+ 2.1277916810924995,
+ 2.1201202403910653,
+ 2.1123770414967753,
+ 2.104562346488144,
+ 2.0966764198635603,
+ 2.088719528532341,
+ 2.0806919418056946,
+ 2.0725939313876043,
+ 2.0644257713656353,
+ 2.056187738201656,
+ 2.0478801107224793,
+ 2.03950317011043,
+ 2.031057199893823,
+ 2.0225424859373686,
+ 2.0139593164324983,
+ 2.0053079818876096,
+ 1.9965887751182323,
+ 1.9878019912371194,
+ 1.9789479276442588,
+ 1.970026884016805,
+ 1.9610391622989396,
+ 1.9519850666916483,
+ 1.9428649036424273,
+ 1.93367898183491,
+ 1.9244276121784196,
+ 1.9151111077974452,
+ 1.905729784021045,
+ 1.8962839583721727,
+ 1.8867739505569303,
+ 1.877200082453748,
+ 1.86756267810249,
+ 1.857862063693486,
+ 1.8480985675564905,
+ 1.8382725201495718,
+ 1.8283842540479265,
+ 1.8184341039326222,
+ 1.80842240657927,
+ 1.7983495008466281,
+ 1.788215727665129,
+ 1.778021430025343,
+ 1.7677669529663689,
+ 1.7574526435641544,
+ 1.7470788509197501,
+ 1.7366459261474934,
+ 1.7261542223631243,
+ 1.7156040946718343,
+ 1.7049959001562465,
+ 1.694329997864331,
+ 1.683606748797251,
+ 1.6728265158971458,
+ 1.6619896640348446,
+ 1.6510965599975194,
+ 1.6401475724762684,
+ 1.6291430720536382,
+ 1.6180834311910814,
+ 1.6069690242163488,
+ 1.595800227310821,
+ 1.5845774184967758,
+ 1.5733009776245939,
+ 1.561971286359901,
+ 1.5505887281706503,
+ 1.539153688314146,
+ 1.5276665538239997,
+ 1.516127713497034,
+ 1.504537557880121,
+ 1.4928964792569657,
+ 1.4812048716348272,
+ 1.4694631307311832,
+ 1.4576716539603372,
+ 1.4458308404199665,
+ 1.4339410908776153,
+ 1.4220028077571298,
+ 1.4100163951250364,
+ 1.3979822586768675,
+ 1.385900805723429,
+ 1.3737724451770152,
+ 1.361597587537568,
+ 1.3493766448787827,
+ 1.337110030834161,
+ 1.3247981605830128,
+ 1.312441450836401,
+ 1.3000403198230388,
+ 1.2875951872751359,
+ 1.2751064744141885,
+ 1.2625746039367256,
+ 1.2500000000000002]
+y = [0.0,
+ 0.014544328387484583,
+ 0.029088164503492532,
+ 0.04363101609320877,
+ 0.058172390935140796,
+ 0.07271179685777851,
+ 0.08724874175625241,
+ 0.10178273360898957,
+ 0.11631328049436661,
+ 0.13083989060735957,
+ 0.14536207227618955,
+ 0.1598793339789641,
+ 0.17439118436031323,
+ 0.18889713224802018,
+ 0.2033966866696457,
+ 0.21788935686914537,
+ 0.23237465232348048,
+ 0.24685208275921977,
+ 0.2613211581691336,
+ 0.27578138882877923,
+ 0.29023228531307554,
+ 0.30467335851286864,
+ 0.3191041196514865,
+ 0.3335240803012817,
+ 0.3479327524001635,
+ 0.3623296482681168,
+ 0.37671428062370776,
+ 0.3910861626005771,
+ 0.40544480776391856,
+ 0.41978973012694265,
+ 0.43412044416732576,
+ 0.4484364648436434,
+ 0.46273730761178644,
+ 0.47702248844136197,
+ 0.49129152383207525,
+ 0.5055439308300947,
+ 0.5197792270443982,
+ 0.5339969306631001,
+ 0.5481965604697582,
+ 0.5623776358596624,
+ 0.5765396768561003,
+ 0.5906822041266032,
+ 0.6048047389991692,
+ 0.618906803478465,
+ 0.6329879202620043,
+ 0.6470476127563018,
+ 0.6610854050930054,
+ 0.6751008221450018,
+ 0.6890933895424978,
+ 0.7030626336890764,
+ 0.7170080817777256,
+ 0.7309292618068418,
+ 0.7448257025962048,
+ 0.7586969338029265,
+ 0.7725424859373684,
+ 0.7863618903790339,
+ 0.8001546793924288,
+ 0.8139203861428916,
+ 0.8276585447123951,
+ 0.8413686901153157,
+ 0.8550503583141716,
+ 0.8687030862353283,
+ 0.8823264117846721,
+ 0.8959198738632506,
+ 0.9094830123828785,
+ 0.9230153682817109,
+ 0.9365164835397799,
+ 0.9499859011944972,
+ 0.9634231653561207,
+ 0.9768278212231842,
+ 0.9901994150978919,
+ 1.0035374944014728,
+ 1.0168416076895004,
+ 1.0301113046671708,
+ 1.0433461362045446,
+ 1.0565456543517484,
+ 1.0697094123541355,
+ 1.0828369646674074,
+ 1.0959278669726933,
+ 1.1089816761915896,
+ 1.1219979505011553,
+ 1.1349762493488669,
+ 1.147916133467529,
+ 1.1608171648901422,
+ 1.1736789069647267,
+ 1.186500924369101,
+ 1.1992827831256152,
+ 1.2120240506158424,
+ 1.2247242955952173,
+ 1.237383088207635,
+ 1.2499999999999998,
+ 1.2625746039367247,
+ 1.275106474414188,
+ 1.287595187275135,
+ 1.3000403198230384,
+ 1.3124414508364004,
+ 1.3247981605830121,
+ 1.3371100308341606,
+ 1.3493766448787818,
+ 1.3615975875375674,
+ 1.373772445177015,
+ 1.3859008057234283,
+ 1.3979822586768669,
+ 1.4100163951250357,
+ 1.4220028077571292,
+ 1.4339410908776151,
+ 1.445830840419966,
+ 1.4576716539603365,
+ 1.4694631307311825,
+ 1.4812048716348267,
+ 1.4928964792569652,
+ 1.5045375578801203,
+ 1.5161277134970332,
+ 1.527666553823999,
+ 1.5391536883141455,
+ 1.5505887281706499,
+ 1.5619712863599002,
+ 1.5733009776245934,
+ 1.5845774184967754,
+ 1.5958002273108205,
+ 1.6069690242163481,
+ 1.6180834311910808,
+ 1.6291430720536377,
+ 1.640147572476268,
+ 1.6510965599975191,
+ 1.6619896640348442,
+ 1.6728265158971454,
+ 1.6836067487972506,
+ 1.6943299978643305,
+ 1.7049959001562462,
+ 1.7156040946718338,
+ 1.726154222363124,
+ 1.736645926147493,
+ 1.74707885091975,
+ 1.7574526435641542,
+ 1.7677669529663687,
+ 1.7780214300253427,
+ 1.7882157276651283,
+ 1.7983495008466277,
+ 1.8084224065792696,
+ 1.8184341039326215,
+ 1.828384254047926,
+ 1.8382725201495713,
+ 1.8480985675564898,
+ 1.8578620636934853,
+ 1.8675626781024899,
+ 1.8772000824537476,
+ 1.8867739505569299,
+ 1.8962839583721722,
+ 1.9057297840210445,
+ 1.9151111077974448,
+ 1.924427612178419,
+ 1.9336789818349098,
+ 1.942864903642427,
+ 1.9519850666916478,
+ 1.961039162298939,
+ 1.9700268840168045,
+ 1.9789479276442585,
+ 1.9878019912371192,
+ 1.9965887751182319,
+ 2.005307981887609,
+ 2.0139593164324983,
+ 2.022542485937368,
+ 2.0310571998938225,
+ 2.03950317011043,
+ 2.0478801107224793,
+ 2.0561877382016553,
+ 2.064425771365635,
+ 2.072593931387604,
+ 2.080691941805694,
+ 2.0887195285323408,
+ 2.09667641986356,
+ 2.104562346488143,
+ 2.1123770414967753,
+ 2.1201202403910644,
+ 2.127791681092499,
+ 2.1353911039513136,
+ 2.1429182517552805,
+ 2.1503728697384132,
+ 2.1577547055895905,
+ 2.1650635094610964]
+[line] = ax.plot(x, y, 'k', linewidth=1, linestyle='dashed')
+
+# line
+x = [0.0, 4.0]
+y = [0.0, 0.0]
+[line] = ax.plot(x, y, 'k', linewidth=1, linestyle='dashed')
+
+# line
+x = [0.0, 2.0000000000000004]
+y = [0.0, 3.4641016151377544]
+[line] = ax.plot(x, y, 'k', linewidth=1, linestyle='dashed')
+ax.text(0.629904, 0.791025, 'radius',
+        horizontalalignment='left', fontsize=14)
+
+# line
+mpl.arrow(x=1, y=1.73205, dx=-1, dy=-1.73205,
+          facecolor='k', edgecolor='k',
+          linestyle='dashed',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=0, y=0, dx=1, dy=1.73205,
+          facecolor='k', edgecolor='k',
+          linestyle='dashed',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+
+# line
+x = [0.0, -1.0352761804100834]
+y = [0.0, 3.8637033051562732]
+[line] = ax.plot(x, y, 'k', linewidth=1, linestyle='dashed')
+ax.text(0.430736, 3.27177, 'arc_angle',
+        horizontalalignment='center', fontsize=14)
+
+# arc
+x = [1.5000000000000004,
+ 1.488649511025625,
+ 1.477270680310402,
+ 1.4658637244908648,
+ 1.4544288607390112,
+ 1.4429663067581633,
+ 1.4314762807788257,
+ 1.4199590015545303,
+ 1.4084146883576727,
+ 1.3968435609753347,
+ 1.3852458397051022,
+ 1.3736217453508708,
+ 1.3619714992186405,
+ 1.3502953231123052,
+ 1.3385934393294268,
+ 1.3268660706570043,
+ 1.3151134403672324,
+ 1.3033357722132515,
+ 1.2915332904248857,
+ 1.2797062197043756,
+ 1.2678547852220987,
+ 1.2559792126122844,
+ 1.2440797279687175,
+ 1.2321565578404323,
+ 1.2202099292274011,
+ 1.2082400695762117,
+ 1.1962472067757388,
+ 1.184231569152802,
+ 1.1721933854678217,
+ 1.1601328849104626,
+ 1.1480502970952695,
+ 1.1359458520572991,
+ 1.1238197802477365,
+ 1.1116723125295092,
+ 1.099503680172892,
+ 1.0873141148511052,
+ 1.075103848635901,
+ 1.062873113993148,
+ 1.0506221437784022,
+ 1.038351171232479,
+ 1.0260604299770064,
+ 1.0137501540099814,
+ 1.0014205777013134,
+ 0.9890719357883619,
+ 0.9767044633714703,
+ 0.9643183959094851,
+ 0.9519139692152769,
+ 0.9394914194512493,
+ 0.9270509831248424,
+ 0.9145928970840327,
+ 0.9021173985128199,
+ 0.8896247249267135,
+ 0.8771151141682103,
+ 0.8645888044022682,
+ 0.8520460341117683,
+ 0.8394870420929765,
+ 0.8269120674509975,
+ 0.814321349595223,
+ 0.8017151282347709,
+ 0.7890936433739248,
+ 0.7764571353075629,
+ 0.7638058446165829,
+ 0.7511400121633245,
+ 0.7384598790869795,
+ 0.7257656867990037,
+ 0.71305767697852,
+ 0.7003360915677164,
+ 0.6876011727672428,
+ 0.6748531630315955,
+ 0.6620923050645039,
+ 0.6493188418143094,
+ 0.636533016469339,
+ 0.6237350724532784,
+ 0.6109252534205329,
+ 0.5981038032515915,
+ 0.585270966048385,
+ 0.5724269861296347,
+ 0.5595721080262044,
+ 0.5467065764764429,
+ 0.5338306364215253,
+ 0.5209445330007912,
+ 0.5080485115470743,
+ 0.4951428175820335,
+ 0.482227696811479,
+ 0.46930339512069275,
+ 0.4563701585697504,
+ 0.4434282333888323,
+ 0.43047786597353854,
+ 0.41751930288019706,
+ 0.40455279082116924,
+ 0.39157857666015516,
+ 0.37859690740748986,
+ 0.36560803021544247,
+ 0.3526121923735131,
+ 0.3396096413037205,
+ 0.3266006245558942,
+ 0.313585389802961,
+ 0.30056418483622893,
+ 0.28753725756067217,
+ 0.2745048559902076,
+ 0.2614672282429751,
+ 0.24842462253661374,
+ 0.235377287183535,
+ 0.22232547058619806,
+ 0.20926942123237635,
+ 0.19620938769042914,
+ 0.1831456186045714,
+ 0.17007836269013277,
+ 0.1570078687288319,
+ 0.14393438556403237,
+ 0.13085816209600803,
+ 0.11777944727720599,
+ 0.10469849010750323,
+ 0.09161553962946846,
+ 0.07853084492362009,
+ 0.06544465510368347,
+ 0.05235721931185079,
+ 0.03926878671403372,
+ 0.026179606495121688,
+ 0.013089927854240412,
+ 1.8369701987210297e-16,
+ -0.01308992785423938,
+ -0.026179606495121327,
+ -0.03926878671403335,
+ -0.052357219311849765,
+ -0.06544465510368311,
+ -0.07853084492361906,
+ -0.09161553962946742,
+ -0.10469849010750287,
+ -0.11777944727720498,
+ -0.13085816209600767,
+ -0.14393438556403138,
+ -0.15700786872883085,
+ -0.1700783626901324,
+ -0.18314561860457035,
+ -0.19620938769042878,
+ -0.209269421232376,
+ -0.222325470586197,
+ -0.23537728718353462,
+ -0.24842462253661268,
+ -0.261467228242974,
+ -0.2745048559902072,
+ -0.28753725756067117,
+ -0.3005641848362286,
+ -0.31358538980296,
+ -0.32660062455589317,
+ -0.3396096413037201,
+ -0.35261219237351205,
+ -0.3656080302154421,
+ -0.37859690740748875,
+ -0.39157857666015417,
+ -0.4045527908211689,
+ -0.41751930288019606,
+ -0.43047786597353743,
+ -0.44342823338883197,
+ -0.4563701585697494,
+ -0.4693033951206924,
+ -0.482227696811478,
+ -0.4951428175820325,
+ -0.5080485115470739,
+ -0.5209445330007902,
+ -0.5338306364215251,
+ -0.5467065764764419,
+ -0.5595721080262033,
+ -0.5724269861296344,
+ -0.5852709660483839,
+ -0.5981038032515912,
+ -0.6109252534205319,
+ -0.6237350724532773,
+ -0.6365330164693387,
+ -0.6493188418143083,
+ -0.6620923050645029,
+ -0.674853163031595,
+ -0.6876011727672418,
+ -0.700336091567716,
+ -0.713057676978519,
+ -0.7257656867990027,
+ -0.7384598790869792,
+ -0.7511400121633235,
+ -0.7638058446165825,
+ -0.7764571353075619]
+y = [2.598076211353316,
+ 2.6045964434674262,
+ 2.611067087819699,
+ 2.6174880212183913,
+ 2.623859121418187,
+ 2.630180267122523,
+ 2.636451337985896,
+ 2.6426722146161565,
+ 2.6488427785767805,
+ 2.6549629123891254,
+ 2.661032499534665,
+ 2.6670514244572088,
+ 2.6730195725651034,
+ 2.6789368302334107,
+ 2.684803084806075,
+ 2.6906182245980648,
+ 2.6963821388975013,
+ 2.7020947179677637,
+ 2.7077558530495818,
+ 2.7133654363631035,
+ 2.7189233611099493,
+ 2.7244295214752436,
+ 2.7298838126296294,
+ 2.7352861307312653,
+ 2.7406363729278027,
+ 2.745934437358341,
+ 2.751180223155372,
+ 2.756373630446695,
+ 2.7615145603573206,
+ 2.766602915011355,
+ 2.77163859753386,
+ 2.7766215120526994,
+ 2.781551563700362,
+ 2.7864286586157725,
+ 2.791252703946074,
+ 2.7960236078483955,
+ 2.8007412794916053,
+ 2.805405629058035,
+ 2.8100165677451927,
+ 2.8145740077674524,
+ 2.819077862357725,
+ 2.8235280457691116,
+ 2.8279244732765347,
+ 2.8322670611783525,
+ 2.8365557267979504,
+ 2.840790388485317,
+ 2.844970965618598,
+ 2.849097378605631,
+ 2.8531695488854605,
+ 2.857187398929835,
+ 2.8611508522446805,
+ 2.86505983337156,
+ 2.868914267889106,
+ 2.8727140824144435,
+ 2.876459204604579,
+ 2.8801495631577856,
+ 2.8837850878149567,
+ 2.887365709360942,
+ 2.890891359625869,
+ 2.894361971486439,
+ 2.8977774788672046,
+ 2.901137816741829,
+ 2.904442921134323,
+ 2.907692729120263,
+ 2.9108871788279895,
+ 2.9140262094397844,
+ 2.9171097611930294,
+ 2.9201377753813453,
+ 2.9231101943557056,
+ 2.926026961525538,
+ 2.9288880213598,
+ 2.9316933193880366,
+ 2.9344428022014166,
+ 2.9371364174537513,
+ 2.9397741138624887,
+ 2.9423558412096913,
+ 2.944881550342992,
+ 2.9473511931765293,
+ 2.9497647226918637,
+ 2.9521220929388727,
+ 2.954423259036624,
+ 2.956668177174233,
+ 2.958856804611694,
+ 2.9609890996806953,
+ 2.9630650217854133,
+ 2.965084531403282,
+ 2.9670475900857505,
+ 2.9689541604590106,
+ 2.970804206224711,
+ 2.9725976921606465,
+ 2.974334584121431,
+ 2.976014849039145,
+ 2.977638454923966,
+ 2.9792053708647788,
+ 2.9807155670297623,
+ 2.982169014666959,
+ 2.9835656861048196,
+ 2.9849055547527352,
+ 2.9861885951015363,
+ 2.9874147827239854,
+ 2.988584094275237,
+ 2.989696507493284,
+ 2.990752001199384,
+ 2.991750555298457,
+ 2.9926921507794724,
+ 2.99357676971581,
+ 2.994404395265601,
+ 2.995175011672046,
+ 2.9958886042637216,
+ 2.9965451594548522,
+ 2.9971446647455733,
+ 2.9976871087221686,
+ 2.998172481057287,
+ 2.9986007725101387,
+ 2.998971974926672,
+ 2.9992860812397275,
+ 2.999543085469174,
+ 2.999742982722021,
+ 2.999885769192514,
+ 2.9999714421622032,
+ 3.0,
+ 2.9999714421622032,
+ 2.999885769192514,
+ 2.999742982722021,
+ 2.999543085469174,
+ 2.9992860812397275,
+ 2.998971974926672,
+ 2.998600772510139,
+ 2.998172481057287,
+ 2.9976871087221686,
+ 2.9971446647455733,
+ 2.9965451594548522,
+ 2.9958886042637216,
+ 2.995175011672046,
+ 2.994404395265601,
+ 2.99357676971581,
+ 2.9926921507794724,
+ 2.991750555298457,
+ 2.990752001199384,
+ 2.989696507493284,
+ 2.988584094275237,
+ 2.9874147827239854,
+ 2.9861885951015363,
+ 2.9849055547527352,
+ 2.98356568610482,
+ 2.982169014666959,
+ 2.9807155670297623,
+ 2.9792053708647788,
+ 2.9776384549239663,
+ 2.976014849039145,
+ 2.9743345841214315,
+ 2.9725976921606465,
+ 2.9708042062247113,
+ 2.9689541604590106,
+ 2.9670475900857505,
+ 2.9650845314032823,
+ 2.9630650217854133,
+ 2.960989099680696,
+ 2.9588568046116945,
+ 2.956668177174233,
+ 2.9544232590366244,
+ 2.9521220929388727,
+ 2.9497647226918637,
+ 2.9473511931765293,
+ 2.944881550342992,
+ 2.9423558412096917,
+ 2.9397741138624887,
+ 2.9371364174537513,
+ 2.934442802201417,
+ 2.9316933193880366,
+ 2.9288880213598,
+ 2.9260269615255385,
+ 2.9231101943557056,
+ 2.9201377753813453,
+ 2.91710976119303,
+ 2.9140262094397844,
+ 2.9108871788279895,
+ 2.907692729120263,
+ 2.9044429211343235,
+ 2.9011378167418296,
+ 2.897777478867205]
+[line] = ax.plot(x, y, 'k', linewidth=1, linestyle='dashed')
+mpl.title("Arc")
+mpl.draw()
+mpl.savefig("tmp_Arc.png", dpi=None)
+mpl.savefig("tmp_Arc.pdf")

+ 122 - 0
doc/src/tut/fig-tut/mpl_code_Axis.py

@@ -0,0 +1,122 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = 0.0, 15.0, -7.0, 8.0
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+
+# line
+x = [12.240192378864668, 12.5]
+y = [2.150000000000001, 2.0000000000000004]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+
+# line
+x = [7.5, 12.5]
+y = [2.0, 2.0000000000000004]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+
+# line
+x = [12.240192378864668, 12.5]
+y = [1.8499999999999999, 2.0000000000000004]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+ax.text(12.8333, 2, 'x',
+        horizontalalignment='center', fontsize=14)
+
+# line
+x = [7.35, 7.5]
+y = [6.740192378864668, 7.0]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+
+# line
+x = [7.5, 7.5]
+y = [2.0, 7.0]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+
+# line
+x = [7.65, 7.5]
+y = [6.740192378864668, 7.0]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
+ax.text(7.5, 7.33333, 'y',
+        horizontalalignment='center', fontsize=14)
+mpl.draw()
+
+# line
+x = [11.034779889691228, 11.33022221559489]
+y = [5.161843595132618, 5.213938048432697]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+
+# line
+x = [7.5, 11.33022221559489]
+y = [2.0, 5.213938048432697]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+
+# line
+x = [11.22761617259719, 11.33022221559489]
+y = [4.932030262196924, 5.213938048432697]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+ax.text(11.5856, 5.4282, 'x',
+        horizontalalignment='center', fontsize=14)
+
+# line
+x = [4.338156404867384, 4.286061951567303]
+y = [5.534779889691228, 5.83022221559489]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+
+# line
+x = [7.5, 4.286061951567303]
+y = [2.0, 5.83022221559489]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+
+# line
+x = [4.567969737803077, 4.286061951567303]
+y = [5.727616172597189, 5.83022221559489]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
+ax.text(4.0718, 6.08557, 'y',
+        horizontalalignment='center', fontsize=14)
+mpl.draw()
+
+# line
+x = [6.824595394571309, 6.631759111665348]
+y = [-2.694225432125347, -2.92403876506104]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+
+# line
+x = [7.5, 6.631759111665348]
+y = [2.0, -2.92403876506104]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+
+# line
+x = [6.5291530686676476, 6.631759111665348]
+y = [-2.642130978825267, -2.92403876506104]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+ax.text(6.57388, -3.25231, 'x',
+        horizontalalignment='center', fontsize=14)
+
+# line
+x = [12.194225432125346, 12.424038765061042]
+y = [1.3245953945713098, 1.1317591116653478]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+
+# line
+x = [7.5, 12.424038765061042]
+y = [2.0, 1.1317591116653478]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+
+# line
+x = [12.142130978825266, 12.424038765061042]
+y = [1.029153068667647, 1.1317591116653478]
+[line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
+ax.text(12.7523, 1.07388, 'y',
+        horizontalalignment='center', fontsize=14)
+mpl.draw()
+mpl.title("Axis")
+mpl.draw()
+mpl.savefig("tmp_Axis.png", dpi=None)
+mpl.savefig("tmp_Axis.pdf")

+ 195 - 0
doc/src/tut/fig-tut/mpl_code_Dashpot.py

@@ -0,0 +1,195 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = 0.0, 11.0, -2.5, 7.5
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+
+mpl.grid(True)
+
+# line
+x = [1.5, 1.5]
+y = [0.0, 1.25]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+
+# line
+x = [1.5, 1.5]
+y = [5.0, 2.395833333333333]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+
+# rectangle
+x = [1.0833333333333333,
+ 1.9166666666666665,
+ 1.9166666666666665,
+ 1.0833333333333333,
+ 1.0833333333333333]
+y = [2.083333333333333,
+ 2.083333333333333,
+ 2.395833333333333,
+ 2.395833333333333,
+ 2.083333333333333]
+[line] = ax.fill(x, y, 'white', edgecolor='b', linewidth=2, hatch='X')
+
+# pot
+x = [1.0, 1.0, 2.0, 2.0]
+y = [3.75, 1.25, 1.25, 3.75]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+ax.text(1.5, 5.5, 'Dashpot (default)',
+        horizontalalignment='center', fontsize=14)
+
+# line
+x = [6.5, 6.5]
+y = [0.0, 2.0]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+
+# line
+x = [6.5, 6.5]
+y = [6.0, 4.5]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+
+# rectangle
+x = [6.083333333333333,
+ 6.916666666666666,
+ 6.916666666666666,
+ 6.083333333333333,
+ 6.083333333333333]
+y = [4.1875, 4.1875, 4.5, 4.5, 4.1875]
+[line] = ax.fill(x, y, 'white', edgecolor='b', linewidth=2, hatch='X')
+
+# pot
+x = [6.0, 6.0, 7.0, 7.0]
+y = [4.5, 2.0, 2.0, 4.5]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+ax.text(6.5, -1.56667, 'width',
+        horizontalalignment='center', fontsize=14)
+
+# line
+mpl.arrow(x=6, y=-1.75, dx=1, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=7, y=-1.75, dx=-1, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('start', xy=(6.5, 0), xycoords='data',
+            textcoords='data', xytext=(5.75, -0.75),
+            horizontalalignment='center',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+ax.annotate('bar_length', xy=[ 5.5  1. ], xycoords='data',
+            textcoords='data', xytext=(3.5, 1.5),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+
+# line
+mpl.arrow(x=5.5, y=2, dx=0, dy=-2,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=5.5, y=0, dx=0, dy=2,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('total_length', xy=[ 8.5  3. ], xycoords='data',
+            textcoords='data', xytext=(8.75, 5.0),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+
+# line
+mpl.arrow(x=8.5, y=6, dx=0, dy=-6,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=8.5, y=0, dx=0, dy=6,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('dashpot_length', xy=[ 7.5   3.25], xycoords='data',
+            textcoords='data', xytext=(7.0, -0.5),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+
+# line
+mpl.arrow(x=7.5, y=4.5, dx=0, dy=-2.5,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=7.5, y=2, dx=0, dy=2.5,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('piston_pos', xy=[ 5.5      3.09375], xycoords='data',
+            textcoords='data', xytext=(3.5, 3.6875),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+
+# line
+mpl.arrow(x=5.5, y=4.1875, dx=0, dy=-2.1875,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=5.5, y=2, dx=0, dy=2.1875,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.title("Dashpot")
+mpl.draw()
+mpl.savefig("tmp_Dashpot.png", dpi=None)
+mpl.savefig("tmp_Dashpot.pdf")

+ 149 - 0
doc/src/tut/fig-tut/mpl_code_Distance_wText.py

@@ -0,0 +1,149 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = 0.0, 10.0, 0.0, 6.0
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+ax.text(1.13014, 3.14588, '$ 2\\pi R^2 $',
+        horizontalalignment='left', fontsize=14)
+
+# line
+mpl.arrow(x=2, y=4.5, dx=-2, dy=-2.5,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=0, y=2, dx=2, dy=2.5,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(6, 5.16667, '$ 2\\pi R^2 $',
+        horizontalalignment='center', fontsize=14)
+
+# line
+mpl.arrow(x=4, y=5, dx=4, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=8, y=5, dx=-4, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(1.07454, 5.14907, '$ 2\\pi R^2 $',
+        horizontalalignment='center', fontsize=14)
+
+# line
+mpl.arrow(x=0, y=5.5, dx=2, dy=-1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=2, y=4.5, dx=-2, dy=1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(1.11785, 1.11785, '$ 2\\pi R^2 $',
+        horizontalalignment='left', fontsize=14)
+
+# line
+mpl.arrow(x=0, y=2, dx=2, dy=-2,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=2, y=0, dx=-2, dy=2,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(8.8882, 1.27639, '$ 2\\pi R^2 $',
+        horizontalalignment='right', fontsize=14)
+
+# line
+mpl.arrow(x=8, y=2, dx=2, dy=-1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=10, y=1, dx=-2, dy=1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(8.92546, 3.35093, '$ 2\\pi R^2 $',
+        horizontalalignment='center', fontsize=14)
+
+# line
+mpl.arrow(x=8, y=4, dx=2, dy=-1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=10, y=3, dx=-2, dy=1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.text(4.16667, 4.5, '$ 2\\pi R^2 $',
+        horizontalalignment='left', fontsize=14)
+
+# line
+mpl.arrow(x=4, y=5, dx=0, dy=-1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=4, y=4, dx=0, dy=1,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('text_spacing=-1./40, alignment="right"', xy=(9, 1.2), xycoords='data',
+            textcoords='data', xytext=(4, 0.5),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=10,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+ax.annotate('text_spacing=-1./60', xy=(9, 3.2), xycoords='data',
+            textcoords='data', xytext=(4, 3.5),
+            horizontalalignment='left',
+            verticalalignment='top',
+            fontsize=10,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+mpl.title("Distance_wText and text positioning")
+mpl.draw()
+mpl.savefig("tmp_Distance_wText.png", dpi=None)
+mpl.savefig("tmp_Distance_wText.pdf")

+ 66 - 0
doc/src/tut/fig-tut/mpl_code_Rectangle.py

@@ -0,0 +1,66 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = 0.0, 8.0, -1.5, 6.0
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+
+mpl.grid(True)
+
+# rectangle
+x = [2.0, 6.0, 6.0, 2.0, 2.0]
+y = [0.0, 0.0, 3.0, 3.0, 0.0]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+ax.text(4, -0.466667, 'width',
+        horizontalalignment='center', fontsize=14)
+
+# line
+mpl.arrow(x=2, y=-0.6, dx=4, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=6, y=-0.6, dx=-4, dy=0,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+ax.annotate('lower_left_corner', xy=[ 2.  0.], xycoords='data',
+            textcoords='data', xytext=[ 1.2 -0.6],
+            horizontalalignment='center',
+            verticalalignment='top',
+            fontsize=14,
+            arrowprops=dict(arrowstyle='->',
+                            facecolor='black',
+                            linewidth=2,
+                            shrinkA=5,
+                            shrinkB=5))
+ax.text(6.93333, 1.5, 'height',
+        horizontalalignment='left', fontsize=14)
+
+# line
+mpl.arrow(x=6.8, y=3, dx=0, dy=-3,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.arrow(x=6.8, y=0, dx=0, dy=3,
+          facecolor='k', edgecolor='k',
+          linestyle='solid',
+          linewidth=1, head_width=0.1,
+          length_includes_head=True,
+          shape='full')
+mpl.title("Rectangle")
+mpl.draw()
+mpl.savefig("tmp_Rectangle.png", dpi=None)
+mpl.savefig("tmp_Rectangle.pdf")

Diff do ficheiro suprimidas por serem muito extensas
+ 2219 - 0
doc/src/tut/fig-tut/mpl_code_Spring.py


+ 30 - 0
doc/src/tut/fig-tut/mpl_code_Triangle.py

@@ -0,0 +1,30 @@
+import matplotlib.pyplot as mpl
+import matplotlib.transforms as transforms
+
+mpl.ion()  # for interactive drawing
+fig = mpl.figure()
+
+ax = fig.gca()
+xmin, xmax, ymin, ymax = 0.0, 8.0, -1.5, 3.6
+ax.set_xlim(xmin, xmax)
+ax.set_ylim(ymin, ymax)
+ax.set_aspect('equal')
+
+
+
+mpl.grid(True)
+
+# triangle
+x = [2.0, 6.0, 3.2, 2.0]
+y = [0.0, 2.0, 3.0, 0.0]
+[line] = ax.plot(x, y, 'b', linewidth=2, linestyle='solid')
+ax.text(6, 2, 'p2',
+        horizontalalignment='center', fontsize=14)
+ax.text(3.2, 3, 'p3',
+        horizontalalignment='center', fontsize=14)
+ax.text(2, 0, 'p1',
+        horizontalalignment='center', fontsize=14)
+mpl.title("Triangle")
+mpl.draw()
+mpl.savefig("tmp_Triangle.png", dpi=None)
+mpl.savefig("tmp_Triangle.pdf")

Diff do ficheiro suprimidas por serem muito extensas
+ 4025 - 0
doc/src/tut/fig-tut/mpl_code_Wavy.py


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 40880
doc/src/tut/fig-tut/vehicle0.eps


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 40278
doc/src/tut/fig-tut/vehicle0_dim.eps


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 9437
doc/src/tut/fig-tut/vehicle0_hier1.eps


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 40278
doc/src/tut/fig-tut/vehicle1.eps


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 38505
doc/src/tut/fig-tut/wheel_on_inclined_plane.eps


+ 2 - 1
doc/src/tut/main_sketcher.do.txt

@@ -37,5 +37,6 @@ no further background is required.
 
 # #include "basics.do.txt"
 
-# #include "implementation.do.txt"
+# #include "classes.do.txt"
 
+# #include "implementation.do.txt"

+ 2 - 1
examples/osc1.py

@@ -33,7 +33,7 @@ ground = Wall(x=[-L/2,L], y=[0,0], thickness=-H/10)
 wheel1 = Circle((H,H/2), H/2)
 wheel2 = wheel1.copy()
 wheel2.translate(point(2*H, 0))
-fig = Compose({
+fig = Composition({
     'dashpot': d, 'spring': s, 'mass': M, 'left wall': left_wall,
     'ground': ground, 'wheel1': wheel1, 'wheel2': wheel2})
 
@@ -43,4 +43,5 @@ print s
 print s.shapes['bar1']['line'].x, s.shapes['bar1']['line'].y
 print s.shapes['bar2']['line'].x, s.shapes['bar2']['line'].y
 drawing_tool.display()
+drawing_tool.savefig('oscillator')
 raw_input()

+ 41 - 38
pysketcher/shapes.py

@@ -2466,34 +2466,40 @@ def test_Axis():
     drawing_tool.set_coordinate_system(
         xmin=0, xmax=15, ymin=-7, ymax=8, axis=True,
         instruction_file='tmp_Axis.py')
+    # Draw normal x and y axis with origin at (7.5, 2)
+    # in the coordinate system of the sketch: [0,15]x[-7,8]
     x_axis = Axis((7.5,2), 5, 'x', rotation_angle=0)
     y_axis = Axis((7.5,2), 5, 'y', rotation_angle=90)
     system = Composition({'x axis': x_axis, 'y axis': y_axis})
     system.draw()
     drawing_tool.display()
+
+    # Rotate this system 40 degrees counter clockwise
+    # and draw it with dashed lines
     system.set_linestyle('dashed')
     system.rotate(40, (7.5,2))
     system.draw()
     drawing_tool.display()
 
+    # Rotate this system another 220 degrees and show
+    # with dotted lines
     system.set_linestyle('dotted')
     system.rotate(220, (7.5,2))
     system.draw()
     drawing_tool.display()
 
     drawing_tool.display('Axis')
-    drawing_tool.savefig('tmp_Axis.png')
+    drawing_tool.savefig('tmp_Axis')
     print repr(system)
 
 def test_Distance_wText():
-    drawing_tool.set_coordinate_system(xmin=0, xmax=10,
-                                       ymin=0, ymax=6,
-                                       axis=True,
-                                       instruction_file='tmp_Distance_wText.py')
-    #drawing_tool.arrow_head_width = 0.1
+    drawing_tool.set_coordinate_system(
+        xmin=0, xmax=10, ymin=0, ymax=6,
+        axis=True, instruction_file='tmp_Distance_wText.py')
+
     fontsize=14
-    t = r'$ 2\pi R^2 $'
-    dims2 = Composition({
+    t = r'$ 2\pi R^2 $'  # sample text
+    examples = Composition({
         'a0': Distance_wText((4,5), (8, 5), t, fontsize),
         'a6': Distance_wText((4,5), (4, 4), t, fontsize),
         'a1': Distance_wText((0,2), (2, 4.5), t, fontsize),
@@ -2510,18 +2516,17 @@ def test_Distance_wText():
                           (4, 0.5), (9, 1.2),
                           fontsize=10, alignment='left'),
         })
-    dims2.draw()
+    examples.draw()
     drawing_tool.display('Distance_wText and text positioning')
-    drawing_tool.savefig('tmp_Distance_wText.png')
+    drawing_tool.savefig('tmp_Distance_wText')
 
 def test_Rectangle():
     L = 3.0
     W = 4.0
 
-    drawing_tool.set_coordinate_system(xmin=0, xmax=2*W,
-                                       ymin=-L/2, ymax=2*L,
-                                       axis=True,
-                                       instruction_file='tmp_Rectangle.py')
+    drawing_tool.set_coordinate_system(
+        xmin=0, xmax=2*W, ymin=-L/2, ymax=2*L,
+        axis=True, instruction_file='tmp_Rectangle.py')
     drawing_tool.set_linecolor('blue')
     drawing_tool.set_grid(True)
 
@@ -2530,17 +2535,16 @@ def test_Rectangle():
     r.draw()
     r.draw_dimensions()
     drawing_tool.display('Rectangle')
-    drawing_tool.savefig('tmp_Rectangle.png')
+    drawing_tool.savefig('tmp_Rectangle')
 
 
 def test_Triangle():
     L = 3.0
     W = 4.0
 
-    drawing_tool.set_coordinate_system(xmin=0, xmax=2*W,
-                                       ymin=-L/2, ymax=1.2*L,
-                                       axis=True,
-                                       instruction_file='tmp_Triangle.py')
+    drawing_tool.set_coordinate_system(
+        xmin=0, xmax=2*W, ymin=-L/2, ymax=1.2*L,
+        axis=True, instruction_file='tmp_Triangle.py')
     drawing_tool.set_linecolor('blue')
     drawing_tool.set_grid(True)
 
@@ -2549,16 +2553,15 @@ def test_Triangle():
     t.draw()
     t.draw_dimensions()
     drawing_tool.display('Triangle')
-    drawing_tool.savefig('tmp_Triangle.png')
+    drawing_tool.savefig('tmp_Triangle')
 
 def test_Arc():
     L = 4.0
     W = 4.0
 
-    drawing_tool.set_coordinate_system(xmin=-W/2, xmax=W,
-                                       ymin=-L/2, ymax=1.5*L,
-                                       axis=True,
-                                       instruction_file='tmp_Arc.py')
+    drawing_tool.set_coordinate_system(
+        xmin=-W/2, xmax=W, ymin=-L/2, ymax=1.5*L,
+        axis=True, instruction_file='tmp_Arc.py')
     drawing_tool.set_linecolor('blue')
     drawing_tool.set_grid(True)
 
@@ -2599,23 +2602,23 @@ def test_Arc():
 
     a.draw_dimensions()
     drawing_tool.display('Arc')
-    drawing_tool.savefig('tmp_Arc.png')
+    drawing_tool.savefig('tmp_Arc')
 
 
 def test_Spring():
     L = 5.0
     W = 2.0
 
-    drawing_tool.set_coordinate_system(xmin=0, xmax=7*W,
-                                       ymin=-L/2, ymax=1.5*L,
-                                       axis=True,
-                                       instruction_file='tmp_Spring.py')
+    drawing_tool.set_coordinate_system(
+        xmin=0, xmax=7*W, ymin=-L/2, ymax=1.5*L,
+        axis=True, instruction_file='tmp_Spring.py')
     drawing_tool.set_linecolor('blue')
     drawing_tool.set_grid(True)
 
     xpos = W
     s1 = Spring((W,0), L, teeth=True)
-    s1_title = Text('Default Spring', s1.geometric_features()['end'] + point(0,L/10))
+    s1_title = Text('Default Spring',
+                    s1.geometric_features()['end'] + point(0,L/10))
     s1.draw()
     s1_title.draw()
     #s1.draw_dimensions()
@@ -2625,7 +2628,7 @@ def test_Spring():
     s2.draw()
     s2.draw_dimensions()
     drawing_tool.display('Spring')
-    drawing_tool.savefig('tmp_Spring.png')
+    drawing_tool.savefig('tmp_Spring')
 
 
 def test_Dashpot():
@@ -2633,17 +2636,17 @@ def test_Dashpot():
     W = 2.0
     xpos = 0
 
-    drawing_tool.set_coordinate_system(xmin=xpos, xmax=xpos+5.5*W,
-                                       ymin=-L/2, ymax=1.5*L,
-                                       axis=True,
-                                       instruction_file='tmp_Dashpot.py')
+    drawing_tool.set_coordinate_system(
+        xmin=xpos, xmax=xpos+5.5*W, ymin=-L/2, ymax=1.5*L,
+        axis=True, instruction_file='tmp_Dashpot.py')
     drawing_tool.set_linecolor('blue')
     drawing_tool.set_grid(True)
 
     # Default (simple) dashpot
     xpos = 1.5
     d1 = Dashpot(start=(xpos,0), total_length=L)
-    d1_title = Text('Dashpot (default)', d1.geometric_features()['end'] + point(0,L/10))
+    d1_title = Text('Dashpot (default)',
+                    d1.geometric_features()['end'] + point(0,L/10))
     d1.draw()
     d1_title.draw()
 
@@ -2656,7 +2659,7 @@ def test_Dashpot():
     d2.draw_dimensions()
 
     drawing_tool.display('Dashpot')
-    drawing_tool.savefig('tmp_Dashpot.png')
+    drawing_tool.savefig('tmp_Dashpot')
 
 def test_Wavy():
     drawing_tool.set_coordinate_system(xmin=0, xmax=1.5,
@@ -2670,7 +2673,7 @@ def test_Wavy():
              smoothness=0.05)
     w.draw()
     drawing_tool.display('Wavy')
-    drawing_tool.savefig('tmp_Wavy.png')
+    drawing_tool.savefig('tmp_Wavy')
 
 def diff_files(files1, files2, mode='HTML'):
     import difflib, time