Geometry
Geometry は AUTD3 デバイスの物理配置 (位置・姿勢) を表現する.
Geometry::new(vec![Autd3::new( Point3::origin(), UnitQuaternion::identity(),)]);Autd3::new(origin, rotation) は原点位置 (Point3) と姿勢 (UnitQuaternion) から 1 台のデバイスを構築する.
原点を Point3::origin(), 姿勢を UnitQuaternion::identity() とする Autd3::default() もある.
Geometry( [ Autd3( [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0], ) ])Autd3([x, y, z], rotation) は原点位置と姿勢から 1 台のデバイスを構築する.
姿勢には以下の 3 形式を渡せる.
Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0])Autd3([0.0, 0.0, 0.0], EulerAngles.ZYZ(0.0 * deg, 90.0 * deg, 0.0 * deg))Autd3([0.0, 0.0, 0.0], Rotation.from_euler("ZYZ", [0.0, 90.0, 0.0], degrees=True))- クォータニオン: scalar-first
[w, i, j, k] EulerAngles: intrinsic なオイラー角- scipy の
Rotation
new Geometry(new[] { new Autd3( Vector3.Zero, Quaternion.Identity) });new Autd3(origin, rotation) は原点位置 (Vector3) と姿勢 (Quaternion) から 1 台のデバイスを構築する.
姿勢を省略した new Autd3(origin) もある (Quaternion.Identity を使う).
Geometry::new に複数台を渡すと, 先頭から順にデバイス番号 (idx) が割り振られる.
配置全体の情報取得と, 各 Device へのアクセスを提供する.
let num_devices = geometry.num_devices();let total_transducers = geometry.num_transducers();let array_center = geometry.center();
for device in &geometry { let _ = device;}
let first = &geometry[0];num_devices = geometry.num_devices()total_transducers = geometry.num_transducers()array_center = geometry.center()
for device in geometry: pass
first = geometry[0]var numDevices = geometry.NumDevices;var totalTransducers = geometry.NumTransducers;var arrayCenter = geometry.Center;
for (var i = 0; i < geometry.NumDevices; i++){ var device = geometry[i];}
var first = geometry[0];| メソッド | 返り値 | 説明 |
|---|---|---|
num_devices() |
usize |
デバイス台数 |
num_transducers() |
usize |
全デバイスの振動子総数 |
center() |
Point3<f32> |
アレイ全体の中心座標 |
pattern_buffer() |
Vec<Vec<Emission>> |
Pattern 計算用の出力バッファを確保 |
iter() / &geometry |
Iterator<Item = &Device> |
各 Device を走査 |
geometry[i] |
&Device |
i 番目の Device を取得 |
Device
Section titled “Device”1 台のデバイスを表す.
geometry[i] または &geometry の走査で得る.
各振動子の位置・法線方向や, デバイスの姿勢を取得できる.
let idx = device.idx();let num_transducers = device.num_transducers();let center = device.center();let rotation = device.rotation();let x = device.x_direction();let y = device.y_direction();let axial = device.axial_direction();let positions = device.positions();let directions = device.directions();let pos0 = device.position(0);let dir0 = device.direction(0);idx = device.idx()num_transducers = device.num_transducers()center = device.center()rotation = device.rotation()x = device.x_direction()y = device.y_direction()axial = device.axial_direction()positions = device.positions()directions = device.directions()pos0 = device.position(0)dir0 = device.direction(0)var idx = dev.Idx;var numTransducers = dev.NumTransducers;var center = dev.Center;var rotation = dev.Rotation;var x = dev.XDirection;var y = dev.YDirection;var axial = dev.AxialDirection;var positions = dev.Positions;var directions = dev.Directions;var pos0 = dev.Position(0);var dir0 = dev.Direction(0);| メソッド | 返り値 | 説明 |
|---|---|---|
idx() |
usize |
Geometry 内でのデバイス番号 |
num_transducers() |
usize |
振動子数 |
center() |
Point3<f32> |
デバイス中心座標 |
rotation() |
UnitQuaternion<f32> |
デバイスの姿勢 (回転) |
x_direction() |
UnitVector3<f32> |
ローカル x 軸方向 |
y_direction() |
UnitVector3<f32> |
ローカル y 軸方向 |
axial_direction() |
UnitVector3<f32> |
軸方向 (超音波の放射方向) |
positions() |
&[Point3<f32>] |
全振動子の位置 |
directions() |
&[UnitVector3<f32>] |
全振動子の法線方向 |
position(i) |
Point3<f32> |
i 番目の振動子の位置 |
direction(i) |
UnitVector3<f32> |
i 番目の振動子の方向 |
座標ヘルパ (Rustのみ)
Section titled “座標ヘルパ (Rustのみ)”autd3_rs::geometry には座標を組み立てるヘルパがある.
引数の型が Length になっており, 単位を指定することができる.
| 関数 | 返り値 | 説明 |
|---|---|---|
point(x, y, z) |
Point3<f32> |
絶対座標の点 |
offset(x, y, z) |
Vector3<f32> |
相対変位ベクトル |
Python / C# には長さの単位型はなく, mm 固定である.