com.shinolab.autd3-sdk.core 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AssemblyInfo.cs +0 -1
- package/Geometry.cs +8 -26
- package/Native.cs +48 -42
- package/Plugins/linux-x64/libautd3_core.so +0 -0
- package/Plugins/osx-arm64/libautd3_core.dylib +0 -0
- package/Plugins/win-x64/autd3_core.dll +0 -0
- package/SafeHandles.cs +100 -0
- package/SafeHandles.cs.meta +11 -0
- package/THIRD-PARTY-LICENSES.md +35 -4
- package/Types.cs +2 -2
- package/Units.cs +11 -9
- package/package.json +1 -1
package/AssemblyInfo.cs
CHANGED
|
@@ -6,7 +6,6 @@ using System.Runtime.CompilerServices;
|
|
|
6
6
|
[assembly: InternalsVisibleTo("AUTD3.Modulation")]
|
|
7
7
|
[assembly: InternalsVisibleTo("AUTD3.Link.Echocat")]
|
|
8
8
|
[assembly: InternalsVisibleTo("AUTD3.Link.Ethercrab")]
|
|
9
|
-
[assembly: InternalsVisibleTo("AUTD3.Link.Soem")]
|
|
10
9
|
[assembly: InternalsVisibleTo("AUTD3.Link.Remote")]
|
|
11
10
|
[assembly: InternalsVisibleTo("AUTD3.Link.TwinCAT")]
|
|
12
11
|
[assembly: InternalsVisibleTo("AUTD3.Link.Nop")]
|
package/Geometry.cs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Threading;
|
|
3
2
|
using System.Collections;
|
|
4
3
|
using System.Collections.Generic;
|
|
5
4
|
using System.Numerics;
|
|
@@ -8,9 +7,9 @@ namespace AUTD3
|
|
|
8
7
|
{
|
|
9
8
|
public sealed class Geometry : IDisposable, IEnumerable<Device>
|
|
10
9
|
{
|
|
11
|
-
private
|
|
10
|
+
private readonly GeometryHandle _handle;
|
|
12
11
|
|
|
13
|
-
internal
|
|
12
|
+
internal GeometryHandle Handle => _handle;
|
|
14
13
|
|
|
15
14
|
public Geometry(IReadOnlyList<Autd3> devices)
|
|
16
15
|
{
|
|
@@ -24,7 +23,7 @@ namespace AUTD3
|
|
|
24
23
|
{
|
|
25
24
|
throw new Autd3Exception("failed to create geometry");
|
|
26
25
|
}
|
|
27
|
-
_handle = handle;
|
|
26
|
+
_handle = new GeometryHandle(handle);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
public int NumDevices => (int)NativeCore.autd3_core_geometry_num_devices(Handle);
|
|
@@ -56,38 +55,21 @@ namespace AUTD3
|
|
|
56
55
|
|
|
57
56
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
|
58
57
|
|
|
59
|
-
public void Dispose()
|
|
60
|
-
{
|
|
61
|
-
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
62
|
-
if (handle != IntPtr.Zero)
|
|
63
|
-
{
|
|
64
|
-
NativeCore.autd3_core_geometry_free(handle);
|
|
65
|
-
}
|
|
66
|
-
GC.SuppressFinalize(this);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
~Geometry()
|
|
70
|
-
{
|
|
71
|
-
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
72
|
-
if (handle != IntPtr.Zero)
|
|
73
|
-
{
|
|
74
|
-
NativeCore.autd3_core_geometry_free(handle);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
58
|
+
public void Dispose() => _handle.Dispose();
|
|
77
59
|
}
|
|
78
60
|
|
|
79
61
|
public readonly struct Device
|
|
80
62
|
{
|
|
81
|
-
private readonly
|
|
63
|
+
private readonly GeometryHandle _geometry;
|
|
82
64
|
private readonly UIntPtr _dev;
|
|
83
65
|
|
|
84
|
-
internal Device(
|
|
66
|
+
internal Device(GeometryHandle geometry, UIntPtr dev)
|
|
85
67
|
{
|
|
86
68
|
_geometry = geometry;
|
|
87
69
|
_dev = dev;
|
|
88
70
|
}
|
|
89
71
|
|
|
90
|
-
internal
|
|
72
|
+
internal GeometryHandle GeometryHandle => _geometry;
|
|
91
73
|
|
|
92
74
|
internal UIntPtr DeviceIndex => _dev;
|
|
93
75
|
|
|
@@ -163,7 +145,7 @@ namespace AUTD3
|
|
|
163
145
|
}
|
|
164
146
|
}
|
|
165
147
|
|
|
166
|
-
private Vector3 DeviceDirection(Action<
|
|
148
|
+
private Vector3 DeviceDirection(Action<GeometryHandle, UIntPtr, float[]> native)
|
|
167
149
|
{
|
|
168
150
|
var xyz = new float[3];
|
|
169
151
|
native(_geometry, _dev, xyz);
|
package/Native.cs
CHANGED
|
@@ -10,7 +10,7 @@ namespace AUTD3
|
|
|
10
10
|
|
|
11
11
|
static NativeCore() => NativeAbi.Verify(Lib, autd3_abi_version());
|
|
12
12
|
|
|
13
|
-
[DllImport(Lib)]
|
|
13
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
14
14
|
private static extern uint autd3_abi_version();
|
|
15
15
|
|
|
16
16
|
[StructLayout(LayoutKind.Sequential)]
|
|
@@ -20,110 +20,116 @@ namespace AUTD3
|
|
|
20
20
|
public float Rw, Rx, Ry, Rz;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
[DllImport(Lib)]
|
|
23
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
24
24
|
internal static extern IntPtr autd3_core_geometry_new(Autd3Device[] devices, UIntPtr len);
|
|
25
25
|
|
|
26
|
-
[DllImport(Lib)]
|
|
27
|
-
internal static extern UIntPtr autd3_core_geometry_num_devices(
|
|
26
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
27
|
+
internal static extern UIntPtr autd3_core_geometry_num_devices(GeometryHandle geometry);
|
|
28
28
|
|
|
29
|
-
[DllImport(Lib)]
|
|
30
|
-
internal static extern void autd3_core_geometry_center(
|
|
29
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
30
|
+
internal static extern void autd3_core_geometry_center(GeometryHandle geometry, [Out] float[] outXyz);
|
|
31
31
|
|
|
32
|
-
[DllImport(Lib)]
|
|
33
|
-
internal static extern UIntPtr autd3_core_geometry_num_transducers(
|
|
32
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
33
|
+
internal static extern UIntPtr autd3_core_geometry_num_transducers(GeometryHandle geometry);
|
|
34
34
|
|
|
35
|
-
[DllImport(Lib)]
|
|
36
|
-
internal static extern UIntPtr autd3_core_device_num_transducers(
|
|
35
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
36
|
+
internal static extern UIntPtr autd3_core_device_num_transducers(GeometryHandle geometry, UIntPtr dev);
|
|
37
37
|
|
|
38
|
-
[DllImport(Lib)]
|
|
39
|
-
internal static extern UIntPtr autd3_core_device_idx(
|
|
38
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
39
|
+
internal static extern UIntPtr autd3_core_device_idx(GeometryHandle geometry, UIntPtr dev);
|
|
40
40
|
|
|
41
|
-
[DllImport(Lib)]
|
|
42
|
-
internal static extern void autd3_core_device_rotation(
|
|
41
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
42
|
+
internal static extern void autd3_core_device_rotation(GeometryHandle geometry, UIntPtr dev, [Out] float[] outWijk);
|
|
43
43
|
|
|
44
|
-
[DllImport(Lib)]
|
|
45
|
-
internal static extern void autd3_core_device_center(
|
|
44
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
45
|
+
internal static extern void autd3_core_device_center(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
|
|
46
46
|
|
|
47
|
-
[DllImport(Lib)]
|
|
48
|
-
internal static extern void autd3_core_device_direction_x(
|
|
47
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
48
|
+
internal static extern void autd3_core_device_direction_x(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
|
|
49
49
|
|
|
50
|
-
[DllImport(Lib)]
|
|
51
|
-
internal static extern void autd3_core_device_direction_y(
|
|
50
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
51
|
+
internal static extern void autd3_core_device_direction_y(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
|
|
52
52
|
|
|
53
|
-
[DllImport(Lib)]
|
|
54
|
-
internal static extern void autd3_core_device_direction_axial(
|
|
53
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
54
|
+
internal static extern void autd3_core_device_direction_axial(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
|
|
55
55
|
|
|
56
|
-
[DllImport(Lib)]
|
|
57
|
-
internal static extern int autd3_core_transducer_position(
|
|
56
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
57
|
+
internal static extern int autd3_core_transducer_position(GeometryHandle geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
|
|
58
58
|
|
|
59
|
-
[DllImport(Lib)]
|
|
60
|
-
internal static extern int autd3_core_transducer_direction(
|
|
59
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
60
|
+
internal static extern int autd3_core_transducer_direction(GeometryHandle geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
|
|
61
61
|
|
|
62
|
-
[DllImport(Lib)]
|
|
62
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
63
63
|
internal static extern void autd3_core_geometry_free(IntPtr geometry);
|
|
64
64
|
|
|
65
|
-
[DllImport(Lib)]
|
|
65
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
66
66
|
internal static extern float autd3_core_phase_radian(byte value);
|
|
67
67
|
|
|
68
|
-
[DllImport(Lib)]
|
|
68
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
69
69
|
internal static extern IntPtr autd3_core_sampling_config_divide(ushort divide);
|
|
70
70
|
|
|
71
|
-
[DllImport(Lib)]
|
|
71
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
72
72
|
internal static extern IntPtr autd3_core_sampling_config_freq(float hz);
|
|
73
73
|
|
|
74
|
-
[DllImport(Lib)]
|
|
74
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
75
75
|
internal static extern IntPtr autd3_core_sampling_config_freq_nearest(float hz);
|
|
76
76
|
|
|
77
|
-
[DllImport(Lib)]
|
|
77
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
78
78
|
internal static extern IntPtr autd3_core_sampling_config_period(ulong nanos);
|
|
79
79
|
|
|
80
|
-
[DllImport(Lib)]
|
|
80
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
81
81
|
internal static extern IntPtr autd3_core_sampling_config_period_nearest(ulong nanos);
|
|
82
82
|
|
|
83
|
-
[DllImport(Lib)]
|
|
83
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
84
84
|
internal static extern int autd3_core_sampling_config_divide_value(IntPtr config, out ushort outValue);
|
|
85
85
|
|
|
86
|
-
[DllImport(Lib)]
|
|
86
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
87
87
|
internal static extern int autd3_core_sampling_config_freq_value(IntPtr config, out float outValue);
|
|
88
88
|
|
|
89
|
-
[DllImport(Lib)]
|
|
89
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
90
90
|
internal static extern int autd3_core_sampling_config_period_value(IntPtr config, out ulong outValue);
|
|
91
91
|
|
|
92
|
-
[DllImport(Lib)]
|
|
92
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
93
93
|
internal static extern void autd3_core_sampling_config_free(IntPtr config);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
internal static class NativeAbi
|
|
97
97
|
{
|
|
98
|
-
internal const ushort Major =
|
|
99
|
-
internal const ushort Minor =
|
|
98
|
+
internal const ushort Major = 0;
|
|
99
|
+
internal const ushort Minor = 7;
|
|
100
|
+
internal const ushort Patch = 0;
|
|
100
101
|
|
|
101
102
|
internal const int ErrorBufferLength = 1024;
|
|
102
103
|
|
|
103
104
|
internal static void Verify(string library, uint actual)
|
|
104
105
|
{
|
|
105
|
-
var expected = ((uint)Major <<
|
|
106
|
+
var expected = ((uint)Major << 20) | ((uint)Minor << 10) | Patch;
|
|
106
107
|
if (actual == expected)
|
|
107
108
|
{
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
111
|
throw new Autd3Exception(
|
|
111
|
-
$"native library '{library}' reports C ABI version {actual >>
|
|
112
|
-
$"but this binding requires {Major}.{Minor}. " +
|
|
112
|
+
$"native library '{library}' reports C ABI version {actual >> 20}.{(actual >> 10) & 0x3FF}.{actual & 0x3FF}, " +
|
|
113
|
+
$"but this binding requires exactly {Major}.{Minor}.{Patch}. " +
|
|
113
114
|
"The managed package and the native library are from different releases.");
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
internal static class LinkOptionNative
|
|
118
119
|
{
|
|
120
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
119
121
|
internal delegate int SetDurationFn(IntPtr option, ulong ns);
|
|
120
122
|
|
|
123
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
121
124
|
internal delegate int GetDurationFn(IntPtr option, out ulong ns);
|
|
122
125
|
|
|
126
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
123
127
|
internal delegate int SetOptionalDurationFn(IntPtr option, [MarshalAs(UnmanagedType.I1)] bool hasValue, ulong ns);
|
|
124
128
|
|
|
129
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
125
130
|
internal delegate int GetOptionalDurationFn(IntPtr option, [MarshalAs(UnmanagedType.I1)] out bool hasValue, out ulong ns);
|
|
126
131
|
|
|
132
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
127
133
|
internal delegate IntPtr OpenFn(IntPtr option, byte[] outErr, UIntPtr outErrLen);
|
|
128
134
|
|
|
129
135
|
internal static void Apply(string field, int code)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/SafeHandles.cs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Runtime.InteropServices;
|
|
3
|
+
|
|
4
|
+
namespace AUTD3
|
|
5
|
+
{
|
|
6
|
+
internal abstract class Autd3SafeHandle : SafeHandle
|
|
7
|
+
{
|
|
8
|
+
protected Autd3SafeHandle(IntPtr handle) : base(IntPtr.Zero, true)
|
|
9
|
+
{
|
|
10
|
+
SetHandle(handle);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public override bool IsInvalid => handle == IntPtr.Zero;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
internal sealed class GeometryHandle : Autd3SafeHandle
|
|
17
|
+
{
|
|
18
|
+
internal GeometryHandle(IntPtr handle) : base(handle)
|
|
19
|
+
{
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected override bool ReleaseHandle()
|
|
23
|
+
{
|
|
24
|
+
NativeCore.autd3_core_geometry_free(handle);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
internal sealed class HandleArray : IDisposable
|
|
30
|
+
{
|
|
31
|
+
private readonly SafeHandle[] _handles;
|
|
32
|
+
private readonly bool[] _added;
|
|
33
|
+
|
|
34
|
+
internal readonly IntPtr[] Pointers;
|
|
35
|
+
|
|
36
|
+
internal HandleArray(SafeHandle[] handles)
|
|
37
|
+
{
|
|
38
|
+
_handles = handles;
|
|
39
|
+
_added = new bool[handles.Length];
|
|
40
|
+
Pointers = new IntPtr[handles.Length];
|
|
41
|
+
try
|
|
42
|
+
{
|
|
43
|
+
for (var i = 0; i < handles.Length; i++)
|
|
44
|
+
{
|
|
45
|
+
handles[i].DangerousAddRef(ref _added[i]);
|
|
46
|
+
Pointers[i] = handles[i].DangerousGetHandle();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch
|
|
50
|
+
{
|
|
51
|
+
Dispose();
|
|
52
|
+
throw;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public void Dispose()
|
|
57
|
+
{
|
|
58
|
+
for (var i = 0; i < _handles.Length; i++)
|
|
59
|
+
{
|
|
60
|
+
if (_added[i])
|
|
61
|
+
{
|
|
62
|
+
_added[i] = false;
|
|
63
|
+
_handles[i].DangerousRelease();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
internal struct HandleLease : IDisposable
|
|
70
|
+
{
|
|
71
|
+
private readonly SafeHandle? _handle;
|
|
72
|
+
private bool _added;
|
|
73
|
+
|
|
74
|
+
internal IntPtr Pointer { get; }
|
|
75
|
+
|
|
76
|
+
internal HandleLease(SafeHandle? handle)
|
|
77
|
+
{
|
|
78
|
+
_handle = handle;
|
|
79
|
+
_added = false;
|
|
80
|
+
Pointer = IntPtr.Zero;
|
|
81
|
+
if (handle == null)
|
|
82
|
+
{
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
var added = false;
|
|
86
|
+
handle.DangerousAddRef(ref added);
|
|
87
|
+
_added = added;
|
|
88
|
+
Pointer = handle.DangerousGetHandle();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public void Dispose()
|
|
92
|
+
{
|
|
93
|
+
if (_added)
|
|
94
|
+
{
|
|
95
|
+
_added = false;
|
|
96
|
+
_handle!.DangerousRelease();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
package/THIRD-PARTY-LICENSES.md
CHANGED
|
@@ -5,7 +5,7 @@ The following is a list of those components and the full text of their licenses.
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
- MIT License (
|
|
8
|
+
- MIT License (50)
|
|
9
9
|
- Apache License 2.0 (3)
|
|
10
10
|
- Unicode License v3 (1)
|
|
11
11
|
|
|
@@ -854,7 +854,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
854
854
|
|
|
855
855
|
Used by:
|
|
856
856
|
|
|
857
|
-
- autd3-rs-core 0.
|
|
857
|
+
- autd3-rs-core 0.7.0 — https://github.com/shinolab/autd3-sdk
|
|
858
858
|
- autd3-cpu-wire 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
859
859
|
|
|
860
860
|
```
|
|
@@ -886,8 +886,8 @@ SOFTWARE.
|
|
|
886
886
|
|
|
887
887
|
Used by:
|
|
888
888
|
|
|
889
|
-
- autd3-ffi-abi 0.
|
|
890
|
-
- autd3-ffi-core 0.
|
|
889
|
+
- autd3-ffi-abi 0.7.0 — https://github.com/shinolab/autd3-sdk
|
|
890
|
+
- autd3-ffi-core 0.7.0 — https://github.com/shinolab/autd3-sdk
|
|
891
891
|
- chrono 0.4.45 — https://github.com/chronotope/chrono
|
|
892
892
|
- wide 1.5.0 — https://github.com/Lokathor/wide
|
|
893
893
|
- winapi-i686-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
|
|
@@ -971,6 +971,37 @@ DEALINGS IN THE SOFTWARE.
|
|
|
971
971
|
|
|
972
972
|
Used by:
|
|
973
973
|
|
|
974
|
+
- tracing-core 0.1.36 — https://github.com/tokio-rs/tracing
|
|
975
|
+
|
|
976
|
+
```
|
|
977
|
+
The MIT License (MIT)
|
|
978
|
+
|
|
979
|
+
Copyright (c) 2014 Mathijs van de Nes
|
|
980
|
+
|
|
981
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
982
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
983
|
+
in the Software without restriction, including without limitation the rights
|
|
984
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
985
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
986
|
+
furnished to do so, subject to the following conditions:
|
|
987
|
+
|
|
988
|
+
The above copyright notice and this permission notice shall be included in all
|
|
989
|
+
copies or substantial portions of the Software.
|
|
990
|
+
|
|
991
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
992
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
993
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
994
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
995
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
996
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
997
|
+
SOFTWARE.
|
|
998
|
+
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
## MIT License
|
|
1002
|
+
|
|
1003
|
+
Used by:
|
|
1004
|
+
|
|
974
1005
|
- typenum 1.20.1 — https://github.com/paholg/typenum
|
|
975
1006
|
|
|
976
1007
|
```
|
package/Types.cs
CHANGED
|
@@ -88,11 +88,11 @@ namespace AUTD3
|
|
|
88
88
|
public static Phase Zero => new Phase(0x00);
|
|
89
89
|
public static Phase Pi => new Phase(0x80);
|
|
90
90
|
|
|
91
|
-
public float
|
|
91
|
+
public float Rad() => NativeCore.autd3_core_phase_radian(Value);
|
|
92
92
|
|
|
93
93
|
public static explicit operator Phase(Angle angle)
|
|
94
94
|
{
|
|
95
|
-
var p = (int)MathF.Round(angle.
|
|
95
|
+
var p = (int)MathF.Round(angle.Rad / (2f * MathF.PI) * 256f);
|
|
96
96
|
return new Phase((byte)(p & 0xFF));
|
|
97
97
|
}
|
|
98
98
|
|
package/Units.cs
CHANGED
|
@@ -13,39 +13,41 @@ namespace AUTD3
|
|
|
13
13
|
|
|
14
14
|
public float M => Mm / 1000f;
|
|
15
15
|
|
|
16
|
-
public static Length
|
|
16
|
+
public static Length FromMm(float mm) => new Length(mm);
|
|
17
|
+
|
|
18
|
+
public static Length FromM(float m) => new Length(m * 1000f);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
public readonly struct Angle
|
|
20
22
|
{
|
|
21
|
-
public float
|
|
23
|
+
public float Rad { get; }
|
|
22
24
|
|
|
23
25
|
internal Angle(float radian)
|
|
24
26
|
{
|
|
25
|
-
|
|
27
|
+
Rad = radian;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
public float
|
|
30
|
+
public float Deg => Rad * (180f / MathF.PI);
|
|
29
31
|
|
|
30
32
|
public static Angle Zero => new Angle(0f);
|
|
31
33
|
|
|
32
34
|
public static Angle Pi => new Angle(MathF.PI);
|
|
33
35
|
|
|
34
|
-
public static Angle
|
|
36
|
+
public static Angle FromRad(float radian) => new Angle(radian);
|
|
35
37
|
|
|
36
|
-
public static Angle
|
|
38
|
+
public static Angle FromDeg(float degree) => new Angle(degree * (MathF.PI / 180f));
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
public readonly struct Velocity
|
|
40
42
|
{
|
|
41
|
-
public float
|
|
43
|
+
public float MmS { get; }
|
|
42
44
|
|
|
43
45
|
internal Velocity(float mmPerS)
|
|
44
46
|
{
|
|
45
|
-
|
|
47
|
+
MmS = mmPerS;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
public float
|
|
50
|
+
public float MS => MmS / 1000f;
|
|
49
51
|
|
|
50
52
|
public static Velocity FromMmS(float mmPerS) => new Velocity(mmPerS);
|
|
51
53
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/shinolab/autd3-sdk.git",
|
|
6
6
|
"directory": "bindings/unity/com.shinolab.autd3-sdk.core"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.7.0",
|
|
9
9
|
"displayName": "AUTD3 Core",
|
|
10
10
|
"description": "AUTD3 core types, geometry and units (Unity binding).",
|
|
11
11
|
"unity": "6000.0",
|