com.shinolab.autd3-sdk.pattern 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/Ops.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Runtime.InteropServices;
|
|
2
3
|
|
|
3
4
|
namespace AUTD3
|
|
4
5
|
{
|
|
@@ -47,12 +48,13 @@ namespace AUTD3
|
|
|
47
48
|
|
|
48
49
|
IntPtr ICommand.CreateOp()
|
|
49
50
|
{
|
|
50
|
-
var handles = new
|
|
51
|
+
var handles = new SafeHandle[_patterns.Length];
|
|
51
52
|
for (var i = 0; i < _patterns.Length; i++)
|
|
52
53
|
{
|
|
53
54
|
handles[i] = _patterns[i].Handle;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
using var lease = new HandleArray(handles);
|
|
57
|
+
return NativePattern.autd3_op_write_pattern_compressed((byte)_bank, _index, (byte)_format, lease.Pointers, (UIntPtr)lease.Pointers.Length);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -126,7 +128,7 @@ namespace AUTD3
|
|
|
126
128
|
var sampling = _config.CreateHandle();
|
|
127
129
|
try
|
|
128
130
|
{
|
|
129
|
-
return NativePattern.autd3_op_config_foci_stm((byte)_bank, sampling, _size, _numFoci, _soundSpeed.
|
|
131
|
+
return NativePattern.autd3_op_config_foci_stm((byte)_bank, sampling, _size, _numFoci, _soundSpeed.MS, _loopBehavior.Rep);
|
|
130
132
|
}
|
|
131
133
|
finally
|
|
132
134
|
{
|
package/Pattern.cs
CHANGED
|
@@ -71,6 +71,44 @@ namespace AUTD3
|
|
|
71
71
|
new PatternOptionNative { Intensity = Intensity.Value, PhaseOffset = PhaseOffset.Value };
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
public readonly struct TwinTrapOption
|
|
75
|
+
{
|
|
76
|
+
public Intensity Intensity { get; }
|
|
77
|
+
public Phase PhaseOffset { get; }
|
|
78
|
+
|
|
79
|
+
public TwinTrapOption() : this(intensity: null)
|
|
80
|
+
{
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public TwinTrapOption(Intensity? intensity = null, Phase? phaseOffset = null)
|
|
84
|
+
{
|
|
85
|
+
Intensity = intensity ?? Intensity.Max;
|
|
86
|
+
PhaseOffset = phaseOffset ?? Phase.Zero;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
internal PatternOptionNative ToNative() =>
|
|
90
|
+
new PatternOptionNative { Intensity = Intensity.Value, PhaseOffset = PhaseOffset.Value };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public readonly struct VortexOption
|
|
94
|
+
{
|
|
95
|
+
public Intensity Intensity { get; }
|
|
96
|
+
public Phase PhaseOffset { get; }
|
|
97
|
+
|
|
98
|
+
public VortexOption() : this(intensity: null)
|
|
99
|
+
{
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public VortexOption(Intensity? intensity = null, Phase? phaseOffset = null)
|
|
103
|
+
{
|
|
104
|
+
Intensity = intensity ?? Intensity.Max;
|
|
105
|
+
PhaseOffset = phaseOffset ?? Phase.Zero;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
internal PatternOptionNative ToNative() =>
|
|
109
|
+
new PatternOptionNative { Intensity = Intensity.Value, PhaseOffset = PhaseOffset.Value };
|
|
110
|
+
}
|
|
111
|
+
|
|
74
112
|
[StructLayout(LayoutKind.Sequential)]
|
|
75
113
|
internal struct EmissionNative
|
|
76
114
|
{
|
|
@@ -90,98 +128,129 @@ namespace AUTD3
|
|
|
90
128
|
NativeAbi.Verify(ClientLib, autd3capi_abi_version());
|
|
91
129
|
}
|
|
92
130
|
|
|
93
|
-
[DllImport(Lib)]
|
|
131
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
94
132
|
private static extern uint autd3_abi_version();
|
|
95
133
|
|
|
96
|
-
[DllImport(ClientLib, EntryPoint = "autd3_abi_version")]
|
|
134
|
+
[DllImport(ClientLib, EntryPoint = "autd3_abi_version", CallingConvention = CallingConvention.Cdecl)]
|
|
97
135
|
private static extern uint autd3capi_abi_version();
|
|
98
136
|
|
|
99
|
-
[DllImport(Lib)]
|
|
137
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
100
138
|
internal static extern float autd3_pattern_wavelength(float soundSpeedMmPerS);
|
|
101
139
|
|
|
102
|
-
[DllImport(Lib)]
|
|
103
|
-
internal static extern IntPtr autd3_core_geometry_pattern_buffer(
|
|
140
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
141
|
+
internal static extern IntPtr autd3_core_geometry_pattern_buffer(GeometryHandle geometry);
|
|
104
142
|
|
|
105
|
-
[DllImport(Lib)]
|
|
143
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
106
144
|
internal static extern IntPtr autd3_pattern_buffer_from_array(EmissionNative[] emissions, UIntPtr numDevices);
|
|
107
145
|
|
|
108
|
-
[DllImport(Lib)]
|
|
109
|
-
internal static extern UIntPtr autd3_pattern_buffer_num_devices(
|
|
146
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
147
|
+
internal static extern UIntPtr autd3_pattern_buffer_num_devices(PatternBufferHandle buffer);
|
|
110
148
|
|
|
111
|
-
[DllImport(Lib)]
|
|
112
|
-
internal static extern UIntPtr autd3_pattern_buffer_num_transducers(
|
|
149
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
150
|
+
internal static extern UIntPtr autd3_pattern_buffer_num_transducers(PatternBufferHandle buffer, UIntPtr dev);
|
|
113
151
|
|
|
114
|
-
[DllImport(Lib)]
|
|
115
|
-
internal static extern int autd3_pattern_buffer_get(
|
|
152
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
153
|
+
internal static extern int autd3_pattern_buffer_get(PatternBufferHandle buffer, UIntPtr dev, UIntPtr tr, out EmissionNative @out);
|
|
116
154
|
|
|
117
|
-
[DllImport(Lib)]
|
|
118
|
-
internal static extern int autd3_pattern_buffer_set(
|
|
155
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
156
|
+
internal static extern int autd3_pattern_buffer_set(PatternBufferHandle buffer, UIntPtr dev, UIntPtr tr, EmissionNative emission);
|
|
119
157
|
|
|
120
|
-
[DllImport(Lib)]
|
|
158
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
121
159
|
internal static extern void autd3_pattern_buffer_free(IntPtr buffer);
|
|
122
160
|
|
|
123
|
-
[DllImport(Lib)]
|
|
124
|
-
internal static extern int autd3_pattern_focus(
|
|
161
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
162
|
+
internal static extern int autd3_pattern_focus(GeometryHandle geometry, float[] target, float wavelengthMm, in PatternOptionNative option, PatternBufferHandle buffer);
|
|
125
163
|
|
|
126
|
-
[DllImport(Lib)]
|
|
127
|
-
internal static extern int autd3_pattern_focus_device(
|
|
164
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
165
|
+
internal static extern int autd3_pattern_focus_device(GeometryHandle geometry, UIntPtr dev, float[] target, float wavelengthMm, in PatternOptionNative option, [Out] EmissionNative[] dst);
|
|
128
166
|
|
|
129
|
-
[DllImport(Lib)]
|
|
167
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
130
168
|
internal static extern int autd3_pattern_focus_transducer(float[] position, float[] target, float wavelengthMm, in PatternOptionNative option, out EmissionNative @out);
|
|
131
169
|
|
|
132
|
-
[DllImport(Lib)]
|
|
133
|
-
internal static extern int autd3_pattern_plane(
|
|
170
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
171
|
+
internal static extern int autd3_pattern_plane(GeometryHandle geometry, float[] dir, float wavelengthMm, in PatternOptionNative option, PatternBufferHandle buffer);
|
|
134
172
|
|
|
135
|
-
[DllImport(Lib)]
|
|
136
|
-
internal static extern int autd3_pattern_plane_device(
|
|
173
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
174
|
+
internal static extern int autd3_pattern_plane_device(GeometryHandle geometry, UIntPtr dev, float[] dir, float wavelengthMm, in PatternOptionNative option, [Out] EmissionNative[] dst);
|
|
137
175
|
|
|
138
|
-
[DllImport(Lib)]
|
|
176
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
139
177
|
internal static extern int autd3_pattern_plane_transducer(float[] position, float[] dir, float wavelengthMm, in PatternOptionNative option, out EmissionNative @out);
|
|
140
178
|
|
|
141
|
-
[DllImport(Lib)]
|
|
142
|
-
internal static extern int autd3_pattern_bessel(
|
|
179
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
180
|
+
internal static extern int autd3_pattern_bessel(GeometryHandle geometry, float[] apex, float[] dir, float thetaRad, float wavelengthMm, in PatternOptionNative option, PatternBufferHandle buffer);
|
|
143
181
|
|
|
144
|
-
[DllImport(Lib)]
|
|
145
|
-
internal static extern int autd3_pattern_bessel_device(
|
|
182
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
183
|
+
internal static extern int autd3_pattern_bessel_device(GeometryHandle geometry, UIntPtr dev, float[] apex, float[] dir, float thetaRad, float wavelengthMm, in PatternOptionNative option, [Out] EmissionNative[] dst);
|
|
146
184
|
|
|
147
|
-
[DllImport(Lib)]
|
|
185
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
148
186
|
internal static extern int autd3_pattern_bessel_transducer(float[] position, float[] apex, float[] dir, float thetaRad, float wavelengthMm, in PatternOptionNative option, out EmissionNative @out);
|
|
149
187
|
|
|
150
|
-
[DllImport(Lib)]
|
|
151
|
-
internal static extern int
|
|
188
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
189
|
+
internal static extern int autd3_pattern_twin_trap(GeometryHandle geometry, float[] target, float[] normal, float wavelengthMm, in PatternOptionNative option, PatternBufferHandle buffer);
|
|
190
|
+
|
|
191
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
192
|
+
internal static extern int autd3_pattern_twin_trap_device(GeometryHandle geometry, UIntPtr dev, float[] target, float[] normal, float wavelengthMm, in PatternOptionNative option, [Out] EmissionNative[] dst);
|
|
152
193
|
|
|
153
|
-
[DllImport(Lib)]
|
|
154
|
-
internal static extern
|
|
194
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
195
|
+
internal static extern int autd3_pattern_twin_trap_transducer(float[] position, float[] target, float[] normal, float wavelengthMm, in PatternOptionNative option, out EmissionNative @out);
|
|
155
196
|
|
|
197
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
198
|
+
internal static extern int autd3_pattern_vortex(GeometryHandle geometry, float[] target, float[] axis, int order, float wavelengthMm, in PatternOptionNative option, PatternBufferHandle buffer);
|
|
156
199
|
|
|
157
|
-
[DllImport(
|
|
158
|
-
internal static extern
|
|
200
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
201
|
+
internal static extern int autd3_pattern_vortex_device(GeometryHandle geometry, UIntPtr dev, float[] target, float[] axis, int order, float wavelengthMm, in PatternOptionNative option, [Out] EmissionNative[] dst);
|
|
159
202
|
|
|
160
|
-
[DllImport(
|
|
161
|
-
internal static extern
|
|
203
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
204
|
+
internal static extern int autd3_pattern_vortex_transducer(float[] position, float[] target, float[] axis, int order, float wavelengthMm, in PatternOptionNative option, out EmissionNative @out);
|
|
162
205
|
|
|
163
|
-
[DllImport(
|
|
206
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
207
|
+
internal static extern int autd3_pattern_uniform(byte phase, byte intensity, PatternBufferHandle buffer);
|
|
208
|
+
|
|
209
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
210
|
+
internal static extern void autd3_pattern_null(PatternBufferHandle buffer);
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
214
|
+
internal static extern IntPtr autd3_op_pattern(byte bank, PatternBufferHandle patternBuffer, byte transitionMode, ulong transitionValue, uint transitionMarginNs);
|
|
215
|
+
|
|
216
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
217
|
+
internal static extern IntPtr autd3_op_write_pattern_buffer(byte bank, ushort index, PatternBufferHandle patternBuffer);
|
|
218
|
+
|
|
219
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
164
220
|
internal static extern IntPtr autd3_op_write_pattern_compressed(byte bank, uint index, byte format, IntPtr[] patterns, UIntPtr numPatterns);
|
|
165
221
|
|
|
166
|
-
[DllImport(ClientLib)]
|
|
222
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
167
223
|
internal static extern IntPtr autd3_op_config_pattern(byte bank, IntPtr samplingConfig, uint size, ushort rep);
|
|
168
224
|
|
|
169
|
-
[DllImport(ClientLib)]
|
|
225
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
170
226
|
internal static extern IntPtr autd3_op_config_foci_stm(byte bank, IntPtr samplingConfig, uint size, byte numFoci, float soundSpeedMPerS, ushort rep);
|
|
171
227
|
|
|
172
|
-
[DllImport(ClientLib)]
|
|
228
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
173
229
|
internal static extern IntPtr autd3_op_change_pattern_bank(byte bank, byte transitionMode, ulong transitionValue, uint transitionMarginNs);
|
|
174
230
|
|
|
175
|
-
[DllImport(ClientLib)]
|
|
231
|
+
[DllImport(ClientLib, CallingConvention = CallingConvention.Cdecl)]
|
|
176
232
|
internal static extern int autd3_pattern_compression_per_frame(byte format, out UIntPtr @out);
|
|
177
233
|
}
|
|
178
234
|
|
|
235
|
+
internal sealed class PatternBufferHandle : Autd3SafeHandle
|
|
236
|
+
{
|
|
237
|
+
internal PatternBufferHandle(IntPtr handle) : base(handle)
|
|
238
|
+
{
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
protected override bool ReleaseHandle()
|
|
242
|
+
{
|
|
243
|
+
NativePattern.autd3_pattern_buffer_free(handle);
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
179
248
|
public readonly struct DevicePattern : IEnumerable<Emission>
|
|
180
249
|
{
|
|
181
|
-
private readonly
|
|
250
|
+
private readonly PatternBufferHandle _buffer;
|
|
182
251
|
private readonly UIntPtr _dev;
|
|
183
252
|
|
|
184
|
-
internal DevicePattern(
|
|
253
|
+
internal DevicePattern(PatternBufferHandle buffer, UIntPtr dev)
|
|
185
254
|
{
|
|
186
255
|
_buffer = buffer;
|
|
187
256
|
_dev = dev;
|
|
@@ -221,9 +290,9 @@ namespace AUTD3
|
|
|
221
290
|
{
|
|
222
291
|
internal const int NumTransducers = 249;
|
|
223
292
|
|
|
224
|
-
private
|
|
293
|
+
private readonly PatternBufferHandle _handle;
|
|
225
294
|
|
|
226
|
-
internal
|
|
295
|
+
internal PatternBufferHandle Handle => _handle;
|
|
227
296
|
|
|
228
297
|
internal PatternBuffer(IntPtr handle)
|
|
229
298
|
{
|
|
@@ -231,7 +300,7 @@ namespace AUTD3
|
|
|
231
300
|
{
|
|
232
301
|
throw new Autd3Exception("failed to create pattern buffer");
|
|
233
302
|
}
|
|
234
|
-
_handle = handle;
|
|
303
|
+
_handle = new PatternBufferHandle(handle);
|
|
235
304
|
}
|
|
236
305
|
|
|
237
306
|
public static PatternBuffer FromArray(Emission[][] emissions)
|
|
@@ -279,24 +348,7 @@ namespace AUTD3
|
|
|
279
348
|
|
|
280
349
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
|
281
350
|
|
|
282
|
-
public void Dispose()
|
|
283
|
-
{
|
|
284
|
-
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
285
|
-
if (handle != IntPtr.Zero)
|
|
286
|
-
{
|
|
287
|
-
NativePattern.autd3_pattern_buffer_free(handle);
|
|
288
|
-
}
|
|
289
|
-
GC.SuppressFinalize(this);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
~PatternBuffer()
|
|
293
|
-
{
|
|
294
|
-
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
295
|
-
if (handle != IntPtr.Zero)
|
|
296
|
-
{
|
|
297
|
-
NativePattern.autd3_pattern_buffer_free(handle);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
351
|
+
public void Dispose() => _handle.Dispose();
|
|
300
352
|
}
|
|
301
353
|
|
|
302
354
|
public static class GeometryPatternBufferExtensions
|
|
@@ -305,9 +357,6 @@ namespace AUTD3
|
|
|
305
357
|
new PatternBuffer(NativePattern.autd3_core_geometry_pattern_buffer(geometry.Handle));
|
|
306
358
|
}
|
|
307
359
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
360
|
public sealed class Pattern : ICommand
|
|
312
361
|
{
|
|
313
362
|
private readonly PatternBank _bank;
|
|
@@ -331,7 +380,7 @@ namespace AUTD3
|
|
|
331
380
|
|
|
332
381
|
|
|
333
382
|
public static Length Wavelength(Velocity soundSpeed) =>
|
|
334
|
-
new Length(NativePattern.autd3_pattern_wavelength(soundSpeed.
|
|
383
|
+
new Length(NativePattern.autd3_pattern_wavelength(soundSpeed.MmS));
|
|
335
384
|
|
|
336
385
|
|
|
337
386
|
public static void Focus(Geometry geometry, Vector3 target, Length wavelength, FocusOption option, PatternBuffer dst)
|
|
@@ -410,7 +459,7 @@ namespace AUTD3
|
|
|
410
459
|
var a = Coords.PointArray(apex);
|
|
411
460
|
var d = Coords.DirArray(dir);
|
|
412
461
|
var o = option.ToNative();
|
|
413
|
-
if (NativePattern.autd3_pattern_bessel(geometry.Handle, a, d, theta.
|
|
462
|
+
if (NativePattern.autd3_pattern_bessel(geometry.Handle, a, d, theta.Rad, wavelength.Mm, in o, dst.Handle) != 0)
|
|
414
463
|
{
|
|
415
464
|
throw new Autd3Exception("bessel failed (buffer device count must match geometry)");
|
|
416
465
|
}
|
|
@@ -422,7 +471,7 @@ namespace AUTD3
|
|
|
422
471
|
var o = option.ToNative();
|
|
423
472
|
if (NativePattern.autd3_pattern_bessel_device(device.GeometryHandle, device.DeviceIndex,
|
|
424
473
|
Coords.PointArray(apex),
|
|
425
|
-
Coords.DirArray(dir), theta.
|
|
474
|
+
Coords.DirArray(dir), theta.Rad, wavelength.Mm, in o, native) != 0)
|
|
426
475
|
{
|
|
427
476
|
throw new Autd3Exception("bessel_device failed");
|
|
428
477
|
}
|
|
@@ -435,13 +484,85 @@ namespace AUTD3
|
|
|
435
484
|
if (NativePattern.autd3_pattern_bessel_transducer(
|
|
436
485
|
Coords.PointArray(position),
|
|
437
486
|
Coords.PointArray(apex),
|
|
438
|
-
Coords.DirArray(dir), theta.
|
|
487
|
+
Coords.DirArray(dir), theta.Rad, wavelength.Mm, in o, out var e) != 0)
|
|
439
488
|
{
|
|
440
489
|
throw new Autd3Exception("bessel_transducer failed");
|
|
441
490
|
}
|
|
442
491
|
return new Emission(new Phase(e.Phase), new Intensity(e.Intensity));
|
|
443
492
|
}
|
|
444
493
|
|
|
494
|
+
public static void TwinTrap(Geometry geometry, Vector3 target, Vector3 normal, Length wavelength, TwinTrapOption option, PatternBuffer dst)
|
|
495
|
+
{
|
|
496
|
+
var t = Coords.PointArray(target);
|
|
497
|
+
var n = Coords.DirArray(normal);
|
|
498
|
+
var o = option.ToNative();
|
|
499
|
+
if (NativePattern.autd3_pattern_twin_trap(geometry.Handle, t, n, wavelength.Mm, in o, dst.Handle) != 0)
|
|
500
|
+
{
|
|
501
|
+
throw new Autd3Exception("twin_trap failed (buffer device count must match geometry)");
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
public static void TwinTrapDevice(Device device, Vector3 target, Vector3 normal, Length wavelength, TwinTrapOption option, Emission[] dst)
|
|
506
|
+
{
|
|
507
|
+
var native = ToNativeDst(dst);
|
|
508
|
+
var o = option.ToNative();
|
|
509
|
+
if (NativePattern.autd3_pattern_twin_trap_device(device.GeometryHandle, device.DeviceIndex,
|
|
510
|
+
Coords.PointArray(target), Coords.DirArray(normal), wavelength.Mm, in o, native) != 0)
|
|
511
|
+
{
|
|
512
|
+
throw new Autd3Exception("twin_trap_device failed");
|
|
513
|
+
}
|
|
514
|
+
FromNativeDst(native, dst);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
public static Emission TwinTrapTransducer(Vector3 position, Vector3 target, Vector3 normal, Length wavelength, TwinTrapOption option)
|
|
518
|
+
{
|
|
519
|
+
var o = option.ToNative();
|
|
520
|
+
if (NativePattern.autd3_pattern_twin_trap_transducer(
|
|
521
|
+
Coords.PointArray(position),
|
|
522
|
+
Coords.PointArray(target),
|
|
523
|
+
Coords.DirArray(normal), wavelength.Mm, in o, out var e) != 0)
|
|
524
|
+
{
|
|
525
|
+
throw new Autd3Exception("twin_trap_transducer failed");
|
|
526
|
+
}
|
|
527
|
+
return new Emission(new Phase(e.Phase), new Intensity(e.Intensity));
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
public static void Vortex(Geometry geometry, Vector3 target, Vector3 axis, int order, Length wavelength, VortexOption option, PatternBuffer dst)
|
|
531
|
+
{
|
|
532
|
+
var t = Coords.PointArray(target);
|
|
533
|
+
var a = Coords.DirArray(axis);
|
|
534
|
+
var o = option.ToNative();
|
|
535
|
+
if (NativePattern.autd3_pattern_vortex(geometry.Handle, t, a, order, wavelength.Mm, in o, dst.Handle) != 0)
|
|
536
|
+
{
|
|
537
|
+
throw new Autd3Exception("vortex failed (buffer device count must match geometry)");
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
public static void VortexDevice(Device device, Vector3 target, Vector3 axis, int order, Length wavelength, VortexOption option, Emission[] dst)
|
|
542
|
+
{
|
|
543
|
+
var native = ToNativeDst(dst);
|
|
544
|
+
var o = option.ToNative();
|
|
545
|
+
if (NativePattern.autd3_pattern_vortex_device(device.GeometryHandle, device.DeviceIndex,
|
|
546
|
+
Coords.PointArray(target), Coords.DirArray(axis), order, wavelength.Mm, in o, native) != 0)
|
|
547
|
+
{
|
|
548
|
+
throw new Autd3Exception("vortex_device failed");
|
|
549
|
+
}
|
|
550
|
+
FromNativeDst(native, dst);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
public static Emission VortexTransducer(Vector3 position, Vector3 target, Vector3 axis, int order, Length wavelength, VortexOption option)
|
|
554
|
+
{
|
|
555
|
+
var o = option.ToNative();
|
|
556
|
+
if (NativePattern.autd3_pattern_vortex_transducer(
|
|
557
|
+
Coords.PointArray(position),
|
|
558
|
+
Coords.PointArray(target),
|
|
559
|
+
Coords.DirArray(axis), order, wavelength.Mm, in o, out var e) != 0)
|
|
560
|
+
{
|
|
561
|
+
throw new Autd3Exception("vortex_transducer failed");
|
|
562
|
+
}
|
|
563
|
+
return new Emission(new Phase(e.Phase), new Intensity(e.Intensity));
|
|
564
|
+
}
|
|
565
|
+
|
|
445
566
|
public static void Uniform(Emission emission, PatternBuffer dst)
|
|
446
567
|
{
|
|
447
568
|
if (NativePattern.autd3_pattern_uniform(emission.Phase.Value, emission.Intensity.Value, dst.Handle) != 0)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
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 (51)
|
|
9
9
|
- Apache License 2.0 (3)
|
|
10
10
|
- Unicode License v3 (1)
|
|
11
11
|
|
|
@@ -854,8 +854,8 @@ 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.
|
|
858
|
-
- autd3-rs-pattern 0.
|
|
857
|
+
- autd3-rs-core 0.8.0 — https://github.com/shinolab/autd3-sdk
|
|
858
|
+
- autd3-rs-pattern 0.8.0 — https://github.com/shinolab/autd3-sdk
|
|
859
859
|
- autd3-cpu-wire 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
860
860
|
|
|
861
861
|
```
|
|
@@ -887,8 +887,8 @@ SOFTWARE.
|
|
|
887
887
|
|
|
888
888
|
Used by:
|
|
889
889
|
|
|
890
|
-
- autd3-ffi-abi 0.
|
|
891
|
-
- autd3-ffi-pattern 0.
|
|
890
|
+
- autd3-ffi-abi 0.8.0 — https://github.com/shinolab/autd3-sdk
|
|
891
|
+
- autd3-ffi-pattern 0.8.0 — https://github.com/shinolab/autd3-sdk
|
|
892
892
|
- chrono 0.4.45 — https://github.com/chronotope/chrono
|
|
893
893
|
- wide 1.5.0 — https://github.com/Lokathor/wide
|
|
894
894
|
- winapi-i686-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
|
|
@@ -972,6 +972,37 @@ DEALINGS IN THE SOFTWARE.
|
|
|
972
972
|
|
|
973
973
|
Used by:
|
|
974
974
|
|
|
975
|
+
- tracing-core 0.1.36 — https://github.com/tokio-rs/tracing
|
|
976
|
+
|
|
977
|
+
```
|
|
978
|
+
The MIT License (MIT)
|
|
979
|
+
|
|
980
|
+
Copyright (c) 2014 Mathijs van de Nes
|
|
981
|
+
|
|
982
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
983
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
984
|
+
in the Software without restriction, including without limitation the rights
|
|
985
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
986
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
987
|
+
furnished to do so, subject to the following conditions:
|
|
988
|
+
|
|
989
|
+
The above copyright notice and this permission notice shall be included in all
|
|
990
|
+
copies or substantial portions of the Software.
|
|
991
|
+
|
|
992
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
993
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
994
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
995
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
996
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
997
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
998
|
+
SOFTWARE.
|
|
999
|
+
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
## MIT License
|
|
1003
|
+
|
|
1004
|
+
Used by:
|
|
1005
|
+
|
|
975
1006
|
- typenum 1.20.1 — https://github.com/paholg/typenum
|
|
976
1007
|
|
|
977
1008
|
```
|
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.pattern"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.8.0",
|
|
9
9
|
"displayName": "AUTD3 Pattern",
|
|
10
10
|
"description": "AUTD3 emission patterns: Focus, Plane, Bessel (Unity binding).",
|
|
11
11
|
"unity": "6000.0",
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"url": "https://github.com/shinolab"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"com.shinolab.autd3-sdk.core": "0.
|
|
18
|
+
"com.shinolab.autd3-sdk.core": "0.8.0"
|
|
19
19
|
}
|
|
20
20
|
}
|