CrossMatrix

CrossMatrix[r]
gives a matrix whose elements are in a centered cross-shaped region that extends r positions along each index direction, and are otherwise.

CrossMatrix[r, w]
gives a ww matrix containing a cross-shaped region of s.

CrossMatrix[{r1, r2, ...}, ...]
yields an array whose elements are in a centered cross-shaped region that extends positions in the i^(th) index direction.

DetailsDetails

  • The cross of s is always at the center of the region.
  • In CrossMatrix[r] or CrossMatrix[{r1, ...}] the matrix or array is sized so as to just include all nonzero elements.
  • CrossMatrix[All, w] gives a ww matrix containing a cross shape that is as large as possible.
  • CrossMatrix[..., {w1, w2, ...}] gives a ... array.
  • CrossMatrix[{r1, ..., rn}, w] gives a w...w array.
  • CrossMatrix[All, {w1, ..., wn}] gives a ... array containing a cross-shaped region that is as large as possible.
  • Elements of CrossMatrix[r] are if their edit distance from the center is not more than 1.
  • The parameter r need not be an integer; in an odd-dimensional array, the cross extends Floor[Abs[r+1/2]] pixels from the origin.
  • The lines of the cross have width 1 if the corresponding dimension is odd and width 2 otherwise.
  • For integer r, CrossMatrix[r] yields a matrix.
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »