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

32 lines
13 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A trait for extending `prim@f32` and `prim@f64` with extra methods."><title>FloatExt in bevy_math - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bevy_math" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../bevy_math/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../bevy_math/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../bevy_math/index.html">bevy_<wbr>math</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Float<wbr>Ext</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.inverse_lerp" title="inverse_lerp">inverse_lerp</a></li><li><a href="#tymethod.lerp" title="lerp">lerp</a></li><li><a href="#tymethod.remap" title="remap">remap</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-FloatExt-for-f32" title="f32">f32</a></li><li><a href="#impl-FloatExt-for-f64" title="f64">f64</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bevy_<wbr>math</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">bevy_math</a></span><h1>Trait <span class="trait">FloatExt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/glam/float.rs.html#2">Source</a> </span></div><pre class="rust item-decl"><code>pub trait FloatExt {
// Required methods
fn <a href="#tymethod.lerp" class="fn">lerp</a>(self, rhs: Self, s: Self) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.inverse_lerp" class="fn">inverse_lerp</a>(a: Self, b: Self, v: Self) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.remap" class="fn">remap</a>(
self,
in_start: Self,
in_end: Self,
out_start: Self,
out_end: Self,
) -&gt; Self;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait for extending <a href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html" title="primitive f32"><code>f32</code></a> and <a href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html" title="primitive f64"><code>f64</code></a> with extra methods.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.lerp" class="method"><a class="src rightside" href="../src/glam/float.rs.html#9">Source</a><h4 class="code-header">fn <a href="#tymethod.lerp" class="fn">lerp</a>(self, rhs: Self, s: Self) -&gt; Self</h4></section></summary><div class="docblock"><p>Performs a linear interpolation between <code>self</code> and <code>rhs</code> based on the value <code>s</code>.</p>
<p>When <code>s</code> is <code>0</code>, the result will be <code>self</code>. When <code>s</code> is <code>1</code>, the result
will be <code>rhs</code>. When <code>s</code> is outside of the range <code>[0, 1]</code>, the result is linearly
extrapolated.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.inverse_lerp" class="method"><a class="src rightside" href="../src/glam/float.rs.html#18">Source</a><h4 class="code-header">fn <a href="#tymethod.inverse_lerp" class="fn">inverse_lerp</a>(a: Self, b: Self, v: Self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns <code>v</code> normalized to the range <code>[a, b]</code>.</p>
<p>When <code>v</code> is equal to <code>a</code> the result will be <code>0</code>. When <code>v</code> is equal to <code>b</code> will be <code>1</code>.</p>
<p>When <code>v</code> is outside of the range <code>[a, b]</code>, the result is linearly extrapolated.</p>
<p><code>a</code> and <code>b</code> must not be equal, otherwise the result will be either infinite or <code>NAN</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.remap" class="method"><a class="src rightside" href="../src/glam/float.rs.html#29">Source</a><h4 class="code-header">fn <a href="#tymethod.remap" class="fn">remap</a>(
self,
in_start: Self,
in_end: Self,
out_start: Self,
out_end: Self,
) -&gt; Self</h4></section></summary><div class="docblock"><p>Remap <code>self</code> from the input range to the output range.</p>
<p>When <code>self</code> is equal to <code>in_start</code> this returns <code>out_start</code>.
When <code>self</code> is equal to <code>in_end</code> this returns <code>out_end</code>.</p>
<p>When <code>self</code> is outside of the range <code>[in_start, in_end]</code>, the result is linearly extrapolated.</p>
<p><code>in_start</code> and <code>in_end</code> must not be equal, otherwise the result will be either infinite or <code>NAN</code>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-FloatExt-for-f32" class="impl"><a class="src rightside" href="../src/glam/f32/float.rs.html#5">Source</a><a href="#impl-FloatExt-for-f32" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.FloatExt.html" title="trait bevy_math::FloatExt">FloatExt</a> for <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h3></section></summary><div class="impl-items"><section id="method.lerp" class="method trait-impl"><a class="src rightside" href="../src/glam/f32/float.rs.html#7">Source</a><a href="#method.lerp" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lerp" class="fn">lerp</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h4></section><section id="method.inverse_lerp" class="method trait-impl"><a class="src rightside" href="../src/glam/f32/float.rs.html#12">Source</a><a href="#method.inverse_lerp" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.inverse_lerp" class="fn">inverse_lerp</a>(a: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, b: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, v: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h4></section><section id="method.remap" class="method trait-impl"><a class="src rightside" href="../src/glam/f32/float.rs.html#17">Source</a><a href="#method.remap" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.remap" class="fn">remap</a>(self, in_start: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, in_end: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, out_start: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>, out_end: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FloatExt-for-f64" class="impl"><a class="src rightside" href="../src/glam/f64/float.rs.html#5">Source</a><a href="#impl-FloatExt-for-f64" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.FloatExt.html" title="trait bevy_math::FloatExt">FloatExt</a> for <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a></h3></section></summary><div class="impl-items"><section id="method.lerp-1" class="method trait-impl"><a class="src rightside" href="../src/glam/f64/float.rs.html#7">Source</a><a href="#method.lerp-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lerp" class="fn">lerp</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, t: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a></h4></section><section id="method.inverse_lerp-1" class="method trait-impl"><a class="src rightside" href="../src/glam/f64/float.rs.html#12">Source</a><a href="#method.inverse_lerp-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.inverse_lerp" class="fn">inverse_lerp</a>(a: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, b: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, v: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a></h4></section><section id="method.remap-1" class="method trait-impl"><a class="src rightside" href="../src/glam/f64/float.rs.html#17">Source</a><a href="#method.remap-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.remap" class="fn">remap</a>(self, in_start: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, in_end: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, out_start: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>, out_end: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../trait.impl/glam/float/trait.FloatExt.js" data-ignore-extern-crates="std" async></script></section></div></main></body></html>