Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shepard_metzler_shape_renderer-2.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shepard_metzler_shape_renderer-2.0.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file shepard_metzler_shape_renderer-2.0.0.tar.gz.

File metadata

File hashes

Hashes for shepard_metzler_shape_renderer-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8d3946ec762d2df35018a12d07838659ccd736b70cc02afc2a8bdbca50353d74
MD5 168e647f05eab07c7b4e33b5d857ad92
BLAKE2b-256 674d372dee2c99d6914c25db82cb4afaf834441df55d0e4dbe477edfaeb0c7f6

See more details on using hashes here.

File details

Details for the file shepard_metzler_shape_renderer-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for shepard_metzler_shape_renderer-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c301f635c0567aa52d6f86ca6586a241e52d9917a51aec3594d85f1a839682f
MD5 32ac4e9c026804fbdcb5f899770ef39e
BLAKE2b-256 dce7084c6332065717eb61434af7c0765af0c74a319ac4efb31fd991ceca2fa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page