{"id":25213092,"url":"https://github.com/jaredhalpern/jhdiamondsquare","last_synced_at":"2025-04-05T07:40:55.357Z","repository":{"id":56915906,"uuid":"84006765","full_name":"JaredHalpern/JHDiamondSquare","owner":"JaredHalpern","description":"An open-source iterative implementation of the diamond square algorithm. ","archived":false,"fork":false,"pushed_at":"2020-03-20T19:49:50.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-15T13:16:59.913Z","etag":null,"topics":["diamond-square-algorithm","height-map","heightmap","objective-c","open-source","tessellation"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaredHalpern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T22:23:36.000Z","updated_at":"2025-01-12T21:19:46.000Z","dependencies_parsed_at":"2022-08-20T20:50:38.612Z","dependency_job_id":null,"html_url":"https://github.com/JaredHalpern/JHDiamondSquare","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredHalpern%2FJHDiamondSquare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredHalpern%2FJHDiamondSquare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredHalpern%2FJHDiamondSquare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredHalpern%2FJHDiamondSquare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaredHalpern","download_url":"https://codeload.github.com/JaredHalpern/JHDiamondSquare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305906,"owners_count":20917202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["diamond-square-algorithm","height-map","heightmap","objective-c","open-source","tessellation"],"created_at":"2025-02-10T15:18:52.667Z","updated_at":"2025-04-05T07:40:55.330Z","avatar_url":"https://github.com/JaredHalpern.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JHDiamondSquare\n\n[![CI Status](http://img.shields.io/travis/JaredHalpern/JHDiamondSquare.svg?style=flat)](https://travis-ci.org/JaredHalpern/JHDiamondSquare)\n[![Version](https://img.shields.io/cocoapods/v/JHDiamondSquare.svg?style=flat)](http://cocoapods.org/pods/JHDiamondSquare)\n[![License](https://img.shields.io/cocoapods/l/JHDiamondSquare.svg?style=flat)](http://cocoapods.org/pods/JHDiamondSquare)\n[![Platform](https://img.shields.io/cocoapods/p/JHDiamondSquare.svg?style=flat)](http://cocoapods.org/pods/JHDiamondSquare)\n\n\nAn iterative Objective-C implementation of the diamond square algorithm. This technique is useful for generating tessellated 2D height maps to be used in modeling a cloudy sky, smokey air, or terrain.\n\n__Implementation details:__\n\nThe diamond square algorithm requires a 2D array with square dimensions (2^n + 1) where the four corners of the array are set to some initial identical starting value. It is important that the starting value be identical for all four points to ensure the resulting array wraps correctly. The rest of the points in the array may be set to zero or some other value, but will ultimately be overwritten. The specific implementation provided here accounts for wrapping of the far edges, as pointed out in the below StackOverflow discussion. Random amounts of noise, in the range of +/- half the default (or user-provided) height, are introduced to each point. The randomness is deterministic and based on the seed value provided.\n\n\nThere are two different ways of generating 2D Maps using `JHDiamondSquare`. \n\nThe two main class methods are: \n\n`+(NSArray *)diamondSquare:(long)seed gridSize:(NSInteger)gridSize;`\n\n`+(NSArray *)diamondSquare:(long)seed gridSize:(NSInteger)size initialHeight:(CGFloat)initialHeight;`\n\nCalling `NSArray *heightMap = [JHDiamondSquare diamondSquare:1 gridSize:4];` where the seed (used for deterministic noise introduced to each point) is `1` and the grid dimensions are 2^4 + 1, or 17 width and 17 height. This method will use a default `initialHeight` of `1000`.\n\nUsing `NSArray *heightMap = [JHDiamondSquare diamondSquare:1 gridSize:4 initialHeight:200];` will allow the user to specify an `initialHeight` of `200`.\n\n\n__A nice online visualization of the algorithm:__\n\nhttp://www.paulboxley.com/blog/2011/03/terrain-generation-mark-one\n\n\n__Inspired by and with guidance from:__\n\nhttps://en.wikipedia.org/wiki/Diamond-square_algorithm\n\nhttp://www.gameprogrammer.com/fractal.html#diamond\n\nhttp://stackoverflow.com/questions/2755750/diamond-square-algorithm\n\nhttp://weeab.eu/terrain-generation-with-the-diamond-square-algorithm/\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first. `JHViewController.m` contains a simple use-case and prints out the results to the console.\n\n## Requirements\n\nNone.\n\n## Installation\n\nJHDiamondSquare is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"JHDiamondSquare\"\n```\n\n## Author\n\nJared Halpern\n\n## License\n\nJHDiamondSquare is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhalpern%2Fjhdiamondsquare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhalpern%2Fjhdiamondsquare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhalpern%2Fjhdiamondsquare/lists"}