-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Copy pathMotionFrame.cs
44 lines (38 loc) · 964 Bytes
/
MotionFrame.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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 MotionFrame : Frame
{
public MotionFrame(IntPtr ptr)
: base(ptr)
{
}
public Math.Vector MotionData
{
get
{
Math.Vector xyz;
CopyTo(out xyz);
return xyz;
}
}
public void CopyTo(float[] data)
{
Marshal.Copy(Data, data, 0, 3);
}
public void CopyTo<T>(out T xyz)
where T : struct
{
xyz = (T)Marshal.PtrToStructure(Data, typeof(T));
}
public void CopyTo<T>(T xyz)
where T : class
{
Marshal.PtrToStructure(Data, xyz);
}
}
}