![]() |
[e xn y] Gurus? Triangulating place! ??
Hello men, I've been attempting to figure this out all however for some reason I'm perhaps not getting anywhere. My goal would be to just discover the middle of a number of latitudes and Longitudes. My luck has been tryed by me with a Centroid method but that created wound up moving out several which was somewhat off (it was greater than the rest of the points?). Does anybody have any suggestions or ideas? (In c# 2008) Code:
Code:
/** * Function to calculate the area of a, according to the algorithm * defined at http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/ * * @param polyLatLongs * array of LatLongs in the polygon * @return area of the polygon defined by pgLatLongs */ public static double GetArea( LatLong[] polyLatLongs) int i, j, n = polyLatLongs.Length; double area = 0; for (i = 0; i < n; i++) j = (i + 1) % n; area += polyLatLongs[i].X * polyLatLongs[j].Y; area -= polyLatLongs[j].X * polyLatLongs[i].Y; area /= 2.0; return (area ); /** * Function to calculate the center of mass for confirmed polygon, according * ot the algorithm defined at * http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/ * * @param polyLatLongs * array of LatLongs in the polygon * @return LatLong that's the center of mass */ public static LatLong centerOfMass( LatLong[] polyLatLongs) {double cx = 0, cy = 0; double area = GetArea( polyLatLongs ); // might change this to LatLong2D.Float if you like to make use of less storage int i, j, n = polyLatLongs.Length; double factor = 0; for (i = 0; i < n; i++) j = (i + 1) % cx,cy ); |
All times are GMT +1. The time now is 06:16 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2