// Error / Panic --------------------------------------------------------------
parry2d-f64-0.18.0/src/query/clip/clip_aabb_line.rs:141:19:
Matrix index out of bounds.
// What happened ---------------------------------------------------------
I accidentally created a triangle ColliderShape with:
point_a -> Vec2 { data: [40.0, 0.0] }
point_b -> Vec2 { data: [ 0.0, 80.0] } // Same as point_c
point_c -> Vec2 { data: [ 0.0, 80.0] } // Same as point_b
In clip_aabb_line.rs the origin parameter has NAN values -> pub fn clip_aabb_line(...);
In the loop in the else part:
let mut inter_with_near_halfspace = (aabb.mins[i] - origin[i]) * denom; // Results in NaN (origin[i] == NaN)
let mut inter_with_far_halfspace = (aabb.maxs[i] - origin[i]) * denom; // Results in NaN (origin[i] == NaN)
near_diag stays false
near_side stays 0
in line 141 [0 - 1] Matrix index out of bounds.
// Solution ----------------------------------------------------------------
let near = if near_diag {
(tmin, -dir.normalize(), near_side)
} else {
let mut normal = Vector::zeros();
if near_side < 0 {
normal[(-near_side - 1) as usize] = 1.0;
} else if near_side > 0 { // <-------------------------------------- Here
normal[(near_side - 1) as usize] = -1.0;
}
else { // <--------------------------------------------------------- Here
return None;
}
(tmin, normal, near_side)
};
let far = if far_diag {
(tmax, -dir.normalize(), far_side)
} else {
let mut normal = Vector::zeros();
if far_side < 0 {
normal[(-far_side - 1) as usize] = -1.0;
} else if far_side > 0 { // <--------------------------------------- Here
normal[(far_side - 1) as usize] = 1.0;
}
else { // <--------------------------------------------------------- Here
return None;
}
(tmax, normal, far_side)
};
// Error / Panic --------------------------------------------------------------
parry2d-f64-0.18.0/src/query/clip/clip_aabb_line.rs:141:19:
Matrix index out of bounds.
// What happened ---------------------------------------------------------
I accidentally created a triangle ColliderShape with:
point_a -> Vec2 { data: [40.0, 0.0] }
point_b -> Vec2 { data: [ 0.0, 80.0] } // Same as point_c
point_c -> Vec2 { data: [ 0.0, 80.0] } // Same as point_b
In clip_aabb_line.rs the origin parameter has NAN values -> pub fn clip_aabb_line(...);
In the loop in the else part:
let mut inter_with_near_halfspace = (aabb.mins[i] - origin[i]) * denom; // Results in NaN (origin[i] == NaN)
let mut inter_with_far_halfspace = (aabb.maxs[i] - origin[i]) * denom; // Results in NaN (origin[i] == NaN)
near_diag stays false
near_side stays 0
in line 141 [0 - 1] Matrix index out of bounds.
// Solution ----------------------------------------------------------------