Files
phy/hexasphere/index.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

48 lines
7.5 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Library for subdividing shapes made of triangles."><title>hexasphere - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="hexasphere" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../hexasphere/index.html">hexasphere</a><span class="version">15.1.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-usage" title="Example usage">Example usage</a></li><li><a href="#features" title="Features">Features</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>hexasphere</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/hexasphere/lib.rs.html#1-2139">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Library for subdividing shapes made of triangles.</p>
<p>This library defines <a href="struct.Subdivided.html" title="struct hexasphere::Subdivided"><code>Subdivided&lt;T, S&gt;</code></a>. This struct
allows one to define a base shape using <code>S</code> and the
<a href="trait.BaseShape.html" title="trait hexasphere::BaseShape"><code>BaseShape</code></a> trait, and to subdivide it using the
interpolation functions defined as part of <code>S</code>.</p>
<p>Shapes define the starting vertices and triangles, as well as
the type of interpolation used and thus the smooth shape that is approximated.
These provided shapes generate <strong>spheres</strong>:</p>
<ul>
<li><a href="shapes/type.CubeSphere.html" title="type hexasphere::shapes::CubeSphere"><code>shapes::CubeSphere</code></a> (cube)</li>
<li><a href="shapes/type.IcoSphere.html" title="type hexasphere::shapes::IcoSphere"><code>shapes::IcoSphere</code></a> (icosahedron)</li>
<li><a href="shapes/type.NormIcoSphere.html" title="type hexasphere::shapes::NormIcoSphere"><code>shapes::NormIcoSphere</code></a> (icosahedron)</li>
<li><a href="shapes/type.TetraSphere.html" title="type hexasphere::shapes::TetraSphere"><code>shapes::TetraSphere</code></a> (tetrahedron)</li>
</ul>
<p>Two flat shapes are also provided:</p>
<ul>
<li><a href="shapes/type.SquarePlane.html" title="type hexasphere::shapes::SquarePlane"><code>shapes::SquarePlane</code></a></li>
<li><a href="shapes/type.TrianglePlane.html" title="type hexasphere::shapes::TrianglePlane"><code>shapes::TrianglePlane</code></a></li>
</ul>
<h3 id="example-usage"><a class="doc-anchor" href="#example-usage">§</a>Example usage</h3>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>hexasphere::shapes::IcoSphere;
<span class="kw">fn </span>main() {
<span class="comment">// Create a new sphere with 20 subdivisions
// an no data associated with the vertices.
</span><span class="kw">let </span>sphere = IcoSphere::new(<span class="number">20</span>, |<span class="kw">_</span>| ());
<span class="kw">let </span>points = sphere.raw_points();
<span class="kw">for </span>p <span class="kw">in </span>points {
<span class="macro">println!</span>(<span class="string">"{:?} is a point on the sphere!"</span>, p);
}
<span class="kw">let </span>indices = sphere.get_all_indices();
<span class="kw">for </span>triangle <span class="kw">in </span>indices.chunks(<span class="number">3</span>) {
<span class="macro">println!</span>(
<span class="string">"[{}, {}, {}] is a triangle on the resulting shape"</span>,
triangle[<span class="number">0</span>],
triangle[<span class="number">1</span>],
triangle[<span class="number">2</span>],
);
}
}</code></pre></div>
<h2 id="features"><a class="doc-anchor" href="#features">§</a>Features</h2>
<ul>
<li><code>adjacency</code> allows the user to create neighbour maps from
the indices provided by the <code>Subdivided</code> struct.</li>
</ul>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="interpolation/index.html" title="mod hexasphere::interpolation">interpolation</a></div></li><li><div class="item-name"><a class="mod" href="shapes/index.html" title="mod hexasphere::shapes">shapes</a></div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Subdivided.html" title="struct hexasphere::Subdivided">Subdivided</a></div><div class="desc docblock-short">A subdivided shape generated from some <a href="trait.BaseShape.html" title="trait hexasphere::BaseShape"><code>BaseShape</code></a> and a subdivision level.</div></li><li><div class="item-name"><a class="struct" href="struct.Triangle.html" title="struct hexasphere::Triangle">Triangle</a></div><div class="desc docblock-short">A main triangle on the base shape of a subdivided shape.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.BaseShape.html" title="trait hexasphere::BaseShape">Base<wbr>Shape</a></div><div class="desc docblock-short">Defines the geometry of the shape to be subdivided, and the functions
used in interpolation.</div></li></ul></section></div></main></body></html>