![]() |
Online Maps v3
|
Helper class, which contains all the basic methods. More...
Static Public Member Functions | |
static float | Angle2D (Vector2 point1, Vector2 point2) |
The angle between the two points in degree. | |
static float | Angle2D (Vector3 point1, Vector3 point2) |
The angle between the two points in degree. | |
static double | Angle2D (double p1x, double p1y, double p2x, double p2y) |
The angle between the two points in degree. | |
static float | Angle2D (Vector3 point1, Vector3 point2, Vector3 point3, bool unsigned=true) |
The angle between the three points in degree. | |
static float | Angle2DRad (Vector3 point1, Vector3 point2, float offset=0) |
The angle between the two points in radians. | |
static float | Angle2DRad (float p1x, float p1z, float p2x, float p2z, float offset=0) |
The angle between the two points in radians. | |
static float | AngleOfTriangle (Vector2 A, Vector2 B, Vector2 C) |
Calculates the angle of a triangle in radians. | |
static double | Clip (double n, double minValue, double maxValue) |
Clamps a value between a minimum double and maximum double value. | |
static Vector2 | Crossing (Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4) |
Calculates the point of intersection between two line segments defined by the given Vector2 objects. | |
static T | DeepCopy< T > (object obj) |
Deep copy object. | |
static object | DeepCopy (object obj, Type targetType) |
Deep copy object. | |
static List< Vector2 > | DecodePolylinePoints (string encodedPoints) |
Converts Polyline to point list. | |
static List< OnlineMapsVector2d > | DecodePolylinePointsD (string encodedPoints) |
Converts Polyline to point list. | |
static void | Destroy (Object obj) |
Removes a gameobject, component or asset. | |
static Vector2 | DistanceBetweenPoints (Vector2 point1, Vector2 point2) |
The distance between two geographical coordinates. | |
static void | DistanceBetweenPoints (double x1, double y1, double x2, double y2, out double dx, out double dy) |
The distance between two geographical coordinates. | |
static double | DistanceBetweenPoints (double x1, double y1, double a1, double x2, double y2, double a2) |
The distance between two geographical coordinates with altitude. | |
static double | DistanceBetweenPoints (IEnumerable points, out double dx, out double dy) |
The distance between geographical coordinates. | |
static double | DistanceBetweenPointsD (Vector2 point1, Vector2 point2) |
The distance between two geographical coordinates. | |
static double | Dot (double lx, double ly, double rx, double ry) |
Calculates the dot product of two 2D vectors given their x and y components. | |
static T | FindObjectOfType< T > () |
Returns the first active loaded object of Type type. | |
static Vector2 | FixAngle (Vector2 v) |
Fix geographic coordinates. | |
static void | FlipNegative (ref Rect r) |
Flip the negative dimensions of the rect. | |
static void | GetCenterPointAndZoom (OnlineMapsMarkerBase[] markers, out Vector2 center, out int zoom, Vector2 inset=default(Vector2)) |
Get the center point and best zoom for the array of markers. | |
static void | GetCenterPointAndZoom (Vector2[] positions, out Vector2 center, out int zoom, Vector2 inset=default(Vector2)) |
Get the center point and best zoom for the array of coordinates. | |
static void | GetCoordinateInDistance (double lng, double lat, float distance, float angle, out double nlng, out double nlat) |
Given a start point, angle and distance, this will calculate the destination point travelling along a (shortest distance) great circle arc. | |
static Vector2 | GetIntersectionPointOfTwoLines (Vector2 p11, Vector2 p12, Vector2 p21, Vector2 p22, out int state) |
Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation. | |
static int | GetIntersectionPointOfTwoLines (float p11x, float p11y, float p12x, float p12y, float p21x, float p21y, float p22x, float p22y, out float resultx, out float resulty) |
Calculates the intersection point of two 2D lines defined by four coordinates, and returns a value indicating the state of the calculation. | |
static Vector2 | GetIntersectionPointOfTwoLines (Vector3 p11, Vector3 p12, Vector3 p21, Vector3 p22, out int state) |
Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation. | |
static Object | GetObject (int tid) |
Gets the object with the specified instance ID. | |
static void | GetValuesFromEnum (StringBuilder builder, string key, Type type, int value) |
Appends to a StringBuilder the names of the enumeration flags that are set in the given integer value. | |
static Color | HexToColor (string hex) |
Converts HEX string to color. | |
static bool | Intersect (Rect a, Rect b) |
Determines whether two rectangles intersect. | |
static bool | LineIntersection (Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2, out Vector2 out_intersection) |
Determines if two line segments intersect and returns the intersection point. | |
static bool | LineIntersection (float s1x, float s1y, float e1x, float e1y, float s2x, float s2y, float e2x, float e2y, out float intX, out float intY) |
Determines if two line segments intersect and returns the intersection point. | |
static bool | IsPointInPolygon (List< Vector2 > poly, float x, float y) |
Determines whether a point with the given coordinates is inside the specified polygon. | |
static bool | IsPointInPolygon (IEnumerable poly, double x, double y) |
Determines whether a point with the given coordinates is inside the specified polygon. | |
static bool | IsPointInPolygon (double[] poly, double x, double y) |
Determines whether a point with the given coordinates is inside the specified polygon. | |
static Vector2 | LatLongToMercat (float x, float y) |
Converts geographic coordinates to Mercator coordinates. | |
static void | LatLongToMercat (ref float x, ref float y) |
Converts geographic coordinates to Mercator coordinates. | |
static void | LatLongToMercat (ref double x, ref double y) |
Converts geographic coordinates to Mercator coordinates. | |
static double | Magnitude (double p1x, double p1y, double p2x, double p2y) |
Returns the length of vector. | |
static Vector2 | NearestPointStrict (Vector2 point, Vector2 lineStart, Vector2 lineEnd) |
Returns the nearest point on the segment. | |
static void | NearestPointStrict (double pointX, double pointY, double lineStartX, double lineStartY, double lineEndX, double lineEndY, out double nearestPointX, out double nearestPointY) |
Returns the nearest point on the segment. | |
static double | Repeat (double n, double minValue, double maxValue) |
Loops the value n, so that it is never larger than maxValue and never smaller than minValue. | |
static double | SqrMagnitude (double p1x, double p1y, double p2x, double p2y) |
Returns the square of the magnitude of the segment. | |
static string | StrReplace (string str, string[] origin, string[] replace) |
Replaces multiple values in a string. | |
static void | ThreadSleep (int millisecondsTimeout) |
The current thread sleeps for the specified number of milliseconds. | |
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. | |
static StringBuilder | TileToQuadKey (int x, int y, int zoom, StringBuilder quadKey) |
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. | |
static List< int > | Triangulate (List< Vector2 > points) |
Triangulates list of points. | |
static IEnumerable< int > | Triangulate (float[] points, int countVertices, List< int > indices) |
Triangulates points. | |
Static Public Attributes | |
static string | persistentDataPath |
The path to the persistent data. | |
const float | angleSecond = 1 / 3600f |
Arcseconds in meters. | |
const int | maxRaycastDistance = 100000 |
Maximal distance of raycast. | |
const double | R = 6371 |
Earth radius. | |
const double | Deg2Rad = Math.PI / 180 |
Degrees-to-radians conversion constant. | |
const double | Rad2Deg = 180 / Math.PI |
Radians-to-degrees conversion constant. | |
const int | mb = 1024 * 1024 |
Bytes per megabyte. | |
const float | pi4 = 4 * Mathf.PI |
PI * 4. | |
const short | tileSize = 256 |
Size of the tile texture in pixels. | |
const long | second = 10000000 |
The second in ticks. | |
const int | sqrTileSize = tileSize * tileSize |
tileSize squared, to accelerate the calculations. | |
Helper class, which contains all the basic methods.
|
static |
The angle between the two points in degree.
p1x | Point 1 X |
p1y | Point 1 Y |
p2x | Point 2 X |
p2y | Point 2 Y |
|
static |
The angle between the two points in degree.
point1 | Point 1 |
point2 | Point 2 |
|
static |
The angle between the two points in degree.
point1 | Point 1 |
point2 | Point 2 |
|
static |
The angle between the three points in degree.
point1 | Point 1 |
point2 | Point 2 |
point3 | Point 3 |
unsigned | Return a positive result. |
|
static |
The angle between the two points in radians.
p1x | Point 1 X |
p1z | Point 1 Z |
p2x | Point 2 X |
p2z | Point 2 Z |
offset | Result offset in degrees. |
|
static |
The angle between the two points in radians.
point1 | Point 1 |
point2 | Point 2 |
offset | Result offset in degrees. |
|
static |
Calculates the angle of a triangle in radians.
A | Point A |
B | Point B |
C | Point C |
|
static |
Clamps a value between a minimum double and maximum double value.
n | Value |
minValue | Minimum |
maxValue | Maximum |
|
static |
Calculates the point of intersection between two line segments defined by the given Vector2 objects.
p1 | The first endpoint of the first line segment. |
p2 | The second endpoint of the first line segment. |
p3 | The first endpoint of the second line segment. |
p4 | The second endpoint of the second line segment. |
|
static |
Converts Polyline to point list.
encodedPoints | The encoded polyline. |
|
static |
Converts Polyline to point list.
encodedPoints | The encoded polyline. |
|
static |
Deep copy object.
obj | Object to copy |
targetType | Type of target object |
ArgumentException | If the object is not serializable. |
|
static |
Deep copy object.
obj | Object to copy |
T | Type of target object |
|
static |
Removes a gameobject, component or asset.
obj | The object to destroy. |
|
static |
The distance between two geographical coordinates with altitude.
x1 | Longitude 1 |
y1 | Latitude 1 |
a1 | Altitude 1 (km) |
x2 | Longitude 2 |
y2 | Latitude 2 |
a2 | Altitude 2 (km) |
|
static |
The distance between two geographical coordinates.
x1 | Longitude 1. |
y1 | Latitude 1. |
x2 | Longitude 2. |
y2 | Latitude 2. |
dx | Distance longitude (km). |
dy | Distance latitude (km). |
|
static |
The distance between geographical coordinates.
points | IEnumerate of double, float, Vector2 or Vector3 |
dx | Distance longitude (km). |
dy | Distance latitude (km). |
|
static |
The distance between two geographical coordinates.
point1 | Coordinate (X - Lng, Y - Lat) |
point2 | Coordinate (X - Lng, Y - Lat) |
|
static |
The distance between two geographical coordinates.
point1 | Coordinate (X - Lng, Y - Lat) |
point2 | Coordinate (X - Lng, Y - Lat) |
|
static |
Calculates the dot product of two 2D vectors given their x and y components.
lx | The x-component of the first vector. |
ly | The y-component of the first vector. |
rx | The x-component of the second vector. |
ry | The y-component of the second vector. |
|
static |
Returns the first active loaded object of Type type.
T | The type of object to find. |
T | : | Object |
|
static |
Fix geographic coordinates.
v | Coordinates for fix. |
|
static |
Flip the negative dimensions of the rect.
r | Rect. |
|
static |
Get the center point and best zoom for the array of markers.
markers | Array of markers. |
center | Center point. |
zoom | Best zoom. |
inset | Inset for finding a cropped zoom level. |
|
static |
Get the center point and best zoom for the array of coordinates.
positions | Array of coordinates |
center | Center coordinate |
zoom | Best zoom |
inset | Inset for finding a cropped zoom level. |
|
static |
Given a start point, angle and distance, this will calculate the destination point travelling along a (shortest distance) great circle arc.
lng | Longitude of start point |
lat | Latitude of start point |
distance | Distance (km) |
angle | Angle, clockwise from north (degree) |
nlng | Longitude of destination point |
nlat | Latitude of destination point |
|
static |
Calculates the intersection point of two 2D lines defined by four coordinates, and returns a value indicating the state of the calculation.
p11x | The x-coordinate of the first point on the first line. |
p11y | The y-coordinate of the first point on the first line. |
p12x | The x-coordinate of the second point on the first line. |
p12y | The y-coordinate of the second point on the first line. |
p21x | The x-coordinate of the first point on the second line. |
p21y | The y-coordinate of the first point on the second line. |
p22x | The x-coordinate of the second point on the second line. |
p22y | The y-coordinate of the second point on the second line. |
resultx | An output parameter that will contain the x-coordinate of the intersection point if the calculation is successful, otherwise zero. |
resulty | An output parameter that will contain the y-coordinate of the intersection point if the calculation is successful, otherwise zero. |
|
static |
Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.
p11 | The first point on the first line. |
p12 | The second point on the first line. |
p21 | The first point on the second line. |
p22 | The second point on the second line. |
state | The state of the calculation. |
|
static |
Calculates the intersection point of two 2D lines defined by two points each, and returns a value indicating the state of the calculation.
p11 | The first point on the first line. |
p12 | The second point on the first line. |
p21 | The first point on the second line. |
p22 | The second point on the second line. |
state | The state of the calculation. |
|
static |
Gets the object with the specified instance ID.
tid | The instance ID of the object. |
|
static |
Appends to a StringBuilder the names of the enumeration flags that are set in the given integer value.
builder | The StringBuilder to append to. |
key | The key to append to the StringBuilder before the enumeration value(s). |
type | The Type of the enumeration. |
value | The integer value representing the enumeration flags to check. |
|
static |
Converts HEX string to color.
hex | HEX string |
|
static |
Determines whether two rectangles intersect.
a | The first rectangle. |
b | The second rectangle. |
|
static |
Determines whether a point with the given coordinates is inside the specified polygon.
poly | Array of vertices that define the polygon. |
x | The x-coordinate of the point to check. |
y | The y-coordinate of the point to check. |
|
static |
Determines whether a point with the given coordinates is inside the specified polygon.
poly | IEnumerable of vertices that define the polygon. Can be Vector2, float, double or OnlineMapsVector2d. |
x | The x-coordinate of the point to check. |
y | The y-coordinate of the point to check. |
|
static |
Determines whether a point with the given coordinates is inside the specified polygon.
poly | The list of vertices that define the polygon. |
x | The x-coordinate of the point to check. |
y | The y-coordinate of the point to check. |
|
static |
Converts geographic coordinates to Mercator coordinates.
x | Longitude |
y | Latitude |
|
static |
Converts geographic coordinates to Mercator coordinates.
x | Longitude |
y | Latitude |
|
static |
Converts geographic coordinates to Mercator coordinates.
x | Longitude |
y | Latitude |
|
static |
Determines if two line segments intersect and returns the intersection point.
s1x | The x-coordinate of the starting point of the first line segment. |
s1y | The y-coordinate of the starting point of the first line segment. |
e1x | The x-coordinate of the ending point of the first line segment. |
e1y | The y-coordinate of the ending point of the first line segment. |
s2x | The x-coordinate of the starting point of the second line segment. |
s2y | The y-coordinate of the starting point of the second line segment. |
e2x | The x-coordinate of the ending point of the second line segment. |
e2y | The y-coordinate of the ending point of the second line segment. |
intX | The x-coordinate of the intersection point if the line segments intersect, otherwise 0. |
intY | The y-coordinate of the intersection point if the line segments intersect, otherwise 0. |
summary> Returns the intersection point of two line segments, represented by their endpoints, or Vector2.zero if the segments do not intersect. /summary> param name="p1">The first endpoint of the first line segment
param name="p2">The second endpoint of the first line segment
param name="p3">The first endpoint of the second line segment
param name="p4">The second endpoint of the second line segment
returns>The intersection point of the two line segments, or Vector2.zero if the segments do not intersect
|
static |
Determines if two line segments intersect and returns the intersection point.
start1 | The starting point of the first line segment. |
end1 | The ending point of the first line segment. |
start2 | The starting point of the second line segment. |
end2 | The ending point of the second line segment. |
out_intersection | The intersection point if the line segments intersect, otherwise Vector2.zero. |
|
static |
Returns the length of vector.
p1x | Point 1 X |
p1y | Point 1 Y |
p2x | Point 2 X |
p2y | Point 2 Y |
|
static |
Returns the nearest point on the segment.
pointX | Point X |
pointY | Point Y |
lineStartX | Start X of the segment |
lineStartY | Start Y of the segment |
lineEndX | End X of the segment |
lineEndY | End Y of the segment |
nearestPointX | Nearest point X |
nearestPointY | Nearest point Y |
|
static |
Returns the nearest point on the segment.
point | Point |
lineStart | Start of the segment |
lineEnd | End of segment |
|
static |
Loops the value n, so that it is never larger than maxValue and never smaller than minValue.
n | Value |
minValue | Minimum value |
maxValue | Maximum value |
|
static |
Returns the square of the magnitude of the segment.
p1x | Point 1 X |
p1y | Point 1 Y |
p2x | Point 2 X |
p2y | Point 2 Y |
|
static |
Replaces multiple values in a string.
str | Input string |
origin | Values to be replaced |
replace | Values to replace |
|
static |
The current thread sleeps for the specified number of milliseconds.
millisecondsTimeout | number of milliseconds |
|
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.
x | Tile X |
y | Tile Y |
zoom | 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.
x | Tile X |
y | Tile Y |
zoom | Tile Zoom |
quadKey | StringBuilder where to write quadKey |
|
static |
Triangulates points.
points | An array of points containing the values [x, y, x, y...] | ||
countVertices | Number of vertices to be triangulated/param>
|
|
static |
Triangulates list of points.
points | List of points |