|
|
<!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="API documentation for the Rust `Orthographic3` struct in crate `nalgebra`."><meta name="keywords" content="rust, rustlang, rust-lang, Orthographic3"><title>nalgebra::geometry::Orthographic3 - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="http://nalgebra.org/img/favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../nalgebra/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Orthographic3</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.as_matrix">as_matrix</a><a href="#method.as_projective">as_projective</a><a href="#method.bottom">bottom</a><a href="#method.from_fov">from_fov</a><a href="#method.from_matrix_unchecked">from_matrix_unchecked</a><a href="#method.into_inner">into_inner</a><a href="#method.inverse">inverse</a><a href="#method.left">left</a><a href="#method.new">new</a><a href="#method.project_point">project_point</a><a href="#method.project_vector">project_vector</a><a href="#method.right">right</a><a href="#method.set_bottom">set_bottom</a><a href="#method.set_bottom_and_top">set_bottom_and_top</a><a href="#method.set_left">set_left</a><a href="#method.set_left_and_right">set_left_and_right</a><a href="#method.set_right">set_right</a><a href="#method.set_top">set_top</a><a href="#method.set_zfar">set_zfar</a><a href="#method.set_znear">set_znear</a><a href="#method.set_znear_and_zfar">set_znear_and_zfar</a><a href="#method.to_homogeneous">to_homogeneous</a><a href="#method.to_projective">to_projective</a><a href="#method.top">top</a><a href="#method.unproject_point">unproject_point</a><a href="#method.unwrap">unwrap</a><a href="#method.zfar">zfar</a><a href="#method.znear">znear</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a><a href="#impl-Distribution%3COrthographic3%3CN%3E%3E">Distribution<Orthographic3<N>></a><a href="#impl-From%3COrthographic3%3CN%3E%3E">From<Orthographic3<N>></a><a href="#impl-PartialEq%3COrthographic3%3CN%3E%3E">PartialEq<Orthographic3<N>></a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-SupersetOf%3CSS%3E">SupersetOf<SS></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class='location'><a href='../index.html'>nalgebra</a>::<wbr><a href='index.html'>geometry</a></p><script>window.sidebarCurrent = {name: 'Orthographic3', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#20-22' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../index.html'>nalgebra</a>::<wbr><a href='index.html'>geometry</a>::<wbr><a class="struct" href=''>Orthographic3</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Orthographic3<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> { /* fields omitted */ }</pre></div><div class='docblock'><p>A 3D orthographic projection stored as an homogeneous 4x4 matrix.</p>
|
|
|
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#64-679' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> Self</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#108-117' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new orthographic projection matrix.</p>
|
|
|
<p>This follows the OpenGL convention, so this will flip the <code>z</code> axis.</p>
|
|
|
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="comment">// Check this projection actually transforms the view cuboid into the double-unit cube.</span>
|
|
|
<span class="comment">// See https://www.nalgebra.org/projections/#orthographic-projection for more details.</span>
|
|
|
<span class="kw">let</span> <span class="ident">p1</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p2</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p3</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p4</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p5</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p6</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p7</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p8</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p1</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p2</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p3</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p4</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p5</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p6</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p7</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p8</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
|
|
|
<span class="comment">// This also works with flipped axis. In other words, we allow that</span>
|
|
|
<span class="comment">// `left > right`, `bottom > top`, and/or `znear > zfar`.</span>
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p1</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p2</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p3</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p4</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p5</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p6</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p7</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p8</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));</pre></div>
|
|
|
</div><h4 id='method.from_matrix_unchecked' class="method"><code id='from_matrix_unchecked.v'>pub fn <a href='#method.from_matrix_unchecked' class='fnname'>from_matrix_unchecked</a>(matrix: <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N>) -> Self</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#137-139' title='goto source code'>[src]</a></h4><div class='docblock'><p>Wraps the given matrix to interpret it as a 3D orthographic matrix.</p>
|
|
|
<p>It is not checked whether or not the given matrix actually represents an orthographic
|
|
|
projection.</p>
|
|
|
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">mat</span> <span class="op">=</span> <span class="ident">Matrix4</span>::<span class="ident">new</span>(
|
|
|
<span class="number">2.0</span> <span class="op">/</span> <span class="number">9.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">11.0</span> <span class="op">/</span> <span class="number">9.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">2.0</span> <span class="op">/</span> <span class="number">18.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">22.0</span> <span class="op">/</span> <span class="number">18.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">2.0</span> <span class="op">/</span> <span class="number">999.9</span>, <span class="op">-</span><span class="number">1000.1</span> <span class="op">/</span> <span class="number">999.9</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">1.0</span>
|
|
|
);
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">from_matrix_unchecked</span>(<span class="ident">mat</span>);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">proj</span>, <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>));</pre></div>
|
|
|
</div><h4 id='method.from_fov' class="method"><code id='from_fov.v'>pub fn <a href='#method.from_fov' class='fnname'>from_fov</a>(aspect: N, vfov: N, znear: N, zfar: N) -> Self</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#143-165' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new orthographic projection matrix from an aspect ratio and the vertical field of view.</p>
|
|
|
</div><h4 id='method.inverse' class="method"><code id='inverse.v'>pub fn <a href='#method.inverse' class='fnname'>inverse</a>(&self) -> <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#185-201' title='goto source code'>[src]</a></h4><div class='docblock'><p>Retrieves the inverse of the underlying homogeneous matrix.</p>
|
|
|
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">inv</span> <span class="op">=</span> <span class="ident">proj</span>.<span class="ident">inverse</span>();
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">inv</span> <span class="op">*</span> <span class="ident">proj</span>.<span class="ident">as_matrix</span>(), <span class="ident">Matrix4</span>::<span class="ident">identity</span>());
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">as_matrix</span>() <span class="op">*</span> <span class="ident">inv</span>, <span class="ident">Matrix4</span>::<span class="ident">identity</span>());
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">inv</span> <span class="op">=</span> <span class="ident">proj</span>.<span class="ident">inverse</span>();
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">inv</span> <span class="op">*</span> <span class="ident">proj</span>.<span class="ident">as_matrix</span>(), <span class="ident">Matrix4</span>::<span class="ident">identity</span>());
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">as_matrix</span>() <span class="op">*</span> <span class="ident">inv</span>, <span class="ident">Matrix4</span>::<span class="ident">identity</span>());</pre></div>
|
|
|
</div><h4 id='method.to_homogeneous' class="method"><code id='to_homogeneous.v'>pub fn <a href='#method.to_homogeneous' class='fnname'>to_homogeneous</a>(&self) -> <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#218-220' title='goto source code'>[src]</a></h4><div class='docblock'><p>Computes the corresponding homogeneous matrix.</p>
|
|
|
<h1 id="example-3" class="section-header"><a href="#example-3">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">expected</span> <span class="op">=</span> <span class="ident">Matrix4</span>::<span class="ident">new</span>(
|
|
|
<span class="number">2.0</span> <span class="op">/</span> <span class="number">9.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">11.0</span> <span class="op">/</span> <span class="number">9.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">2.0</span> <span class="op">/</span> <span class="number">18.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">22.0</span> <span class="op">/</span> <span class="number">18.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">2.0</span> <span class="op">/</span> <span class="number">999.9</span>, <span class="op">-</span><span class="number">1000.1</span> <span class="op">/</span> <span class="number">999.9</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">1.0</span>
|
|
|
);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">to_homogeneous</span>(), <span class="ident">expected</span>);</pre></div>
|
|
|
</div><h4 id='method.as_matrix' class="method"><code id='as_matrix.v'>pub fn <a href='#method.as_matrix' class='fnname'>as_matrix</a>(&self) -> &<a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#237-239' title='goto source code'>[src]</a></h4><div class='docblock'><p>A reference to the underlying homogeneous transformation matrix.</p>
|
|
|
<h1 id="example-4" class="section-header"><a href="#example-4">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">expected</span> <span class="op">=</span> <span class="ident">Matrix4</span>::<span class="ident">new</span>(
|
|
|
<span class="number">2.0</span> <span class="op">/</span> <span class="number">9.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">11.0</span> <span class="op">/</span> <span class="number">9.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">2.0</span> <span class="op">/</span> <span class="number">18.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">22.0</span> <span class="op">/</span> <span class="number">18.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">2.0</span> <span class="op">/</span> <span class="number">999.9</span>, <span class="op">-</span><span class="number">1000.1</span> <span class="op">/</span> <span class="number">999.9</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">1.0</span>
|
|
|
);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">proj</span>.<span class="ident">as_matrix</span>(), <span class="ident">expected</span>);</pre></div>
|
|
|
</div><h4 id='method.as_projective' class="method"><code id='as_projective.v'>pub fn <a href='#method.as_projective' class='fnname'>as_projective</a>(&self) -> &<a class="type" href="../../nalgebra/geometry/type.Projective3.html" title="type nalgebra::geometry::Projective3">Projective3</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#250-252' title='goto source code'>[src]</a></h4><div class='docblock'><p>A reference to this transformation seen as a <code>Projective3</code>.</p>
|
|
|
<h1 id="example-5" class="section-header"><a href="#example-5">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">as_projective</span>().<span class="ident">to_homogeneous</span>(), <span class="ident">proj</span>.<span class="ident">to_homogeneous</span>());</pre></div>
|
|
|
</div><h4 id='method.to_projective' class="method"><code id='to_projective.v'>pub fn <a href='#method.to_projective' class='fnname'>to_projective</a>(&self) -> <a class="type" href="../../nalgebra/geometry/type.Projective3.html" title="type nalgebra::geometry::Projective3">Projective3</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#263-265' title='goto source code'>[src]</a></h4><div class='docblock'><p>This transformation seen as a <code>Projective3</code>.</p>
|
|
|
<h1 id="example-6" class="section-header"><a href="#example-6">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">to_projective</span>().<span class="ident">to_homogeneous</span>(), <span class="ident">proj</span>.<span class="ident">to_homogeneous</span>());</pre></div>
|
|
|
</div><h4 id='method.into_inner' class="method"><code id='into_inner.v'>pub fn <a href='#method.into_inner' class='fnname'>into_inner</a>(self) -> <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#283-285' title='goto source code'>[src]</a></h4><div class='docblock'><p>Retrieves the underlying homogeneous matrix.</p>
|
|
|
<h1 id="example-7" class="section-header"><a href="#example-7">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">expected</span> <span class="op">=</span> <span class="ident">Matrix4</span>::<span class="ident">new</span>(
|
|
|
<span class="number">2.0</span> <span class="op">/</span> <span class="number">9.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">11.0</span> <span class="op">/</span> <span class="number">9.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">2.0</span> <span class="op">/</span> <span class="number">18.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">22.0</span> <span class="op">/</span> <span class="number">18.0</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="op">-</span><span class="number">2.0</span> <span class="op">/</span> <span class="number">999.9</span>, <span class="op">-</span><span class="number">1000.1</span> <span class="op">/</span> <span class="number">999.9</span>,
|
|
|
<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">1.0</span>
|
|
|
);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">into_inner</span>(), <span class="ident">expected</span>);</pre></div>
|
|
|
</div><h4 id='method.unwrap' class="method"><code id='unwrap.v'>pub fn <a href='#method.unwrap' class='fnname'>unwrap</a>(self) -> <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#291-293' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab deprecated'>Deprecated: <p>use <code>.into_inner()</code> instead</p>
|
|
|
</div></div><div class='docblock'><p>Retrieves the underlying homogeneous matrix.
|
|
|
Deprecated: Use [Orthographic3::into_inner] instead.</p>
|
|
|
</div><h4 id='method.left' class="method"><code id='left.v'>pub fn <a href='#method.left' class='fnname'>left</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#307-309' title='goto source code'>[src]</a></h4><div class='docblock'><p>The left offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">1.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">10.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.right' class="method"><code id='right.v'>pub fn <a href='#method.right' class='fnname'>right</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#323-325' title='goto source code'>[src]</a></h4><div class='docblock'><p>The right offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="number">10.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="number">1.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.bottom' class="method"><code id='bottom.v'>pub fn <a href='#method.bottom' class='fnname'>bottom</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#339-341' title='goto source code'>[src]</a></h4><div class='docblock'><p>The bottom offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">2.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">20.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.top' class="method"><code id='top.v'>pub fn <a href='#method.top' class='fnname'>top</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#355-357' title='goto source code'>[src]</a></h4><div class='docblock'><p>The top offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="number">20.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="number">2.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.znear' class="method"><code id='znear.v'>pub fn <a href='#method.znear' class='fnname'>znear</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#371-373' title='goto source code'>[src]</a></h4><div class='docblock'><p>The near plane offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">0.1</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">1000.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.zfar' class="method"><code id='zfar.v'>pub fn <a href='#method.zfar' class='fnname'>zfar</a>(&self) -> N</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#387-389' title='goto source code'>[src]</a></h4><div class='docblock'><p>The far plane offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="number">1000.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">1.0</span>, <span class="number">20.0</span>, <span class="number">2.0</span>, <span class="number">1000.0</span>, <span class="number">0.1</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="number">0.1</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.project_point' class="method"><code id='project_point.v'>pub fn <a href='#method.project_point' class='fnname'>project_point</a>(&self, p: &<a class="type" href="../../nalgebra/geometry/type.Point3.html" title="type nalgebra::geometry::Point3">Point3</a><N>) -> <a class="type" href="../../nalgebra/geometry/type.Point3.html" title="type nalgebra::geometry::Point3">Point3</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#419-425' title='goto source code'>[src]</a></h4><div class='docblock'><p>Projects a point. Faster than matrix multiplication.</p>
|
|
|
<h1 id="example-8" class="section-header"><a href="#example-8">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">p1</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p2</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p3</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p4</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p5</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p6</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p7</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p8</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>);
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p1</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p2</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p3</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p4</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p5</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p6</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p7</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>));
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_point</span>(<span class="kw-2">&</span><span class="ident">p8</span>), <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>));</pre></div>
|
|
|
</div><h4 id='method.unproject_point' class="method"><code id='unproject_point.v'>pub fn <a href='#method.unproject_point' class='fnname'>unproject_point</a>(&self, p: &<a class="type" href="../../nalgebra/geometry/type.Point3.html" title="type nalgebra::geometry::Point3">Point3</a><N>) -> <a class="type" href="../../nalgebra/geometry/type.Point3.html" title="type nalgebra::geometry::Point3">Point3</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#454-460' title='goto source code'>[src]</a></h4><div class='docblock'><p>Un-projects a point. Faster than multiplication by the underlying matrix inverse.</p>
|
|
|
<h1 id="example-9" class="section-header"><a href="#example-9">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">p1</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p2</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p3</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p4</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p5</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p6</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>, <span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p7</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="op">-</span><span class="number">1.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">p8</span> <span class="op">=</span> <span class="ident">Point3</span>::<span class="ident">new</span>( <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>);
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p1</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p2</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p3</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p4</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p5</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">0.1</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p6</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">2.0</span>, <span class="op">-</span><span class="number">1000.0</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p7</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">0.1</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">unproject_point</span>(<span class="kw-2">&</span><span class="ident">p8</span>), <span class="ident">Point3</span>::<span class="ident">new</span>(<span class="number">10.0</span>, <span class="number">20.0</span>, <span class="op">-</span><span class="number">1000.0</span>), <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.project_vector' class="method"><code id='project_vector.v'>pub fn <a href='#method.project_vector' class='fnname'>project_vector</a><SB>(&self, p: &<a class="type" href="../../nalgebra/base/type.Vector.html" title="type nalgebra::base::Vector">Vector</a><N, <a class="struct" href="../../nalgebra/base/dimension/struct.U3.html" title="struct nalgebra::base::dimension::U3">U3</a>, SB>) -> <a class="type" href="../../nalgebra/base/type.Vector3.html" title="type nalgebra::base::Vector3">Vector3</a><N> <span class="where fmt-newline">where<br> SB: <a class="trait" href="../../nalgebra/base/storage/trait.Storage.html" title="trait nalgebra::base::storage::Storage">Storage</a><N, <a class="struct" href="../../nalgebra/base/dimension/struct.U3.html" title="struct nalgebra::base::dimension::U3">U3</a>>, </span></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#482-489' title='goto source code'>[src]</a></h4><div class='docblock'><p>Projects a vector. Faster than matrix multiplication.</p>
|
|
|
<p>Vectors are not affected by the translation part of the projection.</p>
|
|
|
<h1 id="example-10" class="section-header"><a href="#example-10">Example</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">v1</span> <span class="op">=</span> <span class="ident">Vector3</span>::<span class="ident">x</span>();
|
|
|
<span class="kw">let</span> <span class="ident">v2</span> <span class="op">=</span> <span class="ident">Vector3</span>::<span class="ident">y</span>();
|
|
|
<span class="kw">let</span> <span class="ident">v3</span> <span class="op">=</span> <span class="ident">Vector3</span>::<span class="ident">z</span>();
|
|
|
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_vector</span>(<span class="kw-2">&</span><span class="ident">v1</span>), <span class="ident">Vector3</span>::<span class="ident">x</span>() <span class="op">*</span> <span class="number">2.0</span> <span class="op">/</span> <span class="number">9.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_vector</span>(<span class="kw-2">&</span><span class="ident">v2</span>), <span class="ident">Vector3</span>::<span class="ident">y</span>() <span class="op">*</span> <span class="number">2.0</span> <span class="op">/</span> <span class="number">18.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">project_vector</span>(<span class="kw-2">&</span><span class="ident">v3</span>), <span class="ident">Vector3</span>::<span class="ident">z</span>() <span class="op">*</span> <span class="op">-</span><span class="number">2.0</span> <span class="op">/</span> <span class="number">999.9</span>);</pre></div>
|
|
|
</div><h4 id='method.set_left' class="method"><code id='set_left.v'>pub fn <a href='#method.set_left' class='fnname'>set_left</a>(&mut self, left: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#505-508' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the left offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_left</span>(<span class="number">2.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">2.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a left offset greater than the current right offset.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_left</span>(<span class="number">20.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">20.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_right' class="method"><code id='set_right.v'>pub fn <a href='#method.set_right' class='fnname'>set_right</a>(&mut self, right: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#524-527' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the right offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_right</span>(<span class="number">15.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="number">15.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a right offset smaller than the current left offset.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_right</span>(<span class="op">-</span><span class="number">3.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="op">-</span><span class="number">3.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_bottom' class="method"><code id='set_bottom.v'>pub fn <a href='#method.set_bottom' class='fnname'>set_bottom</a>(&mut self, bottom: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#543-546' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the bottom offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_bottom</span>(<span class="number">8.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">8.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a bottom offset greater than the current top offset.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_bottom</span>(<span class="number">50.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">50.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_top' class="method"><code id='set_top.v'>pub fn <a href='#method.set_top' class='fnname'>set_top</a>(&mut self, top: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#562-565' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the top offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_top</span>(<span class="number">15.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="number">15.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a top offset smaller than the current bottom offset.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_top</span>(<span class="op">-</span><span class="number">3.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="op">-</span><span class="number">3.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_znear' class="method"><code id='set_znear.v'>pub fn <a href='#method.set_znear' class='fnname'>set_znear</a>(&mut self, znear: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#581-584' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the near plane offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_znear</span>(<span class="number">8.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">8.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a znear greater than the current zfar.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_znear</span>(<span class="number">5000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">5000.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_zfar' class="method"><code id='set_zfar.v'>pub fn <a href='#method.set_zfar' class='fnname'>set_zfar</a>(&mut self, zfar: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#600-603' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the far plane offset of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_zfar</span>(<span class="number">15.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="number">15.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is OK to set a zfar smaller than the current znear.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_zfar</span>(<span class="op">-</span><span class="number">3.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="op">-</span><span class="number">3.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_left_and_right' class="method"><code id='set_left_and_right.v'>pub fn <a href='#method.set_left_and_right' class='fnname'>set_left_and_right</a>(&mut self, left: N, right: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#621-628' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the view cuboid offsets along the <code>x</code> axis.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_left_and_right</span>(<span class="number">7.0</span>, <span class="number">70.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">7.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="number">70.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is also OK to have `left > right`.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_left_and_right</span>(<span class="number">70.0</span>, <span class="number">7.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">left</span>(), <span class="number">70.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">right</span>(), <span class="number">7.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_bottom_and_top' class="method"><code id='set_bottom_and_top.v'>pub fn <a href='#method.set_bottom_and_top' class='fnname'>set_bottom_and_top</a>(&mut self, bottom: N, top: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#646-653' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the view cuboid offsets along the <code>y</code> axis.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_bottom_and_top</span>(<span class="number">7.0</span>, <span class="number">70.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">7.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="number">70.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is also OK to have `bottom > top`.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_bottom_and_top</span>(<span class="number">70.0</span>, <span class="number">7.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">bottom</span>(), <span class="number">70.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">top</span>(), <span class="number">7.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div><h4 id='method.set_znear_and_zfar' class="method"><code id='set_znear_and_zfar.v'>pub fn <a href='#method.set_znear_and_zfar' class='fnname'>set_znear_and_zfar</a>(&mut self, znear: N, zfar: N)</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#671-678' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the near and far plane offsets of the view cuboid.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">proj</span> <span class="op">=</span> <span class="ident">Orthographic3</span>::<span class="ident">new</span>(<span class="number">1.0</span>, <span class="number">10.0</span>, <span class="number">2.0</span>, <span class="number">20.0</span>, <span class="number">0.1</span>, <span class="number">1000.0</span>);
|
|
|
<span class="ident">proj</span>.<span class="ident">set_znear_and_zfar</span>(<span class="number">50.0</span>, <span class="number">5000.0</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">50.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="number">5000.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
|
|
|
<span class="comment">// It is also OK to have `znear > zfar`.</span>
|
|
|
<span class="ident">proj</span>.<span class="ident">set_znear_and_zfar</span>(<span class="number">5000.0</span>, <span class="number">0.5</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">znear</span>(), <span class="number">5000.0</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);
|
|
|
<span class="macro">assert_relative_eq</span><span class="macro">!</span>(<span class="ident">proj</span>.<span class="ident">zfar</span>(), <span class="number">0.5</span>, <span class="ident">epsilon</span> <span class="op">=</span> <span class="number">1.0e-6</span>);</pre></div>
|
|
|
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#26-31' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> Self</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#28-30' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
|
|
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
|
|
</div></div><h3 id='impl-PartialEq%3COrthographic3%3CN%3E%3E' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N>> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a href='#impl-PartialEq%3COrthographic3%3CN%3E%3E' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#39-44' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.eq' class="method hidden"><code id='eq.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, right: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#41-43' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
|
|
</div><h4 id='method.ne' class="method hidden"><code id='ne.v'><span class="docblock attributes">#[must_use]
|
|
|
</span>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#208' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
|
|
|
</div></div><h3 id='impl-From%3COrthographic3%3CN%3E%3E' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N>> for <a class="type" href="../../nalgebra/base/type.Matrix4.html" title="type nalgebra::base::Matrix4">Matrix4</a><N></code><a href='#impl-From%3COrthographic3%3CN%3E%3E' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#712-717' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(orth: <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N>) -> Self</code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#714-716' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-Copy' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a href='#impl-Copy' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#24' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#33-37' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#34-36' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Distribution%3COrthographic3%3CN%3E%3E' class='impl'><code class='in-band'>impl<N: <a class="trait" href="../../nalgebra/trait.RealField.html" title="trait nalgebra::RealField">RealField</a>> <a class="trait" href="../../rand/distributions/trait.Distribution.html" title="trait rand::distributions::Distribution">Distribution</a><<a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N>> for <a class="struct" href="../../rand/distributions/struct.Standard.html" title="struct rand::distributions::Standard">Standard</a> <span class="where fmt-newline">where<br> <a class="struct" href="../../rand/distributions/struct.Standard.html" title="struct rand::distributions::Standard">Standard</a>: <a class="trait" href="../../rand/distributions/trait.Distribution.html" title="trait rand::distributions::Distribution">Distribution</a><N>, </span></code><a href='#impl-Distribution%3COrthographic3%3CN%3E%3E' class='anchor'></a><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#681-694' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.sample' class="method hidden"><code id='sample.v'>fn <a href='../../rand/distributions/trait.Distribution.html#tymethod.sample' class='fnname'>sample</a><R: <a class="trait" href="../../rand/trait.Rng.html" title="trait rand::Rng">Rng</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>>(&self, r: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>R) -> <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N></code><a class='srclink' href='../../src/nalgebra/geometry/orthographic.rs.html#684-693' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Generate a random value of <code>T</code>, using <code>rng</code> as the source of randomness.</p>
|
|
|
</div><h4 id='method.sample_iter' class="method hidden"><code id='sample_iter.v'>fn <a href='../../rand/distributions/trait.Distribution.html#method.sample_iter' class='fnname'>sample_iter</a><R>(&'a self, rng: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>R) -> <a class="struct" href="../../rand/distributions/struct.DistIter.html" title="struct rand::distributions::DistIter">DistIter</a><'a, Self, R, T> <span class="where fmt-newline">where<br> R: <a class="trait" href="../../rand/trait.Rng.html" title="trait rand::Rng">Rng</a>, </span></code><a class='srclink' href='../../src/rand/distributions/mod.rs.html#261-269' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Create an iterator that generates random values of <code>T</code>, using <code>rng</code> as the source of randomness. <a href="../../rand/distributions/trait.Distribution.html#method.sample_iter">Read more</a></p>
|
|
|
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Send' class='impl'><code class='in-band'>impl<N> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N> <span class="where fmt-newline">where<br> N: <a class="trait" href="../../nalgebra/base/trait.Scalar.html" title="trait nalgebra::base::Scalar">Scalar</a>, </span></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl<N> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N> <span class="where fmt-newline">where<br> N: <a class="trait" href="../../nalgebra/base/trait.Scalar.html" title="trait nalgebra::base::Scalar">Scalar</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>, </span></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl<N> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N> <span class="where fmt-newline">where<br> N: <a class="trait" href="../../nalgebra/base/trait.Scalar.html" title="trait nalgebra::base::Scalar">Scalar</a>, </span></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl<N> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N> <span class="where fmt-newline">where<br> N: <a class="trait" href="../../nalgebra/base/trait.Scalar.html" title="trait nalgebra::base::Scalar">Scalar</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a>, </span></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl<N> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../nalgebra/geometry/struct.Orthographic3.html" title="struct nalgebra::geometry::Orthographic3">Orthographic3</a><N> <span class="where fmt-newline">where<br> N: <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> + <a class="trait" href="../../nalgebra/base/trait.Scalar.html" title="trait nalgebra::base::Scalar">Scalar</a>, </span></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
|
|
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&self) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
|
|
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
|
|
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#544-549' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553-555' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-1' class="method hidden"><code id='from.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#554' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#572-578' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
|
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#575-577' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#560-567' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
|
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#564-566' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Same%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="../../typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</code><a href='#impl-Same%3CT%3E' class='anchor'></a><a class='srclink' href='../../src/typenum/type_operators.rs.html#32-34' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output' class="type"><code id='Output.t'>type <a href='../../typenum/type_operators/trait.Same.html#associatedtype.Output' class="type">Output</a> = T</code></h4><div class='docblock'><p>Should always be <code>Self</code></p>
|
|
|
</div></div><h3 id='impl-SupersetOf%3CSS%3E' class='impl'><code class='in-band'>impl<SS, SP> <a class="trait" href="../../alga/general/subset/trait.SupersetOf.html" title="trait alga::general::subset::SupersetOf">SupersetOf</a><SS> for SP <span class="where fmt-newline">where<br> SS: <a class="trait" href="../../alga/general/subset/trait.SubsetOf.html" title="trait alga::general::subset::SubsetOf">SubsetOf</a><SP>, </span></code><a href='#impl-SupersetOf%3CSS%3E' class='anchor'></a><a class='srclink' href='../../src/alga/general/subset.rs.html#87-107' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.to_subset' class="method hidden"><code id='to_subset.v'>fn <a href='../../alga/general/subset/trait.SupersetOf.html#method.to_subset' class='fnname'>to_subset</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><SS></code><a class='srclink' href='../../src/alga/general/subset.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>The inverse inclusion map: attempts to construct <code>self</code> from the equivalent element of its superset. <a href="../../alga/general/subset/trait.SupersetOf.html#method.to_subset">Read more</a></p>
|
|
|
</div><h4 id='method.is_in_subset' class="method hidden"><code id='is_in_subset.v'>fn <a href='../../alga/general/subset/trait.SupersetOf.html#tymethod.is_in_subset' class='fnname'>is_in_subset</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../../src/alga/general/subset.rs.html#94-96' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Checks if <code>self</code> is actually part of its subset <code>T</code> (and can be converted to it).</p>
|
|
|
</div><h4 id='method.to_subset_unchecked' class="method hidden"><code id='to_subset_unchecked.v'>unsafe fn <a href='../../alga/general/subset/trait.SupersetOf.html#tymethod.to_subset_unchecked' class='fnname'>to_subset_unchecked</a>(&self) -> SS</code><a class='srclink' href='../../src/alga/general/subset.rs.html#99-101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Use with care! Same as <code>self.to_subset</code> but without any property checks. Always succeeds.</p>
|
|
|
</div><h4 id='method.from_subset' class="method hidden"><code id='from_subset.v'>fn <a href='../../alga/general/subset/trait.SupersetOf.html#tymethod.from_subset' class='fnname'>from_subset</a>(element: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>SS) -> SP</code><a class='srclink' href='../../src/alga/general/subset.rs.html#104-106' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>The inclusion map: converts <code>self</code> to the equivalent element of its superset.</p>
|
|
|
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "nalgebra";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |