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).
There is also Autd3::default(), which uses Point3::origin() for the origin and UnitQuaternion::identity() for the rotation.
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.
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))- 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).
There is also new Autd3(origin), which omits the rotation (it uses Quaternion.Identity).
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;
for (var i = 0; i < geometry.NumDevices; i++){ var device = geometry[i];}
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 |
pattern_buffer() |
Vec<Vec<Emission>> |
Allocate an output buffer for Pattern computation |
iter() / &geometry |
Iterator<Item = &Device> |
Iterate over each Device |
geometry[i] |
&Device |
Get the i-th Device |
Device
Section titled “Device”Represents a single device.
It is obtained via geometry[i] or by iterating over &geometry.
The position and normal direction of each transducer, as well as the device’s rotation, can be retrieved.
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);| 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 |
directions() |
&[UnitVector3<f32>] |
Normal directions of all transducers |
position(i) |
Point3<f32> |
Position of the i-th transducer |
direction(i) |
UnitVector3<f32> |
Direction of the i-th transducer |
Coordinate Helpers (Rust only)
Section titled “Coordinate Helpers (Rust only)”autd3_rs::geometry provides helpers to build coordinates.
The argument type is Length, so a unit can be specified.
| Function | Returns | Description |
|---|---|---|
point(x, y, z) |
Point3<f32> |
An absolute-coordinate point |
offset(x, y, z) |
Vector3<f32> |
A relative displacement vector |
Python / C# have no length-unit type; coordinates are always in mm.