2017-08-03 01:37:44 +08:00
|
|
|
use na::{Quaternion, UnitQuaternion, Vector3};
|
2019-11-16 03:29:18 +08:00
|
|
|
use rand::Rng;
|
|
|
|
use rand_isaac::IsaacRng;
|
2018-02-02 19:26:35 +08:00
|
|
|
use std::ops::{Add, Div, Mul, Sub};
|
2017-08-03 01:37:44 +08:00
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
#[path = "../common/macros.rs"]
|
2017-08-03 01:37:44 +08:00
|
|
|
mod macros;
|
|
|
|
|
|
|
|
bench_binop!(quaternion_add_q, Quaternion<f32>, Quaternion<f32>, add);
|
|
|
|
bench_binop!(quaternion_sub_q, Quaternion<f32>, Quaternion<f32>, sub);
|
|
|
|
bench_binop!(quaternion_mul_q, Quaternion<f32>, Quaternion<f32>, mul);
|
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
bench_binop!(
|
|
|
|
unit_quaternion_mul_v,
|
|
|
|
UnitQuaternion<f32>,
|
|
|
|
Vector3<f32>,
|
|
|
|
mul
|
|
|
|
);
|
2017-08-03 01:37:44 +08:00
|
|
|
|
|
|
|
bench_binop!(quaternion_mul_s, Quaternion<f32>, f32, mul);
|
|
|
|
bench_binop!(quaternion_div_s, Quaternion<f32>, f32, div);
|
|
|
|
|
|
|
|
bench_unop!(quaternion_inv, Quaternion<f32>, try_inverse);
|
|
|
|
bench_unop!(unit_quaternion_inv, UnitQuaternion<f32>, inverse);
|
|
|
|
|
|
|
|
// bench_unop_self!(quaternion_conjugate, Quaternion<f32>, conjugate);
|
|
|
|
// bench_unop!(quaternion_normalize, Quaternion<f32>, normalize);
|
2019-03-24 02:07:16 +08:00
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
criterion_group!(
|
|
|
|
quaternion,
|
2019-03-24 02:07:16 +08:00
|
|
|
quaternion_add_q,
|
|
|
|
quaternion_sub_q,
|
|
|
|
quaternion_mul_q,
|
|
|
|
unit_quaternion_mul_v,
|
|
|
|
quaternion_mul_s,
|
|
|
|
quaternion_div_s,
|
|
|
|
quaternion_inv,
|
|
|
|
unit_quaternion_inv
|
2019-11-16 03:29:18 +08:00
|
|
|
);
|