diff --git a/Cargo.toml b/Cargo.toml index 751c606..b1c6fc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ nalgebra_f32x4 = ["nalgebra", "simba"] nalgebra_f32x8 = ["nalgebra", "simba"] nalgebra_wide = ["nalgebra_f32x4", "nalgebra_f32x8"] -scalar = ["cgmath", "nalgebra", "ultraviolet", "euclid", "vek", "pathfinder_geometry", "static-math"] +scalar = ["cgmath", "nalgebra", "ultraviolet", "euclid", "vek", "pathfinder_geometry"] # nalgebra_wide fails to build due to packed_simd errors # wide = ["glam_f32x1", "ultraviolet_wide", "nalgebra_wide"] @@ -69,9 +69,6 @@ optional = true version = "0.5.1" optional = true -[dependencies.static-math] -version = "0.2.3" -optional = true [dependencies.ultraviolet] version = "0.10.0" diff --git a/README.md b/README.md index 79cf248..d3bfd50 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ games and graphics development, including: * [`euclid`][euclid] * [`nalgebra`][nalgebra] * [`pathfinder_geometry`][pathfinder_geometry] -* [`static-math`][static-math] * [`ultraviolet`][ultraviolet] * [`vek`][vek] @@ -25,7 +24,6 @@ games and graphics development, including: [glam]: https://github.com/bitshifter/glam-rs [nalgebra]: https://nalgebra.org [pathfinder_geometry]: https://crates.io/crates/pathfinder_geometry -[static-math]: https://crates.io/crates/static-math [ultraviolet]: https://crates.io/crates/ultraviolet [vek]: https://crates.io/crates/vek @@ -167,7 +165,7 @@ run the benchmarks themselves and consider publishing their results. The following is a table of benchmarks produced by `mathbench` comparing `glam` performance to `cgmath`, `nalgebra`, `euclid`, `vek`, `pathfinder_geometry`, -`static-math` and `ultraviolet` on `f32` data. +and `ultraviolet` on `f32` data. These benchmarks were performed on an [Intel i7-4710HQ] CPU on Linux. They were compiled with the `1.56.1 (59eed8a2a 2021-11-01)` Rust compiler. Lower @@ -181,7 +179,6 @@ The versions of the libraries tested were: * `glam` - `0.20.1` * `nalgebra` - `0.29.0` * `pathfinder_geometry` - `0.5.1` -* `static-math` - `0.2.3` * `ultraviolet` - `0.8.1` * `vek` - `0.15.3` (`repr_c` types) @@ -195,12 +192,12 @@ Run with the command: cargo bench --features scalar scalar ``` -| benchmark | glam | cgmath | nalgebra | euclid | vek | pathfinder | static-math | ultraviolet | +| benchmark | glam | cgmath | nalgebra | euclid | vek | pathfinder | ultraviolet | |--------------------------------|-----------------|-----------------|-----------------|----------------|-----------------|-----------------|-----------------|-----------------| -| euler 2d x10000 | 16.23 us | 16.13 us | __9.954 us__ | 16.18 us | 16.2 us | 10.42 us | __9.97 us__ | 16.17 us | -| euler 3d x10000 | __15.95 us__ | 32.11 us | 32.13 us | 32.13 us | 32.13 us | __16.27 us__ | 32.16 us | 32.11 us | -| matrix2 determinant | __2.0386 ns__ | 2.0999 ns | 2.1018 ns | N/A | 2.0997 ns | 2.0987 ns | 2.0962 ns | 2.1080 ns | -| matrix2 inverse | __2.8226 ns__ | 8.4418 ns | 7.6303 ns | N/A | N/A | 3.3459 ns | 9.4636 ns | 5.8796 ns | +| euler 2d x10000 | 16.23 us | 16.13 us | __9.954 us__ | 16.18 us | 16.2 us | 10.42 us | 16.17 us | +| euler 3d x10000 | __15.95 us__ | 32.11 us | 32.13 us | 32.13 us | 32.13 us | __16.27 us__ | 32.11 us | +| matrix2 determinant | __2.0386 ns__ | 2.0999 ns | 2.1018 ns | N/A | 2.0997 ns | 2.0987 ns | 2.1080 ns | +| matrix2 inverse | __2.8226 ns__ | 8.4418 ns | 7.6303 ns | N/A | N/A | 3.3459 ns | 5.8796 ns | | matrix2 mul matrix2 | __2.6036 ns__ | 5.0007 ns | 4.8172 ns | N/A | 9.3814 ns | __2.5516 ns__ | 4.7274 ns | 4.9428 ns | | matrix2 mul vector2 x1 | 2.4904 ns | 2.6144 ns | 2.8714 ns | N/A | 4.2139 ns | __2.0839 ns__ | 2.8873 ns | 2.6250 ns | | matrix2 mul vector2 x100 | 227.5271 ns | 243.3579 ns | 265.1698 ns | N/A | 400.6940 ns | __219.7127 ns__ | 267.8780 ns | 243.9880 ns | @@ -469,7 +466,6 @@ won't pay the build cost twice (unless it's a different version). | glam | 0.9.4 | 1.1 | 0.6 | 2 | | nalgebra | 0.22.0 | 24.2 | 18.0 | 24 | | pathfinder_geometry | 0.5.1 | 3.0 | 0.3 | 8 | -| static-math | 0.1.6 | 6.9 | 1.7 | 10 | | ultraviolet | 0.5.1 | 2.5 | 1.3 | 4 | | vek | 0.12.0 | 34.4 | 10.1 | 16 | diff --git a/benches/eulerbench.rs b/benches/eulerbench.rs index acbcfa7..311533b 100644 --- a/benches/eulerbench.rs +++ b/benches/eulerbench.rs @@ -53,10 +53,7 @@ fn bench_euler_3d(c: &mut Criterion) { use nalgebra::{zero, Vector3}; bench_euler!(b, size, ty => Vector3, zero => zero(), dt => UPDATE_RATE); }); - bench_static_math!(group, size, |b, size| { - use static_math::vector3::V3; - bench_euler!(b, size, ty => V3, zero => V3::zeros(), dt => UPDATE_RATE); - }); + bench_euclid!(group, size, |b, size| { use euclid::{UnknownUnit, Vector3D}; bench_euler!(b, size, ty => Vector3D, zero => Vector3D::zero(), dt => UPDATE_RATE); @@ -127,10 +124,7 @@ fn bench_euler_2d(c: &mut Criterion) { use nalgebra::{zero, Vector2}; bench_euler!(b, size, ty => Vector2, zero => zero(), dt => UPDATE_RATE); }); - bench_static_math!(group, size, |b, size| { - use static_math::vector2::V2; - bench_euler!(b, size, ty => V2, zero => V2::zeros(), dt => UPDATE_RATE); - }); + bench_euclid!(group, size, |b, size| { use euclid::{UnknownUnit, Vector2D}; bench_euler!(b, size, ty => Vector2D, zero => Vector2D::zero(), dt => UPDATE_RATE); diff --git a/benches/matrix2.rs b/benches/matrix2.rs index 34017a1..13d4958 100644 --- a/benches/matrix2.rs +++ b/benches/matrix2.rs @@ -29,10 +29,7 @@ fn bench_matrix2_ret_self(c: &mut Criterion) { use vek::Mat2; bench_unop!(b, op => ret_self, ty => Mat2) }); - bench_static_math!(group, |b| { - use static_math::matrix2x2::M22; - bench_unop!(b, op => ret_self, ty => M22) - }); + bench_pathfinder!(group, |b| { use pathfinder_geometry::transform2d::Matrix2x2F; bench_unop!(b, op => ret_self, ty => Matrix2x2F) @@ -87,11 +84,7 @@ fn bench_matrix2_transpose(c: &mut Criterion) { use nalgebra::Matrix2; bench_unop!(b, op => transpose, ty => Matrix2) }); - bench_static_math!(group, |b| { - use static_math::matrix2x2::M22; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => transpose, ty => M22) - }); + bench_vek!(group, |b| { use vek::Mat2; bench_unop!(b, op => transposed, ty => Mat2) @@ -146,11 +139,7 @@ fn bench_matrix2_determinant(c: &mut Criterion) { use nalgebra::Matrix2; bench_unop!(b, op => determinant, ty => Matrix2) }); - bench_static_math!(group, |b| { - use static_math::matrix2x2::M22; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => det, ty => M22) - }); + bench_vek!(group, |b| { use vek::Mat2; bench_unop!(b, op => determinant, ty => Mat2) @@ -199,11 +188,7 @@ fn bench_matrix2_inverse(c: &mut Criterion) { use nalgebra::Matrix2; bench_unop!(b, op => try_inverse, ty => Matrix2) }); - bench_static_math!(group, |b| { - use static_math::matrix2x2::M22; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => inverse, ty => M22) - }); + bench_pathfinder!(group, |b| { use pathfinder_geometry::transform2d::Matrix2x2F; bench_unop!(b, op => inverse, ty => Matrix2x2F) @@ -248,10 +233,7 @@ fn bench_matrix2_mul_matrix2(c: &mut Criterion) { use nalgebra::Matrix2; bench_binop!(b, op => mul, ty1 => Matrix2, ty2 => Matrix2) }); - bench_static_math!(group, |b| { - use static_math::matrix2x2::M22; - bench_binop!(b, op => mul, ty1 => M22, ty2 => M22) - }); + bench_vek!(group, |b| { use vek::Mat2; bench_binop!(b, op => mul, ty1 => Mat2, ty2 => Mat2) @@ -313,11 +295,7 @@ fn bench_matrix2_mul_vector2(c: &mut Criterion) { use nalgebra::{Matrix2, Vector2}; bench_binop!(b, size, op => mul, ty1 => Matrix2, ty2 => Vector2) }); - bench_static_math!(group, size, |b, size| { - use static_math::matrix2x2::M22; - use static_math::vector2::V2; - bench_binop!(b, size, op => mul, ty1 => M22, ty2 => V2) - }); + bench_vek!(group, size, |b, size| { use vek::{Mat2, Vec2}; bench_binop!(b, size, op => mul, ty1 => Mat2, ty2 => Vec2) diff --git a/benches/matrix3.rs b/benches/matrix3.rs index 5382280..ff23fb6 100644 --- a/benches/matrix3.rs +++ b/benches/matrix3.rs @@ -24,10 +24,7 @@ fn bench_matrix3_ret_self(c: &mut Criterion) { use nalgebra::Matrix3; bench_unop!(b, op => ret_self, ty => Matrix3) }); - bench_static_math!(group, |b| { - use static_math::matrix3x3::M33; - bench_unop!(b, op => ret_self, ty => M33) - }); + bench_vek!(group, |b| { use vek::Mat3; bench_unop!(b, op => ret_self, ty => Mat3) @@ -82,11 +79,7 @@ fn bench_matrix3_transpose(c: &mut Criterion) { use nalgebra::Matrix3; bench_unop!(b, op => transpose, ty => Matrix3) }); - bench_static_math!(group, |b| { - use static_math::matrix3x3::M33; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => transpose, ty => M33) - }); + bench_vek!(group, |b| { use vek::Mat3; bench_unop!(b, op => transposed, ty => Mat3) @@ -141,11 +134,7 @@ fn bench_matrix3_determinant(c: &mut Criterion) { use nalgebra::Matrix3; bench_unop!(b, op => determinant, ty => Matrix3) }); - bench_static_math!(group, |b| { - use static_math::matrix3x3::M33; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => det, ty => M33) - }); + bench_vek!(group, |b| { use vek::Mat3; bench_unop!(b, op => determinant, ty => Mat3) @@ -190,11 +179,7 @@ fn bench_matrix3_inverse(c: &mut Criterion) { use nalgebra::Matrix3; bench_unop!(b, op => try_inverse, ty => Matrix3) }); - bench_static_math!(group, |b| { - use static_math::matrix3x3::M33; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => inverse, ty => M33) - }); + group.finish(); } @@ -235,10 +220,7 @@ fn bench_matrix3_mul_matrix3(c: &mut Criterion) { use nalgebra::Matrix3; bench_binop!(b, op => mul, ty1 => Matrix3, ty2 => Matrix3, param => by_ref) }); - bench_static_math!(group, |b| { - use static_math::matrix3x3::M33; - bench_binop!(b, op => mul, ty1 => M33, ty2 => M33) - }); + bench_vek!(group, |b| { use vek::Mat3; bench_binop!(b, op => mul, ty1 => Mat3, ty2 => Mat3) @@ -296,11 +278,7 @@ fn bench_matrix3_mul_vector3(c: &mut Criterion) { use nalgebra::{Matrix3, Vector3}; bench_binop!(b, size, op => mul, ty1 => Matrix3, ty2 => Vector3) }); - bench_static_math!(group, size, |b, size| { - use static_math::matrix3x3::M33; - use static_math::vector3::V3; - bench_binop!(b, size, op => mul, ty1 => M33, ty2 => V3) - }); + bench_vek!(group, size, |b, size| { use vek::{Mat3, Vec3}; bench_binop!(b, size, op => mul, ty1 => Mat3, ty2 => Vec3) diff --git a/benches/matrix4.rs b/benches/matrix4.rs index 773d61f..6887218 100644 --- a/benches/matrix4.rs +++ b/benches/matrix4.rs @@ -25,10 +25,7 @@ fn bench_matrix4_ret_self(c: &mut Criterion) { use nalgebra::Matrix4; bench_unop!(b, op => ret_self, ty => Matrix4) }); - bench_static_math!(group, |b| { - use static_math::matrix4x4::M44; - bench_unop!(b, op => ret_self, ty => M44) - }); + bench_vek!(group, |b| { use vek::Mat4; bench_unop!(b, op => ret_self, ty => Mat4) @@ -83,11 +80,7 @@ fn bench_matrix4_transpose(c: &mut Criterion) { use nalgebra::Matrix4; bench_unop!(b, op => transpose, ty => Matrix4); }); - bench_static_math!(group, |b| { - use static_math::matrix4x4::M44; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => transpose, ty => M44); - }); + bench_vek!(group, |b| { use vek::Mat4; bench_unop!(b, op => transposed, ty => Mat4) @@ -142,11 +135,7 @@ fn bench_matrix4_determinant(c: &mut Criterion) { use nalgebra::Matrix4; bench_unop!(b, op => determinant, ty => Matrix4) }); - bench_static_math!(group, |b| { - use static_math::matrix4x4::M44; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => det, ty => M44) - }); + bench_euclid!(group, |b| { use euclid::{Transform3D, UnknownUnit}; bench_unop!(b, op => determinant, ty => Transform3D) @@ -195,11 +184,7 @@ fn bench_matrix4_inverse(c: &mut Criterion) { use nalgebra::Matrix4; bench_unop!(b, op => try_inverse, ty => Matrix4) }); - bench_static_math!(group, |b| { - use static_math::matrix4x4::M44; - use static_math::traits::LinearAlgebra; - bench_unop!(b, op => inverse, ty => M44) - }); + bench_euclid!(group, |b| { use euclid::{Transform3D, UnknownUnit}; bench_unop!(b, op => inverse, ty => Transform3D) @@ -248,10 +233,7 @@ fn bench_matrix4_mul_matrix4(c: &mut Criterion) { use nalgebra::Matrix4; bench_binop!(b, op => mul, ty1 => Matrix4, ty2 => Matrix4, param => by_ref) }); - bench_static_math!(group, |b| { - use static_math::matrix4x4::M44; - bench_binop!(b, op => mul, ty1 => M44, ty2 => M44) - }); + bench_euclid!(group, |b| { use euclid::{Transform3D, UnknownUnit}; bench_binop!(b, op => then, ty => Transform3D, param => by_ref) @@ -313,11 +295,7 @@ fn bench_matrix4_mul_vector4(c: &mut Criterion) { use nalgebra::{Matrix4, Vector4}; bench_binop!(b, size, op => mul, ty1 => Matrix4, ty2 => Vector4) }); - bench_static_math!(group, size, |b, size| { - use static_math::matrix4x4::M44; - use static_math::vector4::V4; - bench_binop!(b, size, op => mul, ty1 => M44, ty2 => V4) - }); + bench_vek!(group, size, |b, size| { use vek::{Mat4, Vec4}; bench_binop!(b, size, op => mul, ty1 => Mat4, ty2 => Vec4) diff --git a/benches/rotation3.rs b/benches/rotation3.rs index 6bd6e61..9065367 100644 --- a/benches/rotation3.rs +++ b/benches/rotation3.rs @@ -25,10 +25,7 @@ fn bench_rotation3_nop(c: &mut Criterion) { use nalgebra::UnitQuaternion; bench_unop!(b, op => ret_self, ty => UnitQuaternion) }); - bench_static_math!(group, |b| { - use static_math::quaternion::Quaternion; - bench_unop!(b, op => ret_self, ty => Quaternion) - }); + bench_vek!(group, |b| { use vek::Quaternion; bench_unop!(b, op => ret_self, ty => Quaternion) @@ -84,10 +81,7 @@ fn bench_rotation3_inverse(c: &mut Criterion) { use nalgebra::UnitQuaternion; bench_unop!(b, op => conjugate, ty => UnitQuaternion) }); - bench_static_math!(group, |b| { - use static_math::quaternion::Quaternion; - bench_unop!(b, op => conj, ty => Quaternion) - }); + bench_euclid!(group, |b| { use euclid::{Rotation3D, UnknownUnit}; // euclid inverse assumes normalized quaternion, so it's just a conjugate @@ -147,10 +141,7 @@ fn bench_rotation3_mul_rotation3(c: &mut Criterion) { use nalgebra::UnitQuaternion; bench_binop!(b, op => mul, ty1 => UnitQuaternion, ty2 => UnitQuaternion) }); - bench_static_math!(group, |b| { - use static_math::quaternion::Quaternion; - bench_binop!(b, op => mul, ty1 => Quaternion, ty2 => Quaternion) - }); + bench_euclid!(group, |b| { use euclid::{Rotation3D, UnknownUnit}; bench_binop!(b, op => then, ty => Rotation3D, param => by_ref) @@ -211,11 +202,7 @@ fn bench_rotation3_mul_vector3(c: &mut Criterion) { use nalgebra::{UnitQuaternion, Vector3}; bench_binop!(b, size, op => mul, ty1 => UnitQuaternion, ty2 => Vector3) }); - bench_static_math!(group, size, |b, size| { - use static_math::quaternion::Quaternion; - use static_math::vector3::V3; - bench_binop!(b, size, op => mul, ty1 => Quaternion, ty2 => V3) - }); + bench_euclid!(group, size, |b, size| { use euclid::{Point3D, Rotation3D, UnknownUnit}; bench_binop!(b, size, op => transform_point3d, ty1 => Rotation3D, ty2 => Point3D) diff --git a/benches/support/macros.rs b/benches/support/macros.rs index 3965c2a..8f2b996 100644 --- a/benches/support/macros.rs +++ b/benches/support/macros.rs @@ -206,16 +206,6 @@ macro_rules! bench_vek { }; } -#[macro_export] -macro_rules! bench_static_math { - ($group:ident, $closure:expr) => { - bench_lib!("static-math", $group, $closure) - }; - ($group:ident, $size:expr, $closure:expr) => { - bench_lib!("static-math", $group, $size, $closure) - }; -} - #[macro_export] macro_rules! bench_pathfinder { ($group:ident, $closure:expr) => { diff --git a/benches/vector3.rs b/benches/vector3.rs index 0771cf2..21b5662 100644 --- a/benches/vector3.rs +++ b/benches/vector3.rs @@ -24,10 +24,7 @@ fn bench_vector3_ret_self(c: &mut Criterion) { use nalgebra::Vector3; bench_unop!(b, op => ret_self, ty => Vector3) }); - bench_static_math!(group, |b| { - use static_math::vector3::V3; - bench_unop!(b, op => ret_self, ty => V3) - }); + bench_vek!(group, |b| { use vek::Vec3; bench_unop!(b, op => ret_self, ty => Vec3) @@ -82,10 +79,7 @@ fn bench_vector3_length(c: &mut Criterion) { use nalgebra::Vector3; bench_unop!(b, op => magnitude, ty => Vector3) }); - bench_static_math!(group, |b| { - use static_math::vector3::V3; - bench_unop!(b, op => norm2, ty => V3) - }); + bench_euclid!(group, |b| { use euclid::{UnknownUnit, Vector3D}; bench_unop!(b, op => length, ty => Vector3D) @@ -202,11 +196,7 @@ fn bench_vector3_dot(c: &mut Criterion) { use nalgebra::Vector3; bench_binop!(b, op => dot, ty1 => Vector3, ty2 => Vector3, param => by_ref) }); - bench_static_math!(group, |b| { - use static_math::vector3::V3; - use std::ops::Mul; - bench_binop!(b, op => mul, ty1 => V3, ty2 => V3) - }); + bench_euclid!(group, |b| { use euclid::{UnknownUnit, Vector3D}; bench_binop!(b, op => dot, ty1 => Vector3D, ty2 => Vector3D) @@ -265,10 +255,7 @@ fn bench_vector3_cross(c: &mut Criterion) { use nalgebra::Vector3; bench_binop!(b, op => cross, ty1 => Vector3, ty2 => Vector3, param => by_ref) }); - bench_static_math!(group, |b| { - use static_math::vector3::V3; - bench_binop!(b, op => cross, ty1 => V3, ty2 => V3) - }); + bench_euclid!(group, |b| { use euclid::{UnknownUnit, Vector3D}; bench_binop!(b, op => cross, ty1 => Vector3D, ty2 => Vector3D) diff --git a/scripts/summary.py b/scripts/summary.py index e152da1..2c40998 100755 --- a/scripts/summary.py +++ b/scripts/summary.py @@ -7,7 +7,7 @@ import prettytable DEFAULT = ['glam', 'cgmath', 'nalgebra'] -OPTIONAL = ['euclid', 'vek', 'pathfinder', 'static-math', 'ultraviolet'] +OPTIONAL = ['euclid', 'vek', 'pathfinder', 'ultraviolet'] SCALAR = DEFAULT + OPTIONAL WIDE = ['glam_f32x1', 'ultraviolet_f32x4', 'nalgebra_f32x4', 'ultraviolet_f32x8', 'nalgebra_f32x8'] diff --git a/src/lib.rs b/src/lib.rs index d3c4d2f..d82776f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -756,114 +756,6 @@ pub mod nalgebra_support_wide { } } -#[cfg(feature = "static-math")] -pub mod static_math_support { - use super::BenchValue; - use rand::RngExt; - use static_math; - use static_math::matrix2x2::M22; - use static_math::matrix3x3::M33; - use static_math::matrix4x4::M44; - use static_math::quaternion::Quaternion; - use static_math::vector2::V2; - use static_math::vector3::V3; - use static_math::vector4::V4; - - fn random_nonzero_f32(rng: &mut R) -> f32 - where - R: RngExt, - { - rng.random_range(0.1..1.0) - } - - impl BenchValue for M22 { - fn random_value(rng: &mut R) -> Self { - let a = random_nonzero_f32(rng); - let b = random_nonzero_f32(rng); - let c = random_nonzero_f32(rng); - let d = random_nonzero_f32(rng); - M22::new([[a, b], [c, d]]) - } - } - - impl BenchValue for V2 { - fn random_value(rng: &mut R) -> Self { - let a = random_nonzero_f32(rng); - let b = random_nonzero_f32(rng); - V2::new([a, b]) - } - } - - impl BenchValue for M33 { - fn random_value(rng: &mut R) -> Self { - let a_00 = random_nonzero_f32(rng); - let a_01 = random_nonzero_f32(rng); - let a_02 = random_nonzero_f32(rng); - let a_10 = random_nonzero_f32(rng); - let a_11 = random_nonzero_f32(rng); - let a_12 = random_nonzero_f32(rng); - let a_20 = random_nonzero_f32(rng); - let a_21 = random_nonzero_f32(rng); - let a_22 = random_nonzero_f32(rng); - M33::new([[a_00, a_01, a_02], [a_10, a_11, a_12], [a_20, a_21, a_22]]) - } - } - impl BenchValue for V3 { - fn random_value(rng: &mut R) -> Self { - let a = random_nonzero_f32(rng); - let b = random_nonzero_f32(rng); - let c = random_nonzero_f32(rng); - V3::new([a, b, c]) - } - } - impl BenchValue for M44 { - fn random_value(rng: &mut R) -> Self { - let a1 = random_nonzero_f32(rng); - let a2 = random_nonzero_f32(rng); - let a3 = random_nonzero_f32(rng); - let a4 = random_nonzero_f32(rng); - let a5 = random_nonzero_f32(rng); - let a6 = random_nonzero_f32(rng); - let a7 = random_nonzero_f32(rng); - let a8 = random_nonzero_f32(rng); - let a9 = random_nonzero_f32(rng); - let a10 = random_nonzero_f32(rng); - let a11 = random_nonzero_f32(rng); - let a12 = random_nonzero_f32(rng); - let a13 = random_nonzero_f32(rng); - let a14 = random_nonzero_f32(rng); - let a15 = random_nonzero_f32(rng); - let a16 = random_nonzero_f32(rng); - M44::new([ - [a1, a5, a9, a13], - [a2, a6, a10, a14], - [a3, a7, a11, a15], - [a4, a8, a12, a16], - ]) - } - } - - impl BenchValue for V4 { - fn random_value(rng: &mut R) -> Self { - let a = random_nonzero_f32(rng); - let b = random_nonzero_f32(rng); - let c = random_nonzero_f32(rng); - let d = random_nonzero_f32(rng); - V4::new([a, b, c, d]) - } - } - - impl BenchValue for Quaternion { - fn random_value(rng: &mut R) -> Self { - let q0 = random_nonzero_f32(rng); - let q1 = random_nonzero_f32(rng); - let q2 = random_nonzero_f32(rng); - let q3 = random_nonzero_f32(rng); - Quaternion::new_from(q0, q1, q2, q3) - } - } -} - #[cfg(feature = "ultraviolet")] pub mod ultraviolet_support { use super::BenchValue;