A custom-developed image renderer for generating Shepard & Metzler 3D shapes.
Project description
Shepard and Metzler 3D Shape Renderer
The Shepard and Metzler 3D Shape Renderer is a custom-developed image rendering tool for generating perspective pictures of three-dimensional abstract objects from the study on mental rotation done by Shepard R.N. & Metzler J.(1971).
Installation
You can install the Shepard and Metzler 3D Shape Renderer from PyPI:
$ python -m pip install shepard-metzler-shape-renderer
The package is supported on Python 3.12 and above.
How to use
The Shepard and Metzler 3D Shape Renderer is flexible in use. The first thing to be done is to configure the renderer. An example of acceptable configuration format is provided in config.yaml.
camera:
distance: 25.
elevation: -35.
rotation: 20.
renderer:
image_size: 256
background: white
dpi: 100
format: png
object:
facecolor: white
edgecolor: black
edgewidth: 0.8
The following code snippet contains the necessary steps for rendering an image of 3D shape in perspective and saving it in a file.
from shaperenderer.geometry import (
ShapeGenerator,
MetzlerShape
)
from shaperenderer.renderer import (
Camera,
Renderer,
Object3D
)
generator = ShapeGenerator(random_state=12345)
shape = MetzlerShape(generator.generate())
object_params = {
"facecolor": facecolor,
"edgecolor": edgecolor,
"edgewidth": edgewidth
}
object3d = Object3D(
shape=shape,
**object_params
)
camera = Camera()
camera.setSphericalPosition(
r=camera_distance,
theta=camera_elevation,
phi=camera_rotation
)
renderer = Renderer(
imgsize=(width, height),
dpi=dpi,
bgcolor=background,
format=saveformat
)
renderer.render(object3d, camera)
renderer.save_figure_to_file(filename)
Project details
Release history Release notifications | RSS feed
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 shepard_metzler_shape_renderer-2.0.0.tar.gz.
File metadata
- Download URL: shepard_metzler_shape_renderer-2.0.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3946ec762d2df35018a12d07838659ccd736b70cc02afc2a8bdbca50353d74
|
|
| MD5 |
168e647f05eab07c7b4e33b5d857ad92
|
|
| BLAKE2b-256 |
674d372dee2c99d6914c25db82cb4afaf834441df55d0e4dbe477edfaeb0c7f6
|
File details
Details for the file shepard_metzler_shape_renderer-2.0.0-py3-none-any.whl.
File metadata
- Download URL: shepard_metzler_shape_renderer-2.0.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c301f635c0567aa52d6f86ca6586a241e52d9917a51aec3594d85f1a839682f
|
|
| MD5 |
32ac4e9c026804fbdcb5f899770ef39e
|
|
| BLAKE2b-256 |
dce7084c6332065717eb61434af7c0765af0c74a319ac4efb31fd991ceca2fa4
|