%PDF- %PDF-
| Direktori : /usr/share/doc/imath-devel/html/classes/ |
| Current File : //usr/share/doc/imath-devel/html/classes/Sphere3.html |
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sphere3 — Imath Documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/bizstyle.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Vec2" href="Vec2.html" />
<link rel="prev" title="Shear6" href="Shear6.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="Vec2.html" title="Vec2"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Shear6.html" title="Shear6"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Imath</a> »</li>
<li class="nav-item nav-item-this"><a href="">Sphere3</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="sphere3">
<h1>Sphere3<a class="headerlink" href="#sphere3" title="Permalink to this headline">¶</a></h1>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#include <Imath/ImathSphere.h></span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">Sphere3</span></code> class template represents a sphere in 3D space, with
predefined typedefs for lines of type <code class="docutils literal notranslate"><span class="pre">float</span></code> and <code class="docutils literal notranslate"><span class="pre">double</span></code>.</p>
<p>Example:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf"><Imath/ImathSphere.h></span><span class="cp"></span>
<span class="kt">void</span>
<span class="nf">sphere3_example</span><span class="p">()</span>
<span class="p">{</span>
<span class="n">Imath</span><span class="o">::</span><span class="n">V3f</span> <span class="n">center</span> <span class="p">(</span><span class="mf">1.0f</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">);</span>
<span class="kt">float</span> <span class="n">radius</span> <span class="o">=</span> <span class="mf">2.0f</span><span class="p">;</span>
<span class="n">Imath</span><span class="o">::</span><span class="n">Sphere3f</span> <span class="n">s</span> <span class="p">(</span><span class="n">center</span><span class="p">,</span> <span class="n">radius</span><span class="p">);</span>
<span class="n">assert</span> <span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">center</span> <span class="o">==</span> <span class="n">center</span><span class="p">);</span>
<span class="n">assert</span> <span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">radius</span> <span class="o">==</span> <span class="n">radius</span><span class="p">);</span>
<span class="n">Imath</span><span class="o">::</span><span class="n">Line3f</span> <span class="n">line</span> <span class="p">(</span><span class="n">Imath</span><span class="o">::</span><span class="n">V3f</span> <span class="p">(</span><span class="mf">0.0f</span><span class="p">,</span> <span class="mf">0.0f</span><span class="p">,</span> <span class="mf">0.0f</span><span class="p">),</span>
<span class="n">Imath</span><span class="o">::</span><span class="n">V3f</span> <span class="p">(</span><span class="mf">1.0f</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">));</span>
<span class="n">Imath</span><span class="o">::</span><span class="n">V3f</span> <span class="n">v</span><span class="p">;</span>
<span class="n">assert</span> <span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">intersect</span> <span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">v</span><span class="p">));</span>
<span class="n">assert</span> <span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">equalWithAbsError</span> <span class="p">(</span><span class="n">Imath</span><span class="o">::</span><span class="n">V3f</span><span class="p">(</span><span class="mf">2.1547f</span><span class="p">,</span> <span class="mf">2.1547f</span><span class="p">,</span> <span class="mf">2.1547f</span><span class="p">),</span> <span class="mf">1e-6f</span><span class="p">));</span>
<span class="p">}</span>
</pre></div>
</div>
<dl class="cpp type">
<dt id="_CPPv4N5Imath8Sphere3fE">
<span id="_CPPv3N5Imath8Sphere3fE"></span><span id="_CPPv2N5Imath8Sphere3fE"></span><span id="Imath::Sphere3f"></span><span class="target" id="_imath_sphere_8h_1ad2d5d485d065a3e35371508932700440"></span><em class="property">typedef </em><a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3">Sphere3</a><float> <code class="sig-prename descclassname">Imath<code class="sig-prename descclassname">::</code></code><code class="sig-name descname">Sphere3f</code><a class="headerlink" href="#_CPPv4N5Imath8Sphere3fE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Sphere of type float. </p>
</dd></dl>
<dl class="cpp class">
<dt id="_CPPv4I0EN5Imath7Sphere3E">
<span id="_CPPv3I0EN5Imath7Sphere3E"></span><span id="_CPPv2I0EN5Imath7Sphere3E"></span>template<class <code class="sig-name descname">T</code>><br /><span class="target" id="class_imath_1_1_sphere3"></span><em class="property">class </em><code class="sig-prename descclassname">Imath<code class="sig-prename descclassname">::</code></code><code class="sig-name descname">Sphere3</code><a class="headerlink" href="#_CPPv4I0EN5Imath7Sphere3E" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>A 3D sphere. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Direct access to member fields</p>
<dl class="cpp var">
<dt id="_CPPv4N5Imath7Sphere36centerE">
<span id="_CPPv3N5Imath7Sphere36centerE"></span><span id="_CPPv2N5Imath7Sphere36centerE"></span><span id="Imath::Sphere3::center__Vec3:T:"></span><span class="target" id="class_imath_1_1_sphere3_1acbf8b3c3b9a8f599d1880972d80f72f4"></span><a class="reference internal" href="Vec3.html#_CPPv4I0EN5Imath4Vec3E" title="Imath::Vec3">Vec3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>> <code class="sig-name descname">center</code><a class="headerlink" href="#_CPPv4N5Imath7Sphere36centerE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Center. </p>
</dd></dl>
<dl class="cpp var">
<dt id="_CPPv4N5Imath7Sphere36radiusE">
<span id="_CPPv3N5Imath7Sphere36radiusE"></span><span id="_CPPv2N5Imath7Sphere36radiusE"></span><span id="Imath::Sphere3::radius__T"></span><span class="target" id="class_imath_1_1_sphere3_1a33522d988508b879fd94eb175d5dc65d"></span><a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a> <code class="sig-name descname">radius</code><a class="headerlink" href="#_CPPv4N5Imath7Sphere36radiusE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Radius. </p>
</dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Constructors</p>
<dl class="cpp function">
<dt id="_CPPv4N5Imath7Sphere37Sphere3Ev">
<span id="_CPPv3N5Imath7Sphere37Sphere3Ev"></span><span id="_CPPv2N5Imath7Sphere37Sphere3Ev"></span><span id="Imath::Sphere3::Sphere3CE"></span><span class="target" id="class_imath_1_1_sphere3_1a7e0ed7ee862f64a4fd72aa475daca53c"></span><em class="property">inline</em> <em class="property">constexpr</em> <code class="sig-name descname">Sphere3</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5Imath7Sphere37Sphere3Ev" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Default is center at (0,0,0) and radius of 0. </p>
</dd></dl>
<dl class="cpp function">
<dt id="_CPPv4N5Imath7Sphere37Sphere3ERK4Vec3I1TE1T">
<span id="_CPPv3N5Imath7Sphere37Sphere3ERK4Vec3I1TE1T"></span><span id="_CPPv2N5Imath7Sphere37Sphere3ERK4Vec3I1TE1T"></span><span id="Imath::Sphere3::Sphere3__Vec3:T:CR.TCE"></span><span class="target" id="class_imath_1_1_sphere3_1aaa6c6e480f8ec7a4605c5d038669d102"></span><em class="property">inline</em> <em class="property">constexpr</em> <code class="sig-name descname">Sphere3</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="Vec3.html#_CPPv4I0EN5Imath4Vec3E" title="Imath::Vec3">Vec3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>> &<em>c</em>, <a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a> <em>r</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5Imath7Sphere37Sphere3ERK4Vec3I1TE1T" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Initialize to a given center and radius. </p>
</dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Manipulation</p>
<dl class="cpp function">
<dt id="_CPPv4N5Imath7Sphere312circumscribeERK3BoxI4Vec3I1TEE">
<span id="_CPPv3N5Imath7Sphere312circumscribeERK3BoxI4Vec3I1TEE"></span><span id="_CPPv2N5Imath7Sphere312circumscribeERK3BoxI4Vec3I1TEE"></span><span id="Imath::Sphere3::circumscribe__Box:Vec3:T::CR"></span><span class="target" id="class_imath_1_1_sphere3_1a3e3e1e7fa21761ae410e1425973d21f6"></span><em class="property">inline</em> void <code class="sig-name descname">circumscribe</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="Box.html#_CPPv4I0EN5Imath3BoxE" title="Imath::Box">Box</a><<a class="reference internal" href="Vec3.html#_CPPv4I0EN5Imath4Vec3E" title="Imath::Vec3">Vec3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>>> &<em>box</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5Imath7Sphere312circumscribeERK3BoxI4Vec3I1TEE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Set the center and radius of the sphere so that it tightly encloses <a class="reference internal" href="Box.html#class_imath_1_1_box"><span class="std std-ref">Box</span></a> b. </p>
</dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Utility Methods</p>
<dl class="cpp function">
<dt id="_CPPv4NK5Imath7Sphere39intersectERK5Line3I1TER4Vec3I1TE">
<span id="_CPPv3NK5Imath7Sphere39intersectERK5Line3I1TER4Vec3I1TE"></span><span id="_CPPv2NK5Imath7Sphere39intersectERK5Line3I1TER4Vec3I1TE"></span><span id="Imath::Sphere3::intersect__Line3:T:CR.Vec3:T:RCCE"></span><span class="target" id="class_imath_1_1_sphere3_1a84b8ef30046bd07aeab2e66cb3b91d17"></span><em class="property">constexpr</em> bool <code class="sig-name descname">intersect</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="Line3.html#_CPPv4I0EN5Imath5Line3E" title="Imath::Line3">Line3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>> &<em>l</em>, <a class="reference internal" href="Vec3.html#_CPPv4I0EN5Imath4Vec3E" title="Imath::Vec3">Vec3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>> &<em>intersection</em><span class="sig-paren">)</span> <em class="property">const</em><a class="headerlink" href="#_CPPv4NK5Imath7Sphere39intersectERK5Line3I1TER4Vec3I1TE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>If the sphere and line <code class="docutils literal notranslate"><span class="pre">l</span></code> intersect, then compute the smallest <code class="docutils literal notranslate"><span class="pre">t</span></code> with <code class="docutils literal notranslate"><span class="pre">t>=0</span></code> so that <code class="docutils literal notranslate"><span class="pre">l(t)</span></code> is a point on the sphere. </p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>True if the sphere and line intersect, false if they do not. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">[in]</span> <span class="pre">l</span></code>: The line </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[out]</span> <span class="pre">intersection</span></code>: The point of intersection </p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
<dl class="cpp function">
<dt id="_CPPv4NK5Imath7Sphere310intersectTERK5Line3I1TER1T">
<span id="_CPPv3NK5Imath7Sphere310intersectTERK5Line3I1TER1T"></span><span id="_CPPv2NK5Imath7Sphere310intersectTERK5Line3I1TER1T"></span><span id="Imath::Sphere3::intersectT__Line3:T:CR.TRCCE"></span><span class="target" id="class_imath_1_1_sphere3_1ae35eebbdde9ce17868a7f3716f33c43a"></span><em class="property">constexpr</em> bool <code class="sig-name descname">intersectT</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="Line3.html#_CPPv4I0EN5Imath5Line3E" title="Imath::Line3">Line3</a><<a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a>> &<em>l</em>, <a class="reference internal" href="#_CPPv4I0EN5Imath7Sphere3E" title="Imath::Sphere3::T">T</a> &<em>t</em><span class="sig-paren">)</span> <em class="property">const</em><a class="headerlink" href="#_CPPv4NK5Imath7Sphere310intersectTERK5Line3I1TER1T" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>If the sphere and line <code class="docutils literal notranslate"><span class="pre">l</span></code> intersect, then compute the smallest <code class="docutils literal notranslate"><span class="pre">t</span></code> with <code class="docutils literal notranslate"><span class="pre">t>=0</span></code> so that <code class="docutils literal notranslate"><span class="pre">l(t)</span></code> is a point on the sphere. </p>
<p><dl class="simple">
<dt><strong>Return</strong></dt><dd><p>True if the sphere and line intersect, false if they do not. </p>
</dd>
<dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple">
<li><p><code class="docutils literal notranslate"><span class="pre">[in]</span> <span class="pre">l</span></code>: The line </p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[out]</span> <span class="pre">t</span></code>: The parameter of the line at the intersection point </p></li>
</ul>
</dd>
</dl>
</p>
</dd></dl>
</div>
</dd></dl>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/imath-logo-blue.png" alt="Logo"/>
</a></p>
<h4>Previous topic</h4>
<p class="topless"><a href="Shear6.html"
title="previous chapter">Shear6</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="Vec2.html"
title="next chapter">Vec2</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/classes/Sphere3.rst.txt"
rel="nofollow">Show Source</a></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>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="Vec2.html" title="Vec2"
>next</a> |</li>
<li class="right" >
<a href="Shear6.html" title="Shear6"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Imath</a> »</li>
<li class="nav-item nav-item-this"><a href="">Sphere3</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2021, Contributors to the OpenEXR Project.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
</div>
</body>
</html>