1991 lines
112 KiB
HTML
1991 lines
112 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>pylib package — pylib 2019.5.19 documentation</title>
|
||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
<script type="text/javascript" src="_static/language_data.js"></script>
|
||
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="pylib-package">
|
||
<h1>pylib package<a class="headerlink" href="#pylib-package" title="Permalink to this headline">¶</a></h1>
|
||
<div class="section" id="subpackages">
|
||
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
|
||
<div class="toctree-wrapper compound">
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="pylib.numerical.html">pylib.numerical package</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#submodules">Submodules</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#module-pylib.numerical.fit">pylib.numerical.fit module</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#module-pylib.numerical.integration">pylib.numerical.integration module</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#module-pylib.numerical.ode">pylib.numerical.ode module</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#module-pylib.numerical.ode_model">pylib.numerical.ode_model module</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="pylib.numerical.html#module-pylib.numerical">Module contents</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="submodules">
|
||
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
|
||
</div>
|
||
<div class="section" id="module-pylib.data">
|
||
<span id="pylib-data-module"></span><h2>pylib.data module<a class="headerlink" href="#module-pylib.data" title="Permalink to this headline">¶</a></h2>
|
||
<p>Read and write data to or from file and manipulate data structures.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-10-11</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-data"></span><dl class="function">
|
||
<dt id="pylib.data.fold_list">
|
||
<code class="sig-name descname">fold_list</code><span class="sig-paren">(</span><em class="sig-param">lst</em>, <em class="sig-param">n</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#fold_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.fold_list" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Convert one-dimensional kx1 array (list) to two-dimensional mxn
|
||
array. m = k / n</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>lst</strong> (<em>list</em>) – list to convert</p></li>
|
||
<li><p><strong>n</strong> (<em>int</em>) – length of the second dimenson</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>two-dimensional array (list of lists)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>list</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.get_id">
|
||
<code class="sig-name descname">get_id</code><span class="sig-paren">(</span><em class="sig-param">ids</em>, <em class="sig-param">uide</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#get_id"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.get_id" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get full id from unique id ending.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ids</strong> (<em>list</em>) – ids</p></li>
|
||
<li><p><strong>uide</strong> (<em>str</em>) – unique id ending</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>full id</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>str or int</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.load">
|
||
<code class="sig-name descname">load</code><span class="sig-paren">(</span><em class="sig-param">file_name</em>, <em class="sig-param">default=None</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#load"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.load" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Load stored program objects from binary file.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>file_name</strong> (<em>str</em>) – file to load</p></li>
|
||
<li><p><strong>default</strong> (<em>object</em>) – return object if data loading fails</p></li>
|
||
<li><p><strong>verbose</strong> (<em>bool</em>) – verbose information (default = False)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>loaded data</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>object</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.read">
|
||
<code class="sig-name descname">read</code><span class="sig-paren">(</span><em class="sig-param">file_name</em>, <em class="sig-param">x_column</em>, <em class="sig-param">y_column</em>, <em class="sig-param">default=None</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#read"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.read" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read ascii data file.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>filename</strong> (<em>str</em>) – file to read</p></li>
|
||
<li><p><strong>x_column</strong> (<em>int</em>) – column index for the x data (first column is 0)</p></li>
|
||
<li><p><strong>y_column</strong> (<em>int</em>) – column index for the y data (first column is 0)</p></li>
|
||
<li><p><strong>default</strong> (<em>object</em>) – return object if data loading fails</p></li>
|
||
<li><p><strong>verbose</strong> (<em>bool</em>) – verbose information (default = False)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>x and y</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple(list, list)</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.seq">
|
||
<code class="sig-name descname">seq</code><span class="sig-paren">(</span><em class="sig-param">start</em>, <em class="sig-param">stop=None</em>, <em class="sig-param">step=1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#seq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.seq" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Create an arithmetic bounded sequence.</p>
|
||
<p>The sequence is one of the following;</p>
|
||
<ul class="simple">
|
||
<li><p>empty <span class="math notranslate nohighlight">\(\{\}=\emptyset\)</span>, if start and stop are the same</p></li>
|
||
<li><p>degenerate <span class="math notranslate nohighlight">\(\{a\}\)</span>, if the sequence has only one element.</p></li>
|
||
<li><p>left-close and right-open <span class="math notranslate nohighlight">\([a, b)\)</span></p></li>
|
||
</ul>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>start</strong> (<em>int</em><em> or </em><em>float</em>) – start of the sequence, the lower bound. If only start
|
||
is given than it is interpreted as stop and start will be 0.</p></li>
|
||
<li><p><strong>stop</strong> (<em>int</em><em> or </em><em>float</em>) – stop of sequence, the upper bound.</p></li>
|
||
<li><p><strong>step</strong> (<em>int</em><em> or </em><em>float</em>) – step size, the common difference (constant difference
|
||
between consecutive terms).</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>arithmetic bounded sequence</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>list</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.store">
|
||
<code class="sig-name descname">store</code><span class="sig-paren">(</span><em class="sig-param">file_name</em>, <em class="sig-param">object_data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#store"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.store" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Store program objects to binary file.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>file_name</strong> (<em>str</em>) – file to store</p></li>
|
||
<li><p><strong>object_data</strong> (<em>object</em>) – data to store</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.unique_ending">
|
||
<code class="sig-name descname">unique_ending</code><span class="sig-paren">(</span><em class="sig-param">ids</em>, <em class="sig-param">n=1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#unique_ending"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.unique_ending" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>From id list get list with unique ending.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ids</strong> (<em>list</em>) – ids</p></li>
|
||
<li><p><strong>n</strong> (<em>int</em>) – minumum chars or ints</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>unique ending of ids</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>list</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.data.write">
|
||
<code class="sig-name descname">write</code><span class="sig-paren">(</span><em class="sig-param">file_name</em>, <em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/data.html#write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.data.write" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Write ascii file.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>file_name</strong> (<em>str</em>) – file to write</p></li>
|
||
<li><p><strong>data</strong> (<em>str</em>) – data to write</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.date">
|
||
<span id="pylib-date-module"></span><h2>pylib.date module<a class="headerlink" href="#module-pylib.date" title="Permalink to this headline">¶</a></h2>
|
||
<p>Calculate spacial dates.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2018-01-15</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-date"></span><dl class="function">
|
||
<dt id="pylib.date.ascension_of_jesus">
|
||
<code class="sig-name descname">ascension_of_jesus</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#ascension_of_jesus"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.ascension_of_jesus" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Ascension of Jesus.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the ascension of Jesus</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of ascension of Jesus</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>datetime.date</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.date.easter_friday">
|
||
<code class="sig-name descname">easter_friday</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#easter_friday"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.easter_friday" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Easter Friday.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the Easter Friday</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of Easter Friday</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>datetime.date</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.date.easter_monday">
|
||
<code class="sig-name descname">easter_monday</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#easter_monday"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.easter_monday" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Easter Monday.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the Easter Monday</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of Easter Monday</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>datetime.date</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.date.easter_sunday">
|
||
<code class="sig-name descname">easter_sunday</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#easter_sunday"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.easter_sunday" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Easter Sunday.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the Easter Sunday</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of Easter Sunday</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>datetime.date</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.date.gaußsche_osterformel">
|
||
<code class="sig-name descname">gaußsche_osterformel</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#gaußsche_osterformel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.gaußsche_osterformel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gaußsche Osterformel.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the Easter Sunday</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of Easter Sunday as a day in march.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>int</p>
|
||
</dd>
|
||
<dt class="field-even">Variables</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>X</strong> (<em>int</em>) – Das Jahr / year</p></li>
|
||
<li><p><strong>K</strong><strong>(</strong><strong>X</strong><strong>)</strong> (<em>int</em>) – Die Säkularzahl</p></li>
|
||
<li><p><strong>M</strong><strong>(</strong><strong>X</strong><strong>)</strong> (<em>int</em>) – Die säkulare Mondschaltung</p></li>
|
||
<li><p><strong>S</strong><strong>(</strong><strong>K</strong><strong>)</strong> (<em>int</em>) – Die säkulare Sonnenschaltung</p></li>
|
||
<li><p><strong>A</strong><strong>(</strong><strong>X</strong><strong>)</strong> (<em>int</em>) – Den Mondparameter</p></li>
|
||
<li><p><strong>D</strong><strong>(</strong><strong>A</strong><strong>,</strong><strong>M</strong><strong>)</strong> (<em>int</em>) – Den Keim für den ersten Vollmond im Frühling</p></li>
|
||
<li><p><strong>R</strong><strong>(</strong><strong>D</strong><strong>,</strong><strong>A</strong><strong>)</strong> (<em>int</em>) – Die kalendarische Korrekturgröße</p></li>
|
||
<li><p><strong>OG</strong><strong>(</strong><strong>D</strong><strong>,</strong><strong>R</strong><strong>)</strong> (<em>int</em>) – Die Ostergrenze</p></li>
|
||
<li><p><strong>SZ</strong><strong>(</strong><strong>X</strong><strong>,</strong><strong>S</strong><strong>)</strong> (<em>int</em>) – Den ersten Sonntag im März</p></li>
|
||
<li><p><strong>OE</strong><strong>(</strong><strong>OG</strong><strong>,</strong><strong>SZ</strong><strong>)</strong> (<em>int</em>) – Die Entfernung des Ostersonntags von der Ostergrenze (Osterentfernung in Tagen)</p></li>
|
||
<li><p><strong>OS</strong><strong>(</strong><strong>OG</strong><strong>,</strong><strong>OE</strong><strong>)</strong> (<em>int</em>) – Das Datum des Ostersonntags als Märzdatum (32. März = 1. April usw.)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p>Algorithmus gilt für den Gregorianischen Kalender.</p>
|
||
<p>source: <a class="reference external" href="https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel">https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel</a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.date.pentecost">
|
||
<code class="sig-name descname">pentecost</code><span class="sig-paren">(</span><em class="sig-param">year</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/date.html#pentecost"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.date.pentecost" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Pentecost.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>year</strong> (<em>int</em>) – the year to calculate the Pentecost</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the day of Pentecost</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>datetime.date</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.drawblock">
|
||
<span id="pylib-drawblock-module"></span><h2>pylib.drawblock module<a class="headerlink" href="#module-pylib.drawblock" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="function">
|
||
<dt id="pylib.drawblock.histogram">
|
||
<code class="sig-name descname">histogram</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/drawblock.html#histogram"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.drawblock.histogram" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Histogram chart with block symbols.</p>
|
||
<dl class="simple">
|
||
<dt>dots:</dt><dd><p>,_,
|
||
<a href="#id7"><span class="problematic" id="id8">|8|</span></a>
|
||
<a href="#id9"><span class="problematic" id="id10">|7|</span></a>
|
||
<a href="#id11"><span class="problematic" id="id12">|6|</span></a>
|
||
<a href="#id13"><span class="problematic" id="id14">|5|</span></a>
|
||
<a href="#id15"><span class="problematic" id="id16">|4|</span></a>
|
||
<a href="#id17"><span class="problematic" id="id18">|3|</span></a>
|
||
<a href="#id19"><span class="problematic" id="id20">|2|</span></a>
|
||
<a href="#id21"><span class="problematic" id="id22">|1|</span></a>
|
||
<a href="#id1"><span class="problematic" id="id2">``</span></a><a href="#id3"><span class="problematic" id="id4">`</span></a></p>
|
||
</dd>
|
||
</dl>
|
||
<p>▁▂▃▄▅▆▇█
|
||
12345678</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.function">
|
||
<span id="pylib-function-module"></span><h2>pylib.function module<a class="headerlink" href="#module-pylib.function" title="Permalink to this headline">¶</a></h2>
|
||
<p>Mathematical equations.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-11-15</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-function"></span><dl class="function">
|
||
<dt id="pylib.function.cosine_wave">
|
||
<code class="sig-name descname">cosine_wave</code><span class="sig-paren">(</span><em class="sig-param">A=1</em>, <em class="sig-param">k=1</em>, <em class="sig-param">f=1</em>, <em class="sig-param">phi=0</em>, <em class="sig-param">D=0</em>, <em class="sig-param">degree=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#cosine_wave"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.cosine_wave" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A cosine wave is said to be sinusoidal, because,
|
||
<span class="math notranslate nohighlight">\(\cos(x) = \sin(x + \pi/2)\)</span>, which is also a sine wave with a
|
||
phase-shift of π/2 radians. Because of this head start, it is often
|
||
said that the cosine function leads the sine function or the sine
|
||
lags the cosine.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>A</strong> (<em>float</em><em> or </em><em>int</em>) – amplitude</p></li>
|
||
<li><p><strong>k</strong> (<em>float</em><em> or </em><em>int</em>) – (angular) wave number</p></li>
|
||
<li><p><strong>f</strong> (<em>float</em><em> or </em><em>int</em>) – ordinary frequency</p></li>
|
||
<li><p><strong>phi</strong> (<em>float</em><em> or </em><em>int</em>) – phase</p></li>
|
||
<li><p><strong>D</strong> (<em>float</em><em> or </em><em>int</em>) – non-zero center amplitude</p></li>
|
||
<li><p><strong>degree</strong> (<em>bool</em>) – boolean to switch between radians and degree. If
|
||
False phi is interpreted in radians and if True then phi is
|
||
interpreted in degrees.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Results</dt>
|
||
<dd class="field-even"><p>sine wave function of spatial variable x and optional
|
||
time t</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.function.sine_wave" title="pylib.function.sine_wave"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sine_wave()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.function.epitrochoid">
|
||
<code class="sig-name descname">epitrochoid</code><span class="sig-paren">(</span><em class="sig-param">R</em>, <em class="sig-param">r</em>, <em class="sig-param">d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#epitrochoid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.epitrochoid" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Epitrochoid</p>
|
||
<p>A point is attached with a distance d from the center of a circle
|
||
of radius r. The circle is rolling around the outside of a fixed
|
||
circle of radius R.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>R</strong> (<em>float</em>) – radius of the fixed interior circle</p></li>
|
||
<li><p><strong>r</strong> – radius of the rolling circle outside of the fixed circle</p></li>
|
||
<li><p><strong>d</strong> (<em>float</em>) – distance from the center of the exterior circle</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Typre r</dt>
|
||
<dd class="field-even"><p>float</p>
|
||
</dd>
|
||
<dt class="field-odd">Results</dt>
|
||
<dd class="field-odd"><p>functions for x of theta and y of theta</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}x(\theta) = (R + r)\cos\theta - d\cos\left(\frac{R+r}{r}\theta\right) \\
|
||
y(\theta) = (R + r)\sin\theta - d\sin\left(\frac{R+r}{r}\theta\right) \\
|
||
\theta = \left[0, 2\pi\right]\end{split}\]</div>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="n">R</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="n">r</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">**</span> <span class="o">....</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">**</span> <span class="n">d</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">epitrochoid</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)[:</span><span class="mi">1</span><span class="p">]</span>
|
||
<span class="gp">>>> </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">theta_end</span> <span class="o">=</span> <span class="n">epitrochoid</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.function.hypotrochoid">
|
||
<code class="sig-name descname">hypotrochoid</code><span class="sig-paren">(</span><em class="sig-param">R</em>, <em class="sig-param">r</em>, <em class="sig-param">d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#hypotrochoid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.hypotrochoid" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Hypotrochoid</p>
|
||
<p>A point is attached with a distance d from the center of a circle
|
||
of radius r. The circle is rolling around the inside of a fixed
|
||
circle of radius R.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>R</strong> (<em>float</em>) – radius of the fixed exterior circle</p></li>
|
||
<li><p><strong>r</strong> – radius of the rolling circle inside of the fixed circle</p></li>
|
||
<li><p><strong>d</strong> (<em>float</em>) – distance from the center of the interior circle</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Typre r</dt>
|
||
<dd class="field-even"><p>float</p>
|
||
</dd>
|
||
<dt class="field-odd">Results</dt>
|
||
<dd class="field-odd"><p>functions for x of theta and y of theta</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}x(\theta) = (R - r)\cos\theta + d\cos\left(\frac{R-r}{r}\theta\right) \\
|
||
y(\theta) = (R - r)\sin\theta - d\sin\left(\frac{R-r}{r}\theta\right) \\
|
||
\theta = \left[0, 2\pi\frac{\mathrm{lcm}(r, R)}{R}\right]\end{split}\]</div>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="n">R</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="n">r</span> <span class="o">**</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">....</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="n">d</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">**</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span>
|
||
<span class="o">*</span> <span class="o">*</span> <span class="o">*</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">hyotrochoid</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">6</span><span class="p">)[:</span><span class="mi">1</span><span class="p">]</span>
|
||
<span class="gp">>>> </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">theta_end</span> <span class="o">=</span> <span class="n">hyotrochoid</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="mathematics.html#mathematics.lcm" title="mathematics.lcm"><code class="xref py py-meth docutils literal notranslate"><span class="pre">mathematics.lcm()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.function.sine_wave">
|
||
<code class="sig-name descname">sine_wave</code><span class="sig-paren">(</span><em class="sig-param">A=1</em>, <em class="sig-param">k=1</em>, <em class="sig-param">f=1</em>, <em class="sig-param">phi=0</em>, <em class="sig-param">D=0</em>, <em class="sig-param">degree=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#sine_wave"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.sine_wave" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A sine wave or sinusoid is a mathematical curve that describes a
|
||
smooth periodic oscillation.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>A</strong> (<em>float</em><em> or </em><em>int</em>) – amplitude</p></li>
|
||
<li><p><strong>k</strong> (<em>float</em><em> or </em><em>int</em>) – (angular) wave number</p></li>
|
||
<li><p><strong>f</strong> (<em>float</em><em> or </em><em>int</em>) – ordinary frequency</p></li>
|
||
<li><p><strong>phi</strong> (<em>float</em><em> or </em><em>int</em>) – phase</p></li>
|
||
<li><p><strong>D</strong> (<em>float</em><em> or </em><em>int</em>) – non-zero center amplitude</p></li>
|
||
<li><p><strong>degree</strong> (<em>bool</em>) – boolean to switch between radians and degree. If
|
||
False phi is interpreted in radians and if True then phi is
|
||
interpreted in degrees.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Results</dt>
|
||
<dd class="field-even"><p>sine wave function of spatial variable x and optional
|
||
time t</p>
|
||
</dd>
|
||
</dl>
|
||
<p>In general, the function is:</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}y(x,t) = A\sin(kx + 2\pi f t + \varphi) + D \\
|
||
y(x,t) = A\sin(kx + \omega t + \varphi) + D\end{split}\]</div>
|
||
<p>where:</p>
|
||
<blockquote>
|
||
<div><ul class="simple">
|
||
<li><p>A, amplitude, the peak deviation of the function from zero.</p></li>
|
||
<li><p>f, ordinary frequency, the number of oscillations (cycles) that
|
||
occur each second of time.</p></li>
|
||
<li><p>ω = 2πf, angular frequency, the rate of change of the function
|
||
argument in units of radians per second. If ω < 0 the wave is
|
||
moving to the right, if ω > 0 the wave is moving to the left.</p></li>
|
||
<li><p>φ, phase, specifies (in radians) where in its cycle the
|
||
oscillation is at t = 0.</p></li>
|
||
<li><p>x, spatial variable that represents the position on the
|
||
dimension on which the wave propagates.</p></li>
|
||
<li><p>k, characteristic parameter called wave number (or angular wave
|
||
number), which represents the proportionality between the
|
||
angular frequency ω and the linear speed (speed of propagation)
|
||
ν.</p></li>
|
||
<li><p>D, non-zero center amplitude.</p></li>
|
||
</ul>
|
||
</div></blockquote>
|
||
<p>The wavenumber is related to the angular frequency by:</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[k={\omega \over v}={2\pi f \over v}={2\pi \over \lambda }\]</div>
|
||
<p>where λ (lambda) is the wavelength, f is the frequency, and v is the
|
||
linear speed.</p>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.function.cosine_wave" title="pylib.function.cosine_wave"><code class="xref py py-meth docutils literal notranslate"><span class="pre">cosine_wave()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.function.to_str">
|
||
<code class="sig-name descname">to_str</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x=None</em>, <em class="sig-param">x_0=0</em>, <em class="sig-param">x_1=1</em>, <em class="sig-param">t=None</em>, <em class="sig-param">h=10</em>, <em class="sig-param">w=80</em>, <em class="sig-param">density=1</em>, <em class="sig-param">char_set='line'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#to_str"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.to_str" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represent functions as string frame with a specific character set.
|
||
which are normed to the range of [0, 1] to</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>f</strong> (<em>function</em><em> or </em><em>list</em>) – function or list of functions normed to the range of [0, 1]</p></li>
|
||
<li><p><strong>h</strong> (<em>int</em>) – number of chars in vertical direction</p></li>
|
||
<li><p><strong>w</strong> (<em>int</em>) – number of chars in horizontal direction</p></li>
|
||
<li><p><strong>char_set</strong> (<em>str</em>) – either “braille” or “block”. “braille” uses Unicode
|
||
Characters in the Braille Patterns Block (fisrt index U+2800, last
|
||
index U+28FF <a class="reference internal" href="#cudb" id="id5"><span>[CUDB]</span></a>) and the “block” uses part of the Unicode
|
||
Characters in the Block Elements Block (fisrt index U+2580, last
|
||
index U+259F <a class="reference internal" href="#cudb" id="id6"><span>[CUDB]</span></a>). Alias for braille is line and alias for
|
||
block is histogram</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><ul class="simple">
|
||
<li><p>case dependent arguments</p>
|
||
<ul>
|
||
<li><p>1 quasi line plot (braille characters)
|
||
f = lambda function (lambda x, t=0: …)
|
||
x_1 = max x value
|
||
x_0 = min x value
|
||
t = time (animation)</p></li>
|
||
<li><p>2 histogram (block characters)
|
||
f = lambda function (lambda x, t=0: …)
|
||
x_1 = max x value
|
||
x_0 = min x value
|
||
t = time (animation)
|
||
chart=”histogram”</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p>general arguments
|
||
w = window width in number of chars
|
||
density = number of data point per pixel (for line chart higher density makes thicker lines)
|
||
chart = either “line” or “histogram”</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Braille Patterns Block</p>
|
||
<ul class="simple">
|
||
<li><p>Dots or pixels per character in vertical direction: 6</p></li>
|
||
<li><p>Dots or pixels per character in horizontal direction: 2</p></li>
|
||
</ul>
|
||
<p>First dot (bottom left) is the zero (0) position of the
|
||
function. So, a function value of zero does not mean to have zero
|
||
dots but one.
|
||
Example of 3 columns and 3 rows (upside down view of ‘normal’ braille/drawille position)</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> | ^ y axis
|
||
| |
|
||
| ,_____,,_____,,_____,
|
||
7 + | * *|| * *|| * *|
|
||
6 + | * *|| * *|| * *|
|
||
5 + | * *|| * *|| * *|
|
||
4 + | * *|| * *|| * *|
|
||
| ;=====;;=====;;=====;
|
||
3 + | * *|| * *|| * *|
|
||
2 + | * *|| * *|| * *|
|
||
1 + | * *|| * *|| * *|
|
||
0 + - | * *|| * *|| * *| ---> x axis
|
||
| ;=====;;=====;;=====;
|
||
-1 + | * *|| * *|| * *|
|
||
-2 + | * *|| * *|| * *|
|
||
-3 + | * *|| * *|| * *|
|
||
-4 + | * *|| * *|| * *|
|
||
| `````````````````````
|
||
| |
|
||
`-----+--+---+--+---+--+-------------
|
||
-2 -1 0 1 2 3
|
||
</pre></div>
|
||
</div>
|
||
<p class="rubric">Block Elements Block</p>
|
||
<ul class="simple">
|
||
<li><p>Dots or pixels per character in vertical direction: 8</p></li>
|
||
<li><p>Dots or pixels per character in horizontal direction: 1</p></li>
|
||
</ul>
|
||
<p>Example of 3 columns and 3 rows</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> | ^ y axis
|
||
| |
|
||
| ,_____,,_____,,_____,
|
||
15 + | --- || --- || --- |
|
||
14 + | --- || --- || --- |
|
||
13 + | --- || --- || --- |
|
||
12 + | --- || --- || --- |
|
||
11 + | --- || --- || --- |
|
||
10 + | --- || --- || --- |
|
||
9 + | --- || --- || --- |
|
||
8 + | --- || --- || --- |
|
||
| ;=====;;=====;;=====;
|
||
7 + | --- || --- || --- |
|
||
6 + | --- || --- || --- |
|
||
5 + | --- || --- || --- |
|
||
4 + | --- || --- || --- |
|
||
3 + | --- || --- || --- |
|
||
2 + | --- || --- || --- |
|
||
1 + | --- || --- || --- |
|
||
0 + - | --- || --- || --- | ---> x axis
|
||
| ;=====;;=====;;=====;
|
||
-1 + | --- || --- || --- |
|
||
-2 + | --- || --- || --- |
|
||
-3 + | --- || --- || --- |
|
||
-4 + | --- || --- || --- |
|
||
-5 + | --- || --- || --- |
|
||
-6 + | --- || --- || --- |
|
||
-7 + | --- || --- || --- |
|
||
-8 + | --- || --- || --- |
|
||
| `````````````````````
|
||
| |
|
||
`------+------+------+---------------
|
||
-1 0 1
|
||
</pre></div>
|
||
</div>
|
||
<p class="rubric">References</p>
|
||
<dl class="citation">
|
||
<dt class="label" id="cudb"><span class="brackets">CUDB</span><span class="fn-backref">(<a href="#id5">1</a>,<a href="#id6">2</a>)</span></dt>
|
||
<dd><p><a class="reference external" href="ftp://ftp.unicode.org/Public/UNIDATA/Blocks.txt">Unicode Database - Blocks</a></p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.function.transformation" title="pylib.function.transformation"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pylib.function.transformation()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.function.transformation">
|
||
<code class="sig-name descname">transformation</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">scale_vertical=1</em>, <em class="sig-param">scale_horizontal=1</em>, <em class="sig-param">shift_horizontal=0</em>, <em class="sig-param">shift_vertical=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/function.html#transformation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.function.transformation" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Transform functions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>f</strong> (<em>function</em><em> or </em><em>list</em>) – function or list of functions</p></li>
|
||
<li><p><strong>scale_vertical</strong> – “a” scale factor in vertical direction (default
|
||
= 1)</p></li>
|
||
<li><p><strong>scale_horizontal</strong> – “b” scale factor in horizontal direction
|
||
(default = 1)</p></li>
|
||
<li><p><strong>shift_horizontal</strong> – “c” shift factor in horizontal direction
|
||
(default = 0)</p></li>
|
||
<li><p><strong>shift_vertical</strong> – “d” shift factor in vertical direction (default
|
||
= 0)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>transformed function or list of transformed functions</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>function or list</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[y = a \, f(b\,(x-c)) + d\]</div>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.geometry">
|
||
<span id="pylib-geometry-module"></span><h2>pylib.geometry module<a class="headerlink" href="#module-pylib.geometry" title="Permalink to this headline">¶</a></h2>
|
||
<p>2D geometry objects.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-08-28</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-geometry"></span><dl class="function">
|
||
<dt id="pylib.geometry.angle">
|
||
<code class="sig-name descname">angle</code><span class="sig-paren">(</span><em class="sig-param">point1</em>, <em class="sig-param">point2=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#angle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.angle" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Angle of point or between two points.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>point1</strong> (<em>tuple</em>) – (first) point</p></li>
|
||
<li><p><strong>point2</strong> (<em>tuple</em>) – second point (default = None)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>angle of point or between two points</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.cubic">
|
||
<code class="sig-name descname">cubic</code><span class="sig-paren">(</span><em class="sig-param">point1</em>, <em class="sig-param">angle1</em>, <em class="sig-param">point2</em>, <em class="sig-param">angle2</em>, <em class="sig-param">samples=10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#cubic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.cubic" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Cubic line defined by two end points and the rotation in radians
|
||
at the points.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>point1</strong> (<em>tuple</em>) – one end point</p></li>
|
||
<li><p><strong>angle1</strong> (<em>int</em><em> or </em><em>float</em>) – the slope at the one end point</p></li>
|
||
<li><p><strong>point2</strong> (<em>tuple</em>) – other end point</p></li>
|
||
<li><p><strong>angle2</strong> (<em>int</em><em> or </em><em>float</em>) – the slope at the other end point</p></li>
|
||
<li><p><strong>samples</strong> (<em>int</em>) – number of sampling points (default = 10)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>([sample_point1_x, sample_point2_x, …],
|
||
[sample_points1_y, sample_point2_y, …])</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.cubic_deg">
|
||
<code class="sig-name descname">cubic_deg</code><span class="sig-paren">(</span><em class="sig-param">point1</em>, <em class="sig-param">angle1</em>, <em class="sig-param">point2</em>, <em class="sig-param">angle2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#cubic_deg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.cubic_deg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Cubic line defined by two end points and the roation in degree
|
||
at the points.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>point1</strong> (<em>tuple</em>) – one end point</p></li>
|
||
<li><p><strong>angle1</strong> (<em>int</em><em> or </em><em>float</em>) – the slope at the one end point</p></li>
|
||
<li><p><strong>point2</strong> (<em>tuple</em>) – other end point</p></li>
|
||
<li><p><strong>angle2</strong> (<em>int</em><em> or </em><em>float</em>) – the slope at the other end point</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>([sample_point1_x, sample_point2_x, …],
|
||
[sample_points1_y, sample_point2_y, …])</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.cubic" title="pylib.geometry.cubic"><code class="xref py py-meth docutils literal notranslate"><span class="pre">cubic()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.cubics">
|
||
<code class="sig-name descname">cubics</code><span class="sig-paren">(</span><em class="sig-param">pts</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#cubics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.cubics" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Cubic lines defined by a list of two end points. The deformation
|
||
as displacement and rotation (radians) is defined element wise as
|
||
keyword argument deformation or global node wise as
|
||
global_deformation. The global coordinate system is xy. x in the
|
||
right direction and y in the top direction.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>pts</strong> – list of points in absolute global coordinate system. If
|
||
keyword inc is given than the inc decides what the left and the
|
||
right end point of the line is, otherwise it is assumed that the
|
||
points build a solid line, that is lines between the given points
|
||
in given order.</p></li>
|
||
<li><p><strong>**kwargs</strong> – <p>options:</p>
|
||
<ul>
|
||
<li><p>deformation – list of deformation element wise. Additional
|
||
deformation (translation and rotation in radians) at element
|
||
left and right node.</p></li>
|
||
<li><p>rotation_plane – rotation plane of the element wise
|
||
deformation defined by a string; either ‘xy’ or ‘xz’ (default
|
||
= ‘xy’). x in the right direction and y in the top direction
|
||
or z in the bottom direction.</p></li>
|
||
<li><p>global_deformation – list of deformation global node wise.
|
||
Additional deformation (horizontal translation, vertical
|
||
translation and rotation in radians) at node.</p></li>
|
||
<li><p>factor – factor of the derformation (default = 1).</p></li>
|
||
<li><p>inc – the incidence table, a list of 2 element lists. The inc
|
||
decides what the left and the right end point of the line is.</p></li>
|
||
<li><p>index_offset – starting index of lists (default = 0).</p></li>
|
||
</ul>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>list of endpoints for each line;
|
||
[(((point1_x, point1_y) angle1), ((point2_x, point2_y), angle2),
|
||
(p1, angle1, p2, angle2),
|
||
…]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>list</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.distance">
|
||
<code class="sig-name descname">distance</code><span class="sig-paren">(</span><em class="sig-param">point1</em>, <em class="sig-param">point2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#distance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.distance" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Distance between two points (or length of a straight line).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>point1</strong> (<em>tuple</em>) – first point (first end point of straight line)</p></li>
|
||
<li><p><strong>point2</strong> (<em>tuple</em>) – second point (second end point of straight line)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>distance between the two points</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.interpolate_hermite">
|
||
<code class="sig-name descname">interpolate_hermite</code><span class="sig-paren">(</span><em class="sig-param">lvd</em>, <em class="sig-param">lr</em>, <em class="sig-param">rvd</em>, <em class="sig-param">rr</em>, <em class="sig-param">lhd=0</em>, <em class="sig-param">rhd=0</em>, <em class="sig-param">scale_x=1</em>, <em class="sig-param">scale_y=1</em>, <em class="sig-param">samples=10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#interpolate_hermite"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.interpolate_hermite" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Interpolate cubic line with hermite boundary conditions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>lvd</strong> (<em>int</em><em> or </em><em>float</em>) – left vertcal deflection</p></li>
|
||
<li><p><strong>lr</strong> (<em>int</em><em> or </em><em>float</em>) – left rotation</p></li>
|
||
<li><p><strong>rvd</strong> (<em>int</em><em> or </em><em>float</em>) – right vertical deflection</p></li>
|
||
<li><p><strong>rr</strong> (<em>int</em><em> or </em><em>float</em>) – right rotation</p></li>
|
||
<li><p><strong>lhd</strong> (<em>int</em><em> or </em><em>float</em>) – left horizontal deformation (default = 0)</p></li>
|
||
<li><p><strong>rhd</strong> (<em>int</em><em> or </em><em>float</em>) – right horizontal deformation (default = 0)</p></li>
|
||
<li><p><strong>scale_x</strong> (<em>int</em><em> or </em><em>float</em>) – length of element (default = 1)</p></li>
|
||
<li><p><strong>scale_y</strong> (<em>int</em><em> or </em><em>float</em>) – factor of the deformation (default = 1).
|
||
This does not change the length.</p></li>
|
||
<li><p><strong>samples</strong> (<em>int</em>) – number of sampling points (default = 10)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}s = \frac{x - x_1}{L} \\
|
||
x = s\,L + x_1\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.line">
|
||
<code class="sig-name descname">line</code><span class="sig-paren">(</span><em class="sig-param">point1</em>, <em class="sig-param">point2</em>, <em class="sig-param">samples=2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#line"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.line" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Line defined by two end points.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[y = \frac{y_2-y_1}{x_2-x_1}(x-x_1) + y_1\]</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>point1</strong> (<em>tuple</em>) – one end point</p></li>
|
||
<li><p><strong>point2</strong> (<em>tuple</em>) – other end point</p></li>
|
||
<li><p><strong>samples</strong> (<em>int</em>) – number of sampling points (default = 2)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>((point1_x, point2_x), (points1_y, point2_y)) or
|
||
([sample_point1_x, sample_point2_x, …],
|
||
[sample_points1_y, sample_point2_y, …])</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
<dt class="field-even">Example</dt>
|
||
<dd class="field-even"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">line</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||
<span class="go">((0, 1), (0, 0))</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.lines">
|
||
<code class="sig-name descname">lines</code><span class="sig-paren">(</span><em class="sig-param">pts</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.lines" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Lines defined by a list of end points.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>pts</strong> (<em>list</em>) – list of points in absolute global coordinate system. If
|
||
keyword inc is given than the inc decides what the left and the
|
||
right end point of the line is, otherwise it is assumed that the
|
||
points build a solid line, that is lines between the given points
|
||
in given order.</p></li>
|
||
<li><p><strong>**kwargs</strong> – <p>options:</p>
|
||
<ul>
|
||
<li><p>deformation – list of points. Additional deformation
|
||
(translation) at point.</p></li>
|
||
<li><p>factor – factor of the deformation (default = 1).</p></li>
|
||
<li><p>inc – the incidence table, a list of 2 element lists. The inc
|
||
decides what the left and the right end point of the line is.</p></li>
|
||
<li><p>index_offset – starting index of lists (default = 0).</p></li>
|
||
</ul>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>list of endpoints for each line;
|
||
[((point1_x, point1_y), (point2_x, point2_y)),
|
||
(p1, p2),
|
||
…]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>list</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="geometry_plot.html#geometry_plot.plot_lines" title="geometry_plot.plot_lines"><code class="xref py py-meth docutils literal notranslate"><span class="pre">plot_lines()</span></code></a> of the <a class="reference internal" href="#module-geometry_plot" title="geometry_plot: Geometry plotting. (*nix, Windows)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">geometry_plot</span></code></a>
|
||
module to plot the lines</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.rectangle">
|
||
<code class="sig-name descname">rectangle</code><span class="sig-paren">(</span><em class="sig-param">width</em>, <em class="sig-param">height</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#rectangle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.rectangle" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>width</strong> (<em>int</em><em> or </em><em>float</em>) – the width of the rectangle</p></li>
|
||
<li><p><strong>height</strong> (<em>int</em><em> or </em><em>float</em>) – the height of the rectangle</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(point1, point2, point3, point4)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.rotate">
|
||
<code class="sig-name descname">rotate</code><span class="sig-paren">(</span><em class="sig-param">origin</em>, <em class="sig-param">angle</em>, <em class="sig-param">*pts</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.rotate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotate a point or polygon counterclockwise by a given angle
|
||
around a given origin. The angle should be given in radians.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>origin</strong> (<em>tuple</em>) – the center of rotation</p></li>
|
||
<li><p><strong>angle</strong> (<em>int</em><em> or </em><em>float</em>) – the rotation angle</p></li>
|
||
<li><p><strong>*pts</strong> – points to rotate</p></li>
|
||
<li><p><strong>**kwargs</strong> – options</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(point_x, point_y) or (point1, point2, …)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.rotate_xy" title="pylib.geometry.rotate_xy"><code class="xref py py-meth docutils literal notranslate"><span class="pre">rotate_xy()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.rotate_deg">
|
||
<code class="sig-name descname">rotate_deg</code><span class="sig-paren">(</span><em class="sig-param">origin</em>, <em class="sig-param">angle</em>, <em class="sig-param">*pts</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#rotate_deg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.rotate_deg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotate a point or polygon counterclockwise by a given angle
|
||
around a given origin. The angle should be given in degrees.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>origin</strong> (<em>tuple</em>) – the center of rotation</p></li>
|
||
<li><p><strong>angle</strong> (<em>int</em><em> or </em><em>float</em>) – the rotation angle</p></li>
|
||
<li><p><strong>*pts</strong> – points to rotate</p></li>
|
||
<li><p><strong>**kwargs</strong> – options</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(point_x, point_y) or (point1, point2, …)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.rotate" title="pylib.geometry.rotate"><code class="xref py py-meth docutils literal notranslate"><span class="pre">rotate()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.rotate_xy">
|
||
<code class="sig-name descname">rotate_xy</code><span class="sig-paren">(</span><em class="sig-param">origin</em>, <em class="sig-param">angle</em>, <em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#rotate_xy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.rotate_xy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotate x and y coordinates counterclockwise by a given angle
|
||
around a given origin. The angle should be given in radians.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>origin</strong> (<em>tuple</em>) – the center of rotation</p></li>
|
||
<li><p><strong>angle</strong> (<em>int</em><em> or </em><em>float</em>) – the rotation angle</p></li>
|
||
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em>) – x coordinates</p></li>
|
||
<li><p><strong>y</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em>) – y coordinates</p></li>
|
||
<li><p><strong>**kwargs</strong> – options</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.rotate" title="pylib.geometry.rotate"><code class="xref py py-meth docutils literal notranslate"><span class="pre">rotate()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.square">
|
||
<code class="sig-name descname">square</code><span class="sig-paren">(</span><em class="sig-param">width</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#square"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.square" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>width</strong> (<em>int</em><em> or </em><em>float</em>) – the edge size of the square</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(point1, point2, point3, point4)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.rectangle" title="pylib.geometry.rectangle"><code class="xref py py-meth docutils literal notranslate"><span class="pre">rectangle()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.translate">
|
||
<code class="sig-name descname">translate</code><span class="sig-paren">(</span><em class="sig-param">vec</em>, <em class="sig-param">*pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#translate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.translate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translate a point or polygon by a given vector.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>vec</strong> (<em>tuple</em>) – translation vector</p></li>
|
||
<li><p><strong>*pts</strong> – points to translate</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(point_x, point_y) or (point1, point2, …)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.translate_xy" title="pylib.geometry.translate_xy"><code class="xref py py-meth docutils literal notranslate"><span class="pre">translate_xy()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry.translate_xy">
|
||
<code class="sig-name descname">translate_xy</code><span class="sig-paren">(</span><em class="sig-param">vec</em>, <em class="sig-param">x</em>, <em class="sig-param">y</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry.html#translate_xy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry.translate_xy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translate a point or polygon by a given vector.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>vec</strong> (<em>tuple</em>) – translation vector</p></li>
|
||
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em>) – points to translate</p></li>
|
||
<li><p><strong>y</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em>) – points to translate</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>(x’, y’)</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>tuple</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#pylib.geometry.translate" title="pylib.geometry.translate"><code class="xref py py-meth docutils literal notranslate"><span class="pre">translate()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.geometry_plot">
|
||
<span id="pylib-geometry-plot-module"></span><h2>pylib.geometry_plot module<a class="headerlink" href="#module-pylib.geometry_plot" title="Permalink to this headline">¶</a></h2>
|
||
<p>2D geometry plotter using matplotlib (pylab).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-08-20</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-geometry_plot"></span><dl class="function">
|
||
<dt id="pylib.geometry_plot.plot_cubic_lines">
|
||
<code class="sig-name descname">plot_cubic_lines</code><span class="sig-paren">(</span><em class="sig-param">lns</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry_plot.html#plot_cubic_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry_plot.plot_cubic_lines" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.geometry_plot.plot_lines">
|
||
<code class="sig-name descname">plot_lines</code><span class="sig-paren">(</span><em class="sig-param">lns</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/geometry_plot.html#plot_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.geometry_plot.plot_lines" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.mathematics">
|
||
<span id="pylib-mathematics-module"></span><h2>pylib.mathematics module<a class="headerlink" href="#module-pylib.mathematics" title="Permalink to this headline">¶</a></h2>
|
||
<p>Mathematical functions and objects.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-12-12</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-mathematics"></span><dl class="function">
|
||
<dt id="pylib.mathematics.lcm">
|
||
<code class="sig-name descname">lcm</code><span class="sig-paren">(</span><em class="sig-param">a</em>, <em class="sig-param">b</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#lcm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.lcm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Compute the lowest common multiple of a and b</p>
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="pylib.mathematics.matrix">
|
||
<em class="property">class </em><code class="sig-name descname">matrix</code><a class="reference internal" href="_modules/pylib/mathematics.html#matrix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
|
||
<p>Use/create matrix like list of lists</p>
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.rotate_x">
|
||
<code class="sig-name descname">rotate_x</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.rotate_x"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.rotate_x" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the x dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx' & yy' & yz' & t_y' \\
|
||
zx' & zy' & zz' & t_z' \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & 0 \\
|
||
0 & \cos \theta & -\sin \theta & 0 \\
|
||
0 & \sin \theta & \cos \theta & 0 \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}
|
||
\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx & yy & yz & t_y \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.rotate_y">
|
||
<code class="sig-name descname">rotate_y</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.rotate_y"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.rotate_y" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the y dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}
|
||
xx' & xy' & xz' & t_x' \\
|
||
yx & yy & yz & t_y \\
|
||
zx' & zy' & zz' & t_z' \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
\cos \theta & 0 & \sin \theta & 0 \\
|
||
0 & 1 & 0 & 0 \\
|
||
-\sin \theta & 0 & \cos \theta & 0 \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}
|
||
\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx & yy & yz & t_y \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.rotate_z">
|
||
<code class="sig-name descname">rotate_z</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.rotate_z"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.rotate_z" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the z dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}
|
||
xx' & xy' & xz' & t_x' \\
|
||
yx' & yy' & yz' & t_y' \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
\cos \theta & -\sin \theta & 0 & 0 \\
|
||
\sin \theta & \cos \theta & 0 & 0 \\
|
||
0 & 0 & 1 & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx & yy & yz & t_y \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.rx">
|
||
<em class="property">static </em><code class="sig-name descname">rx</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.rx"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.rx" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation matrix about the x direction.</p>
|
||
<p>Rotates the coordinate system of vectors</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}R_{x}(\theta) =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & 0 \\
|
||
0 & \cos \theta & -\sin \theta & 0 \\
|
||
0 & \sin \theta & \cos \theta & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.ry">
|
||
<em class="property">static </em><code class="sig-name descname">ry</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.ry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.ry" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation matrix about the y direction.</p>
|
||
<p>Rotates the coordinate system of vectors</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}R_{y}(\theta) =
|
||
\begin{bmatrix}
|
||
\cos \theta & 0 & \sin \theta & 0 \\
|
||
0 & 1 & 0 & 0 \\
|
||
-\sin \theta & 0 & \cos \theta & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.rz">
|
||
<em class="property">static </em><code class="sig-name descname">rz</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.rz"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.rz" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation matrix about the z direction.</p>
|
||
<p>Rotates the coordinate system of vectors</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}R_{z}(\theta) =
|
||
\begin{bmatrix}
|
||
\cos \theta & -\sin \theta & 0 & 0 \\
|
||
\sin \theta & \cos \theta & 0 & 0 \\
|
||
0 & 0 & 1 & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}\end{split}\]</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Example</dt>
|
||
<dd class="field-odd"><p></p></dd>
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}R_{z}(\theta) \begin{bmatrix}1 \\ 0 \\ 0 \\ 1\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
\cos 90° & -\sin 90° & 0 & 0 \\
|
||
\sin 90° & \cos 90° & 0 & 0 \\
|
||
0 & 0 & 1 & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}1 \\ 0 \\ 0 \\ 1\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
0 & -1 & 0 & 0 \\
|
||
1 & 0 & 0 & 0 \\
|
||
0 & 0 & 1 & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}1 \\ 0 \\ 0 \\ 1\end{bmatrix} =
|
||
\begin{bmatrix}0 \\ 1 \\ 0 \\ 1\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.s">
|
||
<em class="property">static </em><code class="sig-name descname">s</code><span class="sig-paren">(</span><em class="sig-param">sx</em>, <em class="sig-param">sy=None</em>, <em class="sig-param">sz=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.s"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.s" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Scaling matrix</p>
|
||
<p>uniform scaling if sx=sy=sz=s.
|
||
Note that scaling happens around the origin, so objects not
|
||
centered at the origin will have their centers move. To avoid this,
|
||
either scale the object when it’s located at the origin, or
|
||
perform a translation afterwards to move the object back to where
|
||
it should be.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}S =
|
||
\begin{bmatrix}
|
||
s_x & 0 & 0 & 0 \\
|
||
0 & s_y & 0 & 0 \\
|
||
0 & 0 & s_z & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.scale">
|
||
<code class="sig-name descname">scale</code><span class="sig-paren">(</span><em class="sig-param">sx</em>, <em class="sig-param">sy=None</em>, <em class="sig-param">sz=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.scale"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.scale" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Scaling</p>
|
||
<p>uniform scaling if sx=sy=sz=s.
|
||
Note that scaling happens around the origin, so objects not
|
||
centered at the origin will have their centers move. To avoid this,
|
||
either scale the object when it’s located at the origin, or
|
||
perform a translation afterwards to move the object back to where
|
||
it should be.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}
|
||
xx' & xy' & xz' & t_x' \\
|
||
yx' & yy' & yz' & t_y' \\
|
||
zx' & zy' & zz' & t_z' \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
s_x & 0 & 0 & 0 \\
|
||
0 & s_y & 0 & 0 \\
|
||
0 & 0 & s_z & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx & yy & yz & t_y \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.t">
|
||
<em class="property">static </em><code class="sig-name descname">t</code><span class="sig-paren">(</span><em class="sig-param">tx</em>, <em class="sig-param">ty</em>, <em class="sig-param">tz</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.t"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.t" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translation matrix</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}T =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & t_x \\
|
||
0 & 1 & 0 & t_y \\
|
||
0 & 0 & 1 & t_z \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.matrix.translate">
|
||
<code class="sig-name descname">translate</code><span class="sig-paren">(</span><em class="sig-param">tx</em>, <em class="sig-param">ty</em>, <em class="sig-param">tz</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#matrix.translate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.matrix.translate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translation</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}
|
||
xx & xy & xz & t_x' \\
|
||
yx & yy & yz & t_y' \\
|
||
zx & zy & zz & t_z' \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & t_x \\
|
||
0 & 1 & 0 & t_y \\
|
||
0 & 0 & 1 & t_z \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}
|
||
xx & xy & xz & t_x \\
|
||
yx & yy & yz & t_y \\
|
||
zx & zy & zz & t_z \\
|
||
0 & 0 & 0 & h
|
||
\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="pylib.mathematics.vector">
|
||
<em class="property">class </em><code class="sig-name descname">vector</code><a class="reference internal" href="_modules/pylib/mathematics.html#vector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
|
||
<p>Use/create vector like lists</p>
|
||
<ul class="simple">
|
||
<li><p>size -> len(a)</p></li>
|
||
<li><p>abs -> abs(a)</p></li>
|
||
<li><p>dot -> a * b</p></li>
|
||
<li><p>outer -> a @ b</p></li>
|
||
</ul>
|
||
<p>use super constructor</p>
|
||
<p>use super __iter__</p>
|
||
<p>use super __setitem__</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">v</span><span class="p">[</span><span class="mi">3</span><span class="p">:</span><span class="mi">5</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[1, 2, 3, 1, 2]</span>
|
||
<span class="gp">>>> </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">vector</span><span class="p">)</span>
|
||
<span class="go">True</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>use super __lt__(a, b)</p>
|
||
<p>use super __le__(a, b)</p>
|
||
<p>use super __eq__(a, b)</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">v2</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">v</span> <span class="o">==</span> <span class="n">v2</span>
|
||
<span class="go">True</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>use super __ne__(a, b)</p>
|
||
<p>use super __ge__(a, b)</p>
|
||
<p>use super __gt__(a, b)</p>
|
||
<p>use super __contains__</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="mi">2</span> <span class="ow">in</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="go">True</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>__isub__</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">v</span> <span class="o">-=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[-2, -1, 0]</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>__imul__</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">v</span> <span class="o">*=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">18</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>__imatmul__</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">m</span> <span class="o">=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="n">m</span> <span class="o">*=</span> <span class="n">vector</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[[3, 3, 3], [6, 6, 6], [9, 9, 9]]</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.abs">
|
||
<em class="property">static </em><code class="sig-name descname">abs</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.abs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.abs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return modulus parts of a complex vector</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.ang">
|
||
<em class="property">static </em><code class="sig-name descname">ang</code><span class="sig-paren">(</span><em class="sig-param">a</em>, <em class="sig-param">b</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.ang"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.ang" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.arg">
|
||
<em class="property">static </em><code class="sig-name descname">arg</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.arg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.arg" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return phase parts of a complex vector</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.ch_cs">
|
||
<code class="sig-name descname">ch_cs</code><span class="sig-paren">(</span><em class="sig-param">cs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.ch_cs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.ch_cs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Transform this vector from its defined coordinate system to a
|
||
new coordinate system, defined by the given coordinate system (u,
|
||
v and w direction vectors).</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
u_x & u_y & u_z & 0 \\
|
||
v_x & v_y & v_z & 0 \\
|
||
w_x & w_y & w_z & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.conjugate">
|
||
<em class="property">static </em><code class="sig-name descname">conjugate</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.conjugate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.conjugate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>New vector object</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.cross">
|
||
<em class="property">static </em><code class="sig-name descname">cross</code><span class="sig-paren">(</span><em class="sig-param">a</em>, <em class="sig-param">b</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.cross"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.cross" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Cross product</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
<p>c is orthogonal to both a and b.
|
||
The direction of c can be found with the right-hand rule.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\vec{c} = \vec{a} \times \vec{b}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.full">
|
||
<em class="property">static </em><code class="sig-name descname">full</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">fill_value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.full"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.full" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a vector of length m or matrix of size m rows, n
|
||
columns filled with v.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>length</strong> (<em>int</em>) – length of the vector, e. g. 3</p></li>
|
||
<li><p><strong>fill_value</strong> – Fill value</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Type fill_value</dt>
|
||
<dd class="field-even"><p>scalar</p>
|
||
</dd>
|
||
<dt class="field-odd">Example</dt>
|
||
<dd class="field-odd"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">vector</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[7, 7, 7]</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.im">
|
||
<em class="property">static </em><code class="sig-name descname">im</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.im"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.im" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the imaginary parts of a complex vector</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.normalize">
|
||
<em class="property">static </em><code class="sig-name descname">normalize</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.normalize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.normalize" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Normalize a vector (i. e. the vector has a length of 1)</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
<div class="math notranslate nohighlight">
|
||
\[\vec{e}_a = \frac{\vec{a}}{|\vec{a}|}\]</div>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><code class="xref py py-meth docutils literal notranslate"><span class="pre">norm()</span></code> for a norm (magnitude) of a vector</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.ones">
|
||
<em class="property">static </em><code class="sig-name descname">ones</code><span class="sig-paren">(</span><em class="sig-param">length</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.ones"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.ones" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a vector of length m or matrix of size rows, n
|
||
columns filled with ones.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>length</strong> (<em>int</em>) – lhape of the vector, e. g. 3</p>
|
||
</dd>
|
||
<dt class="field-even">Example</dt>
|
||
<dd class="field-even"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">ones</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[1.0, 1.0, 1.0]</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.random">
|
||
<em class="property">static </em><code class="sig-name descname">random</code><span class="sig-paren">(</span><em class="sig-param">shape</em>, <em class="sig-param">lmin=0.0</em>, <em class="sig-param">lmax=1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.random"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.random" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a random vector of length n or matrix of size m rows, n
|
||
columns filled with random numbers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Example</dt>
|
||
<dd class="field-odd"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">random</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[0.9172905912930438, 0.8908124278322492, 0.5256002790725927]</span>
|
||
<span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">random</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[1.2563665665080803, 1.9270454509964547, 1.2381672401270487]</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.re">
|
||
<em class="property">static </em><code class="sig-name descname">re</code><span class="sig-paren">(</span><em class="sig-param">a</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.re"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.re" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the real parts of a complex vector</p>
|
||
<dl class="field-list simple">
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.rotate_x">
|
||
<code class="sig-name descname">rotate_x</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.rotate_x"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.rotate_x" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the x dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & 0 \\
|
||
0 & \cos \theta & -\sin \theta & 0 \\
|
||
0 & \sin \theta & \cos \theta & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.rotate_y">
|
||
<code class="sig-name descname">rotate_y</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.rotate_y"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.rotate_y" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the y dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
\cos \theta & 0 & \sin \theta & 0 \\
|
||
0 & 1 & 0 & 0 \\
|
||
-\sin \theta & 0 & \cos \theta & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.rotate_z">
|
||
<code class="sig-name descname">rotate_z</code><span class="sig-paren">(</span><em class="sig-param">theta</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.rotate_z"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.rotate_z" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Rotation about the z dirction.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
\cos \theta & -\sin \theta & 0 & 0 \\
|
||
\sin \theta & \cos \theta & 0 & 0 \\
|
||
0 & 0 & 1 & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.scale">
|
||
<code class="sig-name descname">scale</code><span class="sig-paren">(</span><em class="sig-param">sx</em>, <em class="sig-param">sy=None</em>, <em class="sig-param">sz=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.scale"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.scale" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Scaling</p>
|
||
<p>uniform scaling if sx=sy=sz=s.
|
||
Note that scaling happens around the origin, so objects not
|
||
centered at the origin will have their centers move. To avoid this,
|
||
either scale the object when it’s located at the origin, or
|
||
perform a translation afterwards to move the object back to where
|
||
it should be.</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
s_x & 0 & 0 & 0 \\
|
||
0 & s_y & 0 & 0 \\
|
||
0 & 0 & s_z & 0 \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.translate">
|
||
<code class="sig-name descname">translate</code><span class="sig-paren">(</span><em class="sig-param">tx</em>, <em class="sig-param">ty</em>, <em class="sig-param">tz</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.translate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.translate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translation</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[\begin{split}\begin{bmatrix}x' \\ y' \\ z' \\ h'\end{bmatrix} =
|
||
\begin{bmatrix}
|
||
1 & 0 & 0 & t_x \\
|
||
0 & 1 & 0 & t_y \\
|
||
0 & 0 & 1 & t_z \\
|
||
0 & 0 & 0 & 1
|
||
\end{bmatrix}
|
||
\begin{bmatrix}x \\ y \\ z \\ h\end{bmatrix}\end{split}\]</div>
|
||
</dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.xyz">
|
||
<code class="sig-name descname">xyz</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.xyz"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.xyz" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="method">
|
||
<dt id="pylib.mathematics.vector.zeros">
|
||
<em class="property">static </em><code class="sig-name descname">zeros</code><span class="sig-paren">(</span><em class="sig-param">length</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/mathematics.html#vector.zeros"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.mathematics.vector.zeros" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a zero vector of length m or matrix of size rows, n
|
||
columns filled with zeros.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>length</strong> (<em>int</em>) – length of the vector, e. g. 3</p>
|
||
</dd>
|
||
<dt class="field-even">Example</dt>
|
||
<dd class="field-even"><p></p></dd>
|
||
</dl>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">v</span> <span class="o">=</span> <span class="n">zeros</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||
<span class="go">[0.0, 0.0, 0.0]</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib.time_of_day">
|
||
<span id="pylib-time-of-day-module"></span><h2>pylib.time_of_day module<a class="headerlink" href="#module-pylib.time_of_day" title="Permalink to this headline">¶</a></h2>
|
||
<p>Calculate time.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Date</dt>
|
||
<dd class="field-odd"><p>2019-06-01</p>
|
||
</dd>
|
||
</dl>
|
||
<span class="target" id="module-time_of_day"></span><dl class="function">
|
||
<dt id="pylib.time_of_day.days">
|
||
<code class="sig-name descname">days</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#days"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.days" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The days of the time (year).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>hours, range [0, 365.2425]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.days_norm">
|
||
<code class="sig-name descname">days_norm</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#days_norm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.days_norm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The days normalized to 365.2425 (Gregorian, on average) days.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the normalized days, range [0, 1]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.hours">
|
||
<code class="sig-name descname">hours</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#hours"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.hours" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The hours of the time.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>hours, range [0, 24]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.hours_norm">
|
||
<code class="sig-name descname">hours_norm</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#hours_norm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.hours_norm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The hours normalized to 24 hours.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the normalized hours, range [0, 1]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.in_seconds">
|
||
<code class="sig-name descname">in_seconds</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#in_seconds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.in_seconds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If time is <cite>time.struct_time</cite> convert to float seconds.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.minutes">
|
||
<code class="sig-name descname">minutes</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#minutes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.minutes" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The minutes of the time.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>minutes, range [0, 60]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.minutes_norm">
|
||
<code class="sig-name descname">minutes_norm</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#minutes_norm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.minutes_norm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The minutes normalized to 60 minutes.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the normalized minutes, range [0, 1]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.seconds">
|
||
<code class="sig-name descname">seconds</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#seconds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.seconds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The seconds of the time.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>seconds, range [0, 60]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.seconds_norm">
|
||
<code class="sig-name descname">seconds_norm</code><span class="sig-paren">(</span><em class="sig-param">time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#seconds_norm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.seconds_norm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The seconds normalized to 60 seconds.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>time</strong> (float or <cite>time.struct_time</cite>) – the time in seconds</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the normalized seconds, range [0, 1]</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="pylib.time_of_day.transform">
|
||
<code class="sig-name descname">transform</code><span class="sig-paren">(</span><em class="sig-param">time_norm</em>, <em class="sig-param">length</em>, <em class="sig-param">offset=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/time_of_day.html#transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.time_of_day.transform" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Transform normalized time value to new length.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>position_norm</strong> (<em>float</em>) – the normalized time value to transform</p></li>
|
||
<li><p><strong>length</strong> (<em>float</em>) – the transformation</p></li>
|
||
<li><p><strong>offset</strong> (<em>float</em>) – the offset (default = 0)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>the transformation value</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>float</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-pylib">
|
||
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pylib" title="Permalink to this headline">¶</a></h2>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h1 class="logo"><a href="index.html">pylib</a></h1>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2019, Daniel Weschke.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.1</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="_sources/pylib.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |