<span id="the-geometry-module"></span><h1>the geometry module<a class="headerlink" href="#module-pNbody.geometry" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="pNbody.geometry.align">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">align</tt><big>(</big><em>x, axis1=[1, 0, 0], axis2=[0, 0, 1], point=[0, 0, 0]</em><big>)</big><a class="headerlink" href="#pNbody.geometry.align" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate the object around point in order to align the axis ‘axis1’ with the axis ‘axis2’.</p>
<p>axis1 : [x,y,z]
axis2 : [x,y,z]</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.boxcut">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">boxcut</tt><big>(</big><em>pos</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.geometry.boxcut" title="Permalink to this definition">¶</a></dt>
<dd><p>Return only particles that are inside box 1:1:1</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.boxcut_segments">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">boxcut_segments</tt><big>(</big><em>pos</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.geometry.boxcut_segments" title="Permalink to this definition">¶</a></dt>
<dd><p>Return only particles that are inside box 1:1:1</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.expose">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">expose</tt><big>(</big><em>obj</em>, <em>obs</em>, <em>eye=None</em>, <em>dist_eye=None</em>, <em>foc=None</em><big>)</big><a class="headerlink" href="#pNbody.geometry.expose" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate and translate the object in order to be seen as if the
observer was in x0, looking at a point in xp.</p>
<p>obj : object array to expose
obs : representation of the observer
eye : ‘right’ or ‘left’
dist_eye : distance between eyes (separation = angle))
foc : focal</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.frustum">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">frustum</tt><big>(</big><em>pos</em>, <em>clip</em>, <em>size</em><big>)</big><a class="headerlink" href="#pNbody.geometry.frustum" title="Permalink to this definition">¶</a></dt>
<dd><p>Project using a frustrum matrix</p>
<p>clip = near and far planes
size = size of the box</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.get_obs">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">get_obs</tt><big>(</big><em>x0=[0.0, -50.0, 0.0], xp=[0.0, 0.0, 0.0], alpha=0, view='xz', r_obs=50</em><big>)</big><a class="headerlink" href="#pNbody.geometry.get_obs" title="Permalink to this definition">¶</a></dt>
<dd><p>From some parameters, return an obs matrix</p>
<blockquote>
x0,xp,alpha</blockquote>
<dl class="docutils">
<dt>or</dt>
<dd>xz</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.inv_viewport">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">inv_viewport</tt><big>(</big><em>xw</em>, <em>yw</em>, <em>zw</em>, <em>shape</em><big>)</big><a class="headerlink" href="#pNbody.geometry.inv_viewport" title="Permalink to this definition">¶</a></dt>
<dd><p>viewport transformation</p>
<p>xn = position (output from frustum or ortho)
shape = shape of the image</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.norm">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">norm</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.geometry.norm" title="Permalink to this definition">¶</a></dt>
<dd><p>return the norm of vector x</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.ortho">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">ortho</tt><big>(</big><em>pos</em>, <em>clip</em>, <em>size</em><big>)</big><a class="headerlink" href="#pNbody.geometry.ortho" title="Permalink to this definition">¶</a></dt>
<dd><p>Project using an ortho matrix</p>
<p>clip = near and far planes
size = size of the box</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.perspective">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">perspective</tt><big>(</big><em>r_obs=100.0</em>, <em>foc=50.0</em>, <em>view='xz'</em><big>)</big><a class="headerlink" href="#pNbody.geometry.perspective" title="Permalink to this definition">¶</a></dt>
<dd><p>Project the N-body model in order to get a perspective view.</p>
<p>r_obs = distance of the observer to the looking point
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">rotate</tt><big>(</big><em>x, angle=0, axis=[1, 0, 0], point=[0, 0, 0]</em><big>)</big><a class="headerlink" href="#pNbody.geometry.rotate" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate the positions and/or the velocities of the object around a specific axis
with respect to a specific point</p>
<p>angle : rotation angle in radian
axis : [x,y,z] : around this axis
point : [x,y,z] : rotation origin</p>
<p>use the euler rotation matrix</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.geometry.viewport">
<tt class="descclassname">pNbody.geometry.</tt><tt class="descname">viewport</tt><big>(</big><em>xn</em>, <em>shape=None</em><big>)</big><a class="headerlink" href="#pNbody.geometry.viewport" title="Permalink to this definition">¶</a></dt>