Skip to content

set_intensity / set_phase / add_phase

src

These functions rewrite the intensity and phase of a whole pattern buffer at once. Pattern functions such as focus write only the phase, so set the intensity with these functions.

A buffer allocated with pattern_buffer starts at phase 0 and the maximum intensity. Note that, in C#, the elements of new Emission[n] start at intensity 0.

Sets the intensity of every transducer. The phase is left unchanged. Passing Intensity::MIN produces no output.

set_intensity(intensity, &mut dst);

Sets the phase of every transducer. The intensity is left unchanged.

set_phase(phase, &mut dst);

Sets both the phase and the intensity of every transducer.

set_phase_and_intensity(phase, intensity, &mut dst);

Adds a phase uniformly to every transducer (wrapping at 8 bits). The intensity is left unchanged.

add_phase(phase, &mut dst);
Parameter Type Description
intensity Intensity Intensity
phase Phase Phase
dst &mut [[Emission; _]] Target buffer
use autd3_rs::geometry::{Autd3, Geometry, offset};
use autd3_rs::units::{m, mm, s};
use autd3_rs::value::{Intensity, Phase};
use autd3_rs_pattern::{add_phase, focus, set_intensity, wavelength};
let geometry = Geometry::new(vec![Autd3::default()]);
let mut dst = geometry.pattern_buffer();
set_intensity(Intensity(0x80), &mut dst);
focus(
&geometry,
geometry.center() + offset(0.0 * mm, 0.0 * mm, 150.0 * mm),
wavelength(340.0 * m / s),
&mut dst,
);
add_phase(Phase::PI, &mut dst);
set_intensity(Intensity::MIN, &mut dst);