pub struct BoardLayout {
pub name: String,
pub pitch_mm: f32,
pub rows: usize,
pub long_row_cols: usize,
pub marker_outer_radius_mm: f32,
pub marker_inner_radius_mm: f32,
pub markers: Vec<BoardMarker>,
/* private fields */
}Expand description
Runtime board layout used by the detector.
Describes the physical hex-lattice arrangement of ring markers: their
positions in millimeters, ring radii, and lattice parameters. Load from
a JSON file conforming to ringgrid.target.v3 schema, or use the
built-in default via BoardLayout::default().
§Example
use ringgrid::BoardLayout;
use std::path::Path;
let board = BoardLayout::from_json_file(Path::new("target.json")).unwrap();
println!("{} markers, pitch={} mm", board.n_markers(), board.pitch_mm);Fields§
§name: String§pitch_mm: f32§rows: usize§long_row_cols: usize§marker_outer_radius_mm: f32§marker_inner_radius_mm: f32§markers: Vec<BoardMarker>Implementations§
Source§impl BoardLayout
impl BoardLayout
Sourcepub fn build_index(&mut self)
pub fn build_index(&mut self)
Build the internal ID->index lookup table. Must be called after manual marker modifications.
Sourcepub fn xy_mm(&self, id: usize) -> Option<[f32; 2]>
pub fn xy_mm(&self, id: usize) -> Option<[f32; 2]>
Look up board coordinates (x, y) in mm for a given marker ID.
Sourcepub fn marker_outer_radius_mm(&self) -> f32
pub fn marker_outer_radius_mm(&self) -> f32
Marker outer radius in board units (mm).
Sourcepub fn marker_inner_radius_mm(&self) -> f32
pub fn marker_inner_radius_mm(&self) -> f32
Marker inner radius in board units (mm).
Sourcepub fn marker_ids(&self) -> impl Iterator<Item = usize> + '_
pub fn marker_ids(&self) -> impl Iterator<Item = usize> + '_
Iterator over all marker IDs present on the board.
Sourcepub fn max_marker_id(&self) -> usize
pub fn max_marker_id(&self) -> usize
Maximum marker ID present on the board.
Sourcepub fn marker_bounds_mm(&self) -> Option<([f32; 2], [f32; 2])>
pub fn marker_bounds_mm(&self) -> Option<([f32; 2], [f32; 2])>
Axis-aligned marker bounds in board mm.
Returns (min_xy, max_xy) over marker centers.
Sourcepub fn marker_span_mm(&self) -> Option<[f32; 2]>
pub fn marker_span_mm(&self) -> Option<[f32; 2]>
Axis-aligned marker span in board mm ([width, height]).
Trait Implementations§
Source§impl Clone for BoardLayout
impl Clone for BoardLayout
Source§fn clone(&self) -> BoardLayout
fn clone(&self) -> BoardLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BoardLayout
impl Debug for BoardLayout
Auto Trait Implementations§
impl Freeze for BoardLayout
impl RefUnwindSafe for BoardLayout
impl Send for BoardLayout
impl Sync for BoardLayout
impl Unpin for BoardLayout
impl UnsafeUnpin for BoardLayout
impl UnwindSafe for BoardLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.