///|
/// Integer geometric moments of a solid mask.
pub(all) struct GeometricMoments {
  area : Int
  centroid : Point
  second_x : Double
  second_y : Double
  product_xy : Double
} derive(Debug)

///|
/// Return an axis-aligned solid bounding box.
pub fn DomainMask::bounding_box(self : DomainMask) -> Aabb {
  let mut found = false
  let mut min_x = self.size.width.to_double()
  let mut min_y = self.size.height.to_double()
  let mut max_x = 0.0
  let mut max_y = 0.0
  for y in 0.. GeometricMoments {
  let area = self.solid_count()
  let centroid = self.centroid()
  let mut second_x = 0.0
  let mut second_y = 0.0
  let mut product_xy = 0.0
  for y in 0.. DomainMask {
  let result = DomainMask::new(size=self.size)
  for y in 0.. DomainMask {
  let result = DomainMask::new(size=self.size)
  for y in 0.. Array[Int] {
  let result = Array::make(self.size.height.max(0), 0)
  for y in 0.. Array[Int] {
  let result = Array::make(self.size.width.max(0), 0)
  for y in 0.. GridPoint? {
  for y in 0.. Double {
  let center = self.centroid()
  let mut result = 0.0
  for y in 0.. DomainMask {
  let result = DomainMask::new(size=self.size)
  for y in 0..