// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
namespace Intel.RealSense
{
using System;
using System.Runtime.InteropServices;
using Intel.RealSense;
public class PoseFrame : Frame
{
public PoseFrame(IntPtr ptr)
: base(ptr)
{
}
///
/// Gets the transformation represented by the pose data
///
public Pose PoseData
{
get
{
object error;
Pose pose = new Pose();
NativeMethods.rs2_pose_frame_get_pose_data(Handle, pose, out error);
return pose;
}
}
///
/// Copy pose data to managed object
///
/// struct type with layout matching
/// object to copy data to
public void CopyTo(out T pose)
where T : struct
{
pose = (T)Marshal.PtrToStructure(Data, typeof(T));
}
///
/// Copy pose data to managed object
///
/// class type with layout matching
/// object to copy data to
/// Thrown when is null
public void CopyTo(T pose)
where T : class
{
if (pose == null)
{
throw new ArgumentNullException(nameof(pose));
}
Marshal.PtrToStructure(Data, pose);
}
}
}