Skip to main content

pyganja

PyPI

Visualisation library for geometric algebra with cefpython and ganja.js

This is a module for visualing Geometric Algebra from scripts and also from jupyter notebooks, it relies on ganja.js to render Geometric Algebra objects. If 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.

Use

This library is not specifically tied to the clifford library but is designed to work well with it. An example of the syntax that you would use combining these two libraries:

from clifford.tools.g3c import random_line
from pyganja import *

draw([random_line() for i in range(10)])

Produces: Random lines

Mulitple grades of object can be drawn in the same scene with different colors and transparencies

from clifford.g3c import *
from clifford.tools.g3c import *
from pyganja import *

P1 = up(random_euc_mv()*0.1)
P2 = up(random_euc_mv()*0.1)
P3 = up(random_euc_mv()*0.1)
P4 = up(random_euc_mv()*0.1)

# The sphere is the outer product of all 4
S = (P1^P2^P3^P4).normal()

# A line is the outer product of 2 with ninf
L = P1^P2^einf

# The inversion of a line in a sphere is a circle
C = S*L*S

# The tangent to the circle at the intersection point is the reflected line
Ldash = (P1|C)^einf

# The tangent plane to the sphere at the intersection point can be easily found
Ppi = (P1|S)^einf

sc = GanjaScene()
sc.add_objects([P1,P2,P3,P4], color=Color.BLACK)
sc.add_objects([L], color=Color.BLUE)
sc.add_objects([Ldash], color=Color.RED)
sc.add_objects([C], color=Color.RED)
sc.add_objects([S*einf*S], color=Color.BLACK)
sc.add_objects([S])
sc.add_objects([Ppi], color=rgb2hex((0,100,0))+int('70000000',16))
draw(sc,scale=0.5)

Produces: Sphere reflection

Installation

git clone git@github.com:hugohadfield/pyganja.git
cd pyganja
python3 setup.py install

TODO

This is still very much a work in progress, currently it only handles PGA and CGA

Metadata

Release files for pyganja 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyganja 0.0.15
File Size Uploaded
pyganja-0.0.15.tar.gz 45.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyganja 0.0.15
File Interpreter ABI Platform
pyganja-0.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 90.0 kB

Release files / pyganja-0.0.15.tar.gz

Download URL pyganja-0.0.15.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
884143a1954e385d5e2c5d8621aae59cbf4f4fc049408e9c902f5470729e6ab2
BLAKE2b-256 checksum
How to use checksums
78b48afdc1ecf16735f9f381620a7e4944fa5bcf63c6eecca317c9e95dcc4b5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / pyganja-0.0.15-py3-none-any.whl

Download URL pyganja-0.0.15-py3-none-any.whl
Size 45.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d18b19372a3fc7f6f19fbc6d52a545fa039f1220f12405c81dac6b3ed076cb3
BLAKE2b-256 checksum
How to use checksums
03e9f522fbfcc8f813c084868c848909ad7bd51276105862c5378db35d505613
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.15 This release

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page