use glam_det::nums::num_traits::*;
use glam_det::nums::{f32x4, u32x4};
use glam_det::{UnitQuat, UnitQuatx4, Vec3, Vec3x4};
use crate::collision_tasks::{ShapeTester, ShapeWideTester};
use crate::convex_contact_manifold::{Convex4ContactManifoldWide, ConvexContactManifold};
use crate::shapes::{InfinitePlane, InfinitePlaneWide, Sphere, SphereWide};
use crate::traits::{ContactContext, ContactManifoldWide, CreateShapeWide, PairTest, PairWideTest};
use crate::ShapeContainer;
impl PairWideTest<SphereWide, InfinitePlaneWide> for ShapeWideTester {
#[inline]
fn should_reset_manifold_before_test() -> bool {
false
}
#[inline]
fn test(
a: &SphereWide,
_b: &InfinitePlaneWide,
contact_context: &ContactContext,
manifold: &mut Convex4ContactManifoldWide,
) {
let sphere_in_plane =
contact_context.orientation_b.inverse() * (-*contact_context.offset_b);
manifold.normal = contact_context.orientation_b * InfinitePlaneWide::NORMAL;
manifold.depth[0] = a.radius - sphere_in_plane.y;
manifold.offset_a[0] = -manifold.normal * a.radius;
manifold.contact_exists[0] = manifold.depth[0].gt(-contact_context.speculative_margin);
manifold.feature_id[0] = u32x4::ZERO;
}
}
impl_pair_narrowphase!(Sphere, InfinitePlane, SphereWide, InfinitePlaneWide, 1);