com.shinolab.autd3-sdk.core 0.6.1 → 0.8.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 CHANGED
@@ -5,8 +5,6 @@ using System.Runtime.CompilerServices;
5
5
  [assembly: InternalsVisibleTo("AUTD3.Pattern.Holo")]
6
6
  [assembly: InternalsVisibleTo("AUTD3.Modulation")]
7
7
  [assembly: InternalsVisibleTo("AUTD3.Link.Echocat")]
8
- [assembly: InternalsVisibleTo("AUTD3.Link.Ethercrab")]
9
- [assembly: InternalsVisibleTo("AUTD3.Link.Soem")]
10
8
  [assembly: InternalsVisibleTo("AUTD3.Link.Remote")]
11
9
  [assembly: InternalsVisibleTo("AUTD3.Link.TwinCAT")]
12
10
  [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 IntPtr _handle;
10
+ private readonly GeometryHandle _handle;
12
11
 
13
- internal IntPtr Handle => _handle;
12
+ internal GeometryHandle Handle => _handle;
14
13
 
15
14
  public Geometry(IReadOnlyList<Autd3> devices)
16
15
  {
@@ -24,9 +23,43 @@ namespace AUTD3
24
23
  {
25
24
  throw new Autd3Exception("failed to create geometry");
26
25
  }
26
+ _handle = new GeometryHandle(handle);
27
+ }
28
+
29
+ private Geometry(GeometryHandle handle)
30
+ {
27
31
  _handle = handle;
28
32
  }
29
33
 
34
+ public static Geometry FromJson(string json)
35
+ {
36
+ var err = new byte[NativeAbi.ErrorBufferLength];
37
+ var handle = NativeCore.autd3_core_geometry_from_json(json, err, (UIntPtr)err.Length);
38
+ if (handle == IntPtr.Zero)
39
+ {
40
+ throw new Autd3Exception(NativeUtil.Utf8(err));
41
+ }
42
+ return new Geometry(new GeometryHandle(handle));
43
+ }
44
+
45
+ public string ToJson()
46
+ {
47
+ var err = new byte[NativeAbi.ErrorBufferLength];
48
+ var ptr = NativeCore.autd3_core_geometry_to_json(Handle, err, (UIntPtr)err.Length);
49
+ if (ptr == IntPtr.Zero)
50
+ {
51
+ throw new Autd3Exception(NativeUtil.Utf8(err));
52
+ }
53
+ try
54
+ {
55
+ return NativeUtil.PtrToString(ptr);
56
+ }
57
+ finally
58
+ {
59
+ NativeCore.autd3_core_free_string(ptr);
60
+ }
61
+ }
62
+
30
63
  public int NumDevices => (int)NativeCore.autd3_core_geometry_num_devices(Handle);
31
64
 
32
65
  public int NumTransducers => (int)NativeCore.autd3_core_geometry_num_transducers(Handle);
@@ -56,38 +89,21 @@ namespace AUTD3
56
89
 
57
90
  IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
58
91
 
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
- }
92
+ public void Dispose() => _handle.Dispose();
77
93
  }
78
94
 
79
95
  public readonly struct Device
80
96
  {
81
- private readonly IntPtr _geometry;
97
+ private readonly GeometryHandle _geometry;
82
98
  private readonly UIntPtr _dev;
83
99
 
84
- internal Device(IntPtr geometry, UIntPtr dev)
100
+ internal Device(GeometryHandle geometry, UIntPtr dev)
85
101
  {
86
102
  _geometry = geometry;
87
103
  _dev = dev;
88
104
  }
89
105
 
90
- internal IntPtr GeometryHandle => _geometry;
106
+ internal GeometryHandle GeometryHandle => _geometry;
91
107
 
92
108
  internal UIntPtr DeviceIndex => _dev;
93
109
 
@@ -163,7 +179,7 @@ namespace AUTD3
163
179
  }
164
180
  }
165
181
 
166
- private Vector3 DeviceDirection(Action<IntPtr, UIntPtr, float[]> native)
182
+ private Vector3 DeviceDirection(Action<GeometryHandle, UIntPtr, float[]> native)
167
183
  {
168
184
  var xyz = new float[3];
169
185
  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,125 @@ 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(IntPtr geometry);
26
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
27
+ internal static extern IntPtr autd3_core_geometry_from_json([MarshalAs(UnmanagedType.LPUTF8Str)] string json, byte[] outErr, UIntPtr outErrLen);
28
28
 
29
- [DllImport(Lib)]
30
- internal static extern void autd3_core_geometry_center(IntPtr geometry, [Out] float[] outXyz);
29
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
30
+ internal static extern IntPtr autd3_core_geometry_to_json(GeometryHandle geometry, byte[] outErr, UIntPtr outErrLen);
31
31
 
32
- [DllImport(Lib)]
33
- internal static extern UIntPtr autd3_core_geometry_num_transducers(IntPtr geometry);
32
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
33
+ internal static extern void autd3_core_free_string(IntPtr ptr);
34
34
 
35
- [DllImport(Lib)]
36
- internal static extern UIntPtr autd3_core_device_num_transducers(IntPtr geometry, UIntPtr dev);
35
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
36
+ internal static extern UIntPtr autd3_core_geometry_num_devices(GeometryHandle geometry);
37
37
 
38
- [DllImport(Lib)]
39
- internal static extern UIntPtr autd3_core_device_idx(IntPtr geometry, UIntPtr dev);
38
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
39
+ internal static extern void autd3_core_geometry_center(GeometryHandle geometry, [Out] float[] outXyz);
40
40
 
41
- [DllImport(Lib)]
42
- internal static extern void autd3_core_device_rotation(IntPtr geometry, UIntPtr dev, [Out] float[] outWijk);
41
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
42
+ internal static extern UIntPtr autd3_core_geometry_num_transducers(GeometryHandle geometry);
43
43
 
44
- [DllImport(Lib)]
45
- internal static extern void autd3_core_device_center(IntPtr geometry, UIntPtr dev, [Out] float[] outXyz);
44
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
45
+ internal static extern UIntPtr autd3_core_device_num_transducers(GeometryHandle geometry, UIntPtr dev);
46
46
 
47
- [DllImport(Lib)]
48
- internal static extern void autd3_core_device_direction_x(IntPtr geometry, UIntPtr dev, [Out] float[] outXyz);
47
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
48
+ internal static extern UIntPtr autd3_core_device_idx(GeometryHandle geometry, UIntPtr dev);
49
49
 
50
- [DllImport(Lib)]
51
- internal static extern void autd3_core_device_direction_y(IntPtr geometry, UIntPtr dev, [Out] float[] outXyz);
50
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
51
+ internal static extern void autd3_core_device_rotation(GeometryHandle geometry, UIntPtr dev, [Out] float[] outWijk);
52
52
 
53
- [DllImport(Lib)]
54
- internal static extern void autd3_core_device_direction_axial(IntPtr geometry, UIntPtr dev, [Out] float[] outXyz);
53
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
54
+ internal static extern void autd3_core_device_center(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
55
55
 
56
- [DllImport(Lib)]
57
- internal static extern int autd3_core_transducer_position(IntPtr geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
56
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
57
+ internal static extern void autd3_core_device_direction_x(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
58
58
 
59
- [DllImport(Lib)]
60
- internal static extern int autd3_core_transducer_direction(IntPtr geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
59
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
60
+ internal static extern void autd3_core_device_direction_y(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
61
61
 
62
- [DllImport(Lib)]
62
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
63
+ internal static extern void autd3_core_device_direction_axial(GeometryHandle geometry, UIntPtr dev, [Out] float[] outXyz);
64
+
65
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
66
+ internal static extern int autd3_core_transducer_position(GeometryHandle geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
67
+
68
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
69
+ internal static extern int autd3_core_transducer_direction(GeometryHandle geometry, UIntPtr dev, UIntPtr tr, [Out] float[] outXyz);
70
+
71
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
63
72
  internal static extern void autd3_core_geometry_free(IntPtr geometry);
64
73
 
65
- [DllImport(Lib)]
74
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
66
75
  internal static extern float autd3_core_phase_radian(byte value);
67
76
 
68
- [DllImport(Lib)]
77
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
69
78
  internal static extern IntPtr autd3_core_sampling_config_divide(ushort divide);
70
79
 
71
- [DllImport(Lib)]
80
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
72
81
  internal static extern IntPtr autd3_core_sampling_config_freq(float hz);
73
82
 
74
- [DllImport(Lib)]
83
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
75
84
  internal static extern IntPtr autd3_core_sampling_config_freq_nearest(float hz);
76
85
 
77
- [DllImport(Lib)]
86
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
78
87
  internal static extern IntPtr autd3_core_sampling_config_period(ulong nanos);
79
88
 
80
- [DllImport(Lib)]
89
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
81
90
  internal static extern IntPtr autd3_core_sampling_config_period_nearest(ulong nanos);
82
91
 
83
- [DllImport(Lib)]
92
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
84
93
  internal static extern int autd3_core_sampling_config_divide_value(IntPtr config, out ushort outValue);
85
94
 
86
- [DllImport(Lib)]
95
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
87
96
  internal static extern int autd3_core_sampling_config_freq_value(IntPtr config, out float outValue);
88
97
 
89
- [DllImport(Lib)]
98
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
90
99
  internal static extern int autd3_core_sampling_config_period_value(IntPtr config, out ulong outValue);
91
100
 
92
- [DllImport(Lib)]
101
+ [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
93
102
  internal static extern void autd3_core_sampling_config_free(IntPtr config);
94
103
  }
95
104
 
96
105
  internal static class NativeAbi
97
106
  {
98
- internal const ushort Major = 1;
99
- internal const ushort Minor = 0;
107
+ internal const ushort Major = 0;
108
+ internal const ushort Minor = 8;
109
+ internal const ushort Patch = 0;
100
110
 
101
111
  internal const int ErrorBufferLength = 1024;
102
112
 
103
113
  internal static void Verify(string library, uint actual)
104
114
  {
105
- var expected = ((uint)Major << 16) | Minor;
115
+ var expected = ((uint)Major << 20) | ((uint)Minor << 10) | Patch;
106
116
  if (actual == expected)
107
117
  {
108
118
  return;
109
119
  }
110
120
  throw new Autd3Exception(
111
- $"native library '{library}' reports C ABI version {actual >> 16}.{actual & 0xFFFF}, " +
112
- $"but this binding requires {Major}.{Minor}. " +
121
+ $"native library '{library}' reports C ABI version {actual >> 20}.{(actual >> 10) & 0x3FF}.{actual & 0x3FF}, " +
122
+ $"but this binding requires exactly {Major}.{Minor}.{Patch}. " +
113
123
  "The managed package and the native library are from different releases.");
114
124
  }
115
125
  }
116
126
 
117
127
  internal static class LinkOptionNative
118
128
  {
129
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
119
130
  internal delegate int SetDurationFn(IntPtr option, ulong ns);
120
131
 
132
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
121
133
  internal delegate int GetDurationFn(IntPtr option, out ulong ns);
122
134
 
135
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
123
136
  internal delegate int SetOptionalDurationFn(IntPtr option, [MarshalAs(UnmanagedType.I1)] bool hasValue, ulong ns);
124
137
 
138
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
125
139
  internal delegate int GetOptionalDurationFn(IntPtr option, [MarshalAs(UnmanagedType.I1)] out bool hasValue, out ulong ns);
126
140
 
141
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
127
142
  internal delegate IntPtr OpenFn(IntPtr option, byte[] outErr, UIntPtr outErrLen);
128
143
 
129
144
  internal static void Apply(string field, int code)
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
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 91e9f07baade16facb90ae4d012b698b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -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 (49)
8
+ - MIT License (57)
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.6.1 — https://github.com/shinolab/autd3-sdk
857
+ - autd3-rs-core 0.8.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.6.1 — https://github.com/shinolab/autd3-sdk
890
- - autd3-ffi-core 0.6.1 — https://github.com/shinolab/autd3-sdk
889
+ - autd3-ffi-abi 0.8.0 — https://github.com/shinolab/autd3-sdk
890
+ - autd3-ffi-core 0.8.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
@@ -931,14 +931,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
931
931
  Used by:
932
932
 
933
933
  - hermit-abi 0.5.2 — https://github.com/hermit-os/hermit-rs
934
+ - itoa 1.0.18 — https://github.com/dtolnay/itoa
934
935
  - pin-project-lite 0.2.17 — https://github.com/taiki-e/pin-project-lite
935
936
  - proc-macro2 1.0.106 — https://github.com/dtolnay/proc-macro2
936
937
  - quote 1.0.46 — https://github.com/dtolnay/quote
937
938
  - rustversion 1.0.22 — https://github.com/dtolnay/rustversion
939
+ - serde 1.0.228 — https://github.com/serde-rs/serde
940
+ - serde_core 1.0.228 — https://github.com/serde-rs/serde
941
+ - serde_derive 1.0.228 — https://github.com/serde-rs/serde
942
+ - serde_json 1.0.150 — https://github.com/serde-rs/json
938
943
  - syn 2.0.118 — https://github.com/dtolnay/syn
939
944
  - thiserror-impl 2.0.18 — https://github.com/dtolnay/thiserror
940
945
  - thiserror 2.0.18 — https://github.com/dtolnay/thiserror
941
946
  - unicode-ident 1.0.24 — https://github.com/dtolnay/unicode-ident
947
+ - zmij 1.0.21 — https://github.com/dtolnay/zmij
942
948
 
943
949
  ```
944
950
  Permission is hereby granted, free of charge, to any
@@ -971,6 +977,37 @@ DEALINGS IN THE SOFTWARE.
971
977
 
972
978
  Used by:
973
979
 
980
+ - tracing-core 0.1.36 — https://github.com/tokio-rs/tracing
981
+
982
+ ```
983
+ The MIT License (MIT)
984
+
985
+ Copyright (c) 2014 Mathijs van de Nes
986
+
987
+ Permission is hereby granted, free of charge, to any person obtaining a copy
988
+ of this software and associated documentation files (the "Software"), to deal
989
+ in the Software without restriction, including without limitation the rights
990
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
991
+ copies of the Software, and to permit persons to whom the Software is
992
+ furnished to do so, subject to the following conditions:
993
+
994
+ The above copyright notice and this permission notice shall be included in all
995
+ copies or substantial portions of the Software.
996
+
997
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
998
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
999
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1000
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1001
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1002
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1003
+ SOFTWARE.
1004
+
1005
+ ```
1006
+
1007
+ ## MIT License
1008
+
1009
+ Used by:
1010
+
974
1011
  - typenum 1.20.1 — https://github.com/paholg/typenum
975
1012
 
976
1013
  ```
@@ -998,6 +1035,37 @@ SOFTWARE.
998
1035
 
999
1036
  ```
1000
1037
 
1038
+ ## MIT License
1039
+
1040
+ Used by:
1041
+
1042
+ - memchr 2.8.2 — https://github.com/BurntSushi/memchr
1043
+
1044
+ ```
1045
+ The MIT License (MIT)
1046
+
1047
+ Copyright (c) 2015 Andrew Gallant
1048
+
1049
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1050
+ of this software and associated documentation files (the "Software"), to deal
1051
+ in the Software without restriction, including without limitation the rights
1052
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1053
+ copies of the Software, and to permit persons to whom the Software is
1054
+ furnished to do so, subject to the following conditions:
1055
+
1056
+ The above copyright notice and this permission notice shall be included in
1057
+ all copies or substantial portions of the Software.
1058
+
1059
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1060
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1061
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1062
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1063
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1064
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1065
+ THE SOFTWARE.
1066
+
1067
+ ```
1068
+
1001
1069
  ## Unicode License v3
1002
1070
 
1003
1071
  Used by:
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 Radian() => NativeCore.autd3_core_phase_radian(Value);
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.Radian / (2f * MathF.PI) * 256f);
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 Millimeters(float mm) => new Length(mm);
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 Radian { get; }
23
+ public float Rad { get; }
22
24
 
23
25
  internal Angle(float radian)
24
26
  {
25
- Radian = radian;
27
+ Rad = radian;
26
28
  }
27
29
 
28
- public float Degree => Radian * (180f / MathF.PI);
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 FromRadian(float radian) => new Angle(radian);
36
+ public static Angle FromRad(float radian) => new Angle(radian);
35
37
 
36
- public static Angle FromDegree(float degree) => new Angle(degree * (MathF.PI / 180f));
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 MmPerS { get; }
43
+ public float MmS { get; }
42
44
 
43
45
  internal Velocity(float mmPerS)
44
46
  {
45
- MmPerS = mmPerS;
47
+ MmS = mmPerS;
46
48
  }
47
49
 
48
- public float MPerS => MmPerS / 1000f;
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.6.1",
8
+ "version": "0.8.0",
9
9
  "displayName": "AUTD3 Core",
10
10
  "description": "AUTD3 core types, geometry and units (Unity binding).",
11
11
  "unity": "6000.0",