{"id":23512678,"url":"https://github.com/creoone/v","last_synced_at":"2025-07-03T19:07:27.762Z","repository":{"id":29340304,"uuid":"104572862","full_name":"CreoOne/V","owner":"CreoOne","description":"Vector library designed for work with changing dimensionality.","archived":false,"fork":false,"pushed_at":"2023-01-17T11:28:31.000Z","size":142,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T16:36:19.481Z","etag":null,"topics":["csharp","simple","vector","vector-library"],"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/CreoOne.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-09-23T14:18:05.000Z","updated_at":"2023-02-27T10:10:35.000Z","dependencies_parsed_at":"2023-02-10T09:15:34.813Z","dependency_job_id":null,"html_url":"https://github.com/CreoOne/V","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CreoOne/V","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreoOne%2FV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreoOne%2FV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreoOne%2FV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreoOne%2FV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CreoOne","download_url":"https://codeload.github.com/CreoOne/V/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreoOne%2FV/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263385737,"owners_count":23458744,"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":["csharp","simple","vector","vector-library"],"created_at":"2024-12-25T13:19:03.299Z","updated_at":"2025-07-03T19:07:27.728Z","avatar_url":"https://github.com/CreoOne.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# V \nYet another, reinvented, multidimensional Vector library designed for work with changing dimensionality.\n\n### Requirements\n* Microsoft .NET Standard 2.1\n* Microsoft .NET 6.0\n\n### Projects\n* V - Main functionality\n* V.Samples - Usage samples\n* V.UnitTests - Unit tests\n* V.Benchmarks - Benchmarks\n\n### Setup\n* Download repository\n* Open V.sln in Visual Studio (i'm using 2019 Community)\n* Build project V (check project properties for output path, most likely ./bin/Debug/)\n* V.dll is now ready to be added as reference in your projects\n\n### Future / TODO\n* Function RotateAroundAxis should work in all dimensions (currently only in 3)\n\n---\n\n### Samples\nHere are some usage examples that might be helpful. Code used for samples and images is available in V.Samples project.\n\n#### Vector arithmetic operators\n\n##### Addition\n```csharp\nVector add1 = new Vector(1, 2) + new Vector(2, 1);\n// add1 is now [3, 3]\n\nVector add2 = new Vector(1, 2) + 2;\n// add2 is now [3, 4]\n\nVector add3 = 2 + new Vector(2, 1);\n// add3 is now [4, 3]\n```\n\nVisualization of two 3 dimensional vectors (in green) resulting in third vector as a sum (in blue)\n![sum_chart](./V.Samples/img/sum.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n\n##### Subtraction\n```csharp\nVector sub1 = new Vector(1, 2) - new Vector(2, 1);\n// sub1 is now [1, 1]\n\nVector sub2 = new Vector(1, 2) - 2;\n// sub2 is now [-1, 0]\n\nVector sub3 = 2 - new Vector(2, 1);\n// sub3 is now [0, 1]\n```\n\nVisualization of two 3 dimensional vectors (in green) resulting in third vector as a diffrence (in blue)\n![sub_chart](./V.Samples/img/sub.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n\n##### Multiplication\n```csharp\nVector mul1 = new Vector(1, 2) * new Vector(2, 1);\n// mul1 is now [2, 2]\n\nVector mul2 = new Vector(1, 2) * 2;\n// mul2 is now [2, 4]\n\nVector mul3 = 2 * new Vector(2, 1);\n// mul3 is now [4, 2]\n```\n\n##### Division\n```csharp\nVector div1 = new Vector(1, 2) / new Vector(2, 1);\n// div1 is now [0.5, 2]\n\nVector div2 = new Vector(1, 2) / 2;\n// div2 is now [0.5, 1]\n\nVector div3 = 2 / new Vector(2, 1);\n// div 3 is now [1, 2]\n```\n\n##### Inversion\n```csharp\nVector inv = -new Vector(1, -2, 3);\n// inv is now [-1, 2, -3]\n```\n\n#### Functions\n\n##### Min / Max\nProduces vector with minimal/maximal values in every dimension.\n```csharp\nVector min1 = Vector.Min(new Vector(-1, 1, -1), new Vector(1, -1, 1));\n// min1 is now [-1, -1, -1]\n\nVector min2 = Vector.Min(new Vector(1, 2, 3), new Vector(1, -1, 1), new Vector(5, 1, -1));\n// min2 is now [1, -1, -1]\n\nVector max = Vector.Max(new Vector(-1, 1, -1), new Vector(1, -1, 1));\n// max is now [1, 1, 1]\n```\n\n##### Normalize\nProduces unit vector.\n```csharp\nVector nor = Vector.Normalize(new Vector(12, 0, 0));\n// nor is now [1, 0, 0]\n```\n\n##### Dot\nProduces dot product of two vectors.\n```csharp\ndouble dot = Vector.Dot(new Vector(1, 0), new Vector(0.5, 0.5));\n// dot is now 0.5\n```\n\n##### AngleDifference\nProduces angle difference between two vectors (in radians).\n```csharp\ndouble diff = Vector.AngleDifference(new Vector(0, 1), Vector.Create(2, 0), new Vector(1, 0));\n// diff is now half PI\n```\n\n##### RotateAroundAxis\nRotates vector around specified axis by angle (in radians).\n```csharp\nVector raa = Vector.RotateAroundAxis(new Vector(1, 0, 0), new Vector(0, 1, 0), Math.PI / 2d);\n// raa is now [0, 0, 1]\n```\n\nVisualization of 3 dimensional vector (in green) being rotated 180° around axis (in red) resulting in third vector (in blue)\n![raa_chart](./V.Samples/img/raa.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n\n##### CloseEnough\nChecks proximity of two vectors with specified tolerance.\n```csharp\nbool closeEnough = Vector.CloseEnough(new Vector(0, 1, -0.1), new Vector(0, 1, 0.1), 0.5);\n// closeEnough is True\n\nbool notCloseEnough = Vector.CloseEnough(new Vector(0, 1, -0.1), new Vector(0, 1, 0.1), 0.01);\n// notCloseEnough is False\n```\n\n##### Lerp\nProduces interpolation of two vectors.\n```csharp\nVector inter = Vector.Lerp(new Vector(-0.8, 0.3, -0.5), new Vector(0.4, 0.5, 0.3), 0.5);\n// inter is now [-0.2, 0.4, -0.1]\n```\n\nVisualization of two 3 dimensional vectors (in green) resulting in third vector (in blue)\n![lerpIn_chart](./V.Samples/img/lerpIn.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n\nLerp can also be used for extrapolation.\n```csharp\nVector extra = Vector.Lerp(new Vector(-0.8, 0.3, -0.5), new Vector(0.4, 0.5, 0.3), 1.2);\n// extra is now [0.64, 0.54, 0.46]\n```\n\nVisualization of two 3 dimensional vectors (in green) resulting in third vector (in blue)\n![lerpEx_chart](./V.Samples/img/lerpEx.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n\n##### Cross\nProduces vector that is perpendicular to all provided vectors.\n\nThere is specific amount of vectors that is required for this function to work.\n```csharp\nVector cross2d = Vector.Cross(new Vector(1, 0));\n// cross2d is now [0, -1]\n\nVector cross3d = Vector.Cross(new Vector(1, 0, 0), new Vector(0, 1, 0));\n// cross3d is now [0, 0, 1]\n\nVector cross4d = Vector.Cross(new Vector(1, 0, 0, 0), new Vector(0, 1, 0, 0), new Vector(0, 0, 1, 0));\n// cross4d is now [0, 0, 0, -1]\n```\n\nVisualization of two 3 dimensional vectors (in green) resulting in third vector as a cross product (in blue)\n![cross_chart](./V.Samples/img/cross.png \"3 dimensional isometric chart with 3 vectors represented as a lines\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreoone%2Fv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreoone%2Fv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreoone%2Fv/lists"}