SparseSpatialMap Class

Description

Provides core components for SparseSpatialMap, can be used for sparse spatial map building as well as localization using existing map. Also provides utilities for point cloud and plane access.

SparseSpatialMap occupies 2 buffers of camera. Use setBufferCapacity of camera to set an amount of buffers that is not less than the sum of amount of buffers occupied by all components. Refer to Overview .

isAvailable

Check whether SparseSpatialMap is is available, always return true.

C

bool easyar_SparseSpatialMap_isAvailable(void)

C++

static bool isAvailable()

Java

public static boolean isAvailable()

Kotlin

companion object fun isAvailable(): Boolean

Objective-C

+ (bool)isAvailable

Swift

public static func isAvailable() -> Bool

C#

public static bool isAvailable()

inputFrameSink

Input port for input frame. For SparseSpatialMap to work, the inputFrame must include camera parameters, timestamp and spatial information. See also InputFrameSink

C

void easyar_SparseSpatialMap_inputFrameSink(easyar_SparseSpatialMap * This, easyar_InputFrameSink * * Return)

C++

std::shared_ptr<InputFrameSink> inputFrameSink()

Java

public @Nonnull InputFrameSink inputFrameSink()

Kotlin

fun inputFrameSink(): InputFrameSink

Objective-C

- (easyar_InputFrameSink *)inputFrameSink

Swift

public func inputFrameSink() -> InputFrameSink

C#

public virtual InputFrameSink inputFrameSink()

bufferRequirement

Camera buffers occupied in this component.

C

int easyar_SparseSpatialMap_bufferRequirement(easyar_SparseSpatialMap * This)

C++

int bufferRequirement()

Java

public int bufferRequirement()

Kotlin

fun bufferRequirement(): Int

Objective-C

- (int)bufferRequirement

Swift

public func bufferRequirement() -> Int32

C#

public virtual int bufferRequirement()

outputFrameSource

Output port for output frame. See also OutputFrameSource

C

void easyar_SparseSpatialMap_outputFrameSource(easyar_SparseSpatialMap * This, easyar_OutputFrameSource * * Return)

C++

std::shared_ptr<OutputFrameSource> outputFrameSource()

Java

public @Nonnull OutputFrameSource outputFrameSource()

Kotlin

fun outputFrameSource(): OutputFrameSource

Objective-C

- (easyar_OutputFrameSource *)outputFrameSource

Swift

public func outputFrameSource() -> OutputFrameSource

C#

public virtual OutputFrameSource outputFrameSource()

create

Construct SparseSpatialMap.

C

void easyar_SparseSpatialMap_create(easyar_SparseSpatialMap * * Return)

C++

static std::shared_ptr<SparseSpatialMap> create()

Java

public static @Nonnull SparseSpatialMap create()

Kotlin

companion object fun create(): SparseSpatialMap

Objective-C

+ (easyar_SparseSpatialMap *)create

Swift

public static func create() -> SparseSpatialMap

C#

public static SparseSpatialMap create()

setResultPoseType

Sets type of result pose. enableStabilization defaults to false. It only takes effect when InputFrame contains spatial information.

C

void easyar_SparseSpatialMap_setResultPoseType(easyar_SparseSpatialMap * This, bool enableStabilization)

C++

void setResultPoseType(bool enableStabilization)

Java

public void setResultPoseType(boolean enableStabilization)

Kotlin

fun setResultPoseType(enableStabilization: Boolean): Unit

Objective-C

- (void)setResultPoseType:(bool)enableStabilization

Swift

public func setResultPoseType(_ enableStabilization: Bool) -> Void

C#

public virtual void setResultPoseType(bool enableStabilization)

start

Start SparseSpatialMap system.

C

bool easyar_SparseSpatialMap_start(easyar_SparseSpatialMap * This)

C++

bool start()

Java

public boolean start()

Kotlin

fun start(): Boolean

Objective-C

- (bool)start

Swift

public func start() -> Bool

C#

public virtual bool start()

stop

Stop SparseSpatialMap from running。Can resume running by calling start().

C

void easyar_SparseSpatialMap_stop(easyar_SparseSpatialMap * This)

C++

void stop()

Java

public void stop()

Kotlin

fun stop(): Unit

Objective-C

- (void)stop

Swift

public func stop() -> Void

C#

public virtual void stop()

close

Close SparseSpatialMap. SparseSpatialMap can no longer be used.

C

void easyar_SparseSpatialMap_close(easyar_SparseSpatialMap * This)

C++

void close()

Java

public void close()

Kotlin

fun close(): Unit

Objective-C

- (void)close

Swift

public func close() -> Void

C#

public virtual void close()

getPointCloudBuffer

Returns the buffer of point cloud coordinate. Each 3D point is represented by three consecutive values, representing X, Y, Z position coordinates in the world coordinate space, each of which takes 4 bytes.

C

void easyar_SparseSpatialMap_getPointCloudBuffer(easyar_SparseSpatialMap * This, easyar_Buffer * * Return)

C++

std::shared_ptr<Buffer> getPointCloudBuffer()

Java

public @Nonnull Buffer getPointCloudBuffer()

Kotlin

fun getPointCloudBuffer(): Buffer

Objective-C

- (easyar_Buffer *)getPointCloudBuffer

Swift

public func getPointCloudBuffer() -> Buffer

C#

public virtual Buffer getPointCloudBuffer()

getMapPlanes

Returns detected planes in SparseSpatialMap.

C

void easyar_SparseSpatialMap_getMapPlanes(easyar_SparseSpatialMap * This, easyar_ListOfPlaneData * * Return)

C++

std::vector<std::shared_ptr<PlaneData>> getMapPlanes()

Java

public java.util.@Nonnull ArrayList<@Nonnull PlaneData> getMapPlanes()

Kotlin

fun getMapPlanes(): ArrayList<PlaneData>

Objective-C

- (NSArray<easyar_PlaneData *> *)getMapPlanes

Swift

public func getMapPlanes() -> [PlaneData]

C#

public virtual List<PlaneData> getMapPlanes()

hitTestAgainstPointCloud

Perform hit test against the point cloud. The results are returned sorted by their distance to the camera in ascending order.

C

void easyar_SparseSpatialMap_hitTestAgainstPointCloud(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)

C++

std::vector<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)

Java

public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPointCloud(@Nonnull Vec2F cameraImagePoint)

Kotlin

fun hitTestAgainstPointCloud(cameraImagePoint: Vec2F): ArrayList<Vec3F>

Objective-C

- (NSArray<easyar_Vec3F *> *)hitTestAgainstPointCloud:(easyar_Vec2F *)cameraImagePoint

Swift

public func hitTestAgainstPointCloud(_ cameraImagePoint: Vec2F) -> [Vec3F]

C#

public virtual List<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)

hitTestAgainstPlanes

Performs ray cast from the user’s device in the direction of given screen point.

Intersections with detected planes are returned. 3D positions on physical planes are sorted by distance from the device in ascending order.

For the camera image coordinate system ([0, 1]^2), x-right, y-down, and origin is at left-top corner. CameraParameters.imageCoordinatesFromScreenCoordinates can be used to convert points from screen coordinate system to camera image coordinate system.

The output point cloud coordinate is in the world coordinate system.

C

void easyar_SparseSpatialMap_hitTestAgainstPlanes(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)

C++

std::vector<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)

Java

public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPlanes(@Nonnull Vec2F cameraImagePoint)

Kotlin

fun hitTestAgainstPlanes(cameraImagePoint: Vec2F): ArrayList<Vec3F>

Objective-C

- (NSArray<easyar_Vec3F *> *)hitTestAgainstPlanes:(easyar_Vec2F *)cameraImagePoint

Swift

public func hitTestAgainstPlanes(_ cameraImagePoint: Vec2F) -> [Vec3F]

C#

public virtual List<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)

getMapVersion

Get the map data version of the current SparseSpatialMap.

C

void easyar_SparseSpatialMap_getMapVersion(easyar_String * * Return)

C++

static std::string getMapVersion()

Java

public static java.lang.@Nonnull String getMapVersion()

Kotlin

companion object fun getMapVersion(): String

Objective-C

+ (NSString *)getMapVersion

Swift

public static func getMapVersion() -> String

C#

public static string getMapVersion()

unloadMap

UnloadMap specified SparseSpatialMap data via callback function.The return value of callback indicates whether unload map succeeds (true) or fails (false).

C

void easyar_SparseSpatialMap_unloadMap(easyar_SparseSpatialMap * This, easyar_String * mapID, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromBool resultCallBack)

C++

void unloadMap(std::string mapID, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(bool)>> resultCallBack)

Java

public void unloadMap(java.lang.@Nonnull String mapID, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromBool resultCallBack)

Kotlin

fun unloadMap(mapID: String, callbackScheduler: CallbackScheduler, resultCallBack: FunctorOfVoidFromBool?): Unit

Objective-C

- (void)unloadMap:(NSString *)mapID callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler resultCallBack:(void (^)(bool))resultCallBack

Swift

public func unloadMap(_ mapID: String, _ callbackScheduler: CallbackScheduler, _ resultCallBack: ((Bool) -> Void)?) -> Void

C#

public virtual void unloadMap(string mapID, CallbackScheduler callbackScheduler, Optional<Action<bool>> resultCallBack)

setConfig

Set configurations for SparseSpatialMap. See also SparseSpatialMapConfig .

C

void easyar_SparseSpatialMap_setConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * config)

C++

void setConfig(std::shared_ptr<SparseSpatialMapConfig> config)

Java

public void setConfig(@Nonnull SparseSpatialMapConfig config)

Kotlin

fun setConfig(config: SparseSpatialMapConfig): Unit

Objective-C

- (void)setConfig:(easyar_SparseSpatialMapConfig *)config

Swift

public func setConfig(_ config: SparseSpatialMapConfig) -> Void

C#

public virtual void setConfig(SparseSpatialMapConfig config)

getConfig

Returns configurations for SparseSpatialMap. See also SparseSpatialMapConfig .

C

void easyar_SparseSpatialMap_getConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * * Return)

C++

std::shared_ptr<SparseSpatialMapConfig> getConfig()

Java

public @Nonnull SparseSpatialMapConfig getConfig()

Kotlin

fun getConfig(): SparseSpatialMapConfig

Objective-C

- (easyar_SparseSpatialMapConfig *)getConfig

Swift

public func getConfig() -> SparseSpatialMapConfig

C#

public virtual SparseSpatialMapConfig getConfig()

startLocalization

Start localization in loaded maps. Should set LocalizationMode first.

C

bool easyar_SparseSpatialMap_startLocalization(easyar_SparseSpatialMap * This)

C++

bool startLocalization()

Java

public boolean startLocalization()

Kotlin

fun startLocalization(): Boolean

Objective-C

- (bool)startLocalization

Swift

public func startLocalization() -> Bool

C#

public virtual bool startLocalization()

stopLocalization

Stop localization in loaded maps.

C

void easyar_SparseSpatialMap_stopLocalization(easyar_SparseSpatialMap * This)

C++

void stopLocalization()

Java

public void stopLocalization()

Kotlin

fun stopLocalization(): Unit

Objective-C

- (void)stopLocalization

Swift

public func stopLocalization() -> Void

C#

public virtual void stopLocalization()