Mapbox : How to animate Polygon transformation - android

Its pretty simple to transform a Point feature from one to another like this :
But I am facing a usecase that needs to animate polygon feature from one state to another, sometimes the polygons (old and new) can have different number of vertices like shown below below where I want to smoothly animate the left polygon to right?
Are there any pre-built APIs or efficient way of doing these things?

sometimes the polygons (old and new) can have different number of vertices
As a solution for this particular problem, you can simply add intermediate nodes on the polygon that has less vertices. The image below shows how to get from polygon A (a rectangle) to polygon B (a "plus" shape). It is a screenshot taken from this video, which I suggest you checkout out.
Now, the difficult part is how to determine where to add those nodes ?
Do you have more info on these polygons ? Is there a relationship between them ?

Related

Generate "out of view" markers indicators on a map with React Native

For a project, I have to indicate, with colored arrows, in which direction are the markers that aren't shown in the visible region.
When the user scrolls, or zoom on the map, the arrows move accordingly to where the not visible markers are compared to the current center of the visible region.
Here is a picture that demonstrate what is needed :
I am using react-native-mapview and added regular views over the map to show the indicators.
I've started working on this by comparing the coordinates and calculating the point of intersection between lines (border lines and line made by the 2 coordinates) at each frame. It works fine on iOS but is pretty laggy on Android, especially chan there are a lot of markers involved.
What would be the best and optimized way to do this ?
Maybe you could try using Animated.View instead regular view. It may render more fluently?
pass tracksViewChanges={false} to Markers https://github.com/react-native-community/react-native-maps/blob/master/docs/marker.md

Move multiple sprites together as a cluster in libgdx

I have say N individual sprites. When user move them closer they snap together and become a cluster. Cluster can have sprites anywhere between 2 to n. If user touches on any cluster member sprite, entire cluster must be moved together.
Currently my problem is I can do this with lot of calculations when a move happen to organization and move them all to gather. When a new member joins the cluster I have to reorganize all again. But is there a better way to merge/groups sprites to gather? So I can perform move and rotation as a single unit. See the picture below.
The simpliest seems to be to use Scene2d Group instance to keep sprites together and a simple Scene2d Image to handle single sprite. Unfortunately you would need to rewrite your game screen but I believe that it's worth.
Here take a lok at Scene2d description and then at Scene2d tutorial

Detect shapes and create histograms

I am working on an app that will compare histograms in hopes to match faces.
The app allows the user to take a photo, select a few key points in the image and then the app draws circles around those points. I then detect the circles using the OpenCV Hough Circle Transform functions. Up to this point the app works great.
What I need to implement now is one of two options:
Detect the circles and create separate histograms for the area inside of each circle.
Detect the circles and blackout the area(s) around the circles and create one histogram.
I'm leaning towards method 2, but I'm not sure how mask/color/paint around the area outside of the circles after they are detected. Any input would be appreciated. Thanks.
Instead of painting the area outside the circles in the original image, why not create a new image and copy the content of the circles to it?
Another point is that histograms are independent of translation. So, it does not matter if you copy the circles to the exact locations in the new image.
Do clarify if I did not answer your question, or if you have other questions now.

can I draw polygons on texture with GLSL?

I'm completely new to OpenGL so my question might sound stupid but I'm trying to do one thing for more then week and I got completely stuck.
I'm trying to draw a globe that you can rotate and zoom and pick the country on Android. There are no problems with rotation but there are some with zooming (texture looks ugly if camera come closer) and I have no idea how to implement country picking. I have an arrays for each country with lat,log for each vertex of country border. But how can I draw it on the sphere ?
I've been trying to convert lat,long to zyx and draw lines but there is a triangulation issue to build polygons. Is it possible to draw texture on run-time with shaders? and is it possible to get a touch point on texture ? (I'd like to highlight selected country by filling it with another color)
I don't need a map, just a countries with one color, borders with another one and rest of the globe with third one.
I'm using Rajawali lib for this purpose. Although it is opensource but it has no comment and tiny doc is outdated so if you know better framework please suggest me.

Mission impossible? google maps mask effects in iphone or android

i've come up with an idea that has a mask effects in google maps so that it can highlight a city .but i've searched the internet again and again found no document about this.
so ,is it possible to make mask effects in android or ios just like the effets below? and how to?
http://cadgis-blog.blogspot.com/2011/10/google-maps-create-cool-mask-effect-on.html
So there's two problems there. The first is where to get the boundary data from, and the second is how do you draw it on a map.
Answering the second part first, if you're using the iOS map view (MKMapView): you'll want to look into MKPolygonView. You can definitely highlight an arbitrary polygon, but the usual highlighting effect looks like a coloured overlay inside the polygon.
The thing to do, therefore, would be to make a huge polygon that encompasses the entire country, with your region as a hole in the polygon. That is, I believe, what your demo does. You can make an MKPolygon with the polygonWithPoints:count:interiorPolygons: method, and pass in your 'hole' as an interior polygon to be cut out.
Regarding the first part, how to get the data: what you need is a set of latitude/longitude pairs that make up the border for your region. Your example used this dataset, which is administrative borders for Switzerland. You'll need to find yourself a dataset that encompasses the borders for cities in the country you're interested in. I would imagine that you would store the coordinates of the borders in a database embedded in your app.

Categories

Resources