distance

CSS Set maximum distance from browser edge.

I've got my site content inside an 800px-wide div, I'd like that div to be centered on the page until the browser window width extends past certain distance. At that point, I'd like the content to "lock" into place and not continue to center itself, staying a fixed amount from the left edge. For example, if the viewers window is 900px w...

Comparing cross point between 2 images in MATLAB

Hello, I took 2 images with a cross point and now I'm trying to compare these 2 images and find out what is the distance and angle moved. How can I use MATLAB to do this? Thank you very much! ...

How to calculate distance between two places? Is there any service available by Google Map for iphone?

I want to put facility to display distance between two places selected by user. Is there any sample source code / service available to do so? Thanks in advance. ...

Avg distance between points in a cluster

Sounds like I got the concept but cant seems to get the implementation correct. eI have a cluster (an ArrayList) with multiple points, and I want to calculate avg distance. Ex: Points in cluster (A, B, C, D, E, F, ... , n), Distance A-B, Distance A-C, Distance A-D, ... Distance A,N, Distance (B,C) Distance (B,D)... Distance (B,N)... Tha...

How to determine 3D position of an object from perspective ?

I have a situation as shown in image, where I need to determine x,y of red and blue square in rectangular space but under perspective. Length and width of the rectangle are know. The rectangles are the same just viewed from different locations. Difference is that one is viewed with 90 degrees offset to the right of the rectangle. Tha...

Help me find the algorithm name - quantify difference between two words

I know there is an algorithm for seeing how "close" two words are together. The idea is that this algorithm adds 1 point to the score for every single letter addition or subtraction that is necessary to transform one word into the other. The lower this score, the "closer" the two words are together. For example, if we take the word "wor...

Optimized method for calculating cosine distance in Python

I wrote a method to calculate the cosine distance between two arrays: def cosine_distance(a, b): if len(a) != len(b): return False numerator = 0 denoma = 0 denomb = 0 for i in range(len(a)): numerator += a[i]*b[i] denoma += abs(a[i])**2 denomb += abs(b[i])**2 result = 1 - numerator / (sqrt(den...

Get polygons close to a lat,long in MySQL

Hi, does anyone know of a way to fetch all polgons in a MySQL db within a given distance from a point. The actual distance is not that important since it's calculated for each found polygon later, but it would be a hube optimization to just do that calculation for the polygons that are "close". I've looked at the MBR and contains func...

Distance formula in java printing NaN -- How do I fix this?

Okay, so I'm using the distance formula to print out the distance between two player objects from inside one of the player objects (With "other" being another Player object). How can I get it to just print the number without getting a "NaN"? System.out.println("D = " + Math.sqrt(Math.pow(x - other.x, 2) - Math.pow(-(y - other.y), 2)));...

How can I determine the distance between two sets of lattitude/longitude coordinates?

I am trying to write something that will determine the distance between to sets of lat/lon coordinates. I am using the following code which I found on this site: public static double distance (double lat1, double lon1, double lat2, double lon2) { double lat1 = Convert.ToDouble(latitude); double lon1 = Convert.ToDouble(longitud...

Query to return the rows that are within a certain geographic distance to a given row (using sql server 2008)

I have a table with multiple records, each contains a field called "coords". This field has been updated with a geography point. UPDATE testing SET [coords] = geography::Point(52.029736, -113.973541, 4326) WHERE id=2" What I need to do is... when a user is logged in, they have a record that belongs to them, for this example says its r...

Get the id of the next closest location

Hi. I have an application in which the user can select a location and view it's distance from several Points Of Interests (POIs). When I retrieve these distances, I would also like to retrieve the ID's of the locations that are the next closest and the next furthest away from each POI. eg. If we have 10 locations, each of them a mile f...

Modifying a Levenshtein distance function to calculate distance between two sets of x-y coordinates?

I've been trying to work on modifying a Levenshtein Distance function so that it can find the distance between two lines, or sets of x-y coordinates (in other words, how similar or different the lines are, not their geometric distance). I'm running into some problems though. I get how you take the value above to get deletion cost, and th...

Arranging objects

I have a group of objects (UIImageViews) in an array. I want to arrange them by yvalues. The greater the y value, the smaller the number in the array. So the one at the top of the page will be the first in the array and the one at the bottom is the last in the array. They move around so every second or so the array will have to be re-arr...

Is point A nearby point B in 3D - distance check

I am looking for efficent algorithm for checking if one point is nearby another in 3D. sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) < radius This doesn't seem to be too fast and actually I don't need such a big accuracy. How else could I do this? ...

Calculate distance between two x/y coordinates?

i would like to calculate the distance between two x/y coordinates. This calculation itself isn't that difficult, however I need the corners and sides of the grid to be 'connected'. This means on a grid of 500x500 that the point after 499 becomes 0 again. The distance between e.g. 0,0 and 0,495 should be 5 then. Is there any good mathe...

Find the first point along a heading that is a specified distance away from a line segment.

Hi, Given a starting point, a heading, a distance, and a line segment, find the first point along this heading that is the specified distance away from this line segment. I covered two cases, but I haven't been able to cover the last one. First case: heading away from the line. Ignore it even if the starting point is within the specifie...

Calculate second point knowing the starting point and distance

Hi, using a Latitude and Longitude value (Point A), I am trying to calculate another Point B, X meters away bearing 0 radians from point A. Then display the point B Latitude and Longitude values. Example (Pseudo code): PointA_Lat = x.xxxx; PointA_Lng = x.xxxx; Distance = 3; //Meters bearing = 0; //radians new_PointB = PointA-Distance;...

Cities Near By a City Webservice or PHP code

Hi All, I am building an application which takes 'City','State' ( For USA Only) and distance ( radius ) as user inputs and the output will be all the cities in that radius . Is there any free or paid web service available for this ? Thanks for your help Regards Kaveri ...

Moving between co-ordinates, Java Algorithms

Ok this question is going to be a little abstract. I have an icon moving along a line which is represented by a series of coordinates stored in a vector, and I am iterating through them. The distance between coordinates is variable. So sometimes the icon will move slowly and smoothly, and others it will jump several 100 pixels at a time...