WVR_GetScenePlanes¶
-
WVR_EXPORT WVR_Result WVR_GetScenePlanes(const WVR_ScenePlaneFilter * planeFilter, uint32_t planeCapacityInput, uint32_t * planeCountOutput, WVR_PoseOriginModel originModel, WVR_ScenePlane * planes)
Function is used to retrieve scene planes.
This is two calls API. Developers should call this API with the value of planeCapacityInput equals to 0 to retrieve the size of planes from planeCountOutput. Then developers allocate the array of WVR_ScenePlane data and assign the planeCapacityInput and call the API in the second time. Then runtime will fill the WVR_ScenePlane array. Note: that only WVR_PoseOriginModel_OriginOnHead and WVR_PoseOriginModel_OriginOnGround cases are supported in originModel.
- Version
- API Level 11
- Parameters
planeFilter
: Filter the scene planes which meeting the filter criteria. Developers set nullptr if no need filter, refer to WVR_ScenePlaneFilter.planeCapacityInput
: the capacity of the planes array, or 0 to indicate a request to retrieve the required capacity.planeCountOutput
: a pointer to the count of planes written, or a pointer to the required capacity in the case that planeCapacityInput is insufficient.originModel
: Only WVR_PoseOriginModel_OriginOnHead and WVR_PoseOriginModel_OriginOnGround are supported, refer to WVR_PoseOriginModel.planes
: An array of WVR_ScenePlane will be filled by the runtime.
- Return Value
WVR_Success
: Get scene planes successfully.others
: WVR_Result mean failure.
Note
Add WVR_SemanticLabelName inside data structure struct WVR_ScenePlane. (See Types in wvr_scene.h and wvr_anchor.h)
Coordinate System of Planes¶
The extent of a plane means the planes’s size in the x-y plane of the plane’s coordinate system. The following pictures show the coordinate system related to scene planes.
Coordinate System of different scene plane type
How to use¶
Sample function:
#include <wvr/wvr_scene.h>
if (WVR_StartScene() == WVR_Success) {
if (WVR_StartScenePerception(WVR_ScenePerceptionTarget_2dPlane) == WVR_Success) {
WVR_ScenePerceptionState state;
if (WVR_GetScenePerceptionState(WVR_ScenePerceptionTarget_2dPlane, &state) == WVR_SUCCESS) {
// wait until state is WVR_ScenePerceptionState_Completed
if (state == WVR_ScenePerceptionState_Completed) {
// Start scene perception with WVR_ScenePerceptionTarget_2dPlane successfully and get the state as completed.
// Developers can call WVR_GetScenePlanes to get scene plane data
uint32_t sceneCount = 0;
WVR_ScenePlane *scenePlanes;
if (WVR_GetScenePlanes(nullptr, 0, &sceneCount, WVR_PoseOriginModel_OriginOnHead, nullptr) == WVR_Success) {
scenePlanes = (WVR_ScenePlane*)malloc(sizeof(WVR_ScenePlane)*sceneCount);
if (WVR_GetScenePlanes(nullptr, sceneCount, &sceneCount, WVR_PoseOriginModel_OriginOnHead, scenePlanes) == WVR_Success) {
// get scene planes data successfully
}
}
}
}
} else {
// start perception with WVR_ScenePerceptionTarget_2dPlane failed
}
// ...
WVR_StopScenePerception(WVR_ScenePerceptionTarget_2dPlane);
WVR_StopScene();
} else {
// start scene failed!
}