{"id":28373371,"url":"https://github.com/dkruchinin/particles","last_synced_at":"2025-07-22T13:32:47.064Z","repository":{"id":10617276,"uuid":"12837185","full_name":"dkruchinin/particles","owner":"dkruchinin","description":"Elastic particle collision simulation","archived":false,"fork":false,"pushed_at":"2024-03-06T19:22:54.000Z","size":252,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T10:36:32.926Z","etag":null,"topics":["c-plus-plus","mass","newtonian-mechanics","particles","sdl2","simulation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkruchinin.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":"2013-09-14T22:44:39.000Z","updated_at":"2024-02-06T18:31:56.000Z","dependencies_parsed_at":"2022-09-18T05:45:12.383Z","dependency_job_id":null,"html_url":"https://github.com/dkruchinin/particles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dkruchinin/particles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkruchinin%2Fparticles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkruchinin%2Fparticles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkruchinin%2Fparticles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkruchinin%2Fparticles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkruchinin","download_url":"https://codeload.github.com/dkruchinin/particles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkruchinin%2Fparticles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266505971,"owners_count":23940019,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c-plus-plus","mass","newtonian-mechanics","particles","sdl2","simulation"],"created_at":"2025-05-29T19:30:42.455Z","updated_at":"2025-07-22T13:32:47.058Z","avatar_url":"https://github.com/dkruchinin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"About\n======\n\nThis is a simulation of the motion of N colliding particles working according to the laws of elastic collision.\nThe simulation uses event driven model which makes it pretty swift. This thing can be used to demonstrate the\nmotion of molecules in gas, Brownian motion, atomic diffusion and many other incredible things.\n\nFor more informatino read this: http://introcs.cs.princeton.edu/java/assignments/collisions.html\n\n\nBuilding\n======\n\nBefore you try to build this, you need:\n\n* OSX: well, if you want to build it under linux you'll have to hack the makefile yourself. I hope I'll have enough time and enthusiasm to migrate this to cmake or something.\n* Compiler supporting C++11\n* GNU Make\n* SDL2: http://www.libsdl.org/download-2.0.php\n\nIf you have all these just run\n\n    % make\n\n\nUsage\n======\n\n    % ./simulation\n    Usage: ./simulation \u003cwidth\u003e \u003cheight\u003e \u003cconfig\u003e\n\n* width - obviously the width of the simulation screen\n* height - obviously the hight of the simulation screen\n* config - configuration file describing particles\n\nConfiguration file\n------------------\n\nConfiguration file format is pretty simple, each line describes unique particle: its x and y coordinates, velocities,\nradius, mass and color.\nLine format:\n\n    x y vx vy mass radius r g b\n\nWhere:\n* x: relative x coordinate in range ```[0.0, 1.0]``` (absolute = width * x)\n* y: relative y coordinate in range ```[0.0, 1.0]``` (absolute = height * y)\n* vx: relative velocity along X axis ```[0.0, 1.0]``` (absolute = (width + height) / 2 * vx)\n* vy: relative velocity along Y axis ```[0.0, 1.0]``` (absolute = (width + height) / 2 * vy)\n* mass: mass of the particle ```[1, 100]```\n* radius: relative radius of the particle ```[0.0, 1.0]``` (absolute = (width + height) / 2 * radius)\n* r: red color value ```[0, 255]```\n* g: green color value ```[0, 255]```\n* b: blue color value ```[0, 255]```\n\nExample of the valid configuration file\n\n    # pendulum\n    .1 .4 .03 0 10 .04 50 50 50\n    .45 .4 0 0 10 .04 50 50 50\n    .5501 .4 0 0 10 .04 50 50 50\n    .6502 .4 0 0 10 .04 50 50 50\n\nYou can find a few ready to use configuration files in the configs directory:\n\n    % ./simulation 600 600 configs/\u003csomething\u003e\n\nControls\n--------\n\n* Space: pause/resume\n* Up: increase speed\n* Down decrease speed\n\nSome examples\n=============\n\nBrownian motion:\n-----------------\n\n    % ./simulation 600 600 configs/brownian\n\n![Sample](https://raw.github.com/dkruchinin/particles/master/misc/brownian.png)\n\n1000 colliding particles:\n-------------------------\n\n    % ./simulation 600 600 configs/1000p\n\n![Sample2](https://raw.github.com/dkruchinin/particles/master/misc/1000p.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkruchinin%2Fparticles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkruchinin%2Fparticles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkruchinin%2Fparticles/lists"}