## coordinates

### How do you follow DRY with code using x-y coords?

How would you get the dreamed DRY ideal in this sample, in the language of your choice: drawLine(Point(0, 0), Point(w, 0)); int curRowY = 0; for(int row=0; row<rowHeights.size(); row++) { curRowY += rowHeights[row]; drawLine(Point(0, curRowY), Point(w, curRowY)); } drawLine(Point(0, 0), Point(0, h)); int curColX = 0; for(int col=0; c...

### Can I limit users to a specific range and zoom level on Google Maps?

I'm implementing a Google Map on a web-page. For the purpose of this project, I want to limit how far users can drag the map, so that they can only view a certain area that falls within two co-ordinates (one specifies north-west, the other, south-east, if you get my meaning). What's the best way to implement this using the Google Maps A...

### Looking for a radial coordinates description of gear teeth.

I don't need a physically accurate function, but something that hints at the involute curves, etc. I was just using r = 2 + sin^2, which gets the idea across, but it looks like - ahem. Googling around, you can find plenty of information on how to draft a 'correct' gear, but nothing in the way of a bare-bones approximation. EDIT: The ...

### Cocoa/OpenGL coordinate transformations

I'm trying to plot some data by timestamp in a NSOpenGLView. I also want to overlay some non-openGL Cocoa elements above the data, such as highlighting boxes. My difficulty is in getting the coordinate systems to line up. My data's timestamps are in seconds since the epoch. The values run from -2 to 2. I can plot the raw data without to...

### Convert OSGB 36 co-ordinates to Latitude/Longitude

I want to convert British OSGB 36 co-ordinates to WGS 84 (i.e. "standard" latitude and longitude), in order to plot them into a KML file for Google Earth. What would be the best way to go about this? I'm implementing in VB .NET. I should probably add that my question is not "How do I write a KML file?". My question is "How do I convert...

### Geoalgorithm for finding coordinates of point from a known location by distance and bearing

I'd like to use Google maps static API to display a map with a path overlay indicating a boundary. AFAICT the static API doesn't support polygons, so I intend to circumvent this by drawing the boundary using paths. To do this I need to determine the points to draw the straight lines (paths) between; so I'd like an algorithm that return...

### Covering Earth with Hexagonal Map Tiles

Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with the traditional geographic system (longitude/latitude). I think it would be interesting t...

### Finding Cities within 'X' Kilometers (or Miles)

This may or may not be clear, leave me a comment if I am off base, or you need more information. Perhaps there is a solution out there already for what I want in PHP. I am looking for a function that will add or subtract a distance from a longitude OR latitude value. Reason: I have a database with all Latitudes and Longitudes in it ...

### Convert string to CLLocationCoordinate2D

Hi all, I have an array with NSString's in it. Some of these are latitude and longitudes and I need to use this with the below code. The latText and lonText are my strings that I am trying to use as co-ordinates.... CLLocationCoordinate2D pinlocation=mapView.userLocation.coordinate; pinlocation.latitude = latText; pinlocation...

### Storing and Querying GPS Coordinates Effectively

I want to create a large database of GPS coordinates that can be queried by saying "Return all coordinates that are within 'n' metres of [this coordinate]". I need it to be as efficient as possible so looping through all the coordinates in the database and calculating whether a coordinate is within 'n' metres wouldn't be a desired solut...

### Calculating coordinates given a bearing and a distance

I am having problems implementing the function described here here. This is my Java implementation: private static double[] pointRadialDistance(double lat1, double lon1, double radianBearing, double radialDistance) { double lat = Math.asin(Math.sin(lat1)*Math.cos(radialDistance)+Math.cos(lat1) *Math.sin(radialDistance)*Math.co...

### Drawing part of a Bézier curve by reusing a basic Bézier-curve-function?

Assuming I'm using some graphic API which allows me to draw bezier curves by specifying the 4 necessary points: start, end, two control points. Can I reuse this function to draw x percent of the 'original' curve (by adjusting the control points and the end point)? Or is it impossible? Unnecessary information, should someone care: ...

### Java String from Map of X-Y Coordinates

Hello, I have a Map where Coords is defined as so: class Coords { int x; int y; public boolean equals(Object o) { Coords c = (Coords)o; return c.x==x && c.y==y; } public Coords(int x, int y) { super(); this.x = x; this.y = y; } public int hashCode() { return new Inte...

### Ordering coordinates problem (QUESTION FROZEN)

Thanks for all your help on this question but your answers and thoughts have made us think about our problem even more and we cannot agree on what the problem criteria shoudld be - dont put any more answers for now - but watch this space and we will get back to you...Cheers Have been scatching my head about this - and I reckon it's simp...

### Generating the function of the plane/surface that a given set of coordinates lie on...

This is something related with Mathematics as well. But this is useful in computing as well. Lets say you have 10 coordinates. (x1,y1)(x2,y2)..... in 2D Space. (i.e on a X-Y Plane). Can we find a single smooth curve going across the each coordinate. While expanding the question, If the space is 3D, then can we find an equation of a sm...

### Change the origin of the canvas

Hi everyone I'm developing a mapping software. Coordinates are plotted with respect to some point (origin) inside the canvas, not the default origin, so the canvas is divided into four quadrants. The mouse hovers over the canvas and the labels are updated to show the current mouse position inside the canvas of course with appropiate sig...

### X/Y Coordinates of Click on an Image in a Windows Forms Application (.net)

Is there a way to tell what x/y coordinates were clicked in a FORMS application? ...

### Clustering Coordinates on Server Side

What is the most efficient way of clustering coordinates on the server side? Examples? Here is an example of exactly what I need (although I can't use third party vendors) http://www.crunchpanorama.com/ PostgreSQL, Python platform, Google Maps. ...

### How do I convert these coordinates to google maps readable coordinates?

HI guys, Take a look at the map coordinates on this page. This is linked in from Wikipedia and the coordinates are passed the query string. I'm not sure of teh actual terms for this but How do I convert the coordinates as they are noted as: 37° 14′ 6″ N, 115° 48′ 40″ W Into as so.. 37.235, -115.811111 ...a format which is readable by...

### Matrix transforms; concepts and theory, are there any free resources for learning practically?

I've been having fun rendering charts and graphs from co-ordinates lately, and I'm fascinated by using matrices to transform co-ordinate spaces. I've been able to successfully scale and invert 2 dimensional co-ordinate spaces, but now my appetite is whetted. :) Where can I go for clear, informative, (free), educational material on matr...