mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
seeing if everything is solid...
This commit is contained in:
parent
23db7cc646
commit
88af2a74d2
@ -3,25 +3,11 @@
|
|||||||
## Geometry
|
## Geometry
|
||||||
|
|
||||||
- try fixed pt again, for determinism purposes mostly
|
- try fixed pt again, for determinism purposes mostly
|
||||||
- very different approaches
|
- just get it working
|
||||||
- v1: keep f64 internally, but constantly drop small bits
|
- MAX dist for lookahead is broken
|
||||||
- we just want deterministic serialization really, so...
|
- buses are getting stuck on this weird tiny thing
|
||||||
- v2: try some rational number thing internally
|
- can natively order
|
||||||
|
|
||||||
- retry integers for everything (probably all at once)
|
|
||||||
- dont round too early... line intersection, dist to pt, kinematics
|
|
||||||
- adjust epsilon values to match actual smallest difference, or start doing direct comparisons now
|
|
||||||
|
|
||||||
- clamp distances first, not points? This one is working well!
|
|
||||||
- note contains_pt needs to use 2 or 3 * epsilon, because of the error that may accumulate...
|
|
||||||
- audit all EPSILON_DIST usages
|
|
||||||
- make natively orderable
|
|
||||||
|
|
||||||
- change internal pt2d representation to int. JUST get that working first.
|
|
||||||
- then get rid of approx_eq, approx_dedupe
|
|
||||||
- make sure dist_to at the tiniest case rounds up, too. maybe that needs to happen now.
|
|
||||||
- make Pt2D natively orderable, hashable
|
|
||||||
- can Pt2D::new() and x() and y() return something besides f64?
|
|
||||||
- then work on proper SI types, with negative/positive cases handled carefully
|
- then work on proper SI types, with negative/positive cases handled carefully
|
||||||
- also bounds?
|
- also bounds?
|
||||||
- cant get rid of the ccw intersection check... different answer in some cases that looks bad
|
- cant get rid of the ccw intersection check... different answer in some cases that looks bad
|
||||||
|
@ -186,10 +186,11 @@ impl Line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn dist_along_of_point(&self, pt: Pt2D) -> Option<Distance> {
|
pub fn dist_along_of_point(&self, pt: Pt2D) -> Option<Distance> {
|
||||||
let dist1 = self.pt1().dist_to(pt);
|
let dist1 = self.pt1().raw_dist_to(pt);
|
||||||
let dist2 = pt.dist_to(self.pt2());
|
let dist2 = pt.raw_dist_to(self.pt2());
|
||||||
if (dist1 + dist2 - self.length()).abs() < EPSILON_DIST * 3.0 {
|
let length = self.pt1().raw_dist_to(self.pt2());
|
||||||
Some(dist1)
|
if (dist1 + dist2 - length).abs() < EPSILON_DIST.inner_meters() {
|
||||||
|
Some(Distance::meters(dist1))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -99,8 +99,12 @@ impl Pt2D {
|
|||||||
|
|
||||||
// TODO valid to do euclidean distance on world-space points that're formed from
|
// TODO valid to do euclidean distance on world-space points that're formed from
|
||||||
// Haversine?
|
// Haversine?
|
||||||
|
pub(crate) fn raw_dist_to(self, to: Pt2D) -> f64 {
|
||||||
|
((self.x() - to.x()).powi(2) + (self.y() - to.y()).powi(2)).sqrt()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn dist_to(self, to: Pt2D) -> Distance {
|
pub fn dist_to(self, to: Pt2D) -> Distance {
|
||||||
Distance::meters(((self.x() - to.x()).powi(2) + (self.y() - to.y()).powi(2)).sqrt())
|
Distance::meters(self.raw_dist_to(to))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn angle_to(self, to: Pt2D) -> Angle {
|
pub fn angle_to(self, to: Pt2D) -> Angle {
|
||||||
|
@ -19,7 +19,7 @@ for map_path in `ls data/raw_maps/`; do
|
|||||||
map=`basename $map_path .abst`;
|
map=`basename $map_path .abst`;
|
||||||
echo "Precomputing $map with no_edits";
|
echo "Precomputing $map with no_edits";
|
||||||
cd precompute;
|
cd precompute;
|
||||||
cargo run $release_mode ../data/raw_maps/$map.abst --edits_name=no_edits;
|
RUST_BACKTRACE=1 cargo run $release_mode ../data/raw_maps/$map.abst --edits_name=no_edits;
|
||||||
cd ..;
|
cd ..;
|
||||||
|
|
||||||
if [ -e data/edits/$map ]; then
|
if [ -e data/edits/$map ]; then
|
||||||
@ -29,7 +29,7 @@ for map_path in `ls data/raw_maps/`; do
|
|||||||
edits=`basename "$edit_path" .json`;
|
edits=`basename "$edit_path" .json`;
|
||||||
echo "Precomputing $map with $edits";
|
echo "Precomputing $map with $edits";
|
||||||
cd precompute;
|
cd precompute;
|
||||||
cargo run $release_mode ../data/raw_maps/$map.abst --edits_name="$edits";
|
RUST_BACKTRACE=1 cargo run $release_mode ../data/raw_maps/$map.abst --edits_name="$edits";
|
||||||
cd ..;
|
cd ..;
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user