| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <!--
- Automatically generated HTML file from DocOnce source
- (https://github.com/hplgit/doconce/)
- -->
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
- <meta name="description" content="Using Pysketcher to Create Principal Sketches of Physics Problems">
- <meta name="keywords" content="tree data structure,recursive function calls">
- <title>Using Pysketcher to Create Principal Sketches of Physics Problems</title>
- <!-- Bootstrap style: bootswatch_readable -->
- <link href="http://netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css" rel="stylesheet">
- <!-- not necessary
- <link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
- -->
- <style type="text/css">
- /* Add scrollbar to dropdown menus in bootstrap navigation bar */
- .dropdown-menu {
- height: auto;
- max-height: 400px;
- overflow-x: hidden;
- }
- </style>
- </head>
- <!-- tocinfo
- {'highest level': 1,
- 'sections': [('A First Glimpse of Pysketcher', 1, None, '___sec0'),
- ('Basic Construction of Sketches', 2, None, '___sec1'),
- ('Basic Drawing', 3, None, '___sec2'),
- ('Groups of Objects', 3, None, '___sec3'),
- ('Changing Line Styles and Colors', 3, None, '___sec4'),
- ('The Figure Composition as an Object Hierarchy',
- 3,
- None,
- '___sec5'),
- ('Animation: Translating the Vehicle', 3, None, '___sec6'),
- ('Animation: Rolling the Wheels',
- 3,
- 'sketcher:vehicle1:anim',
- 'sketcher:vehicle1:anim'),
- ('Basic Shapes', 1, None, '___sec8'),
- ('Axis', 2, None, '___sec9'),
- ('Distance with Text', 2, None, '___sec10'),
- ('Rectangle', 2, None, '___sec11'),
- ('Triangle', 2, None, '___sec12'),
- ('Arc', 2, None, '___sec13'),
- ('Spring', 2, None, '___sec14'),
- ('Dashpot', 2, None, '___sec15'),
- ('Wavy', 2, None, '___sec16'),
- ('Stochastic curves', 2, None, '___sec17'),
- ('Inner Workings of the Pysketcher Tool', 1, None, '___sec18'),
- ('Example of Classes for Geometric Objects',
- 2,
- None,
- '___sec19'),
- ('Simple Geometric Objects', 3, None, '___sec20'),
- ('Class Curve', 3, None, '___sec21'),
- ('Compound Geometric Objects', 3, None, '___sec22'),
- ('Adding Functionality via Recursion', 2, None, '___sec23'),
- ('Basic Principles of Recursion', 3, None, '___sec24'),
- ('Explaining Recursion', 3, None, '___sec25'),
- ('Scaling, Translating, and Rotating a Figure',
- 2,
- 'sketcher:scaling',
- 'sketcher:scaling'),
- ('Scaling', 3, None, '___sec27'),
- ('Translation', 3, None, '___sec28'),
- ('Rotation', 3, None, '___sec29')]}
- end of tocinfo -->
- <body>
- <script type="text/x-mathjax-config">
- MathJax.Hub.Config({
- TeX: {
- equationNumbers: { autoNumber: "none" },
- extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
- }
- });
- </script>
- <script type="text/javascript"
- src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
- </script>
-
- <!-- Bootstrap navigation bar -->
- <div class="navbar navbar-default navbar-fixed-top">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="pysketcher.html">Using Pysketcher to Create Principal Sketches of Physics Problems</a>
- </div>
- <div class="navbar-collapse collapse navbar-responsive-collapse">
- <ul class="nav navbar-nav navbar-right">
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
- <ul class="dropdown-menu">
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec0" style="font-size: 80%;"><b>A First Glimpse of Pysketcher</b></a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec1" style="font-size: 80%;"> Basic Construction of Sketches</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec2" style="font-size: 80%;"> Basic Drawing</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec3" style="font-size: 80%;"> Groups of Objects</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec4" style="font-size: 80%;"> Changing Line Styles and Colors</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec5" style="font-size: 80%;"> The Figure Composition as an Object Hierarchy</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#___sec6" style="font-size: 80%;"> Animation: Translating the Vehicle</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher001.html#sketcher:vehicle1:anim" style="font-size: 80%;"> Animation: Rolling the Wheels</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec8" style="font-size: 80%;"><b>Basic Shapes</b></a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec9" style="font-size: 80%;"> Axis</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec10" style="font-size: 80%;"> Distance with Text</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec11" style="font-size: 80%;"> Rectangle</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec12" style="font-size: 80%;"> Triangle</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec13" style="font-size: 80%;"> Arc</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec14" style="font-size: 80%;"> Spring</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec15" style="font-size: 80%;"> Dashpot</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec16" style="font-size: 80%;"> Wavy</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher002.html#___sec17" style="font-size: 80%;"> Stochastic curves</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec18" style="font-size: 80%;"><b>Inner Workings of the Pysketcher Tool</b></a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec19" style="font-size: 80%;"> Example of Classes for Geometric Objects</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec20" style="font-size: 80%;"> Simple Geometric Objects</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec21" style="font-size: 80%;"> Class Curve</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec22" style="font-size: 80%;"> Compound Geometric Objects</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec23" style="font-size: 80%;"> Adding Functionality via Recursion</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec24" style="font-size: 80%;"> Basic Principles of Recursion</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec25" style="font-size: 80%;"> Explaining Recursion</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:scaling" style="font-size: 80%;"> Scaling, Translating, and Rotating a Figure</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec27" style="font-size: 80%;"> Scaling</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec28" style="font-size: 80%;"> Translation</a></li>
- <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec29" style="font-size: 80%;"> Rotation</a></li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </div> <!-- end of navigation bar -->
- <div class="container">
- <p> </p><p> </p><p> </p> <!-- add vertical space -->
- <a name="part0000"></a>
- <!-- ------------------- main content ---------------------- -->
- <div class="jumbotron">
- <center><h1>Using Pysketcher to Create Principal Sketches of Physics Problems</h1></center> <!-- document title -->
- <p>
- <!-- author(s): Hans Petter Langtangen -->
- <center>
- <b>Hans Petter Langtangen</b> [1, 2]
- </center>
- <p>
- <!-- institution(s) -->
- <center>[1] <b>Center for Biomedical Computing, Simula Research Laboratory</b></center>
- <center>[2] <b>Department of Informatics, University of Oslo</b></center>
- <br>
- <p>
- <center><h4>Dec 22, 2015</h4></center> <!-- date -->
- <br>
- <p>
- <!-- begin box -->
- <div style="width: 95%; padding: 10px; border: 1px solid #000; border-radius: 4px;">
- This document is derived from Chapter 9 in the book
- <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,
- 4th edition, Springer, 2014.
- </div>
- <!-- end box -->
- <p>
- <b>Abstract.</b> Pysketcher is a Python package which allows principal sketches of
- physics and mechanics problems to be realized through short programs
- instead of interactive (and potentially tedious and inaccurate)
- drawing. Elements of the sketch, such as lines, circles, angles,
- forces, coordinate systems, etc., are realized as objects and
- collected in hierarchical structures. Parts of the hierarchical
- structures can easily change line styles and colors, or be copied,
- scaled, translated, and rotated. These features make it
- straightforward to move parts of the sketch to create animation,
- usually in accordance with the physics of the underlying problem.
- Exact dimensioning of the elements in the sketch is trivial to obtain
- since distances are specified in computer code.
- <p>
- Pysketcher is easy to learn from a number of examples. Beyond
- essential Python programming and a knowledge about mechanics problems,
- no further background is required.
- <p>
- <!-- Task (can be questions): make sketches of physical problems, see fig -->
- <!-- through user-friendly composition of basic shapes -->
- <!-- Desired knowledge: plotting curves, basic OO (ch. X.Y, ...) -->
- <!-- Required knowledge? -->
- <!-- Learning Goals: these targets the inner workings of pysketcher, -->
- <!-- which is just a part of this document... -->
- <p>
- <p><a href="._pysketcher001.html" class="btn btn-primary btn-lg">Read »</a></p>
- </div> <!-- end jumbotron -->
- <p>
- <!-- navigation buttons at the bottom of the page -->
- <ul class="pagination">
- <li class="active"><a href="._pysketcher000.html">1</a></li>
- <li><a href="._pysketcher001.html">2</a></li>
- <li><a href="._pysketcher002.html">3</a></li>
- <li><a href="._pysketcher003.html">4</a></li>
- <li><a href="._pysketcher001.html">»</a></li>
- </ul>
- <!-- ------------------- end of main content --------------- -->
- </div> <!-- end container -->
- <!-- include javascript, jQuery *first* -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
- <!-- Bootstrap footer
- <footer>
- <a href="http://..."><img width="250" align=right src="http://..."></a>
- </footer>
- -->
- </body>
- </html>
-
|