Struct GlobalBounds
Creates min and max latitude and longitude to define an area. Mind that this area is not a square or a rectangle on the earth surface. However, smaller areas which are closer to the equator approximate a rectangular shape.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[Serializable]
public struct GlobalBounds
Constructors
GlobalBounds(double, double, double, double)
Initializes a new instance of the GlobalBounds class.
Declaration
public GlobalBounds(double xMin, double zMin, double xMax, double zMax)
Parameters
Type | Name | Description |
---|---|---|
double | xMin | The minimum X value. |
double | zMin | The minimum Z value. |
double | xMax | The maximum X value. |
double | zMax | The maximum Z value. |
Fields
Empty
Represents empty bounds (with max value being smaller than min values).
Declaration
public static readonly GlobalBounds Empty
Field Value
Type | Description |
---|---|
GlobalBounds |
XMax
The coordinate's maximum x-value.
Declaration
public double XMax
Field Value
Type | Description |
---|---|
double |
XMin
The coordinate's minimum x-value.
Declaration
public double XMin
Field Value
Type | Description |
---|---|
double |
ZMax
The coordinate's maximum z-value.
Declaration
public double ZMax
Field Value
Type | Description |
---|---|
double |
ZMin
The coordinate's minimum z-value.
Declaration
public double ZMin
Field Value
Type | Description |
---|---|
double |
Properties
Center
Gets the Vector3Double of the center of an area defined by GeoBounds.
Declaration
public GlobalPosition Center { get; }
Property Value
Type | Description |
---|---|
GlobalPosition |
Extents
Gets the extents of the bounds.
Declaration
public readonly Vector2 Extents { get; }
Property Value
Type | Description |
---|---|
Vector2 |
Radius
Gets the distance from the center of the square grid area to any one of its four edges.
Declaration
public float Radius { get; }
Property Value
Type | Description |
---|---|
float |
SquareExtents
Gets the extents as the edge length of the outermost square with the same center as the bounds.
Declaration
public float SquareExtents { get; }
Property Value
Type | Description |
---|---|
float |
Methods
Clamp(GlobalPosition)
Clamps a vector representing a position along the X and Z axes to lie within the bounds.
Declaration
public readonly GlobalPosition Clamp(GlobalPosition value)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | value | The position to clamp to within the bounds. |
Returns
Type | Description |
---|---|
GlobalPosition | A vector representing the clamped position. |
Clamp(ref double, ref double)
Clamps a position represented by the specified X and Y coordinates to lie within the bounds.
Declaration
public readonly void Clamp(ref double x, ref double z)
Parameters
Type | Name | Description |
---|---|---|
double | x | The X coordinate to clamp in-place. |
double | z | The Z coordinate to clamp in-place. |
ClipLine(GlobalPosition, GlobalPosition, List<GlobalPosition>)
Clips a line from P0 = (x0, y0) to P1 = (x1, y1) against a rectangle with diagonal from (xmin, ymin) to (xmax, ymax).
Declaration
public int ClipLine(GlobalPosition p0, GlobalPosition p1, List<GlobalPosition> result)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | p0 | The start position of the line. |
GlobalPosition | p1 | The end position of the line. |
List<GlobalPosition> | result | A list to be cleared and filled with two clipping points if the line intersects the rectangle. |
Returns
Type | Description |
---|---|
int | The number of returned points in the result list which is either 0 or 2. |
ComputeOuterGeoBounds(GeoCoordinate, out double, out double, out double, out double)
Computes the outer corners of geo bounds.
Declaration
[Pure]
public void ComputeOuterGeoBounds(GeoCoordinate pivot, out double minLatitude, out double maxLatitude, out double minLongitude, out double maxLongitude)
Parameters
Type | Name | Description |
---|---|---|
GeoCoordinate | pivot | The pivot. |
double | minLatitude | Min Latitude output. |
double | maxLatitude | Max Latitude output. |
double | minLongitude | Min Longitude output. |
double | maxLongitude | Max Longitude output. |
Contains(GlobalPosition)
States whether the given position is within these bounds.
Declaration
public readonly bool Contains(GlobalPosition position)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | position | The position to check. |
Returns
Type | Description |
---|---|
bool | Whether the given position lay within these bounds. |
Contains(double, double, GeoCoordinate)
States whether the given coordinate is within these bounds.
Declaration
public bool Contains(double latitude, double longitude, GeoCoordinate pivot)
Parameters
Type | Name | Description |
---|---|---|
double | latitude | The latitude to locate. |
double | longitude | The longitude to locate. |
GeoCoordinate | pivot | The pivot. |
Returns
Type | Description |
---|---|
bool | Whether the given coordinate lay within these bounds. |
Create(GeoCoordinate, params GeoCoordinate[])
Initializes a new instance of the GlobalBounds class.
Declaration
public static GlobalBounds Create(GeoCoordinate pivot, params GeoCoordinate[] coordinates)
Parameters
Type | Name | Description |
---|---|---|
GeoCoordinate | pivot | The pivot. |
GeoCoordinate[] | coordinates | A list of geo coordinates to wrap. |
Returns
Type | Description |
---|---|
GlobalBounds |
Create(GeoCoordinate, int, Vector2Int)
Initializes a new instance of the GlobalBounds class for a tile.
Declaration
public static GlobalBounds Create(GeoCoordinate pivot, int zoomLevel, Vector2Int tilePosition)
Parameters
Type | Name | Description |
---|---|---|
GeoCoordinate | pivot | The pivot. |
int | zoomLevel | The tile zoom level. |
Vector2Int | tilePosition | The tile position. |
Returns
Type | Description |
---|---|
GlobalBounds |
Create(GlobalPosition, float)
Initializes a new instance of the GlobalBounds class.
Declaration
public static GlobalBounds Create(GlobalPosition center, float extents)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | center | The bounds' center. |
float | extents | The bounds' extend. |
Returns
Type | Description |
---|---|
GlobalBounds |
Create(params GlobalPosition[])
Initializes a new instance of the GlobalBounds class.
Declaration
public static GlobalBounds Create(params GlobalPosition[] positions)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition[] | positions | A list of positions to wrap. |
Returns
Type | Description |
---|---|
GlobalBounds |
Create(IEnumerable<GlobalPosition>)
Initializes a new instance of the GlobalBounds class.
Declaration
public static GlobalBounds Create(IEnumerable<GlobalPosition> positions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<GlobalPosition> | positions | A list of positions to wrap. |
Returns
Type | Description |
---|---|
GlobalBounds |
Create(Vector2, float, GlobalPosition)
Initializes a new instance of the GlobalBounds class.
Declaration
public static GlobalBounds Create(Vector2 center, float squareExtents, GlobalPosition offset)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | center | The bounds' center. |
float | squareExtents | The bounds' square extents. |
GlobalPosition | offset | The offset in double precision. |
Returns
Type | Description |
---|---|
GlobalBounds |
DoublePositionAtUV(Vector2)
Locates the position of a given uv within the bounds.
Declaration
public GlobalPosition DoublePositionAtUV(Vector2 uv)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | uv | The position. |
Returns
Type | Description |
---|---|
GlobalPosition | The position at the given uv. |
Equals(GlobalBounds)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GlobalBounds other)
Parameters
Type | Name | Description |
---|---|---|
GlobalBounds | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GeoCoordinateAtUV(Vector2, GeoCoordinate)
Locates the position of a given uv within the bounds.
Declaration
public GeoCoordinate GeoCoordinateAtUV(Vector2 uv, GeoCoordinate pivot)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | uv | The position. |
GeoCoordinate | pivot | The pivot. |
Returns
Type | Description |
---|---|
GeoCoordinate | The geo coordinate at the given uv. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetRandomPoint(Random)
Returns a random point lying inside this bounding rectangle.
Declaration
public GlobalPosition GetRandomPoint(Random random)
Parameters
Type | Name | Description |
---|---|---|
Random | random | The random number generator to use. |
Returns
Type | Description |
---|---|
GlobalPosition | A random point in this bounding rectangle. |
Grow(double, double)
Grows the bounds along the X and the Z axis by the specified amounts.
Declaration
public readonly GlobalBounds Grow(double amountX, double amountZ)
Parameters
Type | Name | Description |
---|---|---|
double | amountX | The amount by which to grow the bounds along the X axis. |
double | amountZ | The amount by which to grow the bounds along the Z axis. |
Returns
Type | Description |
---|---|
GlobalBounds | The bounds grown by the specified amounts. |
Grow(double)
Grows the bounds along the X and the Z axis by the specified amount.
Declaration
public readonly GlobalBounds Grow(double amount)
Parameters
Type | Name | Description |
---|---|---|
double | amount | The amount by which to grow the bounds. |
Returns
Type | Description |
---|---|
GlobalBounds | The bounds grown by the specified amount. |
Overlaps(GlobalBounds)
States whether the given bounds overlaps with these bounds.
Declaration
public bool Overlaps(GlobalBounds other)
Parameters
Type | Name | Description |
---|---|---|
GlobalBounds | other | The bounds to check. |
Returns
Type | Description |
---|---|
bool | Whether the given bounds overlap with these bounds. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
UVAtDoublePose(GlobalPose)
Locates the uv of a given pose position within the bounds.
Declaration
public Vector2 UVAtDoublePose(GlobalPose pose)
Parameters
Type | Name | Description |
---|---|---|
GlobalPose | pose | The pose. |
Returns
Type | Description |
---|---|
Vector2 | The uv of a given pose position. |
UVAtDoublePosition(GlobalPosition)
Locates the uv of a given position within the bounds.
Declaration
[Pure]
public Vector2 UVAtDoublePosition(GlobalPosition position)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | position | The position. |
Returns
Type | Description |
---|---|
Vector2 | The uv of a given position. |
UVAtGeoCoordinate(GeoCoordinate, GeoCoordinate)
Locates the uv of a given coordinate within the bounds.
Declaration
public Vector2 UVAtGeoCoordinate(GeoCoordinate coordinate, GeoCoordinate pivot)
Parameters
Type | Name | Description |
---|---|---|
GeoCoordinate | coordinate | The coordinate to locate. |
GeoCoordinate | pivot | The pivot. |
Returns
Type | Description |
---|---|
Vector2 | The uv of a given coordinate. |
Operators
operator ==(GlobalBounds, GlobalBounds)
Declaration
public static bool operator ==(GlobalBounds left, GlobalBounds right)
Parameters
Type | Name | Description |
---|---|---|
GlobalBounds | left | |
GlobalBounds | right |
Returns
Type | Description |
---|---|
bool |
operator !=(GlobalBounds, GlobalBounds)
Declaration
public static bool operator !=(GlobalBounds left, GlobalBounds right)
Parameters
Type | Name | Description |
---|---|---|
GlobalBounds | left | |
GlobalBounds | right |
Returns
Type | Description |
---|---|
bool |