{"id":18823589,"url":"https://github.com/yvt/zhang_hilbert","last_synced_at":"2026-03-04T03:31:15.751Z","repository":{"id":57672848,"uuid":"172644413","full_name":"yvt/zhang_hilbert","owner":"yvt","description":"A Rust crate for generating an arbitrary-sized pseudo-Hilbert scan ","archived":false,"fork":false,"pushed_at":"2019-06-06T15:00:39.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-15T16:16:10.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yvt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-26T05:31:12.000Z","updated_at":"2019-07-15T22:34:51.000Z","dependencies_parsed_at":"2022-08-31T11:14:37.630Z","dependency_job_id":null,"html_url":"https://github.com/yvt/zhang_hilbert","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yvt/zhang_hilbert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fzhang_hilbert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fzhang_hilbert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fzhang_hilbert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fzhang_hilbert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yvt","download_url":"https://codeload.github.com/yvt/zhang_hilbert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fzhang_hilbert/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30070744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:54:05.506Z","updated_at":"2026-03-04T03:31:15.713Z","avatar_url":"https://github.com/yvt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `zhang_hilbert`\n\n[\u003cimg src=\"https://docs.rs/zhang_hilbert/badge.svg\" alt=\"docs.rs\"\u003e](https://docs.rs/zhang_hilbert/)\n\nThis crate provides iterator types that produce an arbitrary-sized\npseudo-Hilbert scan based on “A Pseudo-Hilbert Scan for Arbitrarily-Sized\nArrays” by Zhang, et al.\n\n![](https://ipfs.io/ipfs/QmUbNnFkcyHQrg3CpNf3ykVq6dm7vG7CGzU8tryzWvXrEf/thecurve.svg)\n\n```rust\nuse zhang_hilbert::ArbHilbertScan32;\nfor [x, y] in ArbHilbertScan32::new([11, 42]) {\n    assert!(x \u003e= 0 \u0026\u0026 y \u003e= 0 \u0026\u0026 x \u003c 11 \u0026\u0026 y \u003c 42);\n    println!(\"{:?}\", [x, y]);\n}\n```\n\n## Differences from the original algorithm\n\n### The last `E_B(E, O)` block\n\nThis implementation uses a different curve-type selection rule for the\nlast `E_B(E, O)` block in a `E_R(E, O)` rectangle. This makes the leaving\npoint fixed at a known point in more cases, making the output suitable for\ntiling.\n\n```\ncargo run --example hilbertgen -- -a zhang 6 7\n  ,---, ,---,        ,---, ,---,\n  '-, '-' ,-'        '-, '-' ,-'\n  ,-' ,-, '-,        ,-' ,-, '-,\n  '-, | '---'        '-, | '---'\n  ,-' '-, ,--        ,-' '-----,\n  '-, ,-' '-,        '-, ,-----'\n  --' '-----'        --' '------\n   Original      This implementation\n\ncargo run --example hilbertgen -- -a zhang 4 3\n    ,------           ,-----,\n    '-----,           '-, ,-'\n    ------'           --' '--\n   Original      This implementation\n```\n\n### Aspect-ratio bounded tiling\n\nThe algorithm accepts any rectangle size, but the output quality\ndeteriorates as the proportions of the rectangle gets distant from square.\n`ArbHilbertScanCore` improves it by dividing the rectangle into multiple\nrectangles whose proportions are closer to square than the original\nrectangle is (thus their aspect ratios are bounded).\n\n```\n$ cargo run --example hilbertgen -- 40 7\n,---, ,---, ,---, ,---, ,---, ,-, ,---, ,---, ,---, ,---, ,-, ,---, ,---, ,---,\n'-, '-' ,-' '-, '-' ,-' '-, '-' '-' ,-' '-, '-' ,-' '-, '-' '-' ,-' '-, '-' ,-'\n,-' ,-, '-, ,-' ,-, '-, ,-' ,-, ,-, '-, ,-' ,-, '-, ,-' ,-, ,-, '-, ,-' ,-, '-,\n'-, | '---' '-, | '---' '---' | | '---' '-, | '---' '---' | | '---' '-, | '---'\n,-' '-----, ,-' '-----, ,-----' '-----, ,-' '-----, ,-----' '-----, ,-' '-----,\n'-, ,-----' '-, ,-----' '-----, ,-----' '-, ,-----' '-----, ,-----' '-, ,-----'\n--' '---------' '-------------' '---------' '-------------' '---------' '------\n\n$ cargo run --example hilbertgen -- -a zhang 40 7\n,-----------------------, ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,---------------,\n'---------------------, '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' ,-------------'\n,---------------------' ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,-, ,-, '-------------,\n'-----------------------' '-' '-' '-' '-' '-' | | '-' '-' '-' '---------------'\n,---------------------------------------------' '-----------------------------,\n'---------------------------------------------, ,-----------------------------'\n----------------------------------------------' '------------------------------\n```\n\n### The `division` function\n\nThe `division` function was modified for efficient implementation. As a\nresult, it produces an different output for the input `3⋅2ⁿ`.\n\n\nLicense: MIT/Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvt%2Fzhang_hilbert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyvt%2Fzhang_hilbert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvt%2Fzhang_hilbert/lists"}