{"id":13994313,"url":"https://github.com/pygae/pyganja","last_synced_at":"2025-07-22T19:31:48.471Z","repository":{"id":49868738,"uuid":"158707611","full_name":"pygae/pyganja","owner":"pygae","description":"Visualisation library for geometric algebra with cefpython and ganja.js","archived":false,"fork":false,"pushed_at":"2021-06-09T13:44:21.000Z","size":272,"stargazers_count":48,"open_issues_count":10,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-10T14:15:39.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/pygae.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":"2018-11-22T14:01:35.000Z","updated_at":"2024-03-07T04:39:06.000Z","dependencies_parsed_at":"2022-09-09T16:41:16.343Z","dependency_job_id":null,"html_url":"https://github.com/pygae/pyganja","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pygae%2Fpyganja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pygae%2Fpyganja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pygae%2Fpyganja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pygae%2Fpyganja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pygae","download_url":"https://codeload.github.com/pygae/pyganja/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227166669,"owners_count":17740959,"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-08-09T14:02:48.975Z","updated_at":"2024-11-29T16:31:09.215Z","avatar_url":"https://github.com/pygae.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# pyganja\n[![PyPI](https://badgen.net/pypi/v/pyganja)](https://pypi.org/project/pyganja/)\n\nVisualisation library for geometric algebra with cefpython and ganja.js\n\nThis is a module for visualing Geometric Algebra from scripts and also from jupyter notebooks, \nit relies on [ganja.js](https://github.com/enkimute/ganja.js) to render Geometric Algebra objects. \nIf you are calling its api from a script it will render them in a cefpython window or if you are in a notebook it can simply render in the notebook itself.\n\n# Use\nThis library is not specifically tied to the [clifford](https://github.com/pygae/clifford) library \nbut is designed to work well with it. An example of the syntax that you would use combining these two libraries:\n\n```\nfrom clifford.tools.g3c import random_line\nfrom pyganja import *\n\ndraw([random_line() for i in range(10)])\n```\nProduces:\n![Random lines](./random_lines.png?raw=true)\n\n\nMulitple grades of object can be drawn in the same scene with different colors and transparencies\n```\nfrom clifford.g3c import *\nfrom clifford.tools.g3c import *\nfrom pyganja import *\n\nP1 = up(random_euc_mv()*0.1)\nP2 = up(random_euc_mv()*0.1)\nP3 = up(random_euc_mv()*0.1)\nP4 = up(random_euc_mv()*0.1)\n\n# The sphere is the outer product of all 4\nS = (P1^P2^P3^P4).normal()\n\n# A line is the outer product of 2 with ninf\nL = P1^P2^einf\n\n# The inversion of a line in a sphere is a circle\nC = S*L*S\n\n# The tangent to the circle at the intersection point is the reflected line\nLdash = (P1|C)^einf\n\n# The tangent plane to the sphere at the intersection point can be easily found\nPpi = (P1|S)^einf\n\nsc = GanjaScene()\nsc.add_objects([P1,P2,P3,P4], color=Color.BLACK)\nsc.add_objects([L], color=Color.BLUE)\nsc.add_objects([Ldash], color=Color.RED)\nsc.add_objects([C], color=Color.RED)\nsc.add_objects([S*einf*S], color=Color.BLACK)\nsc.add_objects([S])\nsc.add_objects([Ppi], color=rgb2hex((0,100,0))+int('70000000',16))\ndraw(sc,scale=0.5)\n```\nProduces:\n![Sphere reflection](./line_sphere_reflect.png?raw=true)\n\n# Installation\n```\ngit clone git@github.com:hugohadfield/pyganja.git\ncd pyganja\npython3 setup.py install\n```\n\n# TODO\nThis is still very much a work in progress, currently it only handles PGA and CGA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpygae%2Fpyganja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpygae%2Fpyganja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpygae%2Fpyganja/lists"}