Comments (6)
We can introduce checked_delta
and checked_slope
methods that mirror the checked_*
methods on integers in the standard library. Would that help @jayvdb?
from geo.
tbh, what I need is a way to get an accurate slope, in order to determine if three coords are a triangle. Needed for cksac/fake-rs#130 i.e. use f64
even in the T is an unsigned int.
Could I contribute a Line::abs_slope
? e.g. something like
fn abs_slope<T>(a: geo_types::Coord<T>, b: geo_types::Coord<T>) -> f64
where
T: CoordNum,
{
let (min_x, max_x) = if a.x > b.x { (b.x, a.x) } else { (a.x, b.x) };
let (min_y, max_y) = if a.y > b.y { (b.y, a.y) } else { (a.y, b.y) };
let delta_x: f64 = cast(max_x - min_x).unwrap();
let delta_y: f64 = cast(max_y - min_y).unwrap();
delta_y / delta_x
}
from geo.
determine if three coords are a triangle
Any three points that aren't collinear form a triangle, right? You could use https://docs.rs/robust/0.2.3/robust/fn.orient2d.html and check for a non-zero value.
Or if you prefer, you can access robust
's orient2d
function via geo
: https://docs.rs/geo/latest/geo/algorithm/kernels/trait.Kernel.html#method.orient2d
from geo.
Seems odd the geo-types package doesnt have a way to determine of a geo_types::Triangle is a triangle. I'd rather not have another dependency just for that.
It looks like orient2d
is going to be a perf hit - its algorithm does lots of additional work when the points are approaching collinear. In my case that isnt desirable as in my use-case it is desirable to discard the points when they are cheaply determined to be approximately collinear, as it is less work to pick a different random point to construct the triangle.
from geo.
Seems odd the geo-types package doesnt have a way to determine of a geo_types::Triangle is a triangle. I'd rather not have another dependency just for that.
geo-types
provides types, not algorithms. The robust crate is minimal, and is provided as a separate crate because its predicates are widely useful to users outside the geo
ecosystem.
its algorithm does lots of additional work when the points are approaching collinear
I would characterise it differently: Jonathan Shewchuk's incredibly widely-used algorithm provides an accurate answer to a difficult problem, trading performance for correctness when appropriate.
You say it "looks like" it's going to be a perf hit. Have you determined this empirically?
As a more general comment, I'm not inclined to accept a PR for less robust functionality already provided by a crate we maintain, though it's not solely up to me.
from geo.
geo-types
provides algorithms like slope
. I am asking to have an 'absolute slope' added.
Have you determined this empirically?
No I havent. Will do.
from geo.
Related Issues (20)
- Happy 1,000th issue geo 🎉
- Offer `Triangulate` algorithm trait HOT 14
- Clarify that the `triangles` method does _not_ do triangulation HOT 3
- ML-assisted contributions
- Compiling with cross set to target `armv7-unknown-linux-gnueabihf` causes issues with `try_map_coords_inplace`. HOT 11
- Nightly build error with `1.71.0-nightly` HOT 2
- Integrate the RINEX crate to the community HOT 8
- Add "Geospatial" category to `Cargo.toml` HOT 1
- Panic in BooleanOps::difference for Multipolygon HOT 10
- `MapCoordsInPlace` not listed under `Iteration` in `lib.rs`
- Implement EuclideanDistance for all combinations of geometry types HOT 2
- implement conversion from multipolygon to polygon of length one HOT 2
- implement RTreeObject for `Geometry`
- Add `ClosestPoints` trait which returns the two closest points between two geometries. HOT 5
- LineString intersection API HOT 2
- LineString slicing HOT 2
- Rename Bearing trait to HaversineBearing
- Change in behavior of LineString::simplify from 0.23.1 to 0.24.0 HOT 3
- `Bearing.bearing(p: &Point)` computes wrong bearing HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geo.