Skip to content
This is the development version of the documentation. It may change before the next release. See 0.14.x for the latest release.

Geometry

Geometry represents the physical layout (position and rotation) of AUTD3 devices.

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

Autd3::new(origin, rotation) constructs a single device from an origin (Point3) and a rotation (UnitQuaternion).

When multiple devices are passed to Geometry::new, device numbers (idx) are assigned in order from the first.

Provides retrieval of information about the whole layout and access to each 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];
Method Returns Description
num_devices() usize Number of devices
num_transducers() usize Total number of transducers across all devices
center() Point3<f32> Center coordinate of the whole array
phase_buffer() Vec<Vec<Phase>> Allocate a phase buffer for Pattern computation (starts at 0)
intensity_buffer() Vec<Vec<Intensity>> Allocate an intensity buffer for Pattern computation (starts at the maximum)
output_mask_buffer() Vec<Vec<bool>> Allocate an output mask buffer for SetOutputMask (starts at true)
iter() / &geometry Iterator<Item = &Device> Iterate over each Device
geometry[i] &Device Get the i-th Device
to_json() Result<String, LayoutError> Convert the layout to a JSON string
from_json(&str) Result<Geometry, LayoutError> Construct Geometry from a JSON string

Represents a single device. It is obtained via geometry[i] or by iterating over &geometry. The position of each transducer and the device’s rotation can be retrieved. All transducers of a device share one normal direction, returned by 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);
Method Returns Description
idx() usize Device number within the Geometry
num_transducers() usize Number of transducers
center() Point3<f32> Device center coordinate
rotation() UnitQuaternion<f32> Device rotation
x_direction() UnitVector3<f32> Local x-axis direction
y_direction() UnitVector3<f32> Local y-axis direction
axial_direction() UnitVector3<f32> Axial direction (ultrasound emission direction)
positions() &[Point3<f32>] Positions of all transducers
position(i) Point3<f32> Position of the i-th transducer

There are helpers to build coordinates. The argument type is Length, so a unit can be specified, as in 150 * mm (see Units and Value Types).

Function Returns (Rust) Description
point(x, y, z) Point3<f32> An absolute-coordinate point
offset(x, y, z) Vector3<f32> A relative displacement vector