{"id":26933574,"url":"https://github.com/gregoor/wacktor","last_synced_at":"2025-04-02T09:20:02.849Z","repository":{"id":32209659,"uuid":"35783456","full_name":"Gregoor/Wacktor","owner":"Gregoor","description":"Immutable 2D Vectors","archived":false,"fork":false,"pushed_at":"2016-11-02T00:37:07.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T13:17:54.617Z","etag":null,"topics":["immutable","js","vector","vector2d"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gregoor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-17T21:20:45.000Z","updated_at":"2016-11-02T00:37:08.000Z","dependencies_parsed_at":"2022-09-13T10:22:16.775Z","dependency_job_id":null,"html_url":"https://github.com/Gregoor/Wacktor","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2FWacktor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2FWacktor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2FWacktor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregoor%2FWacktor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gregoor","download_url":"https://codeload.github.com/Gregoor/Wacktor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246785455,"owners_count":20833498,"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":["immutable","js","vector","vector2d"],"created_at":"2025-04-02T09:20:02.232Z","updated_at":"2025-04-02T09:20:02.830Z","avatar_url":"https://github.com/Gregoor.png","language":"JavaScript","readme":"# Wacktor\n\nSolves the main pain points I have with the other vector libraries:\n\n- vectors are not being mutated =\u003e every method returns a new vector\n- methods accept vectors, objects, arrays and single numbers\n\n```javascript\nvar Vector = require('Wacktor');\n\nvar v1 = new Vector(2, 3);\nvar v2 = new Vector([4, 2]);\nvar v2 = new Vector({x: 13, y: 37);\n```\n\n\n## Methods\n\n### Iterable\n\n```javascript\nvar v1 = new Vector(2, 3);\nconsole.log(...v1); // 2, 3\nvar [x, y] = v1;\nconsole.log(x);     // 2\n```\n\n### add, sub, mul\n\nThe method signature is the same for each of these.\n\n#### (Number n)\nn will be applied to x \u0026 y\n\n#### (Number nx, Number ny) OR ([Number nx, Number ny])\nnx will be applied to x, ny to y\n\n#### (Vector/Object v)\nx of v will be applied to x, y of v to y\n\n\n```javascript\nv1.add(2);      // (4, 5)\nv1.add(2, 0);   // (4, 3)\n\nv1.mul([2, 5]); // (4, 15)\n```\n\n### magSq, mag\nReturns the (squared) magnitude.\n\n```javascript\nnew Vector(4, 3).mag(); // 5\n```\n\n### neg\n```javascript\nnew Vector(12, 34).neg(); // (-12, -34)\n```\n\n### equals\nCompares the vector with another vector, numbers, array or object.\n\n### dist\nDistance to another vector, numbers, array or object\n\n### dot\n\n### angle\n\n### max\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoor%2Fwacktor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregoor%2Fwacktor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoor%2Fwacktor/lists"}