expandPlacement :: Int  -- ^ The index of the package used
              -> LoadSpace
              -> [EuclideanSpace3D]
              -> [ResidualSpace] -- ^All current residual spaces 'rs'
              -> (ResidualSpace, EuclideanSpace3D, [Vec3])  -- ^ The picked residual space 'r', the untranslated package and translation vectors
              -> ([IndexedSpace], [ResidualSpace]) -- ^ The indexed packages and the resulting list of new residual spaces
expandPlacement i load spaces residualspaces (residual, package, translations) =
  indexPackingStep i (tes, splitFoldDominant residualspaces tes)
  where
    residualStart = start $ rspace residual
    packageSize = S.size package
    tes = fmap (\v -> package `translate` (residualStart &+ (packageSize `pointwise` v))) translations
expandPlacement :: Int  -- ^ The index of the package used
              -> LoadSpace
              -> [EuclideanSpace3D]
              -> [ResidualSpace] -- ^All current residual spaces 'rs'
              -> (ResidualSpace, EuclideanSpace3D, [Vec3])  -- ^ The picked residual space 'r', the untranslated package and translation vectors
              -> ([IndexedSpace], [ResidualSpace])
expandPlacement i load spaces residualspaces (residual, package, translations) =
  indexPackingStep i (tes, splitFoldDominant residualspaces tes)
  where
    residualStart = start $ rspace residual
    packageSize = S.size package
    tes = fmap (\v -> package `translate` (residualStart &+ (packageSize `pointwise` v))) translations
expandPlacement i load spaces residualspaces (residual, package, translations) =
  indexPackingStep i (tes, splitFoldDominant residualspaces tes)
  where
    residualStart = start $ rspace residual
    packageSize = S.size package
    tes = fmap (\v -> package `translate` (residualStart &+ (packageSize `pointwise` v))) translations