Snipplr
http://snipplr.com/tags/distance
Recent snippets posted on Snipplr.comen-usMon, 27 Feb 2017 17:52:29 GMT(Python) Work out distance (fill in the blanks) - kibrisli7
http://snipplr.com/view/177536/work-out-distance-fill-in-the-blanks/
Students work out the code by filling in the blanks.
They must work out how far a vehicle has travelled based on speed and time.
Students will fill in the blanks ]]>Thu, 15 Sep 2016 18:56:07 GMThttp://snipplr.com/view/177536/work-out-distance-fill-in-the-blanks/(PHP) Wordpress Query: Sort posts nearest proximity to farthest - JoshChris
http://snipplr.com/view/146463/wordpress-query-sort-posts-nearest-proximity-to-farthest/
A quick query example for a wordpress database query that gets posts ordered by distance via the custom fields `latitude` and `longitude`. ]]>Wed, 23 Mar 2016 16:08:00 GMThttp://snipplr.com/view/146463/wordpress-query-sort-posts-nearest-proximity-to-farthest/(PHP) Distance in SQLITE - brownrl
http://snipplr.com/view/100901/distance-in-sqlite/
This is damn crazy! sQlite does not have all the trig functions need to do distances. So here is how you load that into sQlite on the fly. ]]>Wed, 20 May 2015 01:54:01 GMThttp://snipplr.com/view/100901/distance-in-sqlite/(PHP) Miles to Latitude and Miles to Longitude Converter - VisionHive
http://snipplr.com/view/67019/miles-to-latitude-and-miles-to-longitude-converter/
There are tons of functions out there to calculate the distance between two points, but what if you know one point and want to calculate the latitude ("vertical") or longitude ("horizontal") equivalent of a fixed distance, in miles? An example application would be in generating a minimum & maximum latitude and longitude bounding box around an area to limit the results of a database query that uses distance from a fixed point. ]]>Sat, 01 Sep 2012 13:08:26 GMThttp://snipplr.com/view/67019/miles-to-latitude-and-miles-to-longitude-converter/(JavaScript) Check if coordinates are adjacent - hellowouter
http://snipplr.com/view/64354/check-if-coordinates-are-adjacent/
This function returns true if the two sets of coordinates are neighbors and false if they ar not. The function easily determines whether they are neighbors by looking at the distance between the positions along both axes, also callled the Manhattan distance. The sum of the two distances must be exactly 1 if the positions are adjacent.
Note: the coordinates should be integers ]]>Wed, 04 Apr 2012 19:25:53 GMThttp://snipplr.com/view/64354/check-if-coordinates-are-adjacent/(ActionScript 3) AS3 Get Point Using Polar Co-ordinates - adrianparr
http://snipplr.com/view/60222/as3-get-point-using-polar-coordinates/
This function returns a point object based upon the position, angle and distance of a starting point (polar co-ordinates). ]]>Thu, 27 Oct 2011 01:10:07 GMThttp://snipplr.com/view/60222/as3-get-point-using-polar-coordinates/(ActionScript 3) AS3 Getting the Distance Between Two Geographical Points - adrianparr
http://snipplr.com/view/58443/as3-getting-the-distance-between-two-geographical-points/
Full credit for this goes to Terrence Ryan who converted the JavaScript version to ActionScript. ]]>Mon, 05 Sep 2011 05:31:37 GMThttp://snipplr.com/view/58443/as3-getting-the-distance-between-two-geographical-points/(Objective C) How to find the distance between two CG points? - espinallab
http://snipplr.com/view/54359/how-to-find-the-distance-between-two-cg-points/
Distance between p1 and p2:
CGFloat xDist = (p2.x - p1.x);
CGFloat yDist = (p2.y - p1.y);
CGFloat distance = sqrt((xDist * xDist) + (yDist * yDist));
Background: Pythagorean theorem
Edit: if you only need to calculate if the distance between the points increases or decreases, you can omit the sqrt() which will make it a little faster. ]]>Wed, 25 May 2011 08:18:31 GMThttp://snipplr.com/view/54359/how-to-find-the-distance-between-two-cg-points/(ActionScript 3) AS3 Trails - onemanstudio
http://snipplr.com/view/53738/as3-trails/
AS3 Trails, just call checkDistance() during Your Tween ]]>Wed, 18 May 2011 17:34:03 GMThttp://snipplr.com/view/53738/as3-trails/(PHP) Calculate distances - ichnoweb
http://snipplr.com/view/51629/calculate-distances/
"Here is a very handy function, which calculate the distance from a point A to a point B, using latitudes and longitudes. The function can return the distance in miles, kilometers, or nautical miles." ]]>Wed, 06 Apr 2011 07:11:51 GMThttp://snipplr.com/view/51629/calculate-distances/(PHP) Get distance between 2 points - marzsman
http://snipplr.com/view/51533/get-distance-between-2-points/
Get the distance between 2 points on a map ]]>Mon, 04 Apr 2011 23:23:26 GMThttp://snipplr.com/view/51533/get-distance-between-2-points/(Python) Euclidean Distance - adkatrit
http://snipplr.com/view/48799/euclidean-distance/
]]>Fri, 11 Feb 2011 04:05:09 GMThttp://snipplr.com/view/48799/euclidean-distance/(JavaScript) Distance Between Two Points - parkerkrhoyt
http://snipplr.com/view/47207/distance-between-two-points/
This function will calculate the distance between two provided points. This is useful in game development when calculating paths of motion for sprites. The function expects two points to be provided. A point is defined as an object with an "x" and a "y" property. The result is a numeric value of the distance. ]]>Sun, 16 Jan 2011 04:24:08 GMThttp://snipplr.com/view/47207/distance-between-two-points/(ActionScript) Get vector distance - ricosushi
http://snipplr.com/view/37261/get-vector-distance/
Returns the distance from 2 points. ]]>Wed, 14 Jul 2010 07:30:43 GMThttp://snipplr.com/view/37261/get-vector-distance/(Objective C) Get the distance from the user's location to the venue - espinallab
http://snipplr.com/view/27707/get-the-distance-from-the-users-location-to-the-venue/
This is the code i wrote for clubplanet to get the distance from the user's location to the venues. ]]>Thu, 04 Feb 2010 16:51:20 GMThttp://snipplr.com/view/27707/get-the-distance-from-the-users-location-to-the-venue/(Other) OpenGL Distance to object - antonmills
http://snipplr.com/view/27077/opengl-distance-to-object/
Works out the distance between two objects in 3D space, you'll need the Vertex3D struct also in my snipppets ]]>Tue, 26 Jan 2010 05:00:15 GMThttp://snipplr.com/view/27077/opengl-distance-to-object/(JavaScript) Calculate distance between two points with latitude and longitude coordinates - ginoplusio
http://snipplr.com/view/25479/calculate-distance-between-two-points-with-latitude-and-longitude-coordinates/
This function calculates distance with the Haversine formula, this formula assumes that our Earth is spherical, but it isn’t since it’s more like a big orange fruit also compresses at poles. I’ve read that this function has an error about + o – 3 meters (it depends), but it’s a small error for many purposes. ]]>Sat, 26 Dec 2009 17:57:14 GMThttp://snipplr.com/view/25479/calculate-distance-between-two-points-with-latitude-and-longitude-coordinates/(JavaScript) Calculate distance on Google Map v3 with a ruler - ginoplusio
http://snipplr.com/view/25079/calculate-distance-on-google-map-v3-with-a-ruler/
I’ve made a ruler to measure distances on a Google Map V3. The file Ruler.js contains a two function: one to calculate the distance between two points on the map with their position expressed in decimal degrees, and one function that add the ruler. Ther “ruler” is composed with two markers, a poly and two labels which show the distance. Look the link for a working demo. ]]>Sat, 19 Dec 2009 14:03:48 GMThttp://snipplr.com/view/25079/calculate-distance-on-google-map-v3-with-a-ruler/(SQL) Calculating distance in Kilometres and Miles from Latitude and Longitude - zingo
http://snipplr.com/view/24082/calculating-distance-in-kilometres-and-miles-from-latitude-and-longitude/
Using SQL you can have your database return the distance between 2 sets of Lat and Long points, and using some math functions also take into account the curvature of the earth. ]]>Tue, 01 Dec 2009 20:22:06 GMThttp://snipplr.com/view/24082/calculating-distance-in-kilometres-and-miles-from-latitude-and-longitude/(C++) Mex Function for Mahalanobis Function - benjamin
http://snipplr.com/view/22115/mex-function-for-mahalanobis-function/
This code is a demonstration of writing mex functions using the armadillo scientific library. Please see my blog post for more details and leave comments there. ]]>Thu, 29 Oct 2009 16:20:43 GMThttp://snipplr.com/view/22115/mex-function-for-mahalanobis-function/