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 extends AbsolutePosition

Hierarchy (view full)

Constructors

Properties

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

Created timestamp

displayName: string

Object display name

origin: AbsolutePosition
parentUID: string
positionConstructor: (new () => T)

Type declaration

    • new (): T
    • Returns T

priority: number = 0
uid: string

Object identifier

Returns

Unique object identifier

Accessors

  • get position(): AbsolutePosition
  • Get the current absolute position of the object relative to the global reference space

    Returns AbsolutePosition

    Absolute position of data object

  • set position(position): void
  • Set the current absolute position of the object relative to the global reference space

    Parameters

    • position: AbsolutePosition

    Returns void

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

    Returns RelativePosition<any, Unit>[]

    Array of relative positions

  • set relativePositions(relativePostions): void
  • Parameters

    • relativePostions: RelativePosition<any, Unit>[]

    Returns void

  • get rotationQuaternion(): Quaternion
  • Returns Quaternion

  • set rotationQuaternion(quaternion): void
  • Parameters

    • quaternion: Quaternion

    Returns void

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

    Returns Matrix4

    Transformation matrix

  • set scaleMatrix(matrix): void
  • Parameters

    • matrix: Matrix4

    Returns void

  • get transformationMatrix(): Matrix4
  • Returns Matrix4

  • set transformationMatrix(matrix): void
  • Parameters

    • matrix: Matrix4

    Returns void

  • get translationMatrix(): Matrix4
  • Returns Matrix4

  • set translationMatrix(matrix): void
  • Parameters

    • matrix: Matrix4

    Returns void

Methods

  • Add a connected space

    Parameters

    • space: SymbolicSpace<any>

      Connected space

    • Optional position: T

      Position of connection

    Returns this

    instance

  • Add a relative position to this data object

    Parameters

    • relativePosition: RelativePosition<any, Unit>

      Relative position to add

    Returns this

    Data object instance

  • Bind the data object to a service

    Parameters

    Returns DataObjectBinding<SymbolicSpace<T>>

    Data object binding with a service

  • Clone the data object

    Type Parameters

    Parameters

    • Optional dataType: Constructor<T>

      Data type to clone to

    Returns T

    Cloned data object

  • Get the current absolute position of the object

    Parameters

    • Optional referenceSpace: TransformationSpace

      Reference space to transform it to

    Returns AbsolutePosition

    Position of the data object

  • 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

  • Get relative positions for a different target

    Parameters

    • Optional referenceObjectUID: string

      Reference object identifier

    Returns RelativePosition<any, Unit>[]

    Array of relative positions for the reference object

  • Parameters

    • referenceObjectUID: string

    Returns boolean

  • Check if a position lies within a symbolic location

    Parameters

    • position: AbsolutePosition

      Absolute position to check

    Returns boolean

    Point inside boundaries

  • Parameters

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

    Returns 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

  • Parameters

    • unit: LengthUnit

    Returns ReferenceSpace

  • Parameters

    • referenceObjectUID: string

    Returns void

  • Returns 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

  • Parameters

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

    Returns ReferenceSpace

  • Set a parent object to the data object

    Parameters

    • object: string | DataObject

      Data object or UID to add as parent

    Returns this

    instance

  • Set the current absolute position of the object

    Parameters

    • position: AbsolutePosition

      Position to set

    • Optional referenceSpace: TransformationSpace

      Reference space

    Returns this

    Data object instance

  • Set the unique identifier of this object

    Parameters

    • uid: string

      Unique Identifier

    Returns this

    Data object instance

  • Convert the symbolic space to GeoJSON

    Parameters

    • Optional flat: boolean

      Flat GeoJSON

    Returns any

    GeoJSON

  • Transform a position

    Type Parameters

    • In extends AbsolutePosition
    • Out extends AbsolutePosition = In

    Parameters

    • position: In

      Position to transform

    • Optional options: SpaceTransformationOptions

      Transformation options

    Returns Out

    Transformed position

  • Parameters

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

    Returns ReferenceSpace

  • Update parent reference spaces

    Parameters

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

      Service to use for updating

    Returns Promise<void>

    Update promise

  • Create a reference space from another object

    Parameters

    • object: DataObject

      Reference space

    Returns ReferenceSpace

  • Create a new symbolic space GeoJSON

    Type Parameters

    Parameters

    • json: any

      GeoJSON

    Returns InstanceType<T>

    symbolic space instance