Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SymbolicSpace<T>

A symbolic space can be used to indicate an abstract space with a boundary. It is an extended ReferenceSpace with boundaries.

About

A symbolic space is a ReferenceSpace, and is therefore not directly as a position. It indicates a symbolic space and provides several utilities. Both a hierarchical structure and graph connection can be used to connect symbolic spaces together.

Usage

Creation

Creating a symbolic space requires a generic position type. This type indicates how the symbolic position should be interpreted.

Optionally, the space can be initialized with a display name.

const lobby = new SymbolicSpace<Absolute2DPosition>("Main lobby");
const floor = new SymbolicSpace<Absolute2DPosition>("Floor 3");

Parent space

The parent space uses a wrapper for the ReferenceSpace.parentUID.

lobby.parent = floor;

In addition, the parent is also treated as the base reference space.

Creating boundaries

Boundaries can be set of a symbolic space. Both 2D and 3D polygons are supported.

// Triangle boundary
lobby.setBounds([
new Absolute2DPosition(2, 2),
new Absolute2DPosition(5, 5),
new Absolute2DPosition(8, 8)
]);

Positioning of boundaries is always relative to the parent (i.e. if the floor shifts position, you do not have to change the lobby boundaries).

Boundary utilities

Symbolic spaces provide several boundary utilities.

Checking if a position is inside a symbolic space

lobby.isInside(new Absolute2DPosition(4, 4)); // true
lobby.isInside(new Absolute2DPosition(1, 1)); // false

Centroid

The centroid is determined using the boundaries, this will be the position that is used.

AbsolutePosition to SymbolicSpace

Converting an absolute position to a symbolic space does not provide a single result. Similar to geocoders, the results are sorted based on their probability.

For this, we make use of the SymbolicSpaceService. This service acts as the data store for symbolic spaces.


SymbolicSpace to AbsolutePosition

Converting a symbolic space to a position uses the centroid that is calculated from the boundaries.

const object = new DataObject("mvdewync", "Maxim");
const position = lobby.toPosition();

Type parameters

  • T: AbsolutePosition

Hierarchy

Index

Constructors

Properties

centroid: AbsolutePosition
connectedSpaces: Map<Vector3, string> = ...
coordinates: Vector3[] = []
createdTimestamp: number

Created timestamp

displayName: string

Object display name

parentUID: string
positionConstructor: new () => T

Type declaration

    • new (): T
    • Returns T

priority: number = 0
uid: string

Object identifier

returns

Unique object identifier

Accessors

  • get boundaryType(): new () => T
  • get position(): AbsolutePosition
  • set position(position: AbsolutePosition): void
  • Get the current absolute position of the object relative to the global reference space

    Returns AbsolutePosition

    Absolute position of data object

  • Set the current absolute position of the object relative to the global reference space

    Parameters

    • position: AbsolutePosition

    Returns void

    Absolute position of data object

  • get relativePositions(): RelativePosition<any, Unit>[]
  • set relativePositions(relativePostions: RelativePosition<any, Unit>[]): void
  • Get relative positions

    Returns RelativePosition<any, Unit>[]

    Array of relative positions

  • Get relative positions

    Parameters

    • relativePostions: RelativePosition<any, Unit>[]

    Returns void

    Array of relative positions

  • get rotationQuaternion(): Quaternion
  • Returns Quaternion

  • get scaleMatrix(): Matrix4
  • Get the transformation matrix for scaling

    Returns Matrix4

    Transformation matrix

  • get transformationMatrix(): Matrix4
  • Returns Matrix4

Methods

  • addRelativePosition(relativePosition: RelativePosition<any, Unit>): SymbolicSpace<T>
  • Add a relative position to this data object

    Parameters

    • relativePosition: RelativePosition<any, Unit>

      Relative position to add

    Returns SymbolicSpace<T>

    Data object instance

  • Bind the data object to a service

    Parameters

    • service: DataService<string, SymbolicSpace<T>>

      Service to bind it to

    Returns DataObjectBinding<SymbolicSpace<T>>

    Data object binding with a service

  • Clone the data object

    Returns SymbolicSpace<T>

    Cloned data object

  • getBounds(): T[]
  • getPosition(referenceSpace?: TransformationSpace): AbsolutePosition
  • Get the current absolute position of the object

    Parameters

    • Optional referenceSpace: TransformationSpace

    Returns AbsolutePosition

    Position of the data object

  • getRelativePosition(referenceObjectUID: string, type?: string): RelativePosition<any, Unit>
  • Get relative position of a specified object

    Parameters

    • referenceObjectUID: string

      Reference object identifier

    • Optional type: string

      Constructor type of the relative position

    Returns RelativePosition<any, Unit>

    Relative position to reference object

  • getRelativePositions(referenceObjectUID?: string): RelativePosition<any, Unit>[]
  • Get relative positions for a different target

    Parameters

    • Optional referenceObjectUID: string

    Returns RelativePosition<any, Unit>[]

    Array of relative positions for the reference object

  • hasRelativePosition(referenceObjectUID: string): boolean
  • Parameters

    • referenceObjectUID: string

    Returns boolean

  • isInside(position: AbsolutePosition): boolean
  • Check if a position lies within a symbolic location

    Parameters

    • position: AbsolutePosition

      Absolute position to check

    Returns boolean

    Point inside boundaries

  • orthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): ReferenceSpace
  • Parameters

    • left: number
    • right: number
    • bottom: number
    • top: number
    • near: number
    • far: number

    Returns ReferenceSpace

  • perspective(left: number, right: number, bottom: number, top: number, near: number, far: number): ReferenceSpace
  • Transform perspective

    Parameters

    • left: number

      Farthest left on the x-axis

    • right: number

      Farthest right on the x-axis

    • bottom: number

      Farthest down on the y-axis

    • top: number

      Farthest up on the y-axis

    • near: number

      Distance to the near clipping plane along the -Z axis

    • far: number

      Distance to the far clipping plane along the -Z axis

    Returns ReferenceSpace

    Reference space instance

  • referenceUnit(unit: LengthUnit): ReferenceSpace
  • Parameters

    • unit: LengthUnit

    Returns ReferenceSpace

  • removeRelativePositions(referenceObjectUID: string): void
  • Parameters

    • referenceObjectUID: string

    Returns void

  • reset(): ReferenceSpace
  • Returns ReferenceSpace

  • rotation(r: Quaternion): ReferenceSpace
  • rotation(r: Euler): ReferenceSpace
  • rotation(r: AxisAngle): ReferenceSpace
  • rotation(r: { pitch: number; roll: number; unit?: AngleUnit; yaw: number }): ReferenceSpace
  • rotation(r: { order?: EulerOrder; unit?: AngleUnit; x: number; y: number; z: number }): ReferenceSpace
  • rotation(r: number[]): ReferenceSpace
  • Parameters

    • r: Quaternion

    Returns ReferenceSpace

  • Parameters

    • r: Euler

    Returns ReferenceSpace

  • Parameters

    • r: AxisAngle

    Returns ReferenceSpace

  • Parameters

    • r: { pitch: number; roll: number; unit?: AngleUnit; yaw: number }
      • pitch: number
      • roll: number
      • Optional unit?: AngleUnit
      • yaw: number

    Returns ReferenceSpace

  • Parameters

    • r: { order?: EulerOrder; unit?: AngleUnit; x: number; y: number; z: number }
      • Optional order?: EulerOrder
      • Optional unit?: AngleUnit
      • x: number
      • y: number
      • z: number

    Returns ReferenceSpace

  • Parameters

    • r: number[]

    Returns ReferenceSpace

  • scale(kX: number, kY: number, kZ?: number): ReferenceSpace
  • Parameters

    • kX: number
    • kY: number
    • Optional kZ: number

    Returns ReferenceSpace

  • setArrayBounds(bounds: T[]): void
  • Set a parent object to the data object

    Parameters

    • object: string | DataObject

      Data object or UID to add as parent

    Returns SymbolicSpace<T>

    instance

  • setPosition(position: AbsolutePosition, referenceSpace?: TransformationSpace): SymbolicSpace<T>
  • Set the current absolute position of the object

    Parameters

    • position: AbsolutePosition

      Position to set

    • Optional referenceSpace: TransformationSpace

    Returns SymbolicSpace<T>

    Data object instance

  • Set the unique identifier of this object

    Parameters

    • uid: string

      Unique Identifier

    Returns SymbolicSpace<T>

    Data object instance

  • toGeoJSON(): any
  • toPosition(): T
  • toWKT(): string
  • transform<In, Out>(position: In, options?: SpaceTransformationOptions): Out
  • Transform a position

    Type parameters

    • In: AbsolutePosition<In>

    • Out: AbsolutePosition<Out> = In

    Parameters

    • position: In

      Position to transform

    • Optional options: SpaceTransformationOptions

    Returns Out

    Transformed position

  • translation(dX: number, dY: number, dZ?: number): ReferenceSpace
  • Parameters

    • dX: number
    • dY: number
    • Optional dZ: number

    Returns ReferenceSpace

  • update(service: DataService<string, SymbolicSpace<T>>): Promise<void>
  • Update parent reference spaces

    Parameters

    • service: DataService<string, SymbolicSpace<T>>

      Service to use for updating

    Returns Promise<void>

    Update promise

  • updateCentroid(): void
  • fromGeoJSON<T>(json: any): InstanceType<T>
  • fromWKT<T>(wktLiteral: string): InstanceType<T>