feat: add built-in array comparison
This commit is contained in:
@@ -39,3 +39,45 @@ $arrayDefinition = [ordered]@{
|
||||
$json = $arrayDefinition | ConvertTo-Json -Depth 8
|
||||
[System.IO.File]::WriteAllText($outputPath, $json + [Environment]::NewLine, [System.Text.UTF8Encoding]::new($false))
|
||||
Write-Host "Generated $($microphones.Count) microphones: $outputPath"
|
||||
|
||||
$spiralOutputPath = Join-Path $projectRoot 'assets/array-geometries/fermat-spiral-192.array.json'
|
||||
$spiralMicrophones = [System.Collections.Generic.List[object]]::new()
|
||||
$microphoneCount = 192
|
||||
$radius = 0.225
|
||||
$goldenAngle = [Math]::PI * (3 - [Math]::Sqrt(5))
|
||||
|
||||
for ($index = 0; $index -lt $microphoneCount; $index++) {
|
||||
$microphoneRadius = $radius * [Math]::Sqrt(($index + 0.5) / $microphoneCount)
|
||||
$angle = $index * $goldenAngle
|
||||
$x = $microphoneRadius * [Math]::Cos($angle)
|
||||
$y = $microphoneRadius * [Math]::Sin($angle)
|
||||
$spiralMicrophones.Add([ordered]@{
|
||||
id = 'mic-{0:D3}' -f ($index + 1)
|
||||
position = @([Math]::Round($x, 6), [Math]::Round($y, 6), 0)
|
||||
})
|
||||
}
|
||||
|
||||
$spiralDefinition = [ordered]@{
|
||||
schemaVersion = '1.0.0'
|
||||
kind = 'micarrsim.array'
|
||||
id = 'fermat-spiral-192'
|
||||
name = '192-channel Fermat spiral'
|
||||
description = 'Equal-area Fermat spiral on a 0.45 m circular aperture for comparison with the rectangular baseline'
|
||||
units = 'm'
|
||||
coordinateSystem = [ordered]@{
|
||||
handedness = 'right'
|
||||
xAxis = 'right'
|
||||
yAxis = 'up'
|
||||
zAxis = 'toward-scene'
|
||||
}
|
||||
aperture = [ordered]@{ width = 0.45; height = 0.45 }
|
||||
microphones = $spiralMicrophones
|
||||
}
|
||||
|
||||
$spiralJson = $spiralDefinition | ConvertTo-Json -Depth 8
|
||||
[System.IO.File]::WriteAllText(
|
||||
$spiralOutputPath,
|
||||
$spiralJson + [Environment]::NewLine,
|
||||
[System.Text.UTF8Encoding]::new($false)
|
||||
)
|
||||
Write-Host "Generated $($spiralMicrophones.Count) microphones: $spiralOutputPath"
|
||||
|
||||
Reference in New Issue
Block a user