コンテンツにスキップ
これは開発版のドキュメントである. 内容は次のリリースまでに変更される可能性がある. 最新のリリース版は 0.14.x を参照.

Geometry

Geometry は AUTD3 デバイスの物理配置 (位置・姿勢) を表現する.

Geometry::new(vec![Autd3::new(
Point3::origin(),
UnitQuaternion::identity(),
)]);

Autd3::new(origin, rotation) は原点位置 (Point3) と姿勢 (UnitQuaternion) から 1 台のデバイスを構築する.

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> アレイ全体の中心座標
phase_buffer() Vec<Vec<Phase>> Pattern 計算用の位相バッファを確保 (初期値 0)
intensity_buffer() Vec<Vec<Intensity>> Pattern 計算用の振幅バッファを確保 (初期値最大)
output_mask_buffer() Vec<Vec<bool>> SetOutputMask 用の出力マスクバッファを確保 (初期値 true)
iter() / &geometry Iterator<Item = &Device> 各 Device を走査
geometry[i] &Device i 番目の Device を取得
to_json() Result<String, LayoutError> 配置を JSON 文字列にする
from_json(&str) Result<Geometry, LayoutError> JSON 文字列からGeometryを生成

1 台のデバイスを表す. geometry[i] または &geometry の走査で得る. 各振動子の位置や, デバイスの姿勢を取得できる. 振動子の法線方向はデバイス内で共通で, axial_direction() が返す.

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 pos0 = device.position(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>] 全振動子の位置
position(i) Point3<f32> i 番目の振動子の位置

座標を組み立てるヘルパがある. 引数の型が Length になっており, 150 * mm のように単位を指定することができる (単位と値型 参照).

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