pysketcher.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <!--
  2. Automatically generated HTML file from DocOnce source
  3. (https://github.com/hplgit/doconce/)
  4. -->
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
  9. <meta name="description" content="Using Pysketcher to Create Principal Sketches of Physics Problems">
  10. <meta name="keywords" content="tree data structure,recursive function calls">
  11. <title>Using Pysketcher to Create Principal Sketches of Physics Problems</title>
  12. <style type="text/css">
  13. /* blueish style */
  14. /* Color definitions: http://www.december.com/html/spec/color0.html
  15. CSS examples: http://www.w3schools.com/css/css_examples.asp */
  16. body {
  17. margin-top: 1.0em;
  18. background-color: #ffffff;
  19. font-family: Helvetica, Arial, FreeSans, san-serif;
  20. color: #000000;
  21. }
  22. h1 { font-size: 1.8em; color: #1e36ce; }
  23. h2 { font-size: 1.6em; color: #1e36ce; }
  24. h3 { font-size: 1.4em; color: #1e36ce; }
  25. a { color: #1e36ce; text-decoration:none; }
  26. tt { font-family: "Courier New", Courier; }
  27. /* pre style removed because it will interfer with pygments */
  28. p { text-indent: 0px; }
  29. hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
  30. p.caption { width: 80%; font-style: normal; text-align: left; }
  31. hr.figure { border: 0; width: 80%; border-bottom: 1px solid #aaa}
  32. div { text-align: justify; text-justify: inter-word; }
  33. </style>
  34. </head>
  35. <!-- tocinfo
  36. {'highest level': 1,
  37. 'sections': [(' A First Glimpse of Pysketcher ', 1, None, '___sec0'),
  38. (' Basic Construction of Sketches ', 2, None, '___sec1'),
  39. (' Basic Drawing ', 3, None, '___sec2'),
  40. (' Groups of Objects ', 3, None, '___sec3'),
  41. (' Changing Line Styles and Colors ', 3, None, '___sec4'),
  42. (' The Figure Composition as an Object Hierarchy ',
  43. 3,
  44. None,
  45. '___sec5'),
  46. (' Animation: Translating the Vehicle ', 3, None, '___sec6'),
  47. (' Animation: Rolling the Wheels ',
  48. 3,
  49. 'sketcher:vehicle1:anim',
  50. 'sketcher:vehicle1:anim'),
  51. (' Basic Shapes ', 1, None, '___sec8'),
  52. (' Axis ', 2, None, '___sec9'),
  53. (' Distance with Text ', 2, None, '___sec10'),
  54. (' Rectangle ', 2, None, '___sec11'),
  55. (' Triangle ', 2, None, '___sec12'),
  56. (' Arc ', 2, None, '___sec13'),
  57. (' Spring ', 2, None, '___sec14'),
  58. (' Dashpot ', 2, None, '___sec15'),
  59. (' Wavy ', 2, None, '___sec16'),
  60. (' Stochastic curves ', 2, None, '___sec17'),
  61. (' Inner Workings of the Pysketcher Tool ',
  62. 1,
  63. None,
  64. '___sec18'),
  65. (' Example of Classes for Geometric Objects ',
  66. 2,
  67. None,
  68. '___sec19'),
  69. (' Simple Geometric Objects ', 3, None, '___sec20'),
  70. (' Class Curve ', 3, None, '___sec21'),
  71. (' Compound Geometric Objects ', 3, None, '___sec22'),
  72. (' Adding Functionality via Recursion ', 2, None, '___sec23'),
  73. (' Basic Principles of Recursion ', 3, None, '___sec24'),
  74. (' Explaining Recursion ', 3, None, '___sec25'),
  75. (' Scaling, Translating, and Rotating a Figure ',
  76. 2,
  77. 'sketcher:scaling',
  78. 'sketcher:scaling'),
  79. (' Scaling ', 3, None, '___sec27'),
  80. (' Translation ', 3, None, '___sec28'),
  81. (' Rotation ', 3, None, '___sec29')]}
  82. end of tocinfo -->
  83. <body>
  84. <script type="text/x-mathjax-config">
  85. MathJax.Hub.Config({
  86. TeX: {
  87. equationNumbers: { autoNumber: "none" },
  88. extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
  89. }
  90. });
  91. </script>
  92. <script type="text/javascript"
  93. src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  94. </script>
  95. <a name="part0000"></a>
  96. <p>
  97. <!-- begin top navigation -->
  98. <table style="width: 100%"><tr><td>
  99. </td><td>
  100. <div style="text-align: right;"><a href="._pysketcher001.html"><img src="http://hplgit.github.io/doconce/bundled/html_images/next1.png" border=0 alt="Next &raquo;"></a></div>
  101. </td></tr></table>
  102. <!-- end top navigation -->
  103. </p>
  104. <p>
  105. <!-- ------------------- main content ---------------------- -->
  106. <center><h1>Using Pysketcher to Create Principal Sketches of Physics Problems</h1></center> <!-- document title -->
  107. <p>
  108. <!-- author(s): Hans Petter Langtangen -->
  109. <center>
  110. <b>Hans Petter Langtangen</b> [1, 2]
  111. </center>
  112. <p>
  113. <!-- institution(s) -->
  114. <center>[1] <b>Center for Biomedical Computing, Simula Research Laboratory</b></center>
  115. <center>[2] <b>Department of Informatics, University of Oslo</b></center>
  116. <p>
  117. <center><h4>Apr 27, 2015</h4></center> <!-- date -->
  118. <p>
  119. <!-- begin box -->
  120. <div style="width: 95%; padding: 10px; border: 1px solid #000; border-radius: 4px;">
  121. This document is derived from Chapter 9 in the book
  122. <a href="http://www.amazon.com/Scientific-Programming-Computational-Science-Engineering/dp/3642549586/ref=sr_1_2?s=books&ie=UTF8&qid=1407225588&sr=1-2&keywords=langtangen" target="_self">A Primer on Scientific Programming with Python</a>, by H. P. Langtangen,
  123. 4th edition, Springer, 2014.
  124. </div>
  125. <!-- end box -->
  126. <p>
  127. <b>Abstract.</b> Pysketcher is a Python package which allows principal sketches of
  128. physics and mechanics problems to be realized through short programs
  129. instead of interactive (and potentially tedious and inaccurate)
  130. drawing. Elements of the sketch, such as lines, circles, angles,
  131. forces, coordinate systems, etc., are realized as objects and
  132. collected in hierarchical structures. Parts of the hierarchical
  133. structures can easily change line styles and colors, or be copied,
  134. scaled, translated, and rotated. These features make it
  135. straightforward to move parts of the sketch to create animation,
  136. usually in accordance with the physics of the underlying problem.
  137. Exact dimensioning of the elements in the sketch is trivial to obtain
  138. since distances are specified in computer code.
  139. <p>
  140. Pysketcher is easy to learn from a number of examples. Beyond
  141. essential Python programming and a knowledge about mechanics problems,
  142. no further background is required.
  143. <p>
  144. <!-- Task (can be questions): make sketches of physical problems, see fig -->
  145. <!-- through user-friendly composition of basic shapes -->
  146. <!-- Desired knowledge: plotting curves, basic OO (ch. X.Y, ...) -->
  147. <!-- Required knowledge? -->
  148. <!-- Learning Goals: these targets the inner workings of pysketcher, -->
  149. <!-- which is just a part of this document... -->
  150. <p>
  151. <p>
  152. <!-- begin bottom navigation -->
  153. <table style="width: 100%"><tr><td>
  154. </td><td>
  155. <div style="text-align: right;"><a href="._pysketcher001.html"><img src="http://hplgit.github.io/doconce/bundled/html_images/next1.png" border=0 alt="Next &raquo;"></a></div>
  156. </td></tr></table>
  157. <!-- end bottom navigation -->
  158. </p>
  159. <!-- ------------------- end of main content --------------- -->
  160. </body>
  161. </html>