diff --git a/src/space_fill.rs b/src/space_fill.rs index 67a7de9..39f417c 100644 --- a/src/space_fill.rs +++ b/src/space_fill.rs @@ -9,6 +9,7 @@ pub mod hilbert { /// /// x: The x coordinate. Must be no greater than 2^16-1. /// y: The y coordinate. Must be no greater than 2^16-1. + /// n: Basically the "resolution" of the curve, on one side. /// /// Returns the hilbert curve index corresponding to the (x,y) coordinates given. pub fn encode(x: u32, y: u32, n: u32) -> u32 { @@ -33,6 +34,7 @@ pub mod hilbert { /// Convert hilbert curve index to (x,y). /// /// d: The hilbert curve index. + /// n: Basically the "resolution" of the curve, on one side. /// /// Returns the (x, y) coords at the given index. pub fn decode(d: u32, n: u32) -> (u32, u32) { @@ -197,8 +199,8 @@ mod tests { #[test] fn hilbert_reversible() { let i = 0x4c8587a2; - let (x, y) = hilbert::decode(i); - let i2 = hilbert::encode(x, y); + let (x, y) = hilbert::decode(i, 1 << 16); + let i2 = hilbert::encode(x, y, 1 << 16); assert_eq!(i, i2); }