VecGL is a 3D rendering engine with vector output
Project description
VecGL
VecGL is 3D rendering engine with vector output. It is inspired by OpenGL with the key difference that the rendering result is a set of points, lines, and triangles -- not a pixelated image. These geometric primitives can be used to generate vector graphics or to drive pen plotters.
Getting started
The VecGL package is available through pip.
$ python3 -m pip install vecgl
Let's create and render a simple model. Here's the complete example for a cube.
import math
import vecgl.linalg as vgll
import vecgl.model as vglm
import vecgl.rendering as vglr
# Get a predefined cube model and choose nice colors.
# The cube will span from -1.0 to 1.0 in all dimensions.
cube = vglm.get_cube_model("lightblue", "black")
# Define the view and the projection matrices.
view_mat4 = vgll.mul_mat4(
vgll.get_translate_mat4(0.0, 0.0, -3.0),
vgll.get_rotate_x_mat4(-0.2*math.pi),
vgll.get_rotate_y_mat4(0.15*math.pi))
projection_mat4 = vgll.get_frustum_mat4(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0)
# Transform our cube model and bring it to the clip space.
transform_mat4 = vgll.mul_mat4(projection_mat4, view_mat4)
cube.transform(transform_mat4)
# Render and display the model.
rendered = vglr.render(cube)
vglr.show(rendered)
# You can access the vector-based rendering result through the rendered model.
for ln in rendered.lines:
print(ln)
VecGL will render and display the cude and print the vector-based rendering result to stdout.
Build and run tests
Clone the repository.
$ git clone https://github.com/frgossen/vecgl
$ cd vecgl
Create a virtual environment and activate it (recommended).
$ python3 -m venv .venv
$ source .venv/bin/activate
Install all requirements in the virtual environment.
$ python3 -m pip install -r requirements.txt
Intsall the vecgl package in editable mode.
This makes the package (and your changes) available when running the tests.
$ python3 -m pip install --editable .
You're all set for contributing back to the project. Run the tests with ...
$ python3 -m pytest --benchmark-skip
... and the benchmarks with ...
$ python3 -m pytest --benchmark-only
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vecgl-0.0.2.tar.gz.
File metadata
- Download URL: vecgl-0.0.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54d790fbead8638e8ac5541780e6a2b4fe85976cedf01b1fc7bb19028e7bb402
|
|
| MD5 |
25055c31025a2613b03d86a8c2a568c4
|
|
| BLAKE2b-256 |
b05e1d0a6ca78880e68f5e282e38abe17770f09ef50e5da4172afe8345c396f4
|
File details
Details for the file vecgl-0.0.2-py3-none-any.whl.
File metadata
- Download URL: vecgl-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
157efc49d22b2eb0ee964f83eac105acb22f47494505ed3f2fea2d308122a664
|
|
| MD5 |
34d2dfc68d7ab5d6cbded698826a3842
|
|
| BLAKE2b-256 |
22d1d33d896b5e2971f4e5d42e8a60f601890f1183de57f183509ef84705bca3
|