C# Class DistanceCalculator, gmap377_leathGloves_inc

Datei anzeigen Open project: bi3mer/gmap377_leathGloves_inc Class Usage Examples

Public Methods

Method Description
calculateHaverSineDistVector3 ( float radius, Vector3 pos1, Vector3 pos2 ) : float

Calculates the haver sine dist with vector3's.

euclidianDistance ( Vector3 pos1, Vector3 pos2 ) : float

Euclidians distance between pos1 and pos2

manhattanDistance ( Vector2 pos1, Vector2 pos2 ) : float

Manhattans distance between pos1 and pos2.

squareEuclidianDistance ( Vector3 pos1, Vector3 pos2 ) : float

Euclidian distance without square root

Private Methods

Method Description
convertVector3 ( float radius, Vector3 pos ) : Vector2

Convert vector3 to latitude and longitude degrees

haversineDist ( float radius, Vector2 pos1, Vector2 pos2 ) : float

Calculate haversine distance between pos1 and pos2 Found at http://forum.unity3d.com/threads/pathfinding-in-a-spherical-world.123161/ https://en.wikipedia.org/wiki/Haversine_formula

Method Details

calculateHaverSineDistVector3() public static method

Calculates the haver sine dist with vector3's.
public static calculateHaverSineDistVector3 ( float radius, Vector3 pos1, Vector3 pos2 ) : float
radius float Radius.
pos1 Vector3 Pos1.
pos2 Vector3 Pos2.
return float

euclidianDistance() public static method

Euclidians distance between pos1 and pos2
public static euclidianDistance ( Vector3 pos1, Vector3 pos2 ) : float
pos1 Vector3 Pos1.
pos2 Vector3 Pos2.
return float

manhattanDistance() public static method

Manhattans distance between pos1 and pos2.
public static manhattanDistance ( Vector2 pos1, Vector2 pos2 ) : float
pos1 Vector2 Pos1.
pos2 Vector2 Pos2.
return float

squareEuclidianDistance() public static method

Euclidian distance without square root
public static squareEuclidianDistance ( Vector3 pos1, Vector3 pos2 ) : float
pos1 Vector3
pos2 Vector3
return float