add geometry functions to translate and rotate lists and define lines and cubic lines
add data function to fold a list and geometry_plot functions to plot lines and tests for the geometry functions
This commit is contained in:
201
docs/build/html/geometry.html
vendored
201
docs/build/html/geometry.html
vendored
@@ -37,20 +37,22 @@
|
||||
<p>2D geometry objects.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Date</dt>
|
||||
<dd class="field-odd"><p>2019-03-21</p>
|
||||
<dd class="field-odd"><p>2019-08-20</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<span class="target" id="module-geometry"></span><dl class="function">
|
||||
<dt id="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=50</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/geometry.html#cubic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geometry.cubic" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<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/geometry.html#cubic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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</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>
|
||||
@@ -66,7 +68,9 @@
|
||||
<dl class="function">
|
||||
<dt id="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/geometry.html#cubic_deg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geometry.cubic_deg" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<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>
|
||||
@@ -89,17 +93,91 @@
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="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/geometry.html#cubics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="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/geometry.html#interpolate_hermite"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="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/geometry.html#line"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geometry.line" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><div class="math notranslate nohighlight">
|
||||
<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</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>
|
||||
@@ -110,23 +188,55 @@
|
||||
<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="geometry.points">
|
||||
<code class="sig-name descname">points</code><span class="sig-paren">(</span><em class="sig-param">*pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/geometry.html#points"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geometry.points" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<dt id="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/geometry.html#lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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"><p><strong>*pts</strong> – points to rearrange</p>
|
||||
<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>((point1_x, point2_x), (point1_y, point2_y), …)</p>
|
||||
<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>tuple</p>
|
||||
<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="geometry_plot.html#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">
|
||||
@@ -151,8 +261,8 @@
|
||||
<dl class="function">
|
||||
<dt id="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/geometry.html#rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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>
|
||||
<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">
|
||||
@@ -169,13 +279,17 @@ origin. The angle should be given in radians.</p>
|
||||
<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="#geometry.rotate_xy" title="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="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/geometry.html#rotate_deg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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>
|
||||
<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">
|
||||
@@ -198,6 +312,28 @@ origin. The angle should be given in degrees.</p>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="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/geometry.html#rotate_xy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="#geometry.rotate" title="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="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/geometry.html#square"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geometry.square" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -236,6 +372,35 @@ origin. The angle should be given in degrees.</p>
|
||||
<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="#geometry.translate_xy" title="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="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/geometry.html#translate_xy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="#geometry.translate" title="geometry.translate"><code class="xref py py-meth docutils literal notranslate"><span class="pre">translate()</span></code></a></p>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
@@ -291,7 +456,7 @@ origin. The angle should be given in degrees.</p>
|
||||
©2019, Daniel Weschke.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.1.2</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user