/// <summary> /// Reset reconstruction object to initial state /// </summary> public void ResetReconstruction(FusionVolume vol, Matrix4 startingWorldToCameraTx) { // Reset tracking error counter vol.Engine.CameraTracker.ResetTracking(); // Set the world-view transform to identity, so the world origin is the initial camera location. vol.WorldToCameraTransform = startingWorldToCameraTx; // Reset volume if (null != vol.Reconstruction) { try { // Translate the reconstruction volume location away from the world origin by an amount equal // to the minimum depth threshold. This ensures that some depth signal falls inside the volume. // If set false, the default world origin is set to the center of the front face of the // volume, which has the effect of locating the volume directly in front of the initial camera // position with the +Z axis into the volume along the initial camera direction of view. if (TranslateResetPoseByMinDepthThreshold) { Matrix4 worldToVolumeTransform = vol.DefaultWorldToVolumeTransform; // Translate the volume in the Z axis by the minDepthClip distance float minDist = (vol.MinDepthClip < vol.MaxDepthClip) ? vol.MinDepthClip : vol.MaxDepthClip; worldToVolumeTransform.M43 -= minDist * FusionVolume.VoxelsPerMeter; vol.Reconstruction.ResetReconstruction(vol.WorldToCameraTransform, worldToVolumeTransform); } else { var tx = GetRealWorldVolumeCoordinates(vol); vol.Reconstruction.ResetReconstruction(vol.WorldToCameraTransform, tx); } vol.Engine.CameraTracker.ResetTracking(); vol.OnVolumeReset(EventArgs.Empty); } catch (InvalidOperationException) { logger.Log(LogLevel.Info, "Reset failed"); } } // Update manual reset information to status bar logger.Log(LogLevel.Info, "Volume reset"); }