forked from 1b-agent/opencadstudio-upstream
cargo fmt
This commit is contained in:
1 parent
468cbde5e1
commit
ca07268c7c
204 files changed
+13997
-5525
No files matched your search
+35
-9
@@ -109,7 +109,9 @@ pub fn box_hit<'a>(
|
||||
}
|
||||
let sp = world_to_screen(Vec3::new(px, py, pz), view_proj, bounds);
|
||||
if crossing {
|
||||
if inside(sp) { hit = true; }
|
||||
if inside(sp) {
|
||||
hit = true;
|
||||
}
|
||||
if let Some(p0) = prev {
|
||||
if !hit {
|
||||
hit = segments_intersect(p0, sp, box_tl, box_tr)
|
||||
@@ -119,13 +121,23 @@ pub fn box_hit<'a>(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !inside(sp) { all_inside = false; }
|
||||
if !inside(sp) {
|
||||
all_inside = false;
|
||||
}
|
||||
}
|
||||
prev = Some(sp);
|
||||
}
|
||||
|
||||
let result = if crossing { hit } else { all_inside && prev.is_some() };
|
||||
if result { Some(wire.name.as_str()) } else { None }
|
||||
let result = if crossing {
|
||||
hit
|
||||
} else {
|
||||
all_inside && prev.is_some()
|
||||
};
|
||||
if result {
|
||||
Some(wire.name.as_str())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -167,20 +179,34 @@ pub fn poly_hit<'a>(
|
||||
}
|
||||
let sp = world_to_screen(Vec3::new(px, py, pz), view_proj, bounds);
|
||||
if crossing {
|
||||
if point_in_polygon(sp, poly) { hit = true; }
|
||||
if point_in_polygon(sp, poly) {
|
||||
hit = true;
|
||||
}
|
||||
if !hit {
|
||||
if let Some(p0) = prev {
|
||||
if segment_crosses_polygon(p0, sp, poly) { hit = true; }
|
||||
if segment_crosses_polygon(p0, sp, poly) {
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !point_in_polygon(sp, poly) { all_inside = false; }
|
||||
if !point_in_polygon(sp, poly) {
|
||||
all_inside = false;
|
||||
}
|
||||
}
|
||||
prev = Some(sp);
|
||||
}
|
||||
|
||||
let result = if crossing { hit } else { all_inside && prev.is_some() };
|
||||
if result { Some(wire.name.as_str()) } else { None }
|
||||
let result = if crossing {
|
||||
hit
|
||||
} else {
|
||||
all_inside && prev.is_some()
|
||||
};
|
||||
if result {
|
||||
Some(wire.name.as_str())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user