Direct iphone towards a star - geolocation flip - actionscript-3

With AS3 I combined geolocation and accelerometer to direct the iphone, with its back towards a star at the sky. Accelerometer works fine for tilt 0-90 degrees ( directed towards horizon, phone vertical - towards zenith, phone horizontal with screen downwards) but geolocation heading of course flips around 45 degrees tilt and begins to show star direction + 180 degrees. Around 45 degrees tilt geolocation heading becomes very random and I would be very grateful for a suggested algorithm to eliminate the randomness of this phase shift.

Related

Pixel art not drawing properly on screen when in motion

When camera zoom is 1f
When camera zoom is 1.31f (view is distorted)
The reason it's like this is because I'm using the nearest filter. I have to use nearest filter for pixel art.
I want the map to look properly at different zooms.
in first video, 1 unit equals 4 pixels(world is 320x180, screen is 1280x720) and there is no problem as there is integer scaling.
but since I use zoom it is not possible to always keep the scale at the integer number.
Any ideas on how to properly draw pixel art with libgdx?

Pan and Zoom different objects at the same time - Gestouch. AS3

I'm using gestouch and it works great, but I cannot quite get it working as needed. I have two touch areas on screen - sprites. The first area controls rotation and zoom/scale of a 3D earth. The second controls panning of a small object. I can pan both areas at the same time, using two hands, but if I am touching anywhere in the second area I'm not able to pinch zoom to scale the 3d earth. If I release my finger in the second area then the zoom gesture works fine.
This is for multiple people though... so really need full gesture support in multiple areas.

How to render a circular/radial progress bar in Libgdx?

For a game we develop with libgdx, we need to show the user the remaining time for making a move.
How can we render a circular progress bar which shows the remaining seconds?
In the following answer there is a javascript solution :
Circular / radial progress bar
Thanks.
First create a texture (region) with the full circular progress bar. Next deform a shape (mesh) made up of one or more triangles to fit the actual area which should be shown.
For this, think of a line from the center of the image to the bounds of the image. Calculate the intersection point (and "wall", i.e. left, right, top or bottom of the image) of the line at the given angle. This will give you the portion of the texture (region) that needs to be drawn.
For example, if the line at rest (angle is zero) crosses the bottom wall of the image at the middle, your image is square and you want to rotate clockwise, then everything between 45 and 135 degrees hits the left wall, between 135 and 225 degrees hits the top wall, and so on.
Now you have the shape, you'll need to express it in triangle. Or to maintain compatibility with libgdx's spritebatch, an even number of triangles. Make sure to update the U and V values according to the location of the vertex.
A simple implementation of this can be found over here: https://github.com/xoppa/world/blob/master/src/com/xoppa/android/misc/RadialSprite.java
You could use an OpenGL shader to generate a circular progress bar. Here is an animated timer that would be a good place to start: http://glsl.heroku.com/e#10201.0
However, I don't think there is any good Libgdx infrastructure for dropping in shaders like this. You would have to use the OpenGL APIs (see https://code.google.com/p/libgdx/wiki/OpenGLShader).

How accurate is the scale of Google Satellite Photos?

Given a particular zoom level, how accurate is the scale provided by the satellite view in google maps?
Can one use it to ~accurately determine the square footage of a given building in the picture?
Thanks.
The imagery is very accurate, and at the finest zoom levels (19 or 20), you will be able to perform area calculation with great precision. The location information in Google maps would definitely be more accurate than trying to get readings using a handheld GPS device (there are some app out there that let you walk around a perimeter setting waypoints, and then calculating the internal area based on those waypoints).
Here is a relatively painless utility that demonstrates this:
http://www.daftlogic.com/projects-google-maps-area-calculator-tool.htm
One issue if you are trying to calculate square footage using the imagery however would be determining the number of stories.
Not sure about the accuracy. At the 200 ft. zoom level I superimposed the scale over Rice Stadium in Houston and it shows the playing field as a little over 200 ft. long and 50 meters wide. That means the width is about right but the length is way off since the standard football field is 300 ft. long. Probably has something to do with the angle of the photo. If the satellite is directly overhead it's probably more accurate. Just a thought.
the graphic scale is not consistent as you zoom in and out.
I placed two zoom images into a CAD program and sized the images by measuring the graphic scale. I got two different sized maps.

How to overlay an image in Google Maps (v3) in a specific direction (bearing)?

I have an arrow image that I would like to put on a v3 Google Map and have it point to a specific direction (using bearing from a particular Lat/Long point). Is this possible?
Thanks.
There are two ways to tackle this:
Generate 360 arrow icons, each rotated by 1 degree, and then call the relevant one according to the direction required. You may want to call the arrows something like "arrow_123.png" to indicate 123 degrees.
You will often not require 1 degree precision. In that case you may want to generate just 36 icons at 10 degree increments, for example. Then simply use the icon that is closest to the nearest representation.
You can also use the HTML 5 canvas to rotate the icon by an arbitrary degree as in the following Stack Overflow post: Show wind direction on Google Maps. However note that this will not work in browsers that do not support the canvas element, such as Internet Explorer.