SpatialGraphPlacement Class
Declaration
struct winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacement
Description
Methods
ComputeOriginForView
Computes the origin of the mapped coordinate space, optimized for the specified view. The view and origin poses are expressed in an app-defined "world" coordinate system, determined by the transform provided relative to the reference coordinate system used to initialize this placement. The pose is computed by weighting the control points according to their proximity to the view.
winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialPose ComputeOriginForView(winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialPose const& viewInWorld, Windows::Foundation::Numerics::float4x4 const& worldToReference);
Parameters
viewInWorld
- The pose of the view to optimize for, expressed in the application's world coordinate system.worldToReference
- Transform from the application's world coordinate system to the reference coordinate system used to obtain this placement. This may be identity if the world and reference coordinate systems are the same.
Returns
winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialPose
- The origin of the mapped coordinate space expressed in the app-defined "world" coordinate system.
GetControlPoints
Returns the set of control points which define this placement in the Spatial Graph. These may be stored and used to recreate the placement in a future session - however, the static nodes referenced by the control points may not be valid unless they have also been persisted using SpatialGraph.SpatialGraphPlacement.TryPersistStaticNodesAsync(System.String).
com_array<::winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacementControlPoint> GetControlPoints();
Returns
com_array<::winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacementControlPoint>
TryCreate
Initializes an object which maps coordinates in an application-defined coordinate space onto a set of corresponding locations in the Spatial Graph. The placement of the origin of the coordinate space depends on where it is being viewed from, and will be computed by weighting each control point by its proximity to the view. This enables large objects or scenes to smoothly span across a large physical space as the user moves around, despite non-rigid correspondence between the spaces, e.g. due to head tracking error. A reference coordinate system must be provided to enable efficient per-frame computation of the pose of the origin of the mapped space. The view pose provided each frame must be expressed in this reference coordinate system, though for convenience this may be moderated through a separate "world" coordinate system if necessary (for example, the native coordinate system used by the application versus the interop coordinate system used to initialize the placement).
static winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacement TryCreate(winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphCoordinateSystem const& referenceCoordinateSystem, winrt::array_view<winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacementControlPoint const> controlPoints);
Parameters
referenceCoordinateSystem
- The Spatial Graph coordinate system which will be used to compute view-dependent poses.controlPoints
- The control points which relate coordinates in the mapped space to locations in the Spatial Graph.
Returns
winrt::Microsoft::Azure::ObjectAnchors::SpatialGraph::SpatialGraphPlacement
TryPersistStaticNodesAsync
Attempts to persist the static nodes referenced by this placement's control points to the platform's SpatialAnchorStore, using unique keys based on the the given name and each static node's id. This ensures that these static nodes will remain valid for future sessions. May return false if the platform's storage is full, or does not support storing static nodes. Note that recreating a placement from control points does not require any steps to load the static nodes from persistence; this happens implicity during SpatialGraph.SpatialGraphPlacement.TryCreate(SpatialGraph.SpatialGraphCoordinateSystem,SpatialGraph.SpatialGraphPlacementControlPoint[]). All previously persisted entries associated with the given name are removed regardless of success or failure.
Windows::Foundation::IAsyncOperation<bool> TryPersistStaticNodesAsync(hstring const& name);
Parameters
name
- An application-defined name to disambiguate between different placements which may share the same underlying static nodes.
Returns
Windows::Foundation::IAsyncOperation<bool>
- True if the placement's static nodes were successfully persisted, or false if they could not be persisted.
UnpersistStaticNodesAsync
Releases platform resources associated with a placement previously persisted with the given name. Specifically, removes entries from the platform's SpatialAnchorStore associated with the placement's static nodes. Those static nodes may remain valid if they are actively being used or have been persisted under a different name for another placement, but will become eligable for the platform to reclaim when they are no longer in use. No exception will be thrown if there are no entries corresponding to the given name; the operation simply has no effect.
static Windows::Foundation::IAsyncAction UnpersistStaticNodesAsync(hstring const& name);
Parameters
name
- The application-defined name which was previously used to persist a .
Returns
Windows::Foundation::IAsyncAction