{"id":20648680,"url":"https://github.com/megospc/vecpp","last_synced_at":"2025-03-09T19:13:51.879Z","repository":{"id":235854357,"uuid":"790411872","full_name":"Megospc/vecpp","owner":"Megospc","description":"Vector types in C++","archived":false,"fork":false,"pushed_at":"2024-04-24T17:51:28.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T10:09:56.988Z","etag":null,"topics":["cpp","cpp-vectors","mit-license","vector","vector-math","vectors"],"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/Megospc.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}},"created_at":"2024-04-22T20:41:05.000Z","updated_at":"2024-04-24T17:51:32.000Z","dependencies_parsed_at":"2024-04-24T19:12:05.416Z","dependency_job_id":"d1973881-d2cd-4322-82da-587d198d2ab7","html_url":"https://github.com/Megospc/vecpp","commit_stats":null,"previous_names":["megospc/vecpp"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Megospc%2Fvecpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Megospc%2Fvecpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Megospc%2Fvecpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Megospc%2Fvecpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Megospc","download_url":"https://codeload.github.com/Megospc/vecpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242737017,"owners_count":20177092,"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":["cpp","cpp-vectors","mit-license","vector","vector-math","vectors"],"created_at":"2024-11-16T17:09:56.801Z","updated_at":"2025-03-09T19:13:51.853Z","avatar_url":"https://github.com/Megospc.png","language":"C++","readme":"# vecpp\nVector types in C++.\n\nVersion: 1.7.3 (24.04.2024)\n\n## Example\n```C++\n#include \u003ciostream\u003e\n\n#include \"vecpp.h\"\n\nusing namespace vecpp;\n\nint main() {\n    vec2 myVec2 = vec2(1.0, 0.1); // Create a 2-bases-vector\n    \n    vec4 myVec4 = vec4(myVec2, 0.0, 0.8); // Use vector to create a new one\n    \n    float length = myVec4.length(); // Get length of vector\n    \n    std::cout \u003c\u003c \"myVec4's length: \" \u003c\u003c length \u003c\u003c std::endl;\n    \n    myVec4 += 0.5; // Add 0.5 to any myVec4 bases\n    myVec4 *= vec4(1.0, 0.01, 1.0, 0.5); // Multiply vectors\n    \n    std::cout \u003c\u003c \"myVec4: \";\n    std::cout \u003c\u003c \"x=\" \u003c\u003c myVec4.x \u003c\u003c \", \"; // Get X basis\n    std::cout \u003c\u003c \"y=\" \u003c\u003c myVec4.y \u003c\u003c \", \";\n    std::cout \u003c\u003c \"z=\" \u003c\u003c myVec4[2] \u003c\u003c \", \"; // Or like this\n    std::cout \u003c\u003c \"w=\" \u003c\u003c myVec4.w \u003c\u003c std::endl;\n\n    myVec4.x = 0.01; // Set X basis\n\n    vec3 child = myVec4.ywz(); // Get child vector\n    // child.x = myVec4.y\n    // child.y = myVec4.w\n    // child.z = myVec4.z\n\n    // You can also use another combinations of child bases, such as zxw, yx, wzxy etc.\n\n    vec2 value = vec2(0.3, -1.0);\n\n    myVec4.xw(value); // Set child vector\n    // myVec4.x = value.x\n    // myVec4.w = value.y\n\n    myVec4.w *= -1.0; // Multiply X basis\n    \n    vec4 normalized1 = myVec4.normalize(); // Get normalized vector\n    vec4 normalized2 = ~myVec4; // The same\n\n    if (all(myVec4 \u003e 0.0)) std::cout \u003c\u003c \"All myVec4 bases are greater than 0.0\" \u003c\u003c std::endl;\n    if (!any(myVec2 \u003c 0.0)) std::cout \u003c\u003c \"myVec2 has no basis less than 0.0\" \u003c\u003c std::endl;\n    \n    // And double precision...\n    dvec3 myDoubleVec = dvec3(0.1, 23.0, 4.0);\n    \n    return 0;\n}\n```\n\n## Installing\n1. Download `vecpp.h` file.\n2. Put it into your project folder.\n3. Include it:\n```C++\n#include \"vecpp.h\"\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegospc%2Fvecpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegospc%2Fvecpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegospc%2Fvecpp/lists"}