HeightmapIterator
Heightmap.swift:80struct HeightmapIterator
struct HeightmapIterator
import Heightmap
Data structures for generating and exposing a height map.
struct Heightmap
A two-dimensional array of unit-values, used to represent a height map.
subscript(x: Int, z: Int) -> Float { get }
Returns the floating point value at the width and depth you provide.
subscript(xz: XZIndex) -> Float { get }
Returns the floating point value at the width and depth you provide.
init(_ contents: [Float], width: Int)
Creates a new height map from the collection of floating point values that you provide.
init(_ contents: [Float], width: Int, depth: Int)
Creates a new height map from the collection of floating point values that you provide.
init(bytes: [UInt8], width: Int)
Creates a new height map from the collection of bytes that you provide.
init(from decoder: any Decoder) throws
init(normalizing: [Float], width: Int)
Creates a new height map normalizing the collection of floating point values that you provide to unit values.
var contents: [Float]
The linear interior contents of the two-dimensional array.
var endIndex: Int { get }
let height: Int
The height of the array.
var startIndex: Int { get }
let width: Int
The width of the array.
subscript(linearindex: Int) -> Float { get set }
func index(after i: Int) -> Int
func makeIterator() -> HeightmapIterator
func normalize(expand: Bool = false) -> Heightmap
Returns a height map with the values normalized to map between 0.0 and 1.0.
mutating func normalized(expand: Bool = false)
Changes the contents of the height map to normalize the values between 0 and 1.0.
typealias Index = Int
typealias Iterator = HeightmapIterator
protocol IteratorProtocol<Element>
A type that supplies the values of a sequence one at a time.
mutating func next() -> Float?