Real World Terrain  v4.1
InfinityCode.RealWorldTerrain.RealWorldTerrainUtils Class Reference

This class contains utility methods. More...

Static Public Member Functions

static float Angle2D (Vector2 point1, Vector2 point2)
 The angle between the two points in degree. More...
 
static float Angle2D (Vector3 point1, Vector3 point2)
 The angle between the two points in degree. More...
 
static float Angle2D (Vector3 point1, Vector3 point2, Vector3 point3, bool unsigned=true)
 The angle between the three points in degree. More...
 
static float Angle2DRad (Vector3 point1, Vector3 point2, float offset)
 The angle between the two points in radians. More...
 
static double Clamp (double n, double minValue, double maxValue)
 Clamps value between min and max and returns value. More...
 
static double Clip (double n, double minValue, double maxValue)
 Clamps a value between a minimum double and maximum double value. More...
 
static string ColorToHex (Color32 color)
 Gets Hex value of Color. More...
 
static Vector2 DistanceBetweenPoints (Vector2 point1, Vector2 point2)
 The distance between two geographical coordinates. More...
 
static void LatLongToMercat (ref double x, ref double y)
 Converts geographic coordinates to Mercator coordinates. More...
 
static void LatLongToTile (double dx, double dy, int zoom, out double tx, out double ty)
 Converts geographic coordinates to the index of the tile. What is the tiles, and how it works, you can read here: https://developers.google.com/maps/documentation/javascript/v2/overlays?csw=1#Google_Maps_Coordinates More...
 
static string TileToQuadKey (int x, int y, int zoom)
 Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx More...
 

Public Attributes

const float EARTH_RADIUS = 6371
 The radius of the Earth. More...
 
const int EQUATOR_LENGTH = 40075
 The length of the equator. More...
 
const int AVERAGE_TEXTURE_SIZE = 20000
 The average size of the texture of the tile. More...
 
const double DEG2RAD = Math.PI / 180
 Degrees-to-radians conversion constant. More...
 
const int DOWNLOAD_TEXTURE_LIMIT = 90000000
 Maximum the size of the download for Google Maps. More...
 
const int MAX_ELEVATION = 15000
 The maximum elevation in the world. More...
 
const short TILE_SIZE = 256
 Size of tile. More...
 
const int MB = 1048576
 The number of bytes in megabyte. More...
 
const float PI4 = 4 * Mathf.PI
 PI * 4 More...
 

Detailed Description

This class contains utility methods.

Member Function Documentation

◆ Angle2D() [1/3]

static float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Angle2D ( Vector2  point1,
Vector2  point2 
)
static

The angle between the two points in degree.

Parameters
point1Point 1
point2Point 2
Returns
Angle in degree

◆ Angle2D() [2/3]

static float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Angle2D ( Vector3  point1,
Vector3  point2 
)
static

The angle between the two points in degree.

Parameters
point1Point 1
point2Point 2
Returns
Angle in degree

◆ Angle2D() [3/3]

static float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Angle2D ( Vector3  point1,
Vector3  point2,
Vector3  point3,
bool unsigned  = true 
)
static

The angle between the three points in degree.

Parameters
point1Point 1
point2Point 2
point3Point 3
unsignedReturn a positive result.
Returns
Angle in degree

◆ Angle2DRad()

static float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Angle2DRad ( Vector3  point1,
Vector3  point2,
float  offset 
)
static

The angle between the two points in radians.

Parameters
point1Point 1
point2Point 2
offsetResult offset in degrees.
Returns
Angle in radians

◆ Clamp()

static double InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Clamp ( double  n,
double  minValue,
double  maxValue 
)
static

Clamps value between min and max and returns value.

Parameters
nValue
minValueMin
maxValueMax
Returns
Value in the range between the min and max.

◆ Clip()

static double InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.Clip ( double  n,
double  minValue,
double  maxValue 
)
static

Clamps a value between a minimum double and maximum double value.

Parameters
nValue
minValueMinimum
maxValueMaximum
Returns
Value between a minimum and maximum.

◆ ColorToHex()

static string InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.ColorToHex ( Color32  color)
static

Gets Hex value of Color.

Parameters
colorColor
Returns
Hex value

◆ DistanceBetweenPoints()

static Vector2 InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.DistanceBetweenPoints ( Vector2  point1,
Vector2  point2 
)
static

The distance between two geographical coordinates.

Parameters
point1Coordinate (X - Lng, Y - Lat)
point2Coordinate (X - Lng, Y - Lat)
Returns
Distance (km).

◆ LatLongToMercat()

static void InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.LatLongToMercat ( ref double  x,
ref double  y 
)
static

Converts geographic coordinates to Mercator coordinates.

Parameters
xLongitude
yLatitude

◆ LatLongToTile()

static void InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.LatLongToTile ( double  dx,
double  dy,
int  zoom,
out double  tx,
out double  ty 
)
static

Converts geographic coordinates to the index of the tile. What is the tiles, and how it works, you can read here: https://developers.google.com/maps/documentation/javascript/v2/overlays?csw=1#Google_Maps_Coordinates

Parameters
dxLongitude
dyLatitude
zoomZoom
txTile X
tyTile Y

◆ TileToQuadKey()

static string InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.TileToQuadKey ( int  x,
int  y,
int  zoom 
)
static

Converts tile index to quadkey. What is the tiles and quadkey, and how it works, you can read here: http://msdn.microsoft.com/en-us/library/bb259689.aspx

Parameters
xTile X
yTile Y
zoomZoom
Returns
Quadkey

Member Data Documentation

◆ AVERAGE_TEXTURE_SIZE

const int InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.AVERAGE_TEXTURE_SIZE = 20000

The average size of the texture of the tile.

◆ DEG2RAD

const double InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.DEG2RAD = Math.PI / 180

Degrees-to-radians conversion constant.

◆ DOWNLOAD_TEXTURE_LIMIT

const int InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.DOWNLOAD_TEXTURE_LIMIT = 90000000

Maximum the size of the download for Google Maps.

◆ EARTH_RADIUS

const float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.EARTH_RADIUS = 6371

The radius of the Earth.

◆ EQUATOR_LENGTH

const int InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.EQUATOR_LENGTH = 40075

The length of the equator.

◆ MAX_ELEVATION

const int InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.MAX_ELEVATION = 15000

The maximum elevation in the world.

◆ MB

const int InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.MB = 1048576

The number of bytes in megabyte.

◆ PI4

const float InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.PI4 = 4 * Mathf.PI

PI * 4

◆ TILE_SIZE

const short InfinityCode.RealWorldTerrain.RealWorldTerrainUtils.TILE_SIZE = 256

Size of tile.