{"id":20640092,"url":"https://github.com/linusvanelswijk/unity-int-vectors","last_synced_at":"2025-04-15T22:57:05.711Z","repository":{"id":146905395,"uuid":"56437778","full_name":"LinusVanElswijk/Unity-Int-Vectors","owner":"LinusVanElswijk","description":"Library that adds Vector2i and Vector3i classes, which are integer counterparts to Vector2 and Vector3.","archived":false,"fork":false,"pushed_at":"2017-06-30T08:53:55.000Z","size":9,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-15T22:56:56.903Z","etag":null,"topics":["geometry","integer","integer-vector","unity","vector"],"latest_commit_sha":null,"homepage":"","language":"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/LinusVanElswijk.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-17T13:27:02.000Z","updated_at":"2025-01-31T18:05:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"6aa7b2e9-e9c5-4288-953a-9e91c291ec71","html_url":"https://github.com/LinusVanElswijk/Unity-Int-Vectors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusVanElswijk%2FUnity-Int-Vectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusVanElswijk%2FUnity-Int-Vectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusVanElswijk%2FUnity-Int-Vectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusVanElswijk%2FUnity-Int-Vectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusVanElswijk","download_url":"https://codeload.github.com/LinusVanElswijk/Unity-Int-Vectors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249167439,"owners_count":21223505,"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":["geometry","integer","integer-vector","unity","vector"],"created_at":"2024-11-16T15:27:54.544Z","updated_at":"2025-04-15T22:57:05.704Z","avatar_url":"https://github.com/LinusVanElswijk.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unity Int Vectors\nThis library provides integer vectors, Vector2i and Vector3i.\nThese are integer variants of Unity's Vector2 and Vector3 classes and implement all functionality that you would expect.\n \n### A familiar interface\nVector2i and Vector3i use the same interface as Vector2 and Vector3.\nPractically every function that is defined for Vector2/Vector3 is also defined for Vector2i/Vector3i.\n    \n### Usefull predifined values\nAll the predifined values from Vector2/Vector3 are also defined for Vector2i/Vector3i:\n  \n  * zero (Vector2i and Vector3i)\n  * one (Vector2i and Vector3i)\n  * up (Vector2i and Vector3i)\n  * down (Vector2i and Vector3i)\n  * left (Vector2i and Vector3i)\n  * right (Vector2i and Vector3i)\n  * forward (only Vector3i)\n  * back (only Vector3i)\n  \n### All operators are implemented\nAll mathematical and equality operations are supported:\n```\n  var minus_two = -2 * vector3i.one;\n  var treasure_location = 5 * vector2i.right + 3 * vector2i.up;\n  var b = -vector2i.one == vector2i.one + minus_two;\n```\n  \n### Effortless integration\nNo need to rewrite all your exisiting code.\nJust call any function accepting Vector2/Vector3 and pass it a Vector2i/Vector3i!\nOf course this also works with any third party library you are using or are planning to use.\nImplicit conversion from int to float types does all the work for you.\n\nImplicit conversion only happens from int to float and not the other way around, so this won't accidentally cause rounding errors:\n```\n   public static Vector3 f(Vector3 x) { ... }\n   public static Vector3i g(Vector3i x) { ... }\n   \n   ...\n   \n   Vector3 a;\n   Vector3i b;\n   \n   ...\n   \n   Vector3  r0 = f(b);            // OK\n   Vector3i r1 = f(b);            // Compile Error - potential bug by accidentally casting float to int\n   Vector3i r2 = (Vector3i)f(r2); // OK - make it explicit if it really is what you want to do\n   Vector3  r3 = g(a);            // OK\n   Vector3i r4 = g(b);            // Compile Error - potential bug by accidentally casting float to int\n   vector3i r5 = g((Vector3i)b);  // OK -  make it explicit if it really is what you want to do\n```\n\n### RectLoops and CubeLoops\nThe library also adds new control structures, that make it easier to loop over values of vectors.\n\n```\n// Where you would normally write\nfor(int x = 0; x \u003c 10; ++x) {\n  for(int y = 2; y \u003c 12; ++y) {\n    MyFunction(new Vector(x, y));\n  }\n}\n\n// you can write\nRectLoop(\n  new Vector2i(0, 2),\n  new Vector2i(10, 12),\n  MyFunction\n);\n\n\n// Where you would normally write\nfor(int x = 0; x \u003c 10; ++x) {\n  for(int y = 2; y \u003c 12; ++y) {\n    for(int z = -4; z \u003c 8; ++z) {\n      MyFunction(new Vector(x, y, z));\n    }\n  }\n}\n\n// you can write\nCubeLoop(\n  new Vector3i(0, 2, -4), \n  new Vector3i(10, 12, 8), \n  MyFunction\n);\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusvanelswijk%2Funity-int-vectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusvanelswijk%2Funity-int-vectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusvanelswijk%2Funity-int-vectors/lists"}