///|
/// Definition of an ArUco GridBoard containing a 2D array of fiducial markers.
pub(all) struct GridBoard {
  markers_x : Int
  markers_y : Int
  marker_length : Double
  marker_separation : Double
  dictionary : MarkerDictionary
  ids : Array[Int]
  obj_points : Array[Array[Point3D]] // 4 corners in 3D world space per marker
} derive(Debug, Eq)

///|
/// Creates a new ArUco GridBoard with specified grid dimensions, marker sizes, and dictionary.
pub fn GridBoard::new(
  markers_x : Int,
  markers_y : Int,
  marker_length : Double,
  marker_separation : Double,
  dictionary : MarkerDictionary,
  first_marker_id? : Int = 0,
) -> GridBoard {
  let total_markers = markers_x * markers_y
  let ids = Array::make(total_markers, 0)
  let obj_points : Array[Array[Point3D]] = []

  let mut current_id = first_marker_id

  for y in 0.. Pose3D? {
  let matched_obj_pts : Array[Point3D] = []
  let matched_img_pts : Array[Point2D] = []

  for det in detections {
    // Find matching marker in board
    for i in 0..