init(columns:rows:)
Creates a warp geometry grid of a specified size.
Declaration
convenience init(columns cols: Int, rows: Int)Parameters
- cols:
The number of columns in the grid.
- rows:
The number of rows in the grid.
Mentioned in
Return Value
A new warp geometry grid object.
Discussion
Creating a warp geometry grid without explicit source and destination positions automatically generates the required position arrays. For example, a 2 column by 2 row grid would create two arrays containing nine positions each, beginning at [0,0] - for the bottom left position - and ending at [1,1] - for the top left position.
index: 6, position: [0.0, 1.0] | index: 7, position: [0.5, 1.0] | index: 8, position: [1.0, 1.0] |
|---|---|---|
index: 3, position: [0.0, 0.5] | index: 4, position: [0.5, 0.5] | index: 5, position: [1.0, 0.5] |
index: 0, position: [0.0, 0.0] | index: 1, position: [0.5, 0.0] | index: 2, position: [1.0, 0.0] |