| 1 | // pathfinder/geometry/src/basic/transform3d.rs |
| 2 | // |
| 3 | // Copyright © 2019 The Pathfinder Project Developers. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | // option. This file may not be copied, modified, or distributed |
| 9 | // except according to those terms. |
| 10 | |
| 11 | //! 3D transforms that can be applied to paths. |
| 12 | |
| 13 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::rectrust-analyzer cargo pathfinder_geometry 0.5.1 rect/::RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 14 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::transform2drust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/::Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#; |
| 15 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::vectorrust-analyzer cargo pathfinder_geometry 0.5.1 vector/::{Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#, Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#, Vector3Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector3F#, Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#}; |
| 16 | use pathfinder_simdrust-analyzer cargo pathfinder_simd 0.5.6 crate/::defaultrust-analyzer cargo pathfinder_simd 0.5.6 x86/::F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#; |
| 17 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#}; |
| 18 | |
| 19 | /// An transform, optimized with SIMD. |
| 20 | /// |
| 21 | /// In column-major order. |
| 22 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 23 | #[repr(C)] |
| 24 | pub struct Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 25 | pub c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#, |
| 26 | pub c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#, |
| 27 | pub c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#, |
| 28 | pub c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#, |
| 29 | } |
| 30 | |
| 31 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 32 | #[inline] |
| 33 | fn defaultrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][Default]default().() -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 34 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 35 | c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(1.0, 0.0, 0.0, 0.0), |
| 36 | c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, 1.0, 0.0, 0.0), |
| 37 | c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, 0.0, 1.0, 0.0), |
| 38 | c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, 0.0, 0.0, 1.0), |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 44 | #[inline] |
| 45 | pub fn row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 46 | m00: f32, |
| 47 | m01: f32, |
| 48 | m02: f32, |
| 49 | m03: f32, |
| 50 | m10: f32, |
| 51 | m11: f32, |
| 52 | m12: f32, |
| 53 | m13: f32, |
| 54 | m20: f32, |
| 55 | m21: f32, |
| 56 | m22: f32, |
| 57 | m23: f32, |
| 58 | m30: f32, |
| 59 | m31: f32, |
| 60 | m32: f32, |
| 61 | m33: f32, |
| 62 | ) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 63 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 64 | c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(m00, m10, m20, m30), |
| 65 | c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(m01, m11, m21, m31), |
| 66 | c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(m02, m12, m22, m32), |
| 67 | c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(m03, m13, m23, m33), |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | #[inline] |
| 72 | pub fn from_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_scale().(scale: Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 73 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 74 | c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(scale.xrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]x().(), 0.0, 0.0, 0.0), |
| 75 | c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, scale.yrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]y().(), 0.0, 0.0), |
| 76 | c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, 0.0, scale.zrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]z().(), 0.0), |
| 77 | c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::newrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]new().(0.0, 0.0, 0.0, 1.0), |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | #[inline] |
| 82 | pub fn from_uniform_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_uniform_scale().(factor: f32) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 83 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_scale().(Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#::splatrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]splat().(factor)) |
| 84 | } |
| 85 | |
| 86 | #[inline] |
| 87 | pub fn from_translationrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_translation().(mut translation: Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 88 | translation.set_wrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]set_w().(1.0); |
| 89 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: translation.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#0., ..Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::defaultrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][Default]default().() } |
| 90 | } |
| 91 | |
| 92 | // TODO(pcwalton): Optimize. |
| 93 | pub fn from_rotationrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_rotation().(yaw: f32, pitch: f32, roll: f32) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 94 | let (cos_b, sin_b) = (yaw.cosrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]cos().(), yaw.sinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]sin().()); |
| 95 | let (cos_c, sin_c) = (pitch.cosrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]cos().(), pitch.sinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]sin().()); |
| 96 | let (cos_a, sin_a) = (roll.cosrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]cos().(), roll.sinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]sin().()); |
| 97 | let m00 = cos_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_b; |
| 98 | let m01 = cos_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().sin_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_c; |
| 99 | let m02 = cos_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().sin_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_c; |
| 100 | let m10 = sin_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_b; |
| 101 | let m11 = sin_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().cos_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_c; |
| 102 | let m12 = sin_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().cos_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_c; |
| 103 | let m20 = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().sin_b; |
| 104 | let m21 = cos_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().sin_c; |
| 105 | let m22 = cos_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().cos_c; |
| 106 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 107 | m00, m01, m02, 0.0, m10, m11, m12, 0.0, m20, m21, m22, 0.0, 0.0, 0.0, 0.0, 1.0, |
| 108 | ) |
| 109 | } |
| 110 | |
| 111 | /// Creates a rotation matrix from the given quaternion. |
| 112 | /// |
| 113 | /// The quaternion is expected to be packed into a SIMD type (x, y, z, w) corresponding to |
| 114 | /// x + yi + zj + wk. |
| 115 | pub fn from_rotation_quaternionrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_rotation_quaternion().(q: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 116 | // TODO(pcwalton): Optimize better with more shuffles. |
| 117 | let (mut sq, mut w, mut xy_xz_yz) = (q rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().q, q.wwwwrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]wwww().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().q, q.xxyyrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]xxyy().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().q.yzzyrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]yzzy().()); |
| 118 | sq rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign(). rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().sq; |
| 119 | w rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign(). rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().w; |
| 120 | xy_xz_yz rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign(). rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][`AddAssign<Self>`]add_assign().xy_xz_yz; |
| 121 | let diag = F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(1.0) rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Sub<Self>`]sub().(sq.yxxyrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]yxxy().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().sq.zzyyrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]zzyy().()); |
| 122 | let (wx2, wy2, wz2) = (w.xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]x().(), w.yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]y().(), w.zrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]z().()); |
| 123 | let (xy2, xz2, yz2) = (xy_xz_yz.xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]x().(), xy_xz_yz.yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]y().(), xy_xz_yz.zrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]z().()); |
| 124 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 125 | diag.xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]x().(), |
| 126 | xy2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().wz2, |
| 127 | xz2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().wy2, |
| 128 | 0.0, |
| 129 | xy2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().wz2, |
| 130 | diag.yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]y().(), |
| 131 | yz2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().wx2, |
| 132 | 0.0, |
| 133 | xz2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().wy2, |
| 134 | yz2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().wx2, |
| 135 | diag.zrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]z().(), |
| 136 | 0.0, |
| 137 | 0.0, |
| 138 | 0.0, |
| 139 | 0.0, |
| 140 | 1.0, |
| 141 | ) |
| 142 | } |
| 143 | |
| 144 | /// Just like `glOrtho()`. |
| 145 | #[inline] |
| 146 | pub fn from_orthorust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_ortho().( |
| 147 | left: f32, |
| 148 | right: f32, |
| 149 | bottom: f32, |
| 150 | top: f32, |
| 151 | near_val: f32, |
| 152 | far_val: f32, |
| 153 | ) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 154 | let x_inv = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(right rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().left); |
| 155 | let y_inv = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().bottom); |
| 156 | let z_inv = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(far_val rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().near_val); |
| 157 | let tx = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().(right rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().left) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().x_inv; |
| 158 | let ty = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().(top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().bottom) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().y_inv; |
| 159 | let tz = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().(far_val rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().near_val) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_inv; |
| 160 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 161 | 2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().x_inv, |
| 162 | 0.0, |
| 163 | 0.0, |
| 164 | tx, |
| 165 | 0.0, |
| 166 | 2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().y_inv, |
| 167 | 0.0, |
| 168 | ty, |
| 169 | 0.0, |
| 170 | 0.0, |
| 171 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_inv, |
| 172 | tz, |
| 173 | 0.0, |
| 174 | 0.0, |
| 175 | 0.0, |
| 176 | 1.0, |
| 177 | ) |
| 178 | } |
| 179 | |
| 180 | /// Linearly interpolate between transforms |
| 181 | pub fn lerprust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]lerp().(&self, weight: f32, other: &Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 182 | let c0 = self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(weight) rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().other.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().weight); |
| 183 | let c1 = self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(weight) rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().other.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().weight); |
| 184 | let c2 = self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(weight) rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().other.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().weight); |
| 185 | let c3 = self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(weight) rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().other.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().weight); |
| 186 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0., c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1., c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2., c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3. } |
| 187 | } |
| 188 | |
| 189 | /// Just like `gluPerspective()`. |
| 190 | #[inline] |
| 191 | pub fn from_perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_perspective().(fov_y: f32, aspect: f32, z_near: f32, z_far: f32) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 192 | let f = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(fov_y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().0.5).tanrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f32/impl#[f32]tan().(); |
| 193 | let z_denom = 1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(z_near rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().z_far); |
| 194 | let m00 = f rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().aspect; |
| 195 | let m11 = f; |
| 196 | let m22 = (z_far rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Add<Self>`]add().z_near) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_denom; |
| 197 | let m23 = 2.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_far rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_near rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Mul<Self>`]mul().z_denom; |
| 198 | let m32 = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0; |
| 199 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 200 | m00, 0.0, 0.0, 0.0, 0.0, m11, 0.0, 0.0, 0.0, 0.0, m22, m23, 0.0, 0.0, m32, 0.0, |
| 201 | ) |
| 202 | } |
| 203 | |
| 204 | /// Just like `gluLookAt()`. |
| 205 | #[inline] |
| 206 | pub fn looking_atrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]looking_at().(eye: Vector3Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector3F#, center: Vector3Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector3F#, mut up: Vector3Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector3F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 207 | let f = (center rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F][`Sub<Self>`]sub().eye).normalizerust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]normalize().(); |
| 208 | up = up.normalizerust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]normalize().(); |
| 209 | let s = f.crossrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]cross().(up); |
| 210 | let u = s.normalizerust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]normalize().().crossrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]cross().(f); |
| 211 | let minus_f = -rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F][Neg]neg().f; |
| 212 | |
| 213 | // TODO(pcwalton): Use SIMD. This needs a matrix transpose: |
| 214 | // https://fgiesen.wordpress.com/2013/07/09/simd-transposes-1/ |
| 215 | let transform = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().(s.xrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]x().(), s.yrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]y().(), s.zrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]z().(), 0.0, |
| 216 | u.xrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]x().(), u.yrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]y().(), u.zrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]z().(), 0.0, |
| 217 | minus_f.xrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]x().(), minus_f.yrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]y().(), minus_f.zrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]z().(), 0.0, |
| 218 | 0.0, 0.0, 0.0, 1.0) rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). |
| 219 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_translationrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_translation().((-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F][Neg]neg().eye).to_4drust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector3F]to_4d().()); |
| 220 | transform |
| 221 | } |
| 222 | |
| 223 | // +- -+ |
| 224 | // | A B | |
| 225 | // | C D | |
| 226 | // +- -+ |
| 227 | #[inline] |
| 228 | pub fn from_submatricesrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_submatrices().( |
| 229 | a: Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#, |
| 230 | b: Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#, |
| 231 | c: Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#, |
| 232 | d: Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#, |
| 233 | ) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 234 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 235 | c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: a.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(c.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.), |
| 236 | c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: a.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_zw_zw().(c.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.), |
| 237 | c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: b.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(d.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.), |
| 238 | c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: b.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_zw_zw().(d.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.), |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | #[inline] |
| 243 | pub fn rotaterust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]rotate().(&self, yaw: f32, pitch: f32, roll: f32) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 244 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_rotationrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_rotation().(yaw, pitch, roll) rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self |
| 245 | } |
| 246 | |
| 247 | #[inline] |
| 248 | pub fn scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]scale().(&self, scale: Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 249 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_scale().(scale) rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self |
| 250 | } |
| 251 | |
| 252 | #[inline] |
| 253 | pub fn uniform_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]uniform_scale().(&self, scale: f32) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 254 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_uniform_scalerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_uniform_scale().(scale) rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self |
| 255 | } |
| 256 | |
| 257 | #[inline] |
| 258 | pub fn translaterust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]translate().(&self, translation: Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 259 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_translationrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_translation().(translation) rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self |
| 260 | } |
| 261 | |
| 262 | #[inline] |
| 263 | pub fn upper_leftrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]upper_left().(&self) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 264 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.)) |
| 265 | } |
| 266 | |
| 267 | #[inline] |
| 268 | pub fn upper_rightrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]upper_right().(&self) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 269 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.)) |
| 270 | } |
| 271 | |
| 272 | #[inline] |
| 273 | pub fn lower_leftrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]lower_left().(&self) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 274 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_zw_zw().(self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.)) |
| 275 | } |
| 276 | |
| 277 | #[inline] |
| 278 | pub fn lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]lower_right().(&self) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 279 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_zw_zw().(self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.)) |
| 280 | } |
| 281 | |
| 282 | // https://en.wikipedia.org/wiki/Invertible_matrix#Blockwise_inversion |
| 283 | // |
| 284 | // If A is the upper left submatrix of this matrix, this method assumes that A and the Schur |
| 285 | // complement of A are invertible. |
| 286 | pub fn inverserust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]inverse().(&self) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 287 | // Extract submatrices. |
| 288 | let (a, b) = (self.upper_leftrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]upper_left().(), self.upper_rightrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]upper_right().()); |
| 289 | let (c, d) = (self.lower_leftrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]lower_left().(), self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]lower_right().()); |
| 290 | |
| 291 | // Compute temporary matrices. |
| 292 | let a_inv = a.inverserust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F]inverse().(); |
| 293 | let x = c rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().a_inv; |
| 294 | let y = (d rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Sub<Self>`]sub().x rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().b).inverserust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F]inverse().(); |
| 295 | let z = a_inv rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().b; |
| 296 | |
| 297 | // Compute new submatrices. |
| 298 | let (a_new, b_new) = (a_inv rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][`Add<Self>`]add().z rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().y rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().x, -rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][Neg]neg().z rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().y); |
| 299 | let (c_new, d_new) = (-rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][Neg]neg().y rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/impl#[Matrix2x2F][`Mul<Self>`]mul().x, y); |
| 300 | |
| 301 | // Construct inverse. |
| 302 | Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::from_submatricesrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]from_submatrices().(a_new, b_new, c_new, d_new) |
| 303 | } |
| 304 | |
| 305 | pub fn approx_eqrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]approx_eq().(&self, other: &Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#, epsilon: f32) -> bool { |
| 306 | self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0..approx_eqrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]approx_eq().(other.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0., epsilon) |
| 307 | && self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1..approx_eqrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]approx_eq().(other.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1., epsilon) |
| 308 | && self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2..approx_eqrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]approx_eq().(other.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2., epsilon) |
| 309 | && self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3..approx_eqrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]approx_eq().(other.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3., epsilon) |
| 310 | } |
| 311 | |
| 312 | #[inline] |
| 313 | pub fn as_ptrrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]as_ptr().(&self) -> *const f32 { |
| 314 | (&self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.) as *const F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4# as *const f32 |
| 315 | } |
| 316 | |
| 317 | #[inline] |
| 318 | pub fn to_columnsrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]to_columns().(&self) -> [F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#; 4] { |
| 319 | [self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0., self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1., self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2., self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.] |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#> for Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 324 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]Output# = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#; |
| 325 | |
| 326 | // https://stackoverflow.com/a/18508113 |
| 327 | #[inline] |
| 328 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().(self, other: Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#) -> Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 329 | return Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 330 | c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.: mul_colrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/mul_col().(&self, other.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0.), |
| 331 | c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.: mul_colrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/mul_col().(&self, other.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1.), |
| 332 | c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.: mul_colrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/mul_col().(&self, other.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2.), |
| 333 | c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.: mul_colrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/mul_col().(&self, other.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3.), |
| 334 | }; |
| 335 | |
| 336 | #[inline] |
| 337 | fn mul_colrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/mul_col().(a: &Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#, b_col: F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#) -> F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4# { |
| 338 | a.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().b_col.xxxxrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]xxxx().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().a.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().b_col.yyyyrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]yyyy().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().a.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().b_col.zzzzrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]zzzz().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().a.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().b_col.wwwwrust-analyzer cargo pathfinder_simd 0.5.6 x86/swizzle_f32x4/impl#[F32x4]wwww().() |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#> for Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 344 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]Output# = Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#; |
| 345 | |
| 346 | #[inline] |
| 347 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().(self, vector: Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#) -> Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F# { |
| 348 | let term0 = self.c0rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(vector.xrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]x().()); |
| 349 | let term1 = self.c1rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c1. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(vector.yrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]y().()); |
| 350 | let term2 = self.c2rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c2. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(vector.zrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]z().()); |
| 351 | let term3 = self.c3rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#c3. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(vector.wrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]w().()); |
| 352 | Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#(term0 rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().term1 rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().term2 rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().term3) |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | impl MulAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/MulAssign#<Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#> for Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F# { |
| 357 | fn mul_assignrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`MulAssign<Self>`]mul_assign().(&mut self, other: Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#) { |
| 358 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().other |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | impl Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#> for Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 363 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][`Add<Self>`]Output# = Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#; |
| 364 | #[inline] |
| 365 | fn addrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][`Add<Self>`]add().(self, other: Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 366 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Add<Self>`]add().other.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.) |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | impl Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg# for Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 371 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][Neg]Output# = Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#; |
| 372 | #[inline] |
| 373 | fn negrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Matrix2x2F][Neg]neg().(self) -> Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F# { |
| 374 | Matrix2x2Frust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#(-rust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4][Neg]neg().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 transform2d/Matrix2x2F#0.) |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 379 | pub struct Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 380 | pub transformrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#transform.: Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#, |
| 381 | pub window_sizerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#window_size.: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#, |
| 382 | } |
| 383 | |
| 384 | impl Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 385 | #[inline] |
| 386 | pub fn newrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective]new().(transform: &Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#, window_size: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 387 | Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 388 | transformrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#transform.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().transform, |
| 389 | window_sizerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#window_size., |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#> for Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 395 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Transform4F>`]Output# = Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#; |
| 396 | #[inline] |
| 397 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Transform4F>`]mul().(self, other: Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#) -> Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 398 | Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 399 | transformrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#transform.: self.transformrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#transform. rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul().other, |
| 400 | window_sizerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#window_size.: self.window_sizerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#window_size., |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#> for Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 406 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]Output# = Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#; |
| 407 | #[inline] |
| 408 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().(self, vector: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 409 | let point = (self.transformrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#transform. rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().vector.to_4drust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]to_4d().()).to_2drust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]to_2d().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul().Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#::newrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]new().(1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0); |
| 410 | (point rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add().1.0) rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<Self>`]mul().self.window_sizerust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective#window_size..to_f32rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I]to_f32().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul().0.5 |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#> for Perspectiverust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Perspective# { |
| 415 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<RectF>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 416 | #[inline] |
| 417 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<RectF>`]mul().(self, rect: RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 418 | let (upper_left, upper_right) = (self rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().rect.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().(), self rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().rect.upper_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]upper_right().()); |
| 419 | let (lower_left, lower_right) = (self rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().rect.lower_leftrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_left().(), self rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Perspective][`Mul<Vector2F>`]mul().rect.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().()); |
| 420 | let min_point = upper_left.minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(upper_right).minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(lower_left).minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(lower_right); |
| 421 | let max_point = upper_left.maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(upper_right).maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(lower_left).maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(lower_right); |
| 422 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(min_point, max_point) |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | #[cfg(test)] |
| 427 | mod testrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/test/ { |
| 428 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::vectorrust-analyzer cargo pathfinder_geometry 0.5.1 vector/::Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#; |
| 429 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::transform3drust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/::Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#; |
| 430 | |
| 431 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 432 | fn test_post_mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/test/test_post_mul().() { |
| 433 | let a = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 434 | 3.0, 1.0, 4.0, 5.0, 9.0, 2.0, 6.0, 5.0, 3.0, 5.0, 8.0, 9.0, 7.0, 9.0, 3.0, 2.0, |
| 435 | ); |
| 436 | let b = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 437 | 3.0, 8.0, 4.0, 6.0, 2.0, 6.0, 4.0, 3.0, 3.0, 8.0, 3.0, 2.0, 7.0, 9.0, 5.0, 0.0, |
| 438 | ); |
| 439 | let c = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 440 | 58.0, 107.0, 53.0, 29.0, 84.0, 177.0, 87.0, 72.0, 106.0, 199.0, 101.0, 49.0, 62.0, |
| 441 | 152.0, 83.0, 75.0, |
| 442 | ); |
| 443 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a *rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). b, c); |
| 444 | } |
| 445 | |
| 446 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 447 | fn test_pre_mulrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/test/test_pre_mul().() { |
| 448 | let a = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 449 | 3.0, 1.0, 4.0, 5.0, 9.0, 2.0, 6.0, 5.0, 3.0, 5.0, 8.0, 9.0, 7.0, 9.0, 3.0, 2.0, |
| 450 | ); |
| 451 | let b = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 452 | 3.0, 8.0, 4.0, 6.0, 2.0, 6.0, 4.0, 3.0, 3.0, 8.0, 3.0, 2.0, 7.0, 9.0, 5.0, 0.0, |
| 453 | ); |
| 454 | let c = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 455 | 135.0, 93.0, 110.0, 103.0, 93.0, 61.0, 85.0, 82.0, 104.0, 52.0, 90.0, 86.0, 117.0, |
| 456 | 50.0, 122.0, 125.0, |
| 457 | ); |
| 458 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b *rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Self>`]mul(). a, c); |
| 459 | } |
| 460 | |
| 461 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 462 | fn test_transform_pointrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/test/test_transform_point().() { |
| 463 | let a = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 464 | 3.0, 1.0, 4.0, 5.0, 9.0, 2.0, 6.0, 5.0, 3.0, 5.0, 8.0, 9.0, 7.0, 9.0, 3.0, 2.0, |
| 465 | ); |
| 466 | let p = Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#::newrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]new().(3.0, 8.0, 4.0, 6.0); |
| 467 | let q = Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#::newrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]new().(63.0, 97.0, 135.0, 117.0); |
| 468 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a *rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul(). p, q); |
| 469 | } |
| 470 | |
| 471 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 472 | fn test_inverserust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/test/test_inverse().() { |
| 473 | // Random matrix. |
| 474 | let m = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 475 | 0.86277982, 0.15986552, 0.90739898, 0.60066808, 0.17386167, 0.016353, 0.8535783, |
| 476 | 0.12969608, 0.0946466, 0.43248631, 0.63480505, 0.08154603, 0.50305436, 0.48359687, |
| 477 | 0.51057162, 0.24812012, |
| 478 | ); |
| 479 | let p0 = Vector4Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector4F#::newrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]new().(0.95536648, 0.80633691, 0.16357357, 0.5477598); |
| 480 | let p1 = m rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().p0; |
| 481 | let m_inv = m.inverserust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]inverse().(); |
| 482 | let m_inv_exp = Transform4Frust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/Transform4F#::row_majorrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]row_major().( |
| 483 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().2.47290136, |
| 484 | 3.48865688, |
| 485 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().6.12298336, |
| 486 | 6.17536696, |
| 487 | 0.00124033357, |
| 488 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.72561993, |
| 489 | 2.16876606, |
| 490 | 0.186227748, |
| 491 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.375021729, |
| 492 | 1.53883017, |
| 493 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0558194403, |
| 494 | 0.121857058, |
| 495 | 5.78300323, |
| 496 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().6.87635769, |
| 497 | 8.30196620, |
| 498 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().9.10374060, |
| 499 | ); |
| 500 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(m_inv.approx_eqrust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F]approx_eq().(&m_inv_exp, 0.0001)); |
| 501 | let p2 = m_inv rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 transform3d/impl#[Transform4F][`Mul<Vector4F>`]mul().p1; |
| 502 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p0.approx_eqrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector4F]approx_eq().(p2, 0.0001)); |
| 503 | } |
| 504 | } |