|
|
<!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 `Angle` trait in crate `cgmath`."><meta name="keywords" content="rust, rustlang, rust-lang, Angle"><title>cgmath::Angle - 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="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[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='../cgmath/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Angle</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Unitless">Unitless</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.acos">acos</a><a href="#tymethod.asin">asin</a><a href="#tymethod.atan">atan</a><a href="#tymethod.atan2">atan2</a><a href="#tymethod.cos">cos</a><a href="#tymethod.full_turn">full_turn</a><a href="#tymethod.sin">sin</a><a href="#tymethod.sin_cos">sin_cos</a><a href="#tymethod.tan">tan</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.bisect">bisect</a><a href="#method.cot">cot</a><a href="#method.csc">csc</a><a href="#method.normalize">normalize</a><a href="#method.normalize_signed">normalize_signed</a><a href="#method.opposite">opposite</a><a href="#method.sec">sec</a><a href="#method.turn_div_2">turn_div_2</a><a href="#method.turn_div_3">turn_div_3</a><a href="#method.turn_div_4">turn_div_4</a><a href="#method.turn_div_6">turn_div_6</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>cgmath</a></p><script>window.sidebarCurrent = {name: 'Angle', ty: 'trait', 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/cgmath/structure.rs.html#572-784' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>cgmath</a>::<wbr><a class="trait" href=''>Angle</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Angle <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,<br> Self: <a class="trait" href="../cgmath/trait.AbsDiffEq.html" title="trait cgmath::AbsDiffEq">AbsDiffEq</a><Epsilon = Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>>,<br> Self: <a class="trait" href="../cgmath/trait.RelativeEq.html" title="trait cgmath::RelativeEq">RelativeEq</a><Epsilon = Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>>,<br> Self: <a class="trait" href="../cgmath/trait.UlpsEq.html" title="trait cgmath::UlpsEq">UlpsEq</a><Epsilon = Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>>,<br> Self: <a class="trait" href="../cgmath/prelude/trait.Zero.html" title="trait cgmath::prelude::Zero">Zero</a>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a><Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><Self, Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><Self, Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Rem.html" title="trait core::ops::arith::Rem">Rem</a><Self, Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Mul.html" title="trait core::ops::arith::Mul">Mul</a><Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Div.html" title="trait core::ops::arith::Div">Div</a><Self, Output = Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Div.html" title="trait core::ops::arith::Div">Div</a><Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, Output = Self>,<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/accum/trait.Sum.html" title="trait core::iter::traits::accum::Sum">Sum</a>, </span>{
|
|
|
type <a href='#associatedtype.Unitless' class="type">Unitless</a>: <a class="trait" href="../cgmath/trait.BaseFloat.html" title="trait cgmath::BaseFloat">BaseFloat</a>;
|
|
|
fn <a href='#tymethod.full_turn' class='fnname'>full_turn</a>() -> Self;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.sin' class='fnname'>sin</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.cos' class='fnname'>cos</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.tan' class='fnname'>tan</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.sin_cos' class='fnname'>sin_cos</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.asin' class='fnname'>asin</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.acos' class='fnname'>acos</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.atan' class='fnname'>atan</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self;
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.atan2' class='fnname'>atan2</a>(a: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, b: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self;
|
|
|
|
|
|
fn <a href='#method.normalize' class='fnname'>normalize</a>(self) -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.normalize_signed' class='fnname'>normalize_signed</a>(self) -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.opposite' class='fnname'>opposite</a>(self) -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.bisect' class='fnname'>bisect</a>(self, other: Self) -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.turn_div_2' class='fnname'>turn_div_2</a>() -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.turn_div_3' class='fnname'>turn_div_3</a>() -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.turn_div_4' class='fnname'>turn_div_4</a>() -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.turn_div_6' class='fnname'>turn_div_6</a>() -> Self { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.csc' class='fnname'>csc</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a> { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.cot' class='fnname'>cot</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a> { ... }
|
|
|
<div class='item-spacer'></div> fn <a href='#method.sec' class='fnname'>sec</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a> { ... }
|
|
|
}</pre></div><div class='docblock'><p>Angles and their associated trigonometric functions.</p>
|
|
|
<p>Typed angles allow for the writing of self-documenting code that makes it
|
|
|
clear when semantic violations have occured - for example, adding degrees to
|
|
|
radians, or adding a number to an angle.</p>
|
|
|
</div>
|
|
|
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Unitless' class='method'><code id='Unitless.t'>type <a href='#associatedtype.Unitless' class="type">Unitless</a>: <a class="trait" href="../cgmath/trait.BaseFloat.html" title="trait cgmath::BaseFloat">BaseFloat</a></code></h3></div><span class='loading-content'>Loading content...</span>
|
|
|
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.full_turn' class='method'><code id='full_turn.v'>fn <a href='#tymethod.full_turn' class='fnname'>full_turn</a>() -> Self</code></h3><div class='docblock'><p>A full rotation.</p>
|
|
|
</div><h3 id='tymethod.sin' class='method'><code id='sin.v'>fn <a href='#tymethod.sin' class='fnname'>sin</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the sine of the angle, returning a unitless ratio.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">sin</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.cos' class='method'><code id='cos.v'>fn <a href='#tymethod.cos' class='fnname'>cos</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the cosine of the angle, returning a unitless ratio.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">cos</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.tan' class='method'><code id='tan.v'>fn <a href='#tymethod.tan' class='fnname'>tan</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the tangent of the angle, returning a unitless ratio.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">tan</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.sin_cos' class='method'><code id='sin_cos.v'>fn <a href='#tymethod.sin_cos' class='fnname'>sin_cos</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></h3><div class='docblock'><p>Compute the sine and cosine of the angle, returning the result as a
|
|
|
pair.</p>
|
|
|
<p>This does not have any performance benefits, but calculating both the
|
|
|
sine and cosine of a single angle is a common operation.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> (<span class="ident">s</span>, <span class="ident">c</span>) <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">sin_cos</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.asin' class='method'><code id='asin.v'>fn <a href='#tymethod.asin' class='fnname'>asin</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self</code></h3><div class='docblock'><p>Compute the arcsine of the ratio, returning the resulting angle.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span>: <span class="ident">Rad</span><span class="op"><</span><span class="ident">f32</span><span class="op">></span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">asin</span>(<span class="number">0.5</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.acos' class='method'><code id='acos.v'>fn <a href='#tymethod.acos' class='fnname'>acos</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self</code></h3><div class='docblock'><p>Compute the arccosine of the ratio, returning the resulting angle.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span>: <span class="ident">Rad</span><span class="op"><</span><span class="ident">f32</span><span class="op">></span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">acos</span>(<span class="number">0.5</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.atan' class='method'><code id='atan.v'>fn <a href='#tymethod.atan' class='fnname'>atan</a>(ratio: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self</code></h3><div class='docblock'><p>Compute the arctangent of the ratio, returning the resulting angle.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span>: <span class="ident">Rad</span><span class="op"><</span><span class="ident">f32</span><span class="op">></span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">atan</span>(<span class="number">0.5</span>);</pre></div>
|
|
|
</div><h3 id='tymethod.atan2' class='method'><code id='atan2.v'>fn <a href='#tymethod.atan2' class='fnname'>atan2</a>(a: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>, b: Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a>) -> Self</code></h3></div><span class='loading-content'>Loading content...</span>
|
|
|
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.normalize' class='method'><code id='normalize.v'>fn <a href='#method.normalize' class='fnname'>normalize</a>(self) -> Self</code></h3><div class='docblock'><p>Return the angle, normalized to the range <code>[0, full_turn)</code>.</p>
|
|
|
</div><h3 id='method.normalize_signed' class='method'><code id='normalize_signed.v'>fn <a href='#method.normalize_signed' class='fnname'>normalize_signed</a>(self) -> Self</code></h3><div class='docblock'><p>Return the angle, normalized to the range <code>[-turn_div_2, turn_div_2)</code>.</p>
|
|
|
</div><h3 id='method.opposite' class='method'><code id='opposite.v'>fn <a href='#method.opposite' class='fnname'>opposite</a>(self) -> Self</code></h3><div class='docblock'><p>Return the angle rotated by half a turn.</p>
|
|
|
</div><h3 id='method.bisect' class='method'><code id='bisect.v'>fn <a href='#method.bisect' class='fnname'>bisect</a>(self, other: Self) -> Self</code></h3><div class='docblock'><p>Returns the interior bisector of the two angles.</p>
|
|
|
</div><h3 id='method.turn_div_2' class='method'><code id='turn_div_2.v'>fn <a href='#method.turn_div_2' class='fnname'>turn_div_2</a>() -> Self</code></h3><div class='docblock'><p>Half of a full rotation.</p>
|
|
|
</div><h3 id='method.turn_div_3' class='method'><code id='turn_div_3.v'>fn <a href='#method.turn_div_3' class='fnname'>turn_div_3</a>() -> Self</code></h3><div class='docblock'><p>A third of a full rotation.</p>
|
|
|
</div><h3 id='method.turn_div_4' class='method'><code id='turn_div_4.v'>fn <a href='#method.turn_div_4' class='fnname'>turn_div_4</a>() -> Self</code></h3><div class='docblock'><p>A quarter of a full rotation.</p>
|
|
|
</div><h3 id='method.turn_div_6' class='method'><code id='turn_div_6.v'>fn <a href='#method.turn_div_6' class='fnname'>turn_div_6</a>() -> Self</code></h3><div class='docblock'><p>A sixth of a full rotation.</p>
|
|
|
</div><h3 id='method.csc' class='method'><code id='csc.v'>fn <a href='#method.csc' class='fnname'>csc</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the cosecant of the angle.</p>
|
|
|
<p>This is the same as computing the reciprocal of <code>Self::sin</code>.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">csc</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='method.cot' class='method'><code id='cot.v'>fn <a href='#method.cot' class='fnname'>cot</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the cotangent of the angle.</p>
|
|
|
<p>This is the same as computing the reciprocal of <code>Self::tan</code>.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">cot</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div><h3 id='method.sec' class='method'><code id='sec.v'>fn <a href='#method.sec' class='fnname'>sec</a>(self) -> Self::<a class="type" href="../cgmath/prelude/trait.Angle.html#associatedtype.Unitless" title="type cgmath::prelude::Angle::Unitless">Unitless</a></code></h3><div class='docblock'><p>Compute the secant of the angle.</p>
|
|
|
<p>This is the same as computing the reciprocal of <code>Self::cos</code>.</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
<span class="kw">use</span> <span class="ident">cgmath</span>::<span class="ident">Rad</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">angle</span> <span class="op">=</span> <span class="ident">Rad</span>(<span class="number">35.0</span>);
|
|
|
<span class="kw">let</span> <span class="ident">ratio</span>: <span class="ident">f32</span> <span class="op">=</span> <span class="ident">Rad</span>::<span class="ident">sec</span>(<span class="ident">angle</span>);</pre></div>
|
|
|
</div></div><span class='loading-content'>Loading content...</span>
|
|
|
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Angle' class='impl'><code class='in-band'>impl<S: <a class="trait" href="../cgmath/trait.BaseFloat.html" title="trait cgmath::BaseFloat">BaseFloat</a>> Angle for <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a href='#impl-Angle' class='anchor'></a><a class='srclink' href='../src/cgmath/angle.rs.html#97-111' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Unitless-1' class="type"><code id='Unitless.t-1'>type <a href='#associatedtype.Unitless-1' class="type">Unitless</a> = S</code></h4><h4 id='method.full_turn' class="method hidden"><code id='full_turn.v-1'>fn <a href='#method.full_turn' class='fnname'>full_turn</a>() -> <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#100' title='goto source code'>[src]</a></h4><h4 id='method.sin' class="method hidden"><code id='sin.v-1'>fn <a href='#method.sin' class='fnname'>sin</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#102' title='goto source code'>[src]</a></h4><h4 id='method.cos' class="method hidden"><code id='cos.v-1'>fn <a href='#method.cos' class='fnname'>cos</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#103' title='goto source code'>[src]</a></h4><h4 id='method.tan' class="method hidden"><code id='tan.v-1'>fn <a href='#method.tan' class='fnname'>tan</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#104' title='goto source code'>[src]</a></h4><h4 id='method.sin_cos' class="method hidden"><code id='sin_cos.v-1'>fn <a href='#method.sin_cos' class='fnname'>sin_cos</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>S, S<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../src/cgmath/angle.rs.html#105' title='goto source code'>[src]</a></h4><h4 id='method.asin' class="method hidden"><code id='asin.v-1'>fn <a href='#method.asin' class='fnname'>asin</a>(a: S) -> <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#107' title='goto source code'>[src]</a></h4><h4 id='method.acos' class="method hidden"><code id='acos.v-1'>fn <a href='#method.acos' class='fnname'>acos</a>(a: S) -> <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#108' title='goto source code'>[src]</a></h4><h4 id='method.atan' class="method hidden"><code id='atan.v-1'>fn <a href='#method.atan' class='fnname'>atan</a>(a: S) -> <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#109' title='goto source code'>[src]</a></h4><h4 id='method.atan2' class="method hidden"><code id='atan2.v-1'>fn <a href='#method.atan2' class='fnname'>atan2</a>(a: S, b: S) -> <a class="struct" href="../cgmath/struct.Deg.html" title="struct cgmath::Deg">Deg</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#110' title='goto source code'>[src]</a></h4></div><h3 id='impl-Angle-1' class='impl'><code class='in-band'>impl<S: <a class="trait" href="../cgmath/trait.BaseFloat.html" title="trait cgmath::BaseFloat">BaseFloat</a>> Angle for <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a href='#impl-Angle-1' class='anchor'></a><a class='srclink' href='../src/cgmath/angle.rs.html#97-111' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Unitless-2' class="type"><code id='Unitless.t-2'>type <a href='#associatedtype.Unitless-2' class="type">Unitless</a> = S</code></h4><h4 id='method.full_turn-1' class="method hidden"><code id='full_turn.v-2'>fn <a href='#method.full_turn-1' class='fnname'>full_turn</a>() -> <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#100' title='goto source code'>[src]</a></h4><h4 id='method.sin-1' class="method hidden"><code id='sin.v-2'>fn <a href='#method.sin-1' class='fnname'>sin</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#102' title='goto source code'>[src]</a></h4><h4 id='method.cos-1' class="method hidden"><code id='cos.v-2'>fn <a href='#method.cos-1' class='fnname'>cos</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#103' title='goto source code'>[src]</a></h4><h4 id='method.tan-1' class="method hidden"><code id='tan.v-2'>fn <a href='#method.tan-1' class='fnname'>tan</a>(self) -> S</code><a class='srclink' href='../src/cgmath/angle.rs.html#104' title='goto source code'>[src]</a></h4><h4 id='method.sin_cos-1' class="method hidden"><code id='sin_cos.v-2'>fn <a href='#method.sin_cos-1' class='fnname'>sin_cos</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>S, S<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../src/cgmath/angle.rs.html#105' title='goto source code'>[src]</a></h4><h4 id='method.asin-1' class="method hidden"><code id='asin.v-2'>fn <a href='#method.asin-1' class='fnname'>asin</a>(a: S) -> <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#107' title='goto source code'>[src]</a></h4><h4 id='method.acos-1' class="method hidden"><code id='acos.v-2'>fn <a href='#method.acos-1' class='fnname'>acos</a>(a: S) -> <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#108' title='goto source code'>[src]</a></h4><h4 id='method.atan-1' class="method hidden"><code id='atan.v-2'>fn <a href='#method.atan-1' class='fnname'>atan</a>(a: S) -> <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#109' title='goto source code'>[src]</a></h4><h4 id='method.atan2-1' class="method hidden"><code id='atan2.v-2'>fn <a href='#method.atan2-1' class='fnname'>atan2</a>(a: S, b: S) -> <a class="struct" href="../cgmath/struct.Rad.html" title="struct cgmath::Rad">Rad</a><S></code><a class='srclink' href='../src/cgmath/angle.rs.html#110' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
|
|
src="../implementors/cgmath/trait.Angle.js">
|
|
|
</script></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 = "cgmath";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |