com.shinolab.autd3-sdk.pattern.holo 0.8.0 → 0.10.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/Holo.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
using System.Numerics;
|
|
3
4
|
using System.Runtime.InteropServices;
|
|
4
5
|
|
|
@@ -69,14 +70,14 @@ namespace AUTD3.Holo
|
|
|
69
70
|
public static readonly SplUnit dB = default;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
public readonly struct
|
|
73
|
+
public readonly struct IntensityConstraint
|
|
73
74
|
{
|
|
74
75
|
internal byte Kind { get; }
|
|
75
76
|
internal byte Min { get; }
|
|
76
77
|
internal byte Max { get; }
|
|
77
78
|
internal float MultiplyValue { get; }
|
|
78
79
|
|
|
79
|
-
private
|
|
80
|
+
private IntensityConstraint(byte kind, byte min, byte max, float multiply)
|
|
80
81
|
{
|
|
81
82
|
Kind = kind;
|
|
82
83
|
Min = min;
|
|
@@ -84,17 +85,17 @@ namespace AUTD3.Holo
|
|
|
84
85
|
MultiplyValue = multiply;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
public static
|
|
88
|
-
public static
|
|
89
|
-
public static
|
|
90
|
-
public static
|
|
88
|
+
public static IntensityConstraint Normalize => new IntensityConstraint(0, 0, 0, 0);
|
|
89
|
+
public static IntensityConstraint Multiply(float value) => new IntensityConstraint(1, 0, 0, value);
|
|
90
|
+
public static IntensityConstraint Uniform(Intensity intensity) => new IntensityConstraint(2, intensity.Value, 0, 0);
|
|
91
|
+
public static IntensityConstraint Clamp(Intensity min, Intensity max) => new IntensityConstraint(3, min.Value, max.Value, 0);
|
|
91
92
|
|
|
92
|
-
internal
|
|
93
|
-
new
|
|
93
|
+
internal IntensityConstraintNative ToNative() =>
|
|
94
|
+
new IntensityConstraintNative { Kind = Kind, Min = Min, Max = Max, Multiply = MultiplyValue };
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
[StructLayout(LayoutKind.Sequential)]
|
|
97
|
-
internal struct
|
|
98
|
+
internal struct IntensityConstraintNative
|
|
98
99
|
{
|
|
99
100
|
public byte Kind;
|
|
100
101
|
public byte Min;
|
|
@@ -102,102 +103,54 @@ namespace AUTD3.Holo
|
|
|
102
103
|
public float Multiply;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
public readonly struct TransducerMask
|
|
106
|
-
{
|
|
107
|
-
internal bool[][]? Mask { get; }
|
|
108
|
-
|
|
109
|
-
private TransducerMask(bool[][]? mask)
|
|
110
|
-
{
|
|
111
|
-
Mask = mask;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public static TransducerMask AllEnabled => new TransducerMask(null);
|
|
115
|
-
|
|
116
|
-
public static TransducerMask Masked(bool[][] mask) => new TransducerMask(mask);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
106
|
public readonly struct NaiveOption
|
|
120
107
|
{
|
|
121
|
-
|
|
122
|
-
public
|
|
123
|
-
|
|
124
|
-
public
|
|
125
|
-
|
|
126
|
-
public
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public NaiveOption(EmissionConstraint? constraint = null, Directivity directivity = Directivity.Sphere, TransducerMask mask = default, bool parallel = true)
|
|
131
|
-
{
|
|
132
|
-
Constraint = constraint ?? EmissionConstraint.Clamp(Intensity.Min, Intensity.Max);
|
|
133
|
-
Directivity = directivity;
|
|
134
|
-
Mask = mask;
|
|
135
|
-
Parallel = parallel;
|
|
136
|
-
}
|
|
108
|
+
private readonly IntensityConstraint? _constraint;
|
|
109
|
+
public IntensityConstraint Constraint { get => _constraint ?? IntensityConstraint.Clamp(Intensity.Min, Intensity.Max); init => _constraint = value; }
|
|
110
|
+
private readonly Directivity? _directivity;
|
|
111
|
+
public Directivity Directivity { get => _directivity ?? Directivity.Sphere; init => _directivity = value; }
|
|
112
|
+
private readonly TransducerMask? _mask;
|
|
113
|
+
public TransducerMask Mask { get => _mask ?? TransducerMask.AllEnabled; init => _mask = value; }
|
|
114
|
+
private readonly bool? _parallel;
|
|
115
|
+
public bool Parallel { get => _parallel ?? true; init => _parallel = value; }
|
|
137
116
|
}
|
|
138
117
|
|
|
139
118
|
public readonly struct GsOption
|
|
140
119
|
{
|
|
141
|
-
|
|
142
|
-
public
|
|
143
|
-
|
|
144
|
-
public
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
public GsOption(uint repeat = 100, EmissionConstraint? constraint = null, Directivity directivity = Directivity.Sphere, TransducerMask mask = default, bool parallel = true)
|
|
152
|
-
{
|
|
153
|
-
Repeat = repeat;
|
|
154
|
-
Constraint = constraint ?? EmissionConstraint.Clamp(Intensity.Min, Intensity.Max);
|
|
155
|
-
Directivity = directivity;
|
|
156
|
-
Mask = mask;
|
|
157
|
-
Parallel = parallel;
|
|
158
|
-
}
|
|
120
|
+
private readonly uint? _repeat;
|
|
121
|
+
public uint Repeat { get => _repeat ?? 100; init => _repeat = value; }
|
|
122
|
+
private readonly IntensityConstraint? _constraint;
|
|
123
|
+
public IntensityConstraint Constraint { get => _constraint ?? IntensityConstraint.Clamp(Intensity.Min, Intensity.Max); init => _constraint = value; }
|
|
124
|
+
private readonly Directivity? _directivity;
|
|
125
|
+
public Directivity Directivity { get => _directivity ?? Directivity.Sphere; init => _directivity = value; }
|
|
126
|
+
private readonly TransducerMask? _mask;
|
|
127
|
+
public TransducerMask Mask { get => _mask ?? TransducerMask.AllEnabled; init => _mask = value; }
|
|
128
|
+
private readonly bool? _parallel;
|
|
129
|
+
public bool Parallel { get => _parallel ?? true; init => _parallel = value; }
|
|
159
130
|
}
|
|
160
131
|
|
|
161
132
|
public readonly struct GspatOption
|
|
162
133
|
{
|
|
163
|
-
|
|
164
|
-
public
|
|
165
|
-
|
|
166
|
-
public
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
public GspatOption(uint repeat = 100, EmissionConstraint? constraint = null, Directivity directivity = Directivity.Sphere, TransducerMask mask = default, bool parallel = true)
|
|
174
|
-
{
|
|
175
|
-
Repeat = repeat;
|
|
176
|
-
Constraint = constraint ?? EmissionConstraint.Clamp(Intensity.Min, Intensity.Max);
|
|
177
|
-
Directivity = directivity;
|
|
178
|
-
Mask = mask;
|
|
179
|
-
Parallel = parallel;
|
|
180
|
-
}
|
|
134
|
+
private readonly uint? _repeat;
|
|
135
|
+
public uint Repeat { get => _repeat ?? 100; init => _repeat = value; }
|
|
136
|
+
private readonly IntensityConstraint? _constraint;
|
|
137
|
+
public IntensityConstraint Constraint { get => _constraint ?? IntensityConstraint.Clamp(Intensity.Min, Intensity.Max); init => _constraint = value; }
|
|
138
|
+
private readonly Directivity? _directivity;
|
|
139
|
+
public Directivity Directivity { get => _directivity ?? Directivity.Sphere; init => _directivity = value; }
|
|
140
|
+
private readonly TransducerMask? _mask;
|
|
141
|
+
public TransducerMask Mask { get => _mask ?? TransducerMask.AllEnabled; init => _mask = value; }
|
|
142
|
+
private readonly bool? _parallel;
|
|
143
|
+
public bool Parallel { get => _parallel ?? true; init => _parallel = value; }
|
|
181
144
|
}
|
|
182
145
|
|
|
183
146
|
public readonly struct GreedyOption
|
|
184
147
|
{
|
|
185
|
-
|
|
186
|
-
public
|
|
187
|
-
|
|
188
|
-
public
|
|
189
|
-
|
|
190
|
-
public
|
|
191
|
-
{
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public GreedyOption(byte phaseQuantizationLevels = 16, EmissionConstraint? constraint = null, Directivity directivity = Directivity.Sphere, TransducerMask mask = default)
|
|
195
|
-
{
|
|
196
|
-
PhaseQuantizationLevels = phaseQuantizationLevels;
|
|
197
|
-
Constraint = constraint ?? EmissionConstraint.Uniform(Intensity.Max);
|
|
198
|
-
Directivity = directivity;
|
|
199
|
-
Mask = mask;
|
|
200
|
-
}
|
|
148
|
+
private readonly byte? _phaseQuantizationLevels;
|
|
149
|
+
public byte PhaseQuantizationLevels { get => _phaseQuantizationLevels ?? 16; init => _phaseQuantizationLevels = value; }
|
|
150
|
+
private readonly Directivity? _directivity;
|
|
151
|
+
public Directivity Directivity { get => _directivity ?? Directivity.Sphere; init => _directivity = value; }
|
|
152
|
+
private readonly TransducerMask? _mask;
|
|
153
|
+
public TransducerMask Mask { get => _mask ?? TransducerMask.AllEnabled; init => _mask = value; }
|
|
201
154
|
}
|
|
202
155
|
|
|
203
156
|
[StructLayout(LayoutKind.Sequential)]
|
|
@@ -228,16 +181,25 @@ namespace AUTD3.Holo
|
|
|
228
181
|
internal static extern float autd3_holo_amplitude_spl(float value);
|
|
229
182
|
|
|
230
183
|
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
231
|
-
internal static extern int autd3_holo_naive(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, in
|
|
184
|
+
internal static extern int autd3_holo_naive(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, PhaseBufferHandle phases, IntensityBufferHandle intensities, byte[] outErr, UIntPtr outErrLen);
|
|
185
|
+
|
|
186
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
187
|
+
internal static extern int autd3_holo_gs(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, UIntPtr repeat, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, PhaseBufferHandle phases, IntensityBufferHandle intensities, byte[] outErr, UIntPtr outErrLen);
|
|
188
|
+
|
|
189
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
190
|
+
internal static extern int autd3_holo_gspat(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, UIntPtr repeat, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, PhaseBufferHandle phases, IntensityBufferHandle intensities, byte[] outErr, UIntPtr outErrLen);
|
|
191
|
+
|
|
192
|
+
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
193
|
+
internal static extern int autd3_holo_naive_batch(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, IntPtr[] phases, IntPtr[] intensities, UIntPtr numProblems, byte[] outErr, UIntPtr outErrLen);
|
|
232
194
|
|
|
233
195
|
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
234
|
-
internal static extern int
|
|
196
|
+
internal static extern int autd3_holo_gs_batch(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, UIntPtr repeat, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, IntPtr[] phases, IntPtr[] intensities, UIntPtr numProblems, byte[] outErr, UIntPtr outErrLen);
|
|
235
197
|
|
|
236
198
|
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
237
|
-
internal static extern int
|
|
199
|
+
internal static extern int autd3_holo_gspat_batch(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, UIntPtr repeat, in IntensityConstraintNative constraint, byte directivity, byte[]? mask, [MarshalAs(UnmanagedType.I1)] bool parallel, IntPtr[] phases, IntPtr[] intensities, UIntPtr numProblems, byte[] outErr, UIntPtr outErrLen);
|
|
238
200
|
|
|
239
201
|
[DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
|
|
240
|
-
internal static extern int autd3_holo_greedy(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, byte
|
|
202
|
+
internal static extern int autd3_holo_greedy(GeometryHandle geometry, HoloAmplitudeTargetNative[] foci, UIntPtr numFoci, float wavelengthMm, IntPtr intensities, byte uniformIntensity, byte phaseQuantizationLevels, byte directivity, byte[]? mask, PhaseBufferHandle dst, byte[] outErr, UIntPtr outErrLen);
|
|
241
203
|
}
|
|
242
204
|
|
|
243
205
|
public readonly struct AmplitudeTarget
|
|
@@ -278,56 +240,110 @@ namespace AUTD3.Holo
|
|
|
278
240
|
{
|
|
279
241
|
return null;
|
|
280
242
|
}
|
|
281
|
-
|
|
282
|
-
for (var d = 0; d < numDevices; d++)
|
|
243
|
+
if (mask.Length != numDevices)
|
|
283
244
|
{
|
|
284
|
-
|
|
285
|
-
{
|
|
286
|
-
throw new Autd3Exception($"each device mask requires {Autd3.NumTransducers} values");
|
|
287
|
-
}
|
|
288
|
-
for (var t = 0; t < Autd3.NumTransducers; t++)
|
|
289
|
-
{
|
|
290
|
-
flat[d * Autd3.NumTransducers + t] = (byte)(mask[d][t] ? 1 : 0);
|
|
291
|
-
}
|
|
245
|
+
throw new Autd3Exception($"the mask has {mask.Length} device slots but the buffer has {numDevices} devices");
|
|
292
246
|
}
|
|
293
|
-
return
|
|
247
|
+
return BufferArray.Flatten(mask, m => (byte)(m ? 1 : 0), "mask values");
|
|
294
248
|
}
|
|
295
249
|
|
|
296
|
-
public static void Naive(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, NaiveOption option,
|
|
250
|
+
public static void Naive(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, NaiveOption option, PhaseBuffer phases, IntensityBuffer intensities)
|
|
297
251
|
{
|
|
298
252
|
var c = option.Constraint.ToNative();
|
|
299
253
|
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
300
|
-
if (NativeHolo.autd3_holo_naive(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask,
|
|
254
|
+
if (NativeHolo.autd3_holo_naive(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, phases.Handle, intensities.Handle, err, (UIntPtr)err.Length) != 0)
|
|
301
255
|
{
|
|
302
256
|
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
303
257
|
}
|
|
304
258
|
}
|
|
305
259
|
|
|
306
|
-
public static void Gs(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GsOption option,
|
|
260
|
+
public static void Gs(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GsOption option, PhaseBuffer phases, IntensityBuffer intensities)
|
|
307
261
|
{
|
|
308
262
|
var c = option.Constraint.ToNative();
|
|
309
263
|
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
310
|
-
if (NativeHolo.autd3_holo_gs(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask,
|
|
264
|
+
if (NativeHolo.autd3_holo_gs(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, phases.Handle, intensities.Handle, err, (UIntPtr)err.Length) != 0)
|
|
311
265
|
{
|
|
312
266
|
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
313
267
|
}
|
|
314
268
|
}
|
|
315
269
|
|
|
316
|
-
public static void Gspat(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GspatOption option,
|
|
270
|
+
public static void Gspat(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GspatOption option, PhaseBuffer phases, IntensityBuffer intensities)
|
|
317
271
|
{
|
|
318
272
|
var c = option.Constraint.ToNative();
|
|
319
273
|
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
320
|
-
if (NativeHolo.autd3_holo_gspat(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask,
|
|
274
|
+
if (NativeHolo.autd3_holo_gspat(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, phases.Handle, intensities.Handle, err, (UIntPtr)err.Length) != 0)
|
|
321
275
|
{
|
|
322
276
|
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
323
277
|
}
|
|
324
278
|
}
|
|
325
279
|
|
|
326
|
-
|
|
280
|
+
private static void CheckBatch(IReadOnlyList<PhaseBuffer> phases, IReadOnlyList<IntensityBuffer> intensities)
|
|
281
|
+
{
|
|
282
|
+
if (phases.Count != intensities.Count)
|
|
283
|
+
{
|
|
284
|
+
throw new Autd3Exception(
|
|
285
|
+
$"a batch needs one intensity buffer per phase buffer, but {phases.Count} phase and {intensities.Count} intensity buffers were given",
|
|
286
|
+
Autd3ErrorCode.InvalidArgument);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
private static HandleArray Lease<T>(IReadOnlyList<T> buffers, Func<T, SafeHandle> handle)
|
|
327
291
|
{
|
|
292
|
+
var handles = new SafeHandle[buffers.Count];
|
|
293
|
+
for (var i = 0; i < handles.Length; i++)
|
|
294
|
+
{
|
|
295
|
+
handles[i] = handle(buffers[i]);
|
|
296
|
+
}
|
|
297
|
+
return new HandleArray(handles);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
public static void NaiveBatch(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, NaiveOption option, IReadOnlyList<PhaseBuffer> phases, IReadOnlyList<IntensityBuffer> intensities)
|
|
301
|
+
{
|
|
302
|
+
CheckBatch(phases, intensities);
|
|
328
303
|
var c = option.Constraint.ToNative();
|
|
329
304
|
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
330
|
-
|
|
305
|
+
using var p = Lease(phases, b => b.Handle);
|
|
306
|
+
using var i = Lease(intensities, b => b.Handle);
|
|
307
|
+
var code = NativeHolo.autd3_holo_naive_batch(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, p.Pointers, i.Pointers, (UIntPtr)phases.Count, err, (UIntPtr)err.Length);
|
|
308
|
+
if (code != 0)
|
|
309
|
+
{
|
|
310
|
+
throw Autd3Exception.FromNative(code, err);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
public static void GsBatch(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GsOption option, IReadOnlyList<PhaseBuffer> phases, IReadOnlyList<IntensityBuffer> intensities)
|
|
315
|
+
{
|
|
316
|
+
CheckBatch(phases, intensities);
|
|
317
|
+
var c = option.Constraint.ToNative();
|
|
318
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
319
|
+
using var p = Lease(phases, b => b.Handle);
|
|
320
|
+
using var i = Lease(intensities, b => b.Handle);
|
|
321
|
+
var code = NativeHolo.autd3_holo_gs_batch(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, p.Pointers, i.Pointers, (UIntPtr)phases.Count, err, (UIntPtr)err.Length);
|
|
322
|
+
if (code != 0)
|
|
323
|
+
{
|
|
324
|
+
throw Autd3Exception.FromNative(code, err);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
public static void GspatBatch(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, GspatOption option, IReadOnlyList<PhaseBuffer> phases, IReadOnlyList<IntensityBuffer> intensities)
|
|
329
|
+
{
|
|
330
|
+
CheckBatch(phases, intensities);
|
|
331
|
+
var c = option.Constraint.ToNative();
|
|
332
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
333
|
+
using var p = Lease(phases, b => b.Handle);
|
|
334
|
+
using var i = Lease(intensities, b => b.Handle);
|
|
335
|
+
var code = NativeHolo.autd3_holo_gspat_batch(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, (UIntPtr)option.Repeat, in c, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), option.Parallel, p.Pointers, i.Pointers, (UIntPtr)phases.Count, err, (UIntPtr)err.Length);
|
|
336
|
+
if (code != 0)
|
|
337
|
+
{
|
|
338
|
+
throw Autd3Exception.FromNative(code, err);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
public static void Greedy(Geometry geometry, AmplitudeTarget[] foci, Length wavelength, PatternIntensity intensities, GreedyOption option, PhaseBuffer dst)
|
|
343
|
+
{
|
|
344
|
+
using var intensityLease = new HandleLease(intensities.Buffer?.Handle);
|
|
345
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
346
|
+
if (NativeHolo.autd3_holo_greedy(geometry.Handle, ToNative(foci), (UIntPtr)foci.Length, wavelength.Mm, intensityLease.Pointer, intensities.Uniform, option.PhaseQuantizationLevels, (byte)option.Directivity, FlattenMask(option.Mask.Mask, geometry.NumDevices), dst.Handle, err, (UIntPtr)err.Length) != 0)
|
|
331
347
|
{
|
|
332
348
|
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
333
349
|
}
|
|
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 (44)
|
|
9
9
|
- Apache License 2.0 (3)
|
|
10
10
|
- Unicode License v3 (1)
|
|
11
11
|
|
|
@@ -508,44 +508,9 @@ DEALINGS IN THE SOFTWARE.
|
|
|
508
508
|
|
|
509
509
|
Used by:
|
|
510
510
|
|
|
511
|
-
-
|
|
512
|
-
|
|
513
|
-
```
|
|
514
|
-
Copyright (c) 2014 The Rust Project Developers
|
|
515
|
-
|
|
516
|
-
Permission is hereby granted, free of charge, to any
|
|
517
|
-
person obtaining a copy of this software and associated
|
|
518
|
-
documentation files (the "Software"), to deal in the
|
|
519
|
-
Software without restriction, including without
|
|
520
|
-
limitation the rights to use, copy, modify, merge,
|
|
521
|
-
publish, distribute, sublicense, and/or sell copies of
|
|
522
|
-
the Software, and to permit persons to whom the Software
|
|
523
|
-
is furnished to do so, subject to the following
|
|
524
|
-
conditions:
|
|
525
|
-
|
|
526
|
-
The above copyright notice and this permission notice
|
|
527
|
-
shall be included in all copies or substantial portions
|
|
528
|
-
of the Software.
|
|
529
|
-
|
|
530
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
531
|
-
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
532
|
-
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
533
|
-
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
534
|
-
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
535
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
536
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
537
|
-
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
538
|
-
DEALINGS IN THE SOFTWARE.
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
## MIT License
|
|
542
|
-
|
|
543
|
-
Used by:
|
|
544
|
-
|
|
545
|
-
- bitflags 2.13.0 — https://github.com/bitflags/bitflags
|
|
546
|
-
- log 0.4.33 — https://github.com/rust-lang/log
|
|
511
|
+
- bitflags 2.13.2 — https://github.com/bitflags/bitflags
|
|
547
512
|
- num-complex 0.4.6 — https://github.com/rust-num/num-complex
|
|
548
|
-
- num-integer 0.1.
|
|
513
|
+
- num-integer 0.1.47 — https://github.com/rust-num/num-integer
|
|
549
514
|
- num-rational 0.4.2 — https://github.com/rust-num/num-rational
|
|
550
515
|
- num-traits 0.2.19 — https://github.com/rust-num/num-traits
|
|
551
516
|
|
|
@@ -612,65 +577,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
|
612
577
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
613
578
|
DEALINGS IN THE SOFTWARE.
|
|
614
579
|
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
## MIT License
|
|
618
|
-
|
|
619
|
-
Used by:
|
|
620
|
-
|
|
621
|
-
- winapi 0.3.9 — https://github.com/retep998/winapi-rs
|
|
622
|
-
|
|
623
|
-
```
|
|
624
|
-
Copyright (c) 2015-2018 The winapi-rs Developers
|
|
625
|
-
|
|
626
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
627
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
628
|
-
in the Software without restriction, including without limitation the rights
|
|
629
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
630
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
631
|
-
furnished to do so, subject to the following conditions:
|
|
632
|
-
|
|
633
|
-
The above copyright notice and this permission notice shall be included in all
|
|
634
|
-
copies or substantial portions of the Software.
|
|
635
|
-
|
|
636
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
637
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
638
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
639
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
640
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
641
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
642
|
-
SOFTWARE.
|
|
643
|
-
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
## MIT License
|
|
647
|
-
|
|
648
|
-
Used by:
|
|
649
|
-
|
|
650
|
-
- num_cpus 1.17.0 — https://github.com/seanmonstar/num_cpus
|
|
651
|
-
|
|
652
|
-
```
|
|
653
|
-
Copyright (c) 2015-2025 Sean McArthur
|
|
654
|
-
|
|
655
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
656
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
657
|
-
in the Software without restriction, including without limitation the rights
|
|
658
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
659
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
660
|
-
furnished to do so, subject to the following conditions:
|
|
661
|
-
|
|
662
|
-
The above copyright notice and this permission notice shall be included in
|
|
663
|
-
all copies or substantial portions of the Software.
|
|
664
|
-
|
|
665
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
666
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
667
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
668
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
669
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
670
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
671
|
-
THE SOFTWARE.
|
|
672
|
-
|
|
673
|
-
|
|
674
580
|
```
|
|
675
581
|
|
|
676
582
|
## MIT License
|
|
@@ -891,7 +797,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
891
797
|
|
|
892
798
|
Used by:
|
|
893
799
|
|
|
894
|
-
- libc 0.2.
|
|
800
|
+
- libc 0.2.190 — https://github.com/rust-lang/libc
|
|
895
801
|
|
|
896
802
|
```
|
|
897
803
|
Copyright (c) The Rust Project Developers
|
|
@@ -999,12 +905,43 @@ DEALINGS IN THE SOFTWARE.
|
|
|
999
905
|
|
|
1000
906
|
Used by:
|
|
1001
907
|
|
|
1002
|
-
-
|
|
908
|
+
- crc 3.4.0 — https://github.com/mrhooray/crc-rs.git
|
|
909
|
+
|
|
910
|
+
```
|
|
911
|
+
MIT License
|
|
912
|
+
|
|
913
|
+
Copyright (c) 2017 crc-rs Developers
|
|
914
|
+
|
|
915
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
916
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
917
|
+
in the Software without restriction, including without limitation the rights
|
|
918
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
919
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
920
|
+
furnished to do so, subject to the following conditions:
|
|
921
|
+
|
|
922
|
+
The above copyright notice and this permission notice shall be included in all
|
|
923
|
+
copies or substantial portions of the Software.
|
|
924
|
+
|
|
925
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
926
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
927
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
928
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
929
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
930
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
931
|
+
SOFTWARE.
|
|
932
|
+
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
## MIT License
|
|
936
|
+
|
|
937
|
+
Used by:
|
|
938
|
+
|
|
939
|
+
- crc-catalog 2.5.0 — https://github.com/akhilles/crc-catalog.git
|
|
1003
940
|
|
|
1004
941
|
```
|
|
1005
942
|
MIT License
|
|
1006
943
|
|
|
1007
|
-
Copyright (c)
|
|
944
|
+
Copyright (c) 2019 Akhil Velagapudi
|
|
1008
945
|
|
|
1009
946
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1010
947
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1068,9 +1005,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
1068
1005
|
|
|
1069
1006
|
Used by:
|
|
1070
1007
|
|
|
1071
|
-
- autd3-rs-core 0.
|
|
1072
|
-
- autd3-rs-pattern-holo 0.
|
|
1073
|
-
- autd3-cpu-wire 0.
|
|
1008
|
+
- autd3-rs-core 0.10.0 — https://github.com/shinolab/autd3-sdk
|
|
1009
|
+
- autd3-rs-pattern-holo 0.10.0 — https://github.com/shinolab/autd3-sdk
|
|
1010
|
+
- autd3-cpu-wire 0.10.0 — https://github.com/shinolab/autd3-sdk
|
|
1074
1011
|
|
|
1075
1012
|
```
|
|
1076
1013
|
MIT License
|
|
@@ -1101,24 +1038,10 @@ SOFTWARE.
|
|
|
1101
1038
|
|
|
1102
1039
|
Used by:
|
|
1103
1040
|
|
|
1104
|
-
- autd3-ffi-abi 0.
|
|
1105
|
-
- autd3-ffi-pattern-holo 0.
|
|
1106
|
-
- chrono 0.4.45 — https://github.com/chronotope/chrono
|
|
1041
|
+
- autd3-ffi-abi 0.10.0 — https://github.com/shinolab/autd3-sdk
|
|
1042
|
+
- autd3-ffi-pattern-holo 0.10.0 — https://github.com/shinolab/autd3-sdk
|
|
1107
1043
|
- r-efi 6.0.0 — https://github.com/r-efi/r-efi
|
|
1108
1044
|
- wide 1.5.0 — https://github.com/Lokathor/wide
|
|
1109
|
-
- winapi-i686-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
|
|
1110
|
-
- winapi-x86_64-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
|
|
1111
|
-
- windows-collections 0.3.2 — https://github.com/microsoft/windows-rs
|
|
1112
|
-
- windows-core 0.62.2 — https://github.com/microsoft/windows-rs
|
|
1113
|
-
- windows-future 0.3.2 — https://github.com/microsoft/windows-rs
|
|
1114
|
-
- windows-implement 0.60.2 — https://github.com/microsoft/windows-rs
|
|
1115
|
-
- windows-interface 0.59.3 — https://github.com/microsoft/windows-rs
|
|
1116
|
-
- windows-link 0.2.1 — https://github.com/microsoft/windows-rs
|
|
1117
|
-
- windows-numerics 0.3.1 — https://github.com/microsoft/windows-rs
|
|
1118
|
-
- windows-result 0.4.1 — https://github.com/microsoft/windows-rs
|
|
1119
|
-
- windows-strings 0.5.1 — https://github.com/microsoft/windows-rs
|
|
1120
|
-
- windows-threading 0.2.1 — https://github.com/microsoft/windows-rs
|
|
1121
|
-
- windows 0.62.2 — https://github.com/microsoft/windows-rs
|
|
1122
1045
|
|
|
1123
1046
|
```
|
|
1124
1047
|
MIT License
|
|
@@ -1146,11 +1069,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
1146
1069
|
|
|
1147
1070
|
Used by:
|
|
1148
1071
|
|
|
1149
|
-
- hermit-abi 0.5.2 — https://github.com/hermit-os/hermit-rs
|
|
1150
1072
|
- pin-project-lite 0.2.17 — https://github.com/taiki-e/pin-project-lite
|
|
1151
1073
|
- proc-macro2 1.0.106 — https://github.com/dtolnay/proc-macro2
|
|
1152
1074
|
- quote 1.0.46 — https://github.com/dtolnay/quote
|
|
1153
|
-
- rustversion 1.0.22 — https://github.com/dtolnay/rustversion
|
|
1154
1075
|
- syn 2.0.118 — https://github.com/dtolnay/syn
|
|
1155
1076
|
- thiserror-impl 2.0.18 — https://github.com/dtolnay/thiserror
|
|
1156
1077
|
- thiserror 2.0.18 — https://github.com/dtolnay/thiserror
|
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.holo"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.10.0",
|
|
9
9
|
"displayName": "AUTD3 Pattern Holo",
|
|
10
10
|
"description": "AUTD3 multi-focus holographic patterns (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.pattern": "0.
|
|
18
|
+
"com.shinolab.autd3-sdk.pattern": "0.10.0"
|
|
19
19
|
}
|
|
20
20
|
}
|