multibody_dynamics 0.2.2

Multibody dynamics algorithms in Rust
Documentation
<!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="nalgebra"><meta name="keywords" content="rust, rustlang, rust-lang, nalgebra"><title>nalgebra - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-6827029ac823cab7.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-8af5e100b21cd173.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-c55e1eb52e1886b4.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https://nalgebra.org/img/favicon.ico"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../nalgebra/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../nalgebra/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate nalgebra</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.32.1</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">nalgebra</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/nalgebra/lib.rs.html#1-548">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="nalgebra"><a href="#nalgebra">nalgebra</a></h2>
<p><strong>nalgebra</strong> is a linear algebra library written for Rust targeting:</p>
<ul>
<li>General-purpose linear algebra (still lacks a lot of features…)</li>
<li>Real-time computer graphics.</li>
<li>Real-time computer physics.</li>
</ul>
<h3 id="using-nalgebra"><a href="#using-nalgebra">Using <strong>nalgebra</strong></a></h3>
<p>You will need the last stable build of the <a href="https://www.rust-lang.org">rust compiler</a>
and the official package manager: <a href="https://github.com/rust-lang/cargo">cargo</a>.</p>
<p>Simply add the following to your <code>Cargo.toml</code> file:</p>

<div class="example-wrap ignore"><div class='tooltip'>ⓘ</div><pre class="rust rust-example-rendered"><code>[dependencies]
<span class="comment">// TODO: replace the * by the latest version.
</span>nalgebra = <span class="string">&quot;*&quot;</span></code></pre></div>
<p>Most useful functionalities of <strong>nalgebra</strong> are grouped in the root module <code>nalgebra::</code>.</p>
<p>However, the recommended way to use <strong>nalgebra</strong> is to import types and traits
explicitly, and call free-functions using the <code>na::</code> prefix:</p>

<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[macro_use]
</span><span class="kw">extern crate </span>approx; <span class="comment">// For the macro relative_eq!
</span><span class="kw">extern crate </span>nalgebra <span class="kw">as </span>na;
<span class="kw">use </span>na::{Vector3, Rotation3};

<span class="kw">fn </span>main() {
    <span class="kw">let </span>axis  = Vector3::x_axis();
    <span class="kw">let </span>angle = <span class="number">1.57</span>;
    <span class="kw">let </span>b     = Rotation3::from_axis_angle(<span class="kw-2">&amp;</span>axis, angle);

    <span class="macro">relative_eq!</span>(b.axis().unwrap(), axis);
    <span class="macro">relative_eq!</span>(b.angle(), angle);
}</code></pre></div>
<h3 id="features"><a href="#features">Features</a></h3>
<p><strong>nalgebra</strong> is meant to be a general-purpose, low-dimensional, linear algebra library, with
an optimized set of tools for computer graphics and physics. Those features include:</p>
<ul>
<li>A single parametrizable type <a href="base/struct.Matrix.html"><code>Matrix</code></a> for vectors, (square or rectangular) matrices, and
slices with dimensions known either at compile-time (using type-level integers) or at runtime.</li>
<li>Matrices and vectors with compile-time sizes are statically allocated while dynamic ones are
allocated on the heap.</li>
<li>Convenient aliases for low-dimensional matrices and vectors: <a href="base/type.Vector1.html"><code>Vector1</code></a> to
<a href="base/type.Vector6.html"><code>Vector6</code></a> and <a href="base/type.Matrix1.html"><code>Matrix1x1</code></a> to <a href="base/type.Matrix6.html"><code>Matrix6x6</code></a>, including rectangular
matrices like <a href="base/type.Matrix2x5.html"><code>Matrix2x5</code></a>.</li>
<li>Points sizes known at compile time, and convenience aliases: <a href="geometry/type.Point1.html"><code>Point1</code></a> to
<a href="geometry/type.Point6.html"><code>Point6</code></a>.</li>
<li>Translation (seen as a transformation that composes by multiplication):
<a href="geometry/type.Translation2.html"><code>Translation2</code></a>, <a href="geometry/type.Translation3.html"><code>Translation3</code></a>.</li>
<li>Rotation matrices: <a href="geometry/type.Rotation2.html"><code>Rotation2</code></a>, <a href="geometry/type.Rotation3.html"><code>Rotation3</code></a>.</li>
<li>Quaternions: <a href="geometry/struct.Quaternion.html"><code>Quaternion</code></a>, <a href="geometry/type.UnitQuaternion.html"><code>UnitQuaternion</code></a> (for 3D rotation).</li>
<li>Unit complex numbers can be used for 2D rotation: <a href="geometry/type.UnitComplex.html"><code>UnitComplex</code></a>.</li>
<li>Algebraic entities with a norm equal to one: <a href="base/struct.Unit.html"><code>Unit&lt;T&gt;</code></a>, e.g., <code>Unit&lt;Vector3&lt;f32&gt;&gt;</code>.</li>
<li>Isometries (translation ⨯ rotation): <a href="geometry/type.Isometry2.html"><code>Isometry2</code></a>, <a href="geometry/type.Isometry3.html"><code>Isometry3</code></a></li>
<li>Similarity transformations (translation ⨯ rotation ⨯ uniform scale):
<a href="geometry/type.Similarity2.html"><code>Similarity2</code></a>, <a href="geometry/type.Similarity3.html"><code>Similarity3</code></a>.</li>
<li>Affine transformations stored as a homogeneous matrix:
<a href="geometry/type.Affine2.html"><code>Affine2</code></a>, <a href="geometry/type.Affine3.html"><code>Affine3</code></a>.</li>
<li>Projective (i.e. invertible) transformations stored as a homogeneous matrix:
<a href="geometry/type.Projective2.html"><code>Projective2</code></a>, <a href="geometry/type.Projective3.html"><code>Projective3</code></a>.</li>
<li>General transformations that does not have to be invertible, stored as a homogeneous matrix:
<a href="geometry/type.Transform2.html"><code>Transform2</code></a>, <a href="geometry/type.Transform3.html"><code>Transform3</code></a>.</li>
<li>3D projections for computer graphics: <a href="geometry/struct.Perspective3.html"><code>Perspective3</code></a>,
<a href="geometry/struct.Orthographic3.html"><code>Orthographic3</code></a>.</li>
<li>Matrix factorizations: <a href="linalg/struct.Cholesky.html"><code>Cholesky</code></a>, <a href="linalg/struct.QR.html"><code>QR</code></a>, <a href="linalg/struct.LU.html"><code>LU</code></a>, <a href="linalg/struct.FullPivLU.html"><code>FullPivLU</code></a>,
<a href="linalg/struct.SVD.html"><code>SVD</code></a>, <a href="linalg/struct.Schur.html"><code>Schur</code></a>, <a href="linalg/struct.Hessenberg.html"><code>Hessenberg</code></a>, <a href="linalg/struct.SymmetricEigen.html"><code>SymmetricEigen</code></a>.</li>
<li>Insertion and removal of rows of columns of a matrix.</li>
</ul>
</div></details><h2 id="reexports" class="small-section-header"><a href="#reexports">Re-exports</a></h2><div class="item-table"><div class="item-row"><div class="item-left import-item"><code>pub use crate::<a class="mod" href="base/index.html" title="mod nalgebra::base">base</a>::*;</code></div></div><div class="item-row"><div class="item-left import-item"><code>pub use crate::<a class="mod" href="geometry/index.html" title="mod nalgebra::geometry">geometry</a>::*;</code></div></div><div class="item-row"><div class="item-left import-item"><code>pub use crate::<a class="mod" href="linalg/index.html" title="mod nalgebra::linalg">linalg</a>::*;</code></div></div></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="base/index.html" title="nalgebra::base mod">base</a></div><div class="item-right docblock-short">[Reexported at the root of this crate.] Data structures for vector and matrix computations.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="geometry/index.html" title="nalgebra::geometry mod">geometry</a></div><div class="item-right docblock-short">[Reexported at the root of this crate.] Data structures for points and usual transformations
(rotations, isometries, etc.)</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="linalg/index.html" title="nalgebra::linalg mod">linalg</a></div><div class="item-right docblock-short">[Reexported at the root of this crate.] Factorization of real matrices.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Complex.html" title="nalgebra::Complex struct">Complex</a></div><div class="item-right docblock-short">A complex number in Cartesian form.</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ClosedAdd.html" title="nalgebra::ClosedAdd trait">ClosedAdd</a></div><div class="item-right docblock-short">Trait <strong>alias</strong> for <code>Add</code> and <code>AddAssign</code> with result of type <code>Self</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ClosedDiv.html" title="nalgebra::ClosedDiv trait">ClosedDiv</a></div><div class="item-right docblock-short">Trait <strong>alias</strong> for <code>Div</code> and <code>DivAssign</code> with result of type <code>Self</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ClosedMul.html" title="nalgebra::ClosedMul trait">ClosedMul</a></div><div class="item-right docblock-short">Trait <strong>alias</strong> for <code>Mul</code> and <code>MulAssign</code> with result of type <code>Self</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ClosedSub.html" title="nalgebra::ClosedSub trait">ClosedSub</a></div><div class="item-right docblock-short">Trait <strong>alias</strong> for <code>Sub</code> and <code>SubAssign</code> with result of type <code>Self</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ComplexField.html" title="nalgebra::ComplexField trait">ComplexField</a></div><div class="item-right docblock-short">Trait shared by all complex fields and its subfields (like real numbers).</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Field.html" title="nalgebra::Field trait">Field</a></div><div class="item-right docblock-short">Trait implemented by fields, i.e., complex numbers and floats.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.RealField.html" title="nalgebra::RealField trait">RealField</a></div><div class="item-right docblock-short">Trait shared by all reals.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimdBool.html" title="nalgebra::SimdBool trait">SimdBool</a></div><div class="item-right docblock-short">Lane-wise generalization of <code>bool</code> for SIMD booleans.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimdComplexField.html" title="nalgebra::SimdComplexField trait">SimdComplexField</a></div><div class="item-right docblock-short">Lane-wise generalisation of <code>ComplexField</code> for SIMD complex fields.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimdPartialOrd.html" title="nalgebra::SimdPartialOrd trait">SimdPartialOrd</a></div><div class="item-right docblock-short">Lane-wise generalization of the standard <code>PartialOrd</code> for SIMD values.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimdRealField.html" title="nalgebra::SimdRealField trait">SimdRealField</a></div><div class="item-right docblock-short">Lanewise generalization of <code>RealField</code> for SIMD reals.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimdValue.html" title="nalgebra::SimdValue trait">SimdValue</a></div><div class="item-right docblock-short">Base trait for every SIMD types.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.abs.html" title="nalgebra::abs fn">abs</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">The absolute value of <code>a</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.center.html" title="nalgebra::center fn">center</a></div><div class="item-right docblock-short">The center of two points.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.clamp.html" title="nalgebra::clamp fn">clamp</a></div><div class="item-right docblock-short">Returns a reference to the input value clamped to the interval <code>[min, max]</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.convert.html" title="nalgebra::convert fn">convert</a></div><div class="item-right docblock-short">Converts an object from one type to an equivalent or more general one.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.convert_ref.html" title="nalgebra::convert_ref fn">convert_ref</a></div><div class="item-right docblock-short">Converts an object from one type to an equivalent or more general one.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.convert_ref_unchecked.html" title="nalgebra::convert_ref_unchecked fn">convert_ref_unchecked</a></div><div class="item-right docblock-short">Use with care! Same as <a href="fn.try_convert.html"><code>try_convert</code></a> but
without any property checks.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.convert_unchecked.html" title="nalgebra::convert_unchecked fn">convert_unchecked</a></div><div class="item-right docblock-short">Use with care! Same as <a href="fn.try_convert.html"><code>try_convert</code></a> but
without any property checks.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.distance.html" title="nalgebra::distance fn">distance</a></div><div class="item-right docblock-short">The distance between two points.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.distance_squared.html" title="nalgebra::distance_squared fn">distance_squared</a></div><div class="item-right docblock-short">The squared distance between two points.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.inf.html" title="nalgebra::inf fn">inf</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">Returns the infimum of <code>a</code> and <code>b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.inf_sup.html" title="nalgebra::inf_sup fn">inf_sup</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">Returns simultaneously the infimum and supremum of <code>a</code> and <code>b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.is_convertible.html" title="nalgebra::is_convertible fn">is_convertible</a></div><div class="item-right docblock-short">Indicates if <a href="fn.try_convert.html"><code>try_convert</code></a> will succeed without
actually performing the conversion.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.max.html" title="nalgebra::max fn">max</a></div><div class="item-right docblock-short">Same as <code>cmp::max</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.min.html" title="nalgebra::min fn">min</a></div><div class="item-right docblock-short">Same as <code>cmp::min</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.one.html" title="nalgebra::one fn">one</a></div><div class="item-right docblock-short">Gets the multiplicative identity element.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_clamp.html" title="nalgebra::partial_clamp fn">partial_clamp</a></div><div class="item-right docblock-short">Clamp <code>value</code> between <code>min</code> and <code>max</code>. Returns <code>None</code> if <code>value</code> is not comparable to
<code>min</code> or <code>max</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_cmp.html" title="nalgebra::partial_cmp fn">partial_cmp</a></div><div class="item-right docblock-short">Compare <code>a</code> and <code>b</code> using a partial ordering relation.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_ge.html" title="nalgebra::partial_ge fn">partial_ge</a></div><div class="item-right docblock-short">Returns <code>true</code> iff <code>a</code> and <code>b</code> are comparable and <code>a &gt;= b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_gt.html" title="nalgebra::partial_gt fn">partial_gt</a></div><div class="item-right docblock-short">Returns <code>true</code> iff <code>a</code> and <code>b</code> are comparable and <code>a &gt; b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_le.html" title="nalgebra::partial_le fn">partial_le</a></div><div class="item-right docblock-short">Returns <code>true</code> iff <code>a</code> and <code>b</code> are comparable and <code>a &lt;= b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_lt.html" title="nalgebra::partial_lt fn">partial_lt</a></div><div class="item-right docblock-short">Returns <code>true</code> iff <code>a</code> and <code>b</code> are comparable and <code>a &lt; b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_max.html" title="nalgebra::partial_max fn">partial_max</a></div><div class="item-right docblock-short">Return the maximum of <code>a</code> and <code>b</code> if they are comparable.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_min.html" title="nalgebra::partial_min fn">partial_min</a></div><div class="item-right docblock-short">Return the minimum of <code>a</code> and <code>b</code> if they are comparable.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.partial_sort2.html" title="nalgebra::partial_sort2 fn">partial_sort2</a></div><div class="item-right docblock-short">Sorts two values in increasing order using a partial ordering.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.sup.html" title="nalgebra::sup fn">sup</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short">Returns the supremum of <code>a</code> and <code>b</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.try_convert.html" title="nalgebra::try_convert fn">try_convert</a></div><div class="item-right docblock-short">Attempts to convert an object to a more specific one.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.try_convert_ref.html" title="nalgebra::try_convert_ref fn">try_convert_ref</a></div><div class="item-right docblock-short">Attempts to convert an object to a more specific one.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.wrap.html" title="nalgebra::wrap fn">wrap</a></div><div class="item-right docblock-short">Wraps <code>val</code> into the range <code>[min, max]</code> using modular arithmetics.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.zero.html" title="nalgebra::zero fn">zero</a></div><div class="item-right docblock-short">Gets the additive identity element.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="nalgebra" data-themes="" data-resource-suffix="" data-rustdoc-version="1.67.1 (d5a82bbd2 2023-02-07)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>