C# Class DistanceCalculator, gmap377_leathGloves_inc

Afficher le fichier Open project: bi3mer/gmap377_leathGloves_inc Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat float

euclidianDistance() public static méthode

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

manhattanDistance() public static méthode

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

squareEuclidianDistance() public static méthode

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