26 lines
No EOL
14 KiB
HTML
26 lines
No EOL
14 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 collection of strongly typed math tools for computer graphics with an inclination towards 2d graphics and layout."><title>cosmic::widget::canvas::path::lyon_path::geom::euclid - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.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-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../" data-static-root-path="../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../../../../../../../crates.js"></script><script defer src="../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>widget::<wbr>canvas::<wbr>path::<wbr>lyon_<wbr>path::<wbr>geom</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../index.html">widget</a>::<wbr><a href="../../../../index.html">canvas</a>::<wbr><a href="../../../index.html">path</a>::<wbr><a href="../../index.html">lyon_path</a>::<wbr><a href="../index.html">geom</a></div><h1>Crate <span>euclid</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A collection of strongly typed math tools for computer graphics with an inclination
|
||
towards 2d graphics and layout.</p>
|
||
<p>All types are generic over the scalar type of their component (<code>f32</code>, <code>i32</code>, etc.),
|
||
and tagged with a generic Unit parameter which is useful to prevent mixing
|
||
values from different spaces. For example it should not be legal to translate
|
||
a screen-space position by a world-space vector and this can be expressed using
|
||
the generic Unit parameter.</p>
|
||
<p>This unit system is not mandatory and all structures have an alias
|
||
with the default unit: <code>UnknownUnit</code>.
|
||
for example <code>default::Point2D<T></code> is equivalent to <code>Point2D<T, UnknownUnit></code>.
|
||
Client code typically creates a set of aliases for each type and doesn’t need
|
||
to deal with the specifics of typed units further. For example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>euclid::<span class="kw-2">*</span>;
|
||
<span class="kw">pub struct </span>ScreenSpace;
|
||
<span class="kw">pub type </span>ScreenPoint = Point2D<f32, ScreenSpace>;
|
||
<span class="kw">pub type </span>ScreenSize = Size2D<f32, ScreenSpace>;
|
||
<span class="kw">pub struct </span>WorldSpace;
|
||
<span class="kw">pub type </span>WorldPoint = Point3D<f32, WorldSpace>;
|
||
<span class="kw">pub type </span>ProjectionMatrix = Transform3D<f32, WorldSpace, ScreenSpace>;
|
||
<span class="comment">// etc...</span></code></pre></div>
|
||
<p>All euclid types are marked <code>#[repr(C)]</code> in order to facilitate exposing them to
|
||
foreign function interfaces (provided the underlying scalar type is also <code>repr(C)</code>).</p>
|
||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="approxeq/index.html" title="mod cosmic::widget::canvas::path::lyon_path::geom::euclid::approxeq">approxeq</a></dt><dt><a class="mod" href="approxord/index.html" title="mod cosmic::widget::canvas::path::lyon_path::geom::euclid::approxord">approxord</a></dt><dd>Utilities for testing approximate ordering - especially true for
|
||
floating point types, where NaN’s cannot be ordered.</dd><dt><a class="mod" href="default/index.html" title="mod cosmic::widget::canvas::path::lyon_path::geom::euclid::default">default</a></dt><dd>A set of aliases for all types, tagged with the default unknown unit.</dd><dt><a class="mod" href="num/index.html" title="mod cosmic::widget::canvas::path::lyon_path::geom::euclid::num">num</a></dt><dd>A one-dimensional length, tagged with its units.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Angle.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Angle">Angle</a></dt><dd>An angle in radians</dd><dt><a class="struct" href="struct.BoolVector2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::BoolVector2D">Bool<wbr>Vector2D</a></dt><dd>A 2d vector of booleans, useful for component-wise logic operations.</dd><dt><a class="struct" href="struct.BoolVector3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::BoolVector3D">Bool<wbr>Vector3D</a></dt><dd>A 3d vector of booleans, useful for component-wise logic operations.</dd><dt><a class="struct" href="struct.Box2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Box2D">Box2D</a></dt><dd>A 2d axis aligned rectangle represented by its minimum and maximum coordinates.</dd><dt><a class="struct" href="struct.Box3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Box3D">Box3D</a></dt><dd>An axis aligned 3D box represented by its minimum and maximum coordinates.</dd><dt><a class="struct" href="struct.HomogeneousVector.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::HomogeneousVector">Homogeneous<wbr>Vector</a></dt><dd>Homogeneous vector in 3D space.</dd><dt><a class="struct" href="struct.Length.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Length">Length</a></dt><dd>A one-dimensional distance, with value represented by <code>T</code> and unit of measurement <code>Unit</code>.</dd><dt><a class="struct" href="struct.Point2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Point2D">Point2D</a></dt><dd>A 2d Point tagged with a unit.</dd><dt><a class="struct" href="struct.Point3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Point3D">Point3D</a></dt><dd>A 3d Point tagged with a unit.</dd><dt><a class="struct" href="struct.Rect.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Rect">Rect</a></dt><dd>A 2d Rectangle optionally tagged with a unit.</dd><dt><a class="struct" href="struct.RigidTransform3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::RigidTransform3D">Rigid<wbr>Transform3D</a></dt><dd>A rigid transformation. All lengths are preserved under such a transformation.</dd><dt><a class="struct" href="struct.Rotation2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Rotation2D">Rotation2D</a></dt><dd>A transform that can represent rotations in 2d, represented as an angle in radians.</dd><dt><a class="struct" href="struct.Rotation3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Rotation3D">Rotation3D</a></dt><dd>A transform that can represent rotations in 3d, represented as a quaternion.</dd><dt><a class="struct" href="struct.Scale.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Scale">Scale</a></dt><dd>A scaling factor between two different units of measurement.</dd><dt><a class="struct" href="struct.ScaleOffset2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::ScaleOffset2D">Scale<wbr>Offset2D</a></dt><dt><a class="struct" href="struct.SideOffsets2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::SideOffsets2D">Side<wbr>Offsets2D</a></dt><dd>A group of 2D side offsets, which correspond to top/right/bottom/left for borders, padding,
|
||
and margins in CSS, optionally tagged with a unit.</dd><dt><a class="struct" href="struct.Size2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Size2D">Size2D</a></dt><dd>A 2d size tagged with a unit.</dd><dt><a class="struct" href="struct.Size3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Size3D">Size3D</a></dt><dd>A 3d size tagged with a unit.</dd><dt><a class="struct" href="struct.Transform2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Transform2D">Transform2D</a></dt><dd>A 2d transform represented by a column-major 3 by 3 matrix, compressed down to 3 by 2.</dd><dt><a class="struct" href="struct.Transform3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Transform3D">Transform3D</a></dt><dd>A 3d transform stored as a column-major 4 by 4 matrix.</dd><dt><a class="struct" href="struct.Translation2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Translation2D">Translation2D</a></dt><dd>A 2d transformation from a space to another that can only express translations.</dd><dt><a class="struct" href="struct.Translation3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Translation3D">Translation3D</a></dt><dd>A 3d transformation from a space to another that can only express translations.</dd><dt><a class="struct" href="struct.UnknownUnit.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::UnknownUnit">Unknown<wbr>Unit</a></dt><dd>The default unit.</dd><dt><a class="struct" href="struct.Vector2D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Vector2D">Vector2D</a></dt><dd>A 2d Vector tagged with a unit.</dd><dt><a class="struct" href="struct.Vector3D.html" title="struct cosmic::widget::canvas::path::lyon_path::geom::euclid::Vector3D">Vector3D</a></dt><dd>A 3d Vector tagged with a unit.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Trig.html" title="trait cosmic::widget::canvas::path::lyon_path::geom::euclid::Trig">Trig</a></dt><dd>Trait for basic trigonometry functions, so they can be used on generic numeric types</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.box3d.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::box3d">box3d</a></dt><dd>Shorthand for <code>Box3D::new(Point3D::new(x1, y1, z1), Point3D::new(x2, y2, z2))</code>.</dd><dt><a class="fn" href="fn.bvec2.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::bvec2">bvec2</a></dt><dd>Shorthand for <code>BoolVector2D { x, y }</code>.</dd><dt><a class="fn" href="fn.bvec3.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::bvec3">bvec3</a></dt><dd>Shorthand for <code>BoolVector3D { x, y, z }</code>.</dd><dt><a class="fn" href="fn.point2.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::point2">point2</a></dt><dd>Shorthand for <code>Point2D::new(x, y)</code>.</dd><dt><a class="fn" href="fn.point3.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::point3">point3</a></dt><dd>Shorthand for <code>Point3D::new(x, y)</code>.</dd><dt><a class="fn" href="fn.rect.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::rect">rect</a></dt><dd>Shorthand for <code>Rect::new(Point2D::new(x, y), Size2D::new(w, h))</code>.</dd><dt><a class="fn" href="fn.size2.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::size2">size2</a></dt><dd>Shorthand for <code>Size2D::new(w, h)</code>.</dd><dt><a class="fn" href="fn.size3.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::size3">size3</a></dt><dd>Shorthand for <code>Size3D::new(w, h, d)</code>.</dd><dt><a class="fn" href="fn.vec2.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::vec2">vec2</a></dt><dd>Convenience constructor.</dd><dt><a class="fn" href="fn.vec3.html" title="fn cosmic::widget::canvas::path::lyon_path::geom::euclid::vec3">vec3</a></dt><dd>Convenience constructor.</dd></dl></section></div></main></body></html> |