{"id":15677480,"url":"https://github.com/hph/vigur","last_synced_at":"2025-05-07T00:47:12.343Z","repository":{"id":36434433,"uuid":"40739443","full_name":"hph/vigur","owner":"hph","description":"A two-dimensional vector library written in ES6.","archived":false,"fork":false,"pushed_at":"2015-08-23T22:11:02.000Z","size":188,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-23T12:05:48.443Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/hph.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-08-14T23:07:09.000Z","updated_at":"2023-03-17T11:19:20.000Z","dependencies_parsed_at":"2022-09-17T03:23:41.897Z","dependency_job_id":null,"html_url":"https://github.com/hph/vigur","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/hph%2Fvigur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hph%2Fvigur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hph%2Fvigur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hph%2Fvigur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hph","download_url":"https://codeload.github.com/hph/vigur/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242877183,"owners_count":20199975,"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":[],"created_at":"2024-10-03T16:09:40.738Z","updated_at":"2025-03-10T15:34:36.706Z","avatar_url":"https://github.com/hph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vigur [![Build Status](https://travis-ci.org/hph/vigur.svg?branch=master)](https://travis-ci.org/hph/vigur)\n\nA two-dimensional vector library written with clarity and ease of use in mind.\nLeverages on new ES6 features and syntax and has a 100% test coverage.\nVigur is Icelandic for vector.\n\n### Setup \u0026 usage\nTo use Vigur on Node.js, install it with `npm install vigur` and start playing\naround:\n\n```javascript\nlet Vector = require('vigur');\nlet myVector = new Vector(2, 3);\n```\n\nTo use Vigur on the front end via bower, install it with `bower install vigur`\nand add the script to your template:\n\n```html\n\u003cscript src=\"./bower_components/vigur/dist/vigur.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var myVector = new Vector(2, 3);\n\u003c/script\u003e\n```\n\n### Examples\n```javascript\n// Create a vector\nlet vector = new Vector(2, 3); // =\u003e Vector {x: 2, y: 3}\n\n// Some properties are available as getter methods\nvector.magnitude;  // =\u003e 3.605551275463989\nvector.normalized; // =\u003e Vector {x: 0.5547001962252291, y: 0.8320502943378437}\nvector.direction;  // =\u003e 0.982793723247329\n\n// Some methods accept both values and vectors as params; some take none\nvector                        // =\u003e Vector {x: 2, y: 3}\n  .multiply(3)                // =\u003e Vector {x: 6, y: 9}\n  .multiply(new Vector(1, 3)) // =\u003e Vector {x: 6, y: 27}\n  .rotate(Math.PI / 2)        // =\u003e Vector {x: -27, y: 6.000000000000002}\n  .rounded;                   // =\u003e Vector {x: -27, y: 6}\n\n// Operations that return vectors are chainable\nnew Vector(2, 3)               // =\u003e Vector {x: 2, y: 3}\n  .add(new Vector(2, 5))       // =\u003e Vector {x: 4, y: 8}\n  .multiply(new Vector(1, 3))  // =\u003e Vector {x: 4, y: 24}\n  .subtract(new Vector(4, 10)) // =\u003e Vector {x: 0, y: 14}\n  .invert()                    // =\u003e Vector {x: 0, y: -14}\n  .cross(new Vector(3, 7));    // =\u003e 42\n\n// Also exposes utility methods\nVector.degreesToRadians(180);\n// =\u003e 3.141592653589793\nVector.radiansToDegrees(Math.PI);\n// =\u003e 180\n```\nCheck the [source](https://github.com/hph/vigur/blob/master/src/vigur.js) for a\nfull list of available methods and documentation about them. The\n[tests](https://github.com/hph/vigur/blob/master/test/vigur.js) are also a good\nresource.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhph%2Fvigur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhph%2Fvigur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhph%2Fvigur/lists"}