Optimize intersection computation for envelopes
See original GitHub issueI cannot find a method to compute intersection of two envelopes. The only way I know to do that is via OGCGeometry:
OGCGeometry.createFromEsriGeometry(a, null).intersection(OGCGeometry.createFromEsriGeometry(b, null))
However this method is very slow. It is about 300 times slower than envelope-specific computation: https://github.com/prestodb/presto/pull/10327
@Nullable
public static Envelope intersection(Envelope envelope, Envelope otherEnvelope)
{
requireNonNull(envelope, "envelope is null");
requireNonNull(otherEnvelope, "otherEnvelope is null");
if (envelope.getXMax() < otherEnvelope.getXMin()
|| envelope.getXMin() > otherEnvelope.getXMax()
|| envelope.getYMax() < otherEnvelope.getYMin()
|| envelope.getYMin() > otherEnvelope.getYMax()) {
return null;
}
return new Envelope(
max(envelope.getXMin(), otherEnvelope.getXMin()),
max(envelope.getYMin(), otherEnvelope.getYMin()),
min(envelope.getXMax(), otherEnvelope.getXMax()),
min(envelope.getYMax(), otherEnvelope.getYMax()));
}
Would it be possible to add an efficient Envelope#intersection
API?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Simplification Envelopes - JHU CS
Abstract. We propose the idea of simplification envelopes for gen- erating a hierarchy of level-of-detail approximations for a given polygonal model.
Read more >Simplification Envelopes
Abstract. We propose the idea of simplification envelopes for gen- erating a hierarchy of level-of-detail approximations for a given polygonal model.
Read more >Fast envelope algorithms
1D envelope algorithm framework of Cook and Zhang (2016), we develop an envelope ... a non-convex optimization problem over a u-dimensional Grassmannian.
Read more >Envelope Algorithm Optimization -- Best Place to Put a Circle
Here is a tutorial about the envelope theorem in optimization. ... pointing to the origin, and a circle intersection between the points.
Read more >On the computation of convex envelopes for bivariate ...
The procedure is based on the solution of a KKT system and simplifies the derivation of the convex envelope with respect to previously...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, that’s a bug.
@mbasmanova These methods change e1 polygon as in e1.intersect(e2). The result polygon will be empty if they dont intersect and as well the method returns boolean as extra bonus.