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).
Geometry( [ Autd3( [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0], ) ])Autd3([x, y, z], rotation) constructs a single device from an origin and a rotation.
The rotation accepts the following 3 forms.
- Quaternion: scalar-first
[w, i, j, k] EulerAngles: intrinsic Euler angles- scipy’s
Rotation
new Geometry(new[] { new Autd3( Vector3.Zero, Quaternion.Identity) });new Autd3(origin, rotation) constructs a single device from an origin (Vector3) and a rotation (Quaternion).
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];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;
foreach (var device in geometry){ _ = device;}
var 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 |
Device
Section titled “Device”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);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()pos0 = device.position(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 pos0 = dev.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 |
Coordinate Helpers
Section titled “Coordinate Helpers”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 |