How can I find radius from center in MKMapView in iphone programming? - mkmapview

I have to send radius to web-service and it will return the data of stores back to iPhone. It is pretty good when I am sending radius as digit such as 45, 60, or whatsoever, but what if I am on map and want longitude and latitude from map and want to know radius of visible area?
I am visible MKMapView, and I want radius from center of visible area, what can I do to achieve it?

Related

Autodesk Maya per pixel surface position and normals through whole scene

how can I get in maya per pixel all surface positions and normals of the entire scene.
I don't want to stop at the first viewed surface of the camera. I need to get information about all object. I want to traverse the whole scene
For example a cube is in front of the sphere. The camera position just shows the cube - the sphere gets at that camera position by the cube. My output of every pixel position of my camera rendered image data gives me information of the surface position in world space and the normal of the cube at the first hit. Then again for the other side of the cube. Then the two surfaces of the sphere.
How can that be achieved?
Thanks

How to draw 2D circle in irrlicht

Is there a way to draw a simple circle with given radius and center point in irrlicht?
You can use driver->draw2DPolygon() method.
Simply pass vertexCount to be high enough for your size of shape (the smaller circle on the screen, the lower value you can pass and it won't be noticeable that it has edges).

How to determine the radius of a circle from the scale of the sprite?

I am making this game where a sprite of a circle( origin set at the center of the sprite) is being up-scaled and rotated simultaneously. What I need to determine is the change in the radius of the circle in relation to scaling.How do I go about doing that? What exactly does scaling do? I mean what does 2x scale mean? does it mean my sprite has twice the area than previous? Btw , I am using LibGDX.
I figured it out myself.The problem was that the bounding rectangle of a sprite changes in size as the sprite is being rotated.So the raidous of the circle can not be determined using the with of the rectangle at that time. What I found was that the width of the bounding rectangle is the product of the scale and the initial width .So I can calculate what the width would be at any instance from that even if the sprite is rotating. And I get the radius from that.

How do I access the 2D points rendered by direct3D?

This is my first direct3d program. I'm not even aware of keywords to search for. I have set up a simple 3D world and a camera. I need to get hold of the actual pixel coordinates rendered for a given camera position. I also need to know which 3D points, the points in screen-space map to.
As of now, my code calls:
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertexBuffer.VertexCount, 0, indexBuffer.IndexCount / 3);
and this call is a blackbox to me. My problem would be solved, if this call would just return a list of 2D points in screen space that correspond to the vertices that I'm passing to it.
If there is no way of doing what I'm looking for, what is the closest thing to this that I can get?
For each vertex you are rendering, you can apply it with the world, view and projection matrix to get the protective points on the screen. By the way, why do you need the screen points?

Terrain tile scale in case of tilted camera

I am working on 3d terrain visualization tool right now. Surface is logically covered with square tiles. This tiling could be visualized as follows:
Suppose I want to draw a picture on these tiles. The level of detail for a picture is required to be selected according to the current camera scale which is calculated for each tile individually.
In case of vertical camera (no tilt, i.e. camera looks perpendicularly on the ground) all tiles have the same scale which is camera focal length divided on camera height above the ground.
Following picture depicts the situation:
where red triangle is camera which has no tilt, BG is camera height above the ground and EG is focal length, then scale = AC/DF = BG/EG
But if camera has tilt (i.e. pitch angle isn't 0) then scale is changed from tile to tile (even from point to point).
So I wonder if there any kind method to produce reasonable scale for each tile in that case ?
There may be (there almost surely is) a more straightforward solution, but what you could do is regular world to screen coordinate conversion.
You just take the coordinates of bounding points of the tile and calculate to which pixels on the screen these will project (you of course get floating point precision). From this, I believe you can calculate the "scale" you are mentioning.
This is applicable to any point or set of points in the world space.
Here is tutorial on how to do this "by hand".
If you are rendering the tiles with OpenGL or DirectX, you can do this much easier.

Resources