511 lines
26 KiB
HTML
511 lines
26 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>geometry module — 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="module-geometry">
|
||
<span id="geometry-module"></span><h1>geometry module<a class="headerlink" href="#module-geometry" title="Permalink to this headline">¶</a></h1>
|
||
<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="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/geometry.html#angle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="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/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 (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="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><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="#geometry.cubic" title="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="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.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/geometry.html#distance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="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><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="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"><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="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">
|
||
<dt id="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/geometry.html#rectangle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="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>
|
||
<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="#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>
|
||
<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="#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.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>
|
||
<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="#geometry.rectangle" title="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="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/geometry.html#translate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#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="#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>
|
||
|
||
|
||
</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.0</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="_sources/geometry.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |