コンテンツにスキップ

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::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() usize デバイス台数
num_transducers() usize 全デバイスの振動子総数
center() Point3<f32> アレイ全体の中心座標
pattern_buffer() Vec<Vec<Emission>> Pattern 計算用の出力バッファを確保
iter() / &geometry Iterator<Item = &Device> Device を走査
geometry[i] &Device i 番目の 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() 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 番目の振動子の方向

autd3_rs::geometry には座標を組み立てるヘルパがある. 引数の型が Length になっており, 単位を指定することができる.

関数 返り値 説明
point(x, y, z) Point3<f32> 絶対座標の点
offset(x, y, z) Vector3<f32> 相対変位ベクトル

Python / C# には長さの単位型はなく, mm 固定である.