parry3d/query/sat/
sat_cuboid_segment.rs1use crate::math::{Isometry, Real, Vector};
2use crate::query::sat;
3use crate::shape::{Cuboid, Segment};
4
5#[cfg(feature = "dim3")]
10pub fn cuboid_segment_find_local_separating_edge_twoway(
11 cube1: &Cuboid,
12 segment2: &Segment,
13 pos12: &Isometry<Real>,
14) -> (Real, Vector<Real>) {
15 let x2 = pos12 * (segment2.b - segment2.a);
16
17 let axes = [
18 Vector::new(0.0, -x2.z, x2.y),
20 Vector::new(x2.z, 0.0, -x2.x),
21 Vector::new(-x2.y, x2.x, 0.0),
22 ];
23
24 sat::cuboid_support_map_find_local_separating_edge_twoway(cube1, segment2, &axes, pos12)
25}
26
27#[cfg(feature = "dim2")]
31pub fn segment_cuboid_find_local_separating_normal_oneway(
32 segment1: &Segment,
33 shape2: &Cuboid,
34 pos12: &Isometry<Real>,
35) -> (Real, Vector<Real>) {
36 sat::point_cuboid_find_local_separating_normal_oneway(
37 segment1.a,
38 segment1.normal(),
39 shape2,
40 pos12,
41 )
42}