Thursday, April 12, 2007

Ok,  I've got a rudimentary tester now built to work out when we enter a GeoFence.

My maths, is only GCSE standard so,  I'm a little rusty on doing this kind of thing.    So my thoughts for a simple circular fence,   working out when we're inside is just a basic collision detection algorithm.    This bit of C# is what I've come up with  and seems to work.

 

using System;
using System.Text;

namespace GeoFenceProximity
{

 

 

public class LatLong
{

public double Latitude = 0;
public double Longitude = 0;

public LatLong(double Latitude, double Longitude)
{
this.Latitude = Latitude;
this.Longitude = Longitude;
}
}

public class GeoFence
{

private LatLong centerpoint = null;
private double radius = 0;

public double Radius
{
get { return radius; }
set { radius = value; }
}

public LatLong Centerpoint
{
get { return centerpoint; }
set { centerpoint = value; }
}

/// <summary>
/// checks if we are in our fence or not
/// </summary>
/// <param name="tescordinates"></param>
/// <returns></returns>
public bool TestProximity(LatLong tescordinates)
{
double x1,x2,y1,y2;

if (tescordinates.Longitude > centerpoint.Longitude)
{
x2=tescordinates.Longitude;
x1=centerpoint.Longitude;
}
else
{
x1=tescordinates.Longitude;
x2=centerpoint.Longitude;
}

if (tescordinates.Latitude > centerpoint.Latitude)
{
y2=tescordinates.Latitude;
y1=centerpoint.Latitude;
}
else
{
y1=tescordinates.Latitude;
y2=centerpoint.Latitude;
}
return (Math.Sqrt((x2 - x1) + (y2 - y1) ) < radius) ;
}

public GeoFence()
{
}
}
}

 

/// this is the calling bit of code - from a console application

 

 

using System;
using System.Collections.Generic;
using System.Text;

namespace GeoFenceProximity
{
class Program
{
static void Main(string[] args)
{
GeoFence gf = new GeoFence();
gf.Centerpoint = new LatLong(52.262573, 0.19683);
gf.Radius = .0005;

// outside fence
bool blret=gf.TestProximity(new LatLong(52.262573, 1.19683));

 

// inside fence
blret=gf.TestProximity(new LatLong(52.262573, 0.19683));


}
}
}

 

 

Please feel free to let me know what you think.     Obviously testing your location against lot GeoFences is going to be computationally intensive.   I suggest if this works to use some form of grid system to only do the computation for GeoFences known to be in your locality (but that's another exercise)

 

Anyway, hopefully that gives you the basic building blocks to build GeoFenced applications.   Every day's a school day they say...

Thursday, April 12, 2007 7:15:17 PM UTC  #    Comments [0]  |  Tracked by:
http://9lm-free-porn.info/38012010/intelligence-picture.html [Pingback]
http://9lo-free-porn.info/41725338/rakuen-baby.html [Pingback]
http://9lm-free-porn.info/46227739/index.html [Pingback]
http://9lr-free-porn.info/44442076/index.html [Pingback]
http://9lp-free-porn.info/69836988/banana-blowjobs.html [Pingback]
http://9lq-free-porn.info/76294710/massage-parlors-california-the-erotic-review.... [Pingback]
http://9ls-free-porn.info/16647510/alugar-apartamento-pico.html [Pingback]
http://9lm-free-porn.info/47917652/hydroxycut-hardcore-sydney.html [Pingback]
http://9lp-free-porn.info/12461519/index.html [Pingback]
http://9lq-free-porn.info/88377873/index.html [Pingback]
http://9lr-free-porn.info/67802463/index.html [Pingback]
http://9lo-free-porn.info/92061481/index.html [Pingback]
http://9lq-free-porn.info/01923267/index.html [Pingback]
http://9lm-free-porn.info/96803140/index.html [Pingback]
http://9lr-free-porn.info/18703489/index.html [Pingback]
http://9ll-free-porn.info/61690658/index.html [Pingback]
http://9lm-free-porn.info/22869791/pictures-of-coffee-cups.html [Pingback]
http://9lm-free-porn.info/12545572/householdmasturbation-toys.html [Pingback]
http://9lq-free-porn.info/90002648/videos-by-shakira.html [Pingback]
http://9lt-free-porn.info/39386413/nylon-flight-jackets.html [Pingback]
http://9ll-free-porn.info/75127710/index.html [Pingback]
http://9lq-free-porn.info/69136614/index.html [Pingback]
http://9lp-free-porn.info/37486116/index.html [Pingback]
http://9lo-free-porn.info/86494322/tough-girl-smoking.html [Pingback]
http://9lr-free-porn.info/44442076/6x14-thumb-screw.html [Pingback]
http://9lm-free-porn.info/21928894/index.html [Pingback]
http://9ls-free-porn.info/64510499/index.html [Pingback]
http://9lm-free-porn.info/96461884/throat-fucked-sluts.html [Pingback]
http://9ll-free-porn.info/82930484/chaotropic-salt-nucleases.html [Pingback]
http://9lm-free-porn.info/82821506/index.html [Pingback]
http://9lq-free-porn.info/90002648/index.html [Pingback]
http://9ll-free-porn.info/96008654/index.html [Pingback]
http://9lr-free-porn.info/62393577/sex-models-girl.html [Pingback]
http://9lq-free-porn.info/69957287/index.html [Pingback]
http://9lm-free-porn.info/21970324/massage-parlour-in-bukit-bintang.html [Pingback]
http://9lq-free-porn.info/74569257/index.html [Pingback]
http://9lr-free-porn.info/16024404/index.html [Pingback]
http://9lr-free-porn.info/37946958/gossip-girl-books-synopsis.html [Pingback]
http://9ln-free-porn.info/62355932/index.html [Pingback]
http://9lt-free-porn.info/44587489/index.html [Pingback]
http://9lk-free-porn.info/29669628/index.html [Pingback]
http://9ln-free-porn.info/08396510/index.html [Pingback]
http://9lr-free-porn.info/90252032/index.html [Pingback]
http://9ls-free-porn.info/73245720/index.html [Pingback]
http://9nr-information.info/01396022/index.html [Pingback]

Comments are closed.

Theme design by Jelle Druyts

Pick a theme: