Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.
Index
Namespaces
Methods
Methods
basisChange
-
Parameters
-
operand: Vector3
-
operation: Conversion.TransformType.Coordinates
Returns Vector3
An object containing the conversion functions for each operator
// Convert API Coordinates to SDK Coordinates: const apiCoords: Vector3 = { x: 1, y: 2, z: 3 }; const conversionFunction = mpSdk.Conversion.TransformType.Coordinates.TO_SDK; const sdkCoords: Vector3 = mpSdk.Conversion.basisChange(apiCoords, conversionFunction); // Convert SDK Sweep Rotation to API Sweep Rotation: const sdkSweepRotation: Quaternion = { x: 0, y: 0, z: 0, w: 1 }; const conversionFunction = mpSdk.Conversion.TransformType.SweepRotation.TO_API; const apiSweepRotation: Quaternion = mpSdk.Conversion.basisChange(sdkSweepRotation, conversionFunction);
-
-
Parameters
-
operand: Quaternion
-
operation: Conversion.TransformType.SweepRotation | Conversion.TransformType.CameraRotation
Returns Quaternion
-
worldToScreen
-
Converts a position of an object in 3d to the pixel coordinate on the screen
Parameters
-
worldPos: Vector3
Position of the object
-
cameraPose: Camera.Pose
The current pose of the Camera as received from Camera.pose.subscribe
-
windowSize: Size
The current size of the Showcase player
-
Optional result: Vector3
An optional, pre-allocated Vector3 to store the result
const showcase = document.getElementById('showcaseIframe'); const showcaseSize = { w: showcase.clientWidth, h: showcase.clientHeight, }; const cameraPose; // get pose using: mpSdk.Camera.pose.subscribe const mattertag; // get a mattertag from the collection using: mpSdk.Mattertag.getData const screenCoordinate = mpSdk.Conversion.worldToScreen(mattertag.anchorPosition, cameraPose, showcaseSize)
Returns Vector3
-
Converts a 3D position or rotation between API and SDK orientations