Fix corner case: exit on multiple axes

This commit is contained in:
Robert Hrusecky
2020-10-06 14:01:48 -05:00
parent b614b3de5e
commit 0c1b210109

View File

@@ -208,8 +208,9 @@ impl SAPAxis {
let mut deleted = 0;
for endpoint in &self.endpoints {
if endpoint.value < self.min_bound {
if endpoint.is_end() {
existing_proxies.set(endpoint.proxy() as usize, false);
let proxy_idx = endpoint.proxy() as usize;
if endpoint.is_end() && existing_proxies[proxy_idx] {
existing_proxies.set(proxy_idx, false);
deleted += 1;
}
} else {
@@ -219,7 +220,8 @@ impl SAPAxis {
for endpoint in self.endpoints.iter().rev() {
if endpoint.value > self.max_bound {
if endpoint.is_start() {
let proxy_idx = endpoint.proxy() as usize;
if endpoint.is_start() && existing_proxies[proxy_idx] {
existing_proxies.set(endpoint.proxy() as usize, false);
deleted += 1;
}