Class AlignmentManager
Unity level implementation of aligning Unity's coordinate system
with a discrete finite set of markers in the real world.
Implements
Inherited Members
Namespace: Microsoft.MixedReality.WorldLocking.Core
Assembly: cs.temp.dll.dll
Syntax
public class AlignmentManager : IAlignmentManager
Remarks
In addition to anchoring the otherwise arbitrary WorldLocked coordinate space to this set of correspondences, this addresses the tracker-scale issue, whereby due to tracker error, traversing a known distance in the real world traverses a different distance in Unity space. This means that, given a large object of length L meters in Unity space, starting at one end and walking L meters will not end up at the other end of the object, but only within +- 10% of L. Use of this service gives fairly exact correspondence at alignment points, and by interpolation gives fairly accurate correspondence within the convex set of alignment points. Note that no extrapolation is done, so outside the convex set of alignment points results, particularly with respect to scale compensation, will be less accurate.
Constructors
AlignmentManager(WorldLockingManager)
Constructor, binds to a specific WorldLockingManager. Also registers for scene loading events.
Declaration
public AlignmentManager(WorldLockingManager manager)
Parameters
Type | Name | Description |
---|---|---|
WorldLockingManager | manager | WorldLocking manager which owns this sub-manager. |
Properties
NeedSave
Declaration
public bool NeedSave { get; }
Property Value
Type | Description |
---|---|
Boolean |
PinnedFromLocked
The pose to insert into the camera's hierarchy above the WorldLocking Adjustment transform (if any).
Declaration
public Pose PinnedFromLocked { get; }
Property Value
Type | Description |
---|---|
Pose |
SaveFileName
File to save to and load from.
Declaration
public string SaveFileName { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
May optionally contain subpath. For optimal portability, use forward slashes, e.g. "myPath/myFile.myExt". May NOT be an absolute path (e.g. "/myPath.txt" or "c:/myPath.txt" are NOT allowed and will be ignored.) Application can check validity of path using static AlignmentManager.IsValidSavePath(string). Defaults to "Persistence/Alignment.fwb".
Methods
AddAlignmentAnchor(String, Pose, Pose)
Declaration
public AnchorId AddAlignmentAnchor(string uniqueName, Pose virtualPose, Pose lockedPose)
Parameters
Type | Name | Description |
---|---|---|
String | uniqueName | |
Pose | virtualPose | |
Pose | lockedPose |
Returns
Type | Description |
---|---|
AnchorId |
ClearAlignmentAnchors()
Declaration
public void ClearAlignmentAnchors()
ComputePinnedPose(Pose)
Do the weighted average of all active reference poses to get an alignment pose.
Declaration
public void ComputePinnedPose(Pose lockedHeadPose)
Parameters
Type | Name | Description |
---|---|---|
Pose | lockedHeadPose |
Dispose()
Dispose of internals on shutdown.
Declaration
public void Dispose()
Finalize()
Dispose of internals on shutdown.
Declaration
protected void Finalize()
GetAlignmentPose(AnchorId, out Pose)
Declaration
public bool GetAlignmentPose(AnchorId anchorId, out Pose lockedPose)
Parameters
Type | Name | Description |
---|---|---|
AnchorId | anchorId | |
Pose | lockedPose |
Returns
Type | Description |
---|---|
Boolean |
IsValidSavePath(String)
Check validity of a save/load path. Any path not passing this test will be ignored without error.
Declaration
public static bool IsValidSavePath(string filePath)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The path to test. |
Returns
Type | Description |
---|---|
Boolean | True if a valid path. |
Load()
Load the database and issue notification if loaded.
Declaration
public bool Load()
Returns
Type | Description |
---|---|
Boolean | True if loaded. |
RegisterForLoad(PostAlignmentLoadedDelegate)
Register for notification after any successful loads.
Declaration
public void RegisterForLoad(PostAlignmentLoadedDelegate del)
Parameters
Type | Name | Description |
---|---|---|
PostAlignmentLoadedDelegate | del | Delegate to call after successful load. |
Remarks
Registration holds until a corresponding call to UnregisterForLoad(PostAlignmentLoadedDelegate).
RemoveAlignmentAnchor(AnchorId)
Declaration
public bool RemoveAlignmentAnchor(AnchorId anchorId)
Parameters
Type | Name | Description |
---|---|---|
AnchorId | anchorId |
Returns
Type | Description |
---|---|
Boolean |
RestoreAlignmentAnchor(String, Pose)
Declaration
public AnchorId RestoreAlignmentAnchor(string uniqueName, Pose virtualPose)
Parameters
Type | Name | Description |
---|---|---|
String | uniqueName | |
Pose | virtualPose |
Returns
Type | Description |
---|---|
AnchorId |
Save()
Explicitly save the database.
Declaration
public bool Save()
Returns
Type | Description |
---|---|
Boolean | True if successfully saved. |
SendAlignmentAnchors()
Declaration
public void SendAlignmentAnchors()
UnregisterForLoad(PostAlignmentLoadedDelegate)
Un-register for post load notifications, after registration via RegisterForLoad(PostAlignmentLoadedDelegate).
Declaration
public void UnregisterForLoad(PostAlignmentLoadedDelegate del)
Parameters
Type | Name | Description |
---|---|---|
PostAlignmentLoadedDelegate | del | The delegate to unregister. |
Events
OnTriangulationBuilt
Declaration
public event EventHandler<ITriangulator> OnTriangulationBuilt
Event Type
Type | Description |
---|---|
EventHandler<ITriangulator> |