com.shinolab.autd3-sdk.core 0.2.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.
Files changed (44) hide show
  1. package/AUTD3.Core.asmdef +14 -0
  2. package/AUTD3.Core.asmdef.meta +7 -0
  3. package/AssemblyInfo.cs +14 -0
  4. package/AssemblyInfo.cs.meta +11 -0
  5. package/Command.cs +11 -0
  6. package/Command.cs.meta +11 -0
  7. package/Config.cs +57 -0
  8. package/Config.cs.meta +11 -0
  9. package/Coords.cs +58 -0
  10. package/Coords.cs.meta +11 -0
  11. package/Geometry.cs +167 -0
  12. package/Geometry.cs.meta +11 -0
  13. package/GlobalUsings.cs +7 -0
  14. package/GlobalUsings.cs.meta +11 -0
  15. package/LICENSE.md +21 -0
  16. package/LICENSE.md.meta +7 -0
  17. package/MonoPInvokeCallbackAttribute.cs +15 -0
  18. package/MonoPInvokeCallbackAttribute.cs.meta +11 -0
  19. package/Native.cs +108 -0
  20. package/Native.cs.meta +11 -0
  21. package/Plugins/linux-x64/libautd3_core.so +0 -0
  22. package/Plugins/linux-x64/libautd3_core.so.meta +35 -0
  23. package/Plugins/linux-x64.meta +8 -0
  24. package/Plugins/osx-arm64/libautd3_core.dylib +0 -0
  25. package/Plugins/osx-arm64/libautd3_core.dylib.meta +35 -0
  26. package/Plugins/osx-arm64.meta +8 -0
  27. package/Plugins/win-x64/autd3_core.dll +0 -0
  28. package/Plugins/win-x64/autd3_core.dll.meta +35 -0
  29. package/Plugins/win-x64.meta +8 -0
  30. package/Plugins.meta +8 -0
  31. package/README.md +41 -0
  32. package/README.md.meta +7 -0
  33. package/SamplingConfig.cs +134 -0
  34. package/SamplingConfig.cs.meta +11 -0
  35. package/THIRD-PARTY-LICENSES.md +834 -0
  36. package/THIRD-PARTY-LICENSES.md.meta +7 -0
  37. package/Types.cs +251 -0
  38. package/Types.cs.meta +11 -0
  39. package/Units.cs +184 -0
  40. package/Units.cs.meta +11 -0
  41. package/csc.rsp +2 -0
  42. package/csc.rsp.meta +7 -0
  43. package/package.json +13 -0
  44. package/package.json.meta +7 -0
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 294e6fbe10621f92edc0b662ee8a3c89
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
Binary file
@@ -0,0 +1,35 @@
1
+ fileFormatVersion: 2
2
+ guid: f1d9a9d53c553948e5a09acc5389a30d
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 0
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ Any:
16
+ second:
17
+ enabled: 0
18
+ settings: {}
19
+ - first:
20
+ Editor: Editor
21
+ second:
22
+ enabled: 1
23
+ settings:
24
+ CPU: x86_64
25
+ DefaultValueInitialized: true
26
+ OS: Windows
27
+ - first:
28
+ Standalone: Win64
29
+ second:
30
+ enabled: 1
31
+ settings:
32
+ CPU: x86_64
33
+ userData:
34
+ assetBundleName:
35
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: a4940d1549ba31ec11c819dc4a5135b3
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/Plugins.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 14a66a82643b9d5e765df9c0085c00b1
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # AUTD3 Core (Unity)
2
+
3
+ Core types, geometry and units shared by every AUTD3 package.
4
+
5
+ ## Install
6
+
7
+ Add the scoped registry and the package to `Packages/manifest.json`; sibling
8
+ AUTD3 packages are resolved from the registry automatically.
9
+
10
+ ```json
11
+ {
12
+ "scopedRegistries": [
13
+ { "name": "npmjs", "url": "https://registry.npmjs.org", "scopes": ["com.shinolab"] }
14
+ ],
15
+ "dependencies": {
16
+ "com.shinolab.autd3-sdk.core": "0.1.0"
17
+ }
18
+ }
19
+ ```
20
+
21
+ Packages served from `registry.npmjs.org` do **not** appear in the Package Manager's
22
+ *My Registries* tab, because npmjs does not implement the legacy `/-/all` route that
23
+ Unity's package listing relies on. Resolution is unaffected: edit the manifest as above,
24
+ or use **+ → Add package by name**.
25
+
26
+ ## Platforms
27
+
28
+ Editor and Standalone builds on Windows (`win-x64`), Linux (`linux-x64`) and Apple
29
+ Silicon macOS (`osx-arm64`). Intel macOS is not shipped.
30
+
31
+ ## Notes
32
+
33
+ Minimum Unity version is 6 (6000.x). The API speaks Unity's left-handed, metre frame;
34
+ conversion to the AUTD3 canonical frame happens at the binding boundary.
35
+
36
+ See the [Unity binding README](https://github.com/shinolab/autd3-sdk/blob/main/bindings/unity/README.md) for the
37
+ coordinate system, the full package list and local development with `file:` references.
38
+
39
+ ## License
40
+
41
+ MIT. See `LICENSE.md`. Third-party notices are in `THIRD-PARTY-LICENSES.md`.
package/README.md.meta ADDED
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: f276a5ee7ed06c1f8218200b8123aefc
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,134 @@
1
+ using System;
2
+
3
+ namespace AUTD3
4
+ {
5
+
6
+
7
+ public readonly struct SamplingConfig
8
+ {
9
+ private enum Kind : byte
10
+ {
11
+ // default(SamplingConfig) must stay usable: treat it as FREQ_4K like SineOption's default
12
+ Default,
13
+ Divide,
14
+ Freq,
15
+ FreqNearest,
16
+ Period,
17
+ PeriodNearest,
18
+ }
19
+
20
+ private readonly Kind _kind;
21
+ private readonly ushort _divide;
22
+ private readonly float _freq;
23
+ private readonly ulong _periodNs;
24
+
25
+ private SamplingConfig(Kind kind, ushort divide, float freq, ulong periodNs)
26
+ {
27
+ _kind = kind;
28
+ _divide = divide;
29
+ _freq = freq;
30
+ _periodNs = periodNs;
31
+ }
32
+
33
+ public SamplingConfig(ushort divide)
34
+ {
35
+ if (divide == 0)
36
+ {
37
+ throw new Autd3Exception("sampling divide must be >= 1");
38
+ }
39
+ _kind = Kind.Divide;
40
+ _divide = divide;
41
+ _freq = 0f;
42
+ _periodNs = 0;
43
+ }
44
+
45
+ public SamplingConfig(Freq freq) : this(Kind.Freq, 0, freq.Hz, 0)
46
+ {
47
+ }
48
+
49
+ public SamplingConfig(TimeSpan period) : this(Kind.Period, 0, 0f, (ulong)(period.Ticks * 100))
50
+ {
51
+ }
52
+
53
+ public SamplingConfig(Nearest<Freq> freq) : this(Kind.FreqNearest, 0, freq.Value.Hz, 0)
54
+ {
55
+ }
56
+
57
+ public SamplingConfig(Nearest<TimeSpan> period) : this(Kind.PeriodNearest, 0, 0f, (ulong)(period.Value.Ticks * 100))
58
+ {
59
+ }
60
+
61
+ public static SamplingConfig Freq4k => new SamplingConfig(4000 * Units.Hz);
62
+
63
+ public static SamplingConfig Freq40k => new SamplingConfig(40000 * Units.Hz);
64
+
65
+ public ushort Divide()
66
+ {
67
+ var handle = CreateHandle();
68
+ try
69
+ {
70
+ if (NativeCore.autd3_core_sampling_config_divide_value(handle, out var value) != 0)
71
+ {
72
+ throw new Autd3Exception("sampling config cannot be resolved to a divider");
73
+ }
74
+ return value;
75
+ }
76
+ finally
77
+ {
78
+ NativeCore.autd3_core_sampling_config_free(handle);
79
+ }
80
+ }
81
+
82
+ public Freq Freq()
83
+ {
84
+ var handle = CreateHandle();
85
+ try
86
+ {
87
+ if (NativeCore.autd3_core_sampling_config_freq_value(handle, out var value) != 0)
88
+ {
89
+ throw new Autd3Exception("sampling config cannot be resolved to a frequency");
90
+ }
91
+ return value * Units.Hz;
92
+ }
93
+ finally
94
+ {
95
+ NativeCore.autd3_core_sampling_config_free(handle);
96
+ }
97
+ }
98
+
99
+ public TimeSpan Period()
100
+ {
101
+ var handle = CreateHandle();
102
+ try
103
+ {
104
+ if (NativeCore.autd3_core_sampling_config_period_value(handle, out var value) != 0)
105
+ {
106
+ throw new Autd3Exception("sampling config cannot be resolved to a period");
107
+ }
108
+ return TimeSpan.FromTicks((long)(value / 100));
109
+ }
110
+ finally
111
+ {
112
+ NativeCore.autd3_core_sampling_config_free(handle);
113
+ }
114
+ }
115
+
116
+ internal IntPtr CreateHandle()
117
+ {
118
+ var handle = _kind switch
119
+ {
120
+ Kind.Default => NativeCore.autd3_core_sampling_config_freq(4000f),
121
+ Kind.Divide => NativeCore.autd3_core_sampling_config_divide(_divide),
122
+ Kind.Freq => NativeCore.autd3_core_sampling_config_freq(_freq),
123
+ Kind.FreqNearest => NativeCore.autd3_core_sampling_config_freq_nearest(_freq),
124
+ Kind.Period => NativeCore.autd3_core_sampling_config_period(_periodNs),
125
+ _ => NativeCore.autd3_core_sampling_config_period_nearest(_periodNs),
126
+ };
127
+ if (handle == IntPtr.Zero)
128
+ {
129
+ throw new Autd3Exception("failed to create sampling config");
130
+ }
131
+ return handle;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 7a820c11763d6d97db8c4b5ba26b420c
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: