Optimizations
This commit is contained in:
parent
2719ae448b
commit
8f65ece32c
10
src/main.rs
10
src/main.rs
@ -258,7 +258,7 @@ lazy_static! {
|
||||
// R*-Baum zur Beschleunigung der Routenabschnitt-Hindernis-Überprüfungen
|
||||
static ref RTREE: RwLock<RTree<Polygon>> = RwLock::new(RTree::new());
|
||||
// Cache für die Funktion none_intersect
|
||||
static ref COLLISIONS: RwLock<HashMap<[i32; 4], bool>> = RwLock::new(HashMap::new());
|
||||
static ref COLLISIONS: RwLock<HashMap<[u32; 4], bool>> = RwLock::new(HashMap::new());
|
||||
}
|
||||
|
||||
/// Schneidet die Linie keines der Polygone?
|
||||
@ -272,10 +272,10 @@ fn none_intersect(mut line: Line) -> bool {
|
||||
let mut collisions = COLLISIONS.write();
|
||||
// Liniendaten hashbar machen
|
||||
let id = [
|
||||
line.start.x as i32,
|
||||
line.start.y as i32,
|
||||
line.end.x as i32,
|
||||
line.end.y as i32,
|
||||
line.start.x.to_bits(),
|
||||
line.start.y.to_bits(),
|
||||
line.end.x.to_bits(),
|
||||
line.end.y.to_bits(),
|
||||
];
|
||||
// evtl. gefundenes Ergebnis sofort zurückgeben
|
||||
if let Some(&r) = collisions.get(&id) {
|
||||
|
Loading…
Reference in New Issue
Block a user