Coordinate

public class Coordinate : Navigatable, Focusable, Indexed, Deserializable
extension Coordinate: Hashable
extension Coordinate: Position

A coordinate represents a 3-dimensional position that is in reference to a a specific Map’s origin. A Coordinate is different from just a vector in the way that it is tagged to only pertain to a single map.

  • a convenience way to get the XY coordinate from the position vector

    Declaration

    Swift

    public var vector2: Vector2 { get }
  • x

    a convenience way to get the X coordinate from the position vector

    Declaration

    Swift

    public var x: Float { get }
  • y

    a convenience way to get the Y coordinate from the position vector

    Declaration

    Swift

    public var y: Float { get }
  • z

    a convenience way to get the Z coordinate from the position vector

    Declaration

    Swift

    public var z: Float { get }
  • The location of the map relative to a Map’s origin.

    Declaration

    Swift

    public var vector: Vector3 { get }
  • Venue that this coordinate belongs to

    Declaration

    Swift

    public weak var venue: Venue? { get set }
  • map

    Map that this coordinate belongs to

    Declaration

    Swift

    public var map: Map { get }
  • Initialize a Coordinate adhering the Deserializable protocol

    Declaration

    Swift

    public required init(from buffer: inout BinaryDecoder) throws
  • Initialize a Coordinate using a Core location coordinate. this requires the addition of a Map object to make sure the location is bound correctly to a floor on a venue.

    Declaration

    Swift

    public init(location: CLLocationCoordinate2D, map: Map)
  • Initialize a Coordinate using a Vector3 and a Map.

    Declaration

    Swift

    public init(vector: Vector3, map: Map)
  • Returns the Core Location coordinate for this Coordinate

    Declaration

    Swift

    public func toCLLocation() -> CLLocationCoordinate2D
  • Returns the 2D euclidean distance in meters from this Coordinate to another Coordinate.

    Declaration

    Swift

    public func meters(from coordinate: Coordinate) -> Float

    Parameters

    coordinate

    The other coordinate in the distance calculation

  • Returns the 2D euclidean distance in meters from this Coordinate to the closest point on the edge of a Polygon. If negative the Coordinate is inside the Polygon, if positive the Coordinate is outside.

    Declaration

    Swift

    public func meters(from polygon: Polygon) -> Float

    Parameters

    polygon

    The polygon to be used in the distance calculation

  • Returns the 2D euclidean distance in meters from this Coordinate to the closest point on a path represented by an array of Coordinate line segments.

    Declaration

    Swift

    public func meters(from path: [Coordinate]) -> Float

    Parameters

    path

    An array of Coordinates that make up the line segments of the path

  • Returns a Coordinate that is the closest point on a line segment to this Coordinate.

    Declaration

    Swift

    public func closestPointOnPathSegment(from p1: Vector2, to p2: Vector2) -> Coordinate
  • Returns true if the Coordinate is inside the polygon in 2D space. Returns false if outside.

    Declaration

    Swift

    public func isInside(_ polygon: Polygon) -> Bool

    Parameters

    polygon

    The polygon to be used in the bounds calculation