Comments (8)
My motivation for this was when working with the MVT vector tile format for OpenStreetMap. In that file format, vector geometry is stored as integers.
the intersection of two integral line segments
Yes I had those problems. For my use case I just choose some point that's "good enough". the Intersection
algoritm is probably one where you Floats
are required.
I do think a rasterize operation onto a given grid at the end is the way to go -- that way the user could provide whatever grid they wanted.
You can do this with the MapCoords trait, which allows you to change the types. You could convert f64
to i32
etc. (That's one of the reasons I wrote it like this.
We should definitely explain what's going on in the docs, point out caveats etc. when this turns into a PR, though.
Agreed. I didn't do the "grunt work" in the fork because I wasn't sure if the idea was acceptable and likely to be merged. Now that I see the support, I'll work on cleaning it up and making a real PR.
from geo.
I have worked on this a little more, and reworked it against current master. The new branch is https://github.com/rory/rust-geo/tree/any-num-coordinates
Any feedback? Is this something that rust-geo
should have?
from geo.
Would you mind pushing the branch? I'm curious to take a look. I don't think I understand how this would work since many operations on integral geometries won't always return integral geometries.
For example, the intersection of two integral line segments: l1 = (0, 0), (2, 1)
and l2 = (0, 1), (1, 0)
is (2/3, 1/3)
. Walking through the algorithm with ints (and integer division) you'd get (0,0)
(or one of the other endpoints depending on the implementation).
At first glance, I do think a rasterize operation onto a given grid at the end is the way to go -- that way the user could provide whatever grid they wanted.
from geo.
There's a branch here: https://github.com/rory/rust-geo/tree/any-num
This commit is how I implemented it. I created CoordinateType
to replace the Float
. Then it's almost just a find and replace to use that instead.
Some operations (like line intersection or area) might not make sense, and still require the Float
trait.
from geo.
I like it. Operations can still limit the generic type to Float if they require it.
from geo.
yep, looks good to me too 👍
from geo.
I don't do much raster stuff atm so I'm not really qualified, but it definitely seems like a good idea. We should definitely explain what's going on in the docs, point out caveats etc. when this turns into a PR, though.
from geo.
PR #187 fixes this, so I'll close the issue. Discussion should take place on the PR
from geo.
Related Issues (20)
- MultiPoint::len
- Panic in BooleanOps::union for Polygon<f32> HOT 6
- VecSet may cause panics HOT 7
- Proposal: Common abstraction layer for collection types (via `Deref` and `DerefMut`) HOT 2
- Add delauney triangulation algorithm to root `geo` crate docs index
- Thoughts on algorithms for trait-based geometries
- concave_hull returns nonsense results for simple polygons HOT 1
- Panic in RegionAssembly reproducibly HOT 4
- Clarify that current cross-track distance uses spherical (Haversine) earth model, add Ellipsoidal (Vincenty) version HOT 2
- Missing `contains` implementations
- `is_valid` for all geometry types. HOT 3
- Problems building with Rust 1.75.0 HOT 1
- Add is_equal_topo method to IntersectionMatrix to determine topological equality
- How to calculate intersection area of two rotated rectangles? HOT 2
- Missing PointZ implementations HOT 1
- Latest ahash dep and Rust 1.70.0 are incompatible HOT 4
- 3D (3-dimensional) data types HOT 2
- Rhumb destinations do not wrap angles after the first pole intersection HOT 8
- GeodesicDestination produces cyclcically incosistent results HOT 5
- Expose fields in AffineTransform struct (or have a way to access the internal values)? 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.