Skip to main content
Version: 14 Oct 2024

ml_spatial_anchor.h

Classes

Name
structMLSpatialAnchorLocalizationInfo
A structure containing information about the device's localization state.
structMLSpatialAnchor
A structure representing a user-defined Spatial Anchor.
structMLSpatialAnchorCreateInfo
A structure used to populate anchor creation info when creating a new Spatial Anchor.
structMLSpatialAnchorQueryFilter
A collection of filters for Spatial Anchor queries.

Types

Name
typedef struct MLSpatialAnchorLocalizationInfoMLSpatialAnchorLocalizationInfo
A structure containing information about the device's localization state.
typedef struct MLSpatialAnchorMLSpatialAnchor
A structure representing a user-defined Spatial Anchor.
typedef struct MLSpatialAnchorCreateInfoMLSpatialAnchorCreateInfo
A structure used to populate anchor creation info when creating a new Spatial Anchor.
typedef struct MLSpatialAnchorQueryFilterMLSpatialAnchorQueryFilter
A collection of filters for Spatial Anchor queries.

Enums

Name
enumAnonymous Enum 29
{
MLResultAPIPrefix_SpatialAnchor = ( 0x439 << 16),
MLSpatialAnchor_MaxSpaceNameLength = 64
}
enumMLSpatialAnchorResult
{
MLSpatialAnchorResult_MaxAnchorLimitReached = MLResultAPIPrefix_SpatialAnchor,
MLSpatialAnchorResult_MinDistanceThresholdExceeded,
MLSpatialAnchorResult_InsufficientMapping,
MLSpatialAnchorResult_InvalidId,
MLSpatialAnchorResult_InvalidExpirationTimestamp,
MLSpatialAnchorResult_NotLocalized,
MLSpatialAnchorResult_ServerError,
MLSpatialAnchorResult_ServiceUnavailable,
MLSpatialAnchorResult_Ensure32Bits = 0x7FFFFFFF
}
SpatialAnchor-specific return codes.
enumMLSpatialAnchorLocalizationStatus
{
MLSpatialAnchorLocalizationStatus_NotLocalized,
MLSpatialAnchorLocalizationStatus_Localized,
MLSpatialAnchorLocalizationStatus_LocalizationPending,
MLSpatialAnchorLocalizationStatus_Ensure32Bits = 0x7FFFFFFF
}
The current localization status.
enumMLSpatialAnchorMappingMode
{
MLSpatialAnchorMappingMode_OnDevice,
MLSpatialAnchorMappingMode_ARCloud,
MLSpatialAnchorMappingMode_Ensure32Bits = 0x7FFFFFFF
}
Mapping mode.
enumMLSpatialAnchorQuality
{
MLSpatialAnchorQuality_Low,
MLSpatialAnchorQuality_Medium,
MLSpatialAnchorQuality_High,
MLSpatialAnchorQuality_Ensure32Bits = 0x7FFFFFFF
}
The quality of the local space around the anchor.

Functions

Name
voidMLSpatialAnchorLocalizationInfoInit(MLSpatialAnchorLocalizationInfo * inout_info)
Initialize default values for MLSpatialAnchorLocalizationInfo.
voidMLSpatialAnchorInit(MLSpatialAnchor * inout_anchor)
Initialize default values for a MLSpatialAnchor structure.
voidMLSpatialAnchorCreateInfoInit(MLSpatialAnchorCreateInfo * inout_info)
Initialize default values for a MLSpatialAnchorCreateInfo structure.
voidMLSpatialAnchorQueryFilterInit(MLSpatialAnchorQueryFilter * inout_query_filter)
Initializes the default values for a query filter.
MLResultMLSpatialAnchorTrackerCreate(MLHandle * out_handle)
Create a Spatial Anchor tracker.
MLResultMLSpatialAnchorTrackerDestroy(MLHandle handle)
Destroy a previously created Spatial Anchor tracker.
MLResultMLSpatialAnchorCreate(MLHandle handle, const MLSpatialAnchorCreateInfo create_info, MLSpatialAnchor out_anchor)
Create a new local Spatial Anchor at the desired location.
MLResultMLSpatialAnchorPublish(MLHandle handle, MLUUID anchor_id)
Publish an existing local Spatial Anchor to the persistent backend.
MLResultMLSpatialAnchorDelete(MLHandle handle, MLUUID anchor_id)
Delete an existing Spatial Anchor.
MLResultMLSpatialAnchorUpdate(MLHandle handle, const MLSpatialAnchor * anchor)
Update a Spatial Anchor's properties.
MLResultMLSpatialAnchorQueryCreate(MLHandle handle, const MLSpatialAnchorQueryFilter query_filter, MLHandle out_query_handle, uint32_t * out_results_count)
Create a new query for Spatial Anchors in the current space.
MLResultMLSpatialAnchorQueryDestroy(MLHandle handle, MLHandle query_handle)
Destroy a previously created query handle and release its associated resources.
MLResultMLSpatialAnchorQueryGetResult(MLHandle handle, MLHandle query_handle, uint32_t first_index, uint32_t last_index, MLSpatialAnchor * out_results)
Get the result of a previous Spatial Anchor query.
const char *MLSpatialAnchorGetResultString(MLResult result)
Returns an ASCII string for MLSpatialAnchorResult and MLResult codes.
MLResultMLSpatialAnchorGetLocalizationInfo(MLHandle handle, MLSpatialAnchorLocalizationInfo * out_localization_info)
Get the current localization status of the device.

Enums Documentation

Anonymous Enum 29

EnumeratorValueDescription
MLResultAPIPrefix_SpatialAnchor( 0x439 << 16)Defines the prefix for MLSpatialAnchorResult codes.
MLSpatialAnchor_MaxSpaceNameLength64Maximum size for the name of the space in the MLSpatialAnchorLocalizationInfo structure.

MLSpatialAnchorResult

EnumeratorValueDescription
MLSpatialAnchorResult_MaxAnchorLimitReachedMLResultAPIPrefix_SpatialAnchorThe maximum number of anchors for the current space has been reached.
MLSpatialAnchorResult_MinDistanceThresholdExceededThe minimum distance between anchors was not met.
MLSpatialAnchorResult_InsufficientMappingThe space has not been sufficiently mapped to allow this operation.
MLSpatialAnchorResult_InvalidIdThe provided anchor Id was not valid.
MLSpatialAnchorResult_InvalidExpirationTimestampThe provided expiration suggestion was not valid.
MLSpatialAnchorResult_NotLocalizedThe operation cannot be completed because the device has not yet localized.
MLSpatialAnchorResult_ServerErrorThere was an error communicating with the server.
MLSpatialAnchorResult_ServiceUnavailableThe operation failed because the underlying service is not yet available, retry later.
MLSpatialAnchorResult_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

SpatialAnchor-specific return codes.

API Level:

  • 20

MLSpatialAnchorLocalizationStatus

EnumeratorValueDescription
MLSpatialAnchorLocalizationStatus_NotLocalizedThe device is not currently localized.
MLSpatialAnchorLocalizationStatus_LocalizedThe device has localized successfully.
MLSpatialAnchorLocalizationStatus_LocalizationPendingA localization attempt is currently in progress.
MLSpatialAnchorLocalizationStatus_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

The current localization status.

Deprecated

Deprecated since 1.3.0. Scheduled for removal. Replaced by MLSpaceLocalizationStatus.

API Level:

  • 20

MLSpatialAnchorMappingMode

EnumeratorValueDescription
MLSpatialAnchorMappingMode_OnDeviceUsing on-device mapping.
MLSpatialAnchorMappingMode_ARCloudUsing cloud-based mapping.
MLSpatialAnchorMappingMode_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Mapping mode.

Deprecated

Deprecated since 1.3.0. Scheduled for removal.

API Level:

  • 20

MLSpatialAnchorQuality

EnumeratorValueDescription
MLSpatialAnchorQuality_LowLow quality, this anchor can be expected to move significantly.
MLSpatialAnchorQuality_MediumMedium quality, this anchor may move slightly.
MLSpatialAnchorQuality_HighHigh quality, this anchor is stable and suitable for digital content attachment.
MLSpatialAnchorQuality_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

The quality of the local space around the anchor.

This can change over time as the user continues to scan the space.

API Level:

  • 31

Types Documentation

MLSpatialAnchorLocalizationInfo

typedef struct MLSpatialAnchorLocalizationInfo MLSpatialAnchorLocalizationInfo;

A structure containing information about the device's localization state.

More Info

Deprecated

Deprecated since 1.3.0. Scheduled for removal. Replaced by MLSpaceLocalizationResult.

API Level:

  • 20

MLSpatialAnchor

typedef struct MLSpatialAnchor MLSpatialAnchor;

A structure representing a user-defined Spatial Anchor.

More Info

API Level:

  • 31

MLSpatialAnchorCreateInfo

typedef struct MLSpatialAnchorCreateInfo MLSpatialAnchorCreateInfo;

A structure used to populate anchor creation info when creating a new Spatial Anchor.

More Info

API Level:

  • 20

MLSpatialAnchorQueryFilter

typedef struct MLSpatialAnchorQueryFilter MLSpatialAnchorQueryFilter;

A collection of filters for Spatial Anchor queries.

Filters that have been set will be combined via logical conjunction. E.g. results must match the ids filter AND fall within the radius constraint when both have been set.

This struct must be initialized by calling MLSpatialAnchorQueryFilterInit before use.

More Info

API Level:

  • 20

Functions Documentation

MLSpatialAnchorLocalizationInfoInit

static inline void MLSpatialAnchorLocalizationInfoInit(
MLSpatialAnchorLocalizationInfo * inout_info
)

Initialize default values for MLSpatialAnchorLocalizationInfo.

Parameters

MLSpatialAnchorLocalizationInfo *inout_infoThe localization info to initialize.

Required Permissions:

  • None
Deprecated

Deprecated since 1.3.0. Scheduled for removal. Replaced by MLSpaceLocalizationResultInit.

API Level:

  • 20

MLSpatialAnchorInit

static inline void MLSpatialAnchorInit(
MLSpatialAnchor * inout_anchor
)

Initialize default values for a MLSpatialAnchor structure.

Parameters

MLSpatialAnchor *inout_anchorThe anchor to initialize.

Required Permissions:

  • None

API Level:

  • 31

MLSpatialAnchorCreateInfoInit

static inline void MLSpatialAnchorCreateInfoInit(
MLSpatialAnchorCreateInfo * inout_info
)

Initialize default values for a MLSpatialAnchorCreateInfo structure.

Parameters

MLSpatialAnchorCreateInfo *inout_infoThe info struct to initialize.

Required Permissions:

  • None

API Level:

  • 20

MLSpatialAnchorQueryFilterInit

static inline void MLSpatialAnchorQueryFilterInit(
MLSpatialAnchorQueryFilter * inout_query_filter
)

Initializes the default values for a query filter.

Parameters

MLSpatialAnchorQueryFilter *inout_query_filterThe filter to initialize.

Required Permissions:

  • None

API Level:

  • 20

MLSpatialAnchorTrackerCreate

MLResult MLSpatialAnchorTrackerCreate(
MLHandle * out_handle
)

Create a Spatial Anchor tracker.

Parameters

MLHandle *out_handleA pointer to an MLHandle which will contain a handle for a Spatial Anchor tracker if successful, otherwise it will be ML_INVALID_HANDLE.

Returns

MLResultMLResult_InvalidParamThe out_handle parameter was not valid.
MLResultMLResult_OkSuccessfully created the tracker.
MLResultMLResult_PermissionDeniedNecessary permission is missing.
MLResultMLResult_UnspecifiedFailureThe tracker was not created.

Required Permissions:

  • com.magicleap.permission.SPATIAL_ANCHOR (protection level: normal)

API Level:

  • 20

MLSpatialAnchorTrackerDestroy

MLResult MLSpatialAnchorTrackerDestroy(
MLHandle handle
)

Destroy a previously created Spatial Anchor tracker.

Parameters

MLHandlehandleA handle to a Spatial Anchor tracker created by MLSpatialAnchorCreate().

Returns

MLResultMLResult_InvalidParamThe handle parameter was not valid.
MLResultMLResult_OkSuccessfully destroyed the tracker.
MLResultMLResult_UnspecifiedFailureThe tracker was not destroyed.

Required Permissions:

  • None

API Level:

  • 20

MLSpatialAnchorCreate

MLResult MLSpatialAnchorCreate(
MLHandle handle,
const MLSpatialAnchorCreateInfo * create_info,
MLSpatialAnchor * out_anchor
)

Create a new local Spatial Anchor at the desired location.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
const MLSpatialAnchorCreateInfo *create_infoA struct containing the creation info for the new anchor.
MLSpatialAnchor *out_anchorThe created anchor.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe anchor was successfully created.
MLResultMLSpatialAnchorResult_InsufficientMappingInsufficient mapping.
MLResultMLSpatialAnchorResult_InvalidExpirationTimestampInvalid expiration timestamp.
MLResultMLSpatialAnchorResult_MaxAnchorLimitReachedMaximum anchor limit reached.
MLResultMLSpatialAnchorResult_MinDistanceThresholdExceededMinimum distance threshold exceeded.

Required Permissions:

  • None

On success, out_anchor will be returned with a newly generated ID.

Any unpublished anchor will be lost if the Headpose session is lost. See MLHeadTrackingGetMapEvents for more details.

API Level:

  • 20

MLSpatialAnchorPublish

MLResult MLSpatialAnchorPublish(
MLHandle handle,
MLUUID anchor_id
)

Publish an existing local Spatial Anchor to the persistent backend.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
MLUUIDanchor_idThe Id of the local anchor to publish.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe anchor was successfully published and persisted.
MLResultMLResult_UnauthenticatedInvalid authentication credentials for this operation.
MLResultMLSpatialAnchorResult_NotLocalizedNot localized.
MLResultMLSpatialAnchorResult_InvalidIdInvalid Id provided.
MLResultMLSpatialAnchorResult_MaxAnchorLimitReachedMaximum anchor limit reached.
MLResultMLSpatialAnchorResult_MinDistanceThresholdExceededMinimum distance threshold exceeded.
MLResultMLSpatialAnchorResult_ServerErrorServer error occurred.

Required Permissions:

  • None

Depending on the currently selected mapping mode, this can store the anchor locally or in the cloud. This call will fail if the device is not localized to a space.

Any unpublished anchor will be lost if the Headpose session is lost. See MLHeadTrackingGetMapEvents for more details.

API Level:

  • 20

MLSpatialAnchorDelete

MLResult MLSpatialAnchorDelete(
MLHandle handle,
MLUUID anchor_id
)

Delete an existing Spatial Anchor.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
MLUUIDanchor_idThe Id of the anchor to delete.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe anchor was successfully deleted.
MLResultMLResult_UnauthenticatedInvalid authentication credentials for this operation.
MLResultMLSpatialAnchorResult_InvalidIdInvalid Id provided.
MLResultMLSpatialAnchorResult_ServerErrorServer error occurred.

Required Permissions:

  • None

If successful, this will delete the anchor from persistent storage based on the currently selected mapping mode.

API Level:

  • 20

MLSpatialAnchorUpdate

MLResult MLSpatialAnchorUpdate(
MLHandle handle,
const MLSpatialAnchor * anchor
)

Update a Spatial Anchor's properties.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
const MLSpatialAnchor *anchorThe anchor containing the desired updated properties.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe anchor was successfully updated.
MLResultMLResult_UnauthenticatedInvalid authentication credentials for this operation.
MLResultMLSpatialAnchorResult_InvalidIdInvalid Id provided.
MLResultMLSpatialAnchorResult_InvalidExpirationTimestampInvalid expiration timestamp.
MLResultMLSpatialAnchorResult_ServerErrorServer error occurred.

Required Permissions:

  • None

The only property that can currently be updated is the expiration timestamp.

API Level:

  • 20

MLSpatialAnchorQueryCreate

MLResult MLSpatialAnchorQueryCreate(
MLHandle handle,
const MLSpatialAnchorQueryFilter * query_filter,
MLHandle * out_query_handle,
uint32_t * out_results_count
)

Create a new query for Spatial Anchors in the current space.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
const MLSpatialAnchorQueryFilter *query_filterThe filter structure for the query.
MLHandle *out_query_handleThe handle for this query to be used with MLSpatialAnchorQueryGetResult.
uint32_t *out_results_countThe total number of entries found by the query. This can be any number between 0 and max_results.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe query executed successfully.
MLResultMLResult_UnspecifiedFailureUnspecified error occurred.
MLResultMLSpatialAnchorResult_NotLocalizedNot localized to a space.

Required Permissions:

  • None

It is the responsibility of the caller to call MLSpatialAnchorQueryDestroy with the query handle returned from this function after the results are no longer needed.

API Level:

  • 20

MLSpatialAnchorQueryDestroy

MLResult MLSpatialAnchorQueryDestroy(
MLHandle handle,
MLHandle query_handle
)

Destroy a previously created query handle and release its associated resources.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
MLHandlequery_handleHandle to a Spatial Anchor query.

Returns

MLResultMLResult_InvalidParamOne of the parameters was null.
MLResultMLResult_OkThe handle was successfully destroyed.

Required Permissions:

  • None

API Level:

  • 20

MLSpatialAnchorQueryGetResult

MLResult MLSpatialAnchorQueryGetResult(
MLHandle handle,
MLHandle query_handle,
uint32_t first_index,
uint32_t last_index,
MLSpatialAnchor * out_results
)

Get the result of a previous Spatial Anchor query.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
MLHandlequery_handleHandle to a query obtained from MLSpatialAnchorQuery.
uint32_tfirst_indexThe first index.
uint32_tlast_indexThe last index.
MLSpatialAnchor *out_resultsAn array of (last_index - first_index + 1) size to hold the query results.

Returns

MLResultMLResult_OkThe query executed successfully.
MLResultMLResult_InvalidParamOne of the parameters was incorrect.
MLResultMLResult_UnspecifiedFailureUnspecified failure occurred.
MLResultMLSpatialAnchorResult_NotLocalizedNot localized to a space.

Required Permissions:

  • None

Putting index bounds on the results allows the caller to only receive a subset of the total number of results generated by the query. This is useful as a form of pagination in the case of a large number of anchors in the current space. Indexing is zero-based so if there are N results in the query, then it is required that 0 <= first_index <= last_index < N.

API Level:

  • 20

MLSpatialAnchorGetResultString

const char * MLSpatialAnchorGetResultString(
MLResult result
)

Returns an ASCII string for MLSpatialAnchorResult and MLResult codes.

Parameters

MLResultresultThe input MLResult enum from MLSpatialAnchor functions.

Required Permissions:

  • None

Return: ASCII string containing readable version of result code.

API Level:

  • 31

MLSpatialAnchorGetLocalizationInfo

MLResult MLSpatialAnchorGetLocalizationInfo(
MLHandle handle,
MLSpatialAnchorLocalizationInfo * out_localization_info
)

Get the current localization status of the device.

Parameters

MLHandlehandleHandle to a Spatial Anchor tracker.
MLSpatialAnchorLocalizationInfo *out_localization_infoThe localization info structure to be populated.

Returns

MLResultMLResult_OkThe query executed successfully.
MLResultMLResult_InvalidParamOne of the parameters was incorrect.
MLResultMLResult_UnspecifiedFailureUnspecified failure occurred.

Required Permissions:

  • None
Deprecated

Deprecated since 1.3.0. Scheduled for removal. Replaced by MLSpaceGetLocalizationResult.

API Level:

  • 20

Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"
#include "ml_types.h"

#include <string.h>

ML_EXTERN_C_BEGIN

enum {
MLResultAPIPrefix_SpatialAnchor = MLRESULT_PREFIX(0x439),

MLSpatialAnchor_MaxSpaceNameLength = 64,
};

typedef enum MLSpatialAnchorResult {
MLSpatialAnchorResult_MaxAnchorLimitReached = MLResultAPIPrefix_SpatialAnchor,

MLSpatialAnchorResult_MinDistanceThresholdExceeded,

MLSpatialAnchorResult_InsufficientMapping,

MLSpatialAnchorResult_InvalidId,

MLSpatialAnchorResult_InvalidExpirationTimestamp,

MLSpatialAnchorResult_NotLocalized,

MLSpatialAnchorResult_ServerError,

MLSpatialAnchorResult_ServiceUnavailable,

MLSpatialAnchorResult_Ensure32Bits = 0x7FFFFFFF
} MLSpatialAnchorResult;

typedef enum MLSpatialAnchorLocalizationStatus {
MLSpatialAnchorLocalizationStatus_NotLocalized,

MLSpatialAnchorLocalizationStatus_Localized,

MLSpatialAnchorLocalizationStatus_LocalizationPending,

MLSpatialAnchorLocalizationStatus_Ensure32Bits = 0x7FFFFFFF
} MLSpatialAnchorLocalizationStatus;

typedef enum MLSpatialAnchorMappingMode {
MLSpatialAnchorMappingMode_OnDevice,

MLSpatialAnchorMappingMode_ARCloud,

MLSpatialAnchorMappingMode_Ensure32Bits = 0x7FFFFFFF
} MLSpatialAnchorMappingMode;

typedef enum MLSpatialAnchorQuality {
MLSpatialAnchorQuality_Low,
MLSpatialAnchorQuality_Medium,
MLSpatialAnchorQuality_High,
MLSpatialAnchorQuality_Ensure32Bits = 0x7FFFFFFF
} MLSpatialAnchorQuality;

typedef ML_DEPRECATED_MSG("Replaced by MLSpaceLocalizationResult.") struct MLSpatialAnchorLocalizationInfo {
uint32_t version;

MLSpatialAnchorLocalizationStatus localization_status;

MLSpatialAnchorMappingMode mapping_mode;

char space_name[MLSpatialAnchor_MaxSpaceNameLength];

MLUUID space_id;

MLCoordinateFrameUID target_space_origin;
} MLSpatialAnchorLocalizationInfo;

ML_DEPRECATED_MSG("Replaced by MLSpaceLocalizationResultInit.")
ML_STATIC_INLINE void MLSpatialAnchorLocalizationInfoInit(MLSpatialAnchorLocalizationInfo *inout_info) {
if (inout_info != NULL) {
memset(inout_info, 0, sizeof(MLSpatialAnchorLocalizationInfo));
inout_info->version = 2;
}
}

typedef struct MLSpatialAnchor {
uint32_t version;

MLUUID id;

MLCoordinateFrameUID cfuid;

uint64_t expiration_timestamp_s;

bool is_persisted;

MLUUID space_id;

MLSpatialAnchorQuality quality;
} MLSpatialAnchor;

ML_STATIC_INLINE void MLSpatialAnchorInit(MLSpatialAnchor *inout_anchor) {
if (inout_anchor != NULL) {
memset(inout_anchor, 0, sizeof(MLSpatialAnchor));
inout_anchor->version = 2;
}
}

typedef struct MLSpatialAnchorCreateInfo {
uint32_t version;

MLTransform transform;

uint64_t expiration_timestamp_s;
} MLSpatialAnchorCreateInfo;

ML_STATIC_INLINE void MLSpatialAnchorCreateInfoInit(MLSpatialAnchorCreateInfo *inout_info) {
if (inout_info != NULL) {
memset(inout_info, 0, sizeof(MLSpatialAnchorCreateInfo));
inout_info->version = 1;
}
}

typedef struct MLSpatialAnchorQueryFilter {
uint32_t version;

MLVec3f center;

float radius_m;

const MLUUID *ids;

uint32_t ids_count;

uint32_t max_results;

bool sorted;
} MLSpatialAnchorQueryFilter;

ML_STATIC_INLINE void MLSpatialAnchorQueryFilterInit(MLSpatialAnchorQueryFilter *inout_query_filter) {
if (inout_query_filter != NULL) {
memset(inout_query_filter, 0, sizeof(MLSpatialAnchorQueryFilter));
inout_query_filter->version = 1;
inout_query_filter->sorted = true;
inout_query_filter->max_results = 1;
}
}

ML_API MLResult ML_CALL MLSpatialAnchorTrackerCreate(MLHandle *out_handle);

ML_API MLResult ML_CALL MLSpatialAnchorTrackerDestroy(MLHandle handle);

ML_API MLResult ML_CALL MLSpatialAnchorCreate(MLHandle handle, const MLSpatialAnchorCreateInfo *create_info, MLSpatialAnchor *out_anchor);

ML_API MLResult ML_CALL MLSpatialAnchorPublish(MLHandle handle, MLUUID anchor_id);

ML_API MLResult ML_CALL MLSpatialAnchorDelete(MLHandle handle, MLUUID anchor_id);

ML_API MLResult ML_CALL MLSpatialAnchorUpdate(MLHandle handle, const MLSpatialAnchor *anchor);

ML_API MLResult ML_CALL MLSpatialAnchorQueryCreate(MLHandle handle,
const MLSpatialAnchorQueryFilter *query_filter,
MLHandle *out_query_handle,
uint32_t *out_results_count);

ML_API MLResult ML_CALL MLSpatialAnchorQueryDestroy(MLHandle handle, MLHandle query_handle);

ML_API MLResult ML_CALL MLSpatialAnchorQueryGetResult(MLHandle handle,
MLHandle query_handle,
uint32_t first_index,
uint32_t last_index,
MLSpatialAnchor* out_results);

ML_API const char *ML_CALL MLSpatialAnchorGetResultString(MLResult result);

ML_DEPRECATED_MSG("Replaced by MLSpaceGetLocalizationResult.")
ML_API MLResult ML_CALL MLSpatialAnchorGetLocalizationInfo(MLHandle handle, MLSpatialAnchorLocalizationInfo* out_localization_info);

ML_EXTERN_C_END