Skip to main content

Python bindings for SlamDunk

Project description


SlamDunk is a powerful and user-friendly Python library for making 3D and 2D visualizations for prototyping, data exploration, and algorithm development.

It is lightweight, built using OpenGL and ImGui.

Examples

Hello world

Here is a simple "hello world" program for a SlamDunk visualization.

import slamd

if __name__ == "__main__":
    vis = slamd.Visualizer("Hello world")

    scene = vis.scene("scene")

    scene.set_object("/origin", slamd.geom.Triad())

    vis.hang_forever()

Running this program results in the following interactive visualization:

This example highlights the main components of SlamDunk.

The Visualizer object maintains the state of the visualization, and starts a TCP server that the visualization window connects to.

By default, it spawns a window process that reads from it and displays the visualizations. You can opt out of this with the spawn argument, and control the port with the port argument. In this case, you can start a window with the slamd-window executable:

slamd-window --port [port] --ip [ip]

This client-server architecture allows launching a visualizer a remote server, and connecting to it on your local machine.

A Scene object represents and contains a tree of 3D objects, accessed by paths like /comp1/comp2/comp3. 3D poses and Geometry objects can be assigned with the set_transform and set_object methods.

Geometry objects represent the objects that are displayed in the scene.

Multiple scenes

SlamDunk uses ImGui to allow multiple sub-windows with floating and docking support inside the SlamDunk viewer. The following example illustrates creating two windows, each showing its own scene.

import slamd
import numpy as np

if __name__ == "__main__":
    vis = slamd.Visualizer("two windows")

    scene1 = vis.scene("scene 1")
    scene2 = vis.scene("scene 2")

    scene1.set_object("/box", slamd.geom.Box())

    scene2.set_object("/origin", slamd.geom.Triad())

    scene2.set_object("/ball", slamd.geom.Sphere(2.0))

    sphere_transform = np.identity(4, dtype=np.float32)
    sphere_transform[:, 3] = np.array([5.0, 1.0, 2.0, 1.0])

    scene2.set_transform("/ball", sphere_transform)

    vis.hang_forever()

The resulting window looks like this:

The windows are fully controllable - you can drag them around, make tabs, use them in floating mode, or dock them to the sides like you see in the screenshot. All of this is supported by ImGui.

Here is a slightly more elaborate example of something you can do with SlamDunk:

Or this one:

Supported geometry primitives

3D

  • Camera Frustums (with optional image) (slamd.geom.CameraFrustum)
  • Arrows/Vectors (slamd.geom.Arrows)
  • Arbitrary meshes (slamd.geom.Mesh)
  • Planes (slamd.geom.Plane)
  • Point Clouds (slamd.geom.PointCloud)
  • Piecewise linear curves (slamd.geom.PolyLine)
  • Spheres (slamd.geom.Sphere)
  • Triads/reference frames (slamd.geom.Triad)

2D

  • Images (slamd.geom2d.Image)
  • Points (slamd.geom2d.Points)
  • Piecewise linear curves (slamd.geom2d.PolyLine)
  • Circles (slamd.geom2d.Circles)

Further reading

The examples in python_examples showcase some more features of SlamDunk. Some examples are canvases for 2D visualizations and lots of additional geometry primitives such as point clouds, meshes, camera frustums, etc.

Installation

Wheels are available on PyPi, so you can simply

pip install slamd

Contributions

All contributions and feedback are welcome and appreciated!

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

slamd-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

slamd-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

slamd-2.2.0-cp314-cp314-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

slamd-2.2.0-cp314-cp314-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

slamd-2.2.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

slamd-2.2.0-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

slamd-2.2.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

slamd-2.2.0-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

slamd-2.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

slamd-2.2.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file slamd-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa8a5a2348dbfff377cb4a7544970aace01161527243a5213d9f1436faf13a9e
MD5 e5341e9340beb5ec0866a736f3f0a572
BLAKE2b-256 7ac9f10b00d04cc91db3f6f5d88bd0daea6704858e19988089f9edb819374ea4

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a499476f124c0be29cf2fbfa2ec9c312f2dcc0f5cba82ab07e96c38beedf32e
MD5 032254a546b65192344d2e4bade9d062
BLAKE2b-256 935c218a7eaa82fa05b08b83b958b7659cf8216ef34749b4fb2ad80a3d71b8af

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4ca4a6bd5dc081725dfe542209bbc902a873be3933ae16d82316a00af3649f27
MD5 2672cf9eec2c06c928c8a3889a219cef
BLAKE2b-256 7f741a7b07029e53609b5d66726f643354e105c26a69fb8b5a4ed35064ca09d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8cc4d8328c304cfc1d54471dd4e46999d4f5c86457a039dea454f599078e32c
MD5 e22580cb9acf564ff762fcedd36cc5bd
BLAKE2b-256 77476c9684dbbd55b1a55b58714a7f44c9cb61850ad75e18fb1df25975d0bd05

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2bf91143fa3fd1c85908cb13bb66434945392b5dbd963a07cff685d5f5b870da
MD5 06d45707474adefe17ad9aa3f0337447
BLAKE2b-256 5460938c8a1e5bdf9dac81aae6f09c75824ca65620017a094fb02e84c4782290

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e3fb0e3eb9371fcbd75ad9b19f2492d45dc79cb5d757f3675a4faa4866ed3b9
MD5 cbb25847aebe04604633d4e4c9c694d2
BLAKE2b-256 43ff9cf1c92db7e84ebcb1d5f9319d7a1add4559f700ec1cfd499fcd2ec299d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 333308b1fc16f5afba599abec83092263cdb19d6d06b79b08bf2979f382d418a
MD5 3e8108988e05a7ab527ca28efcfee085
BLAKE2b-256 92c5a593ef17438fa281a28be90b56415d343e480ef142e843bb1c7529ac874f

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 193ca877466c6254a0d6b0ed5100db0afb11480acff06748560f4c074e8d2ada
MD5 87cd67fca286a9681471850070535197
BLAKE2b-256 ea2d80a972831706a1222b0681f4aaffc543ae2daab21551b209e26f65425f9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd34566124fe55bfe5e5257c4f0c241ffca862bfa37518a25924ae7660cec169
MD5 3facdfcd5e0fe2520830d64fb9707a21
BLAKE2b-256 8252a154d6fe48147127c5b99594f60e806f9bd51b18f3986e0234c941e08578

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slamd-2.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0e5110bf73885242077a7940c706bd0419ba4985887090634ae9f520f698e1d
MD5 4594c5d8bfa8241ca6bc44602c931197
BLAKE2b-256 92fa3219ab7fefeba3021bec47b9ff0c5a03c477857b8212b4a1fea25af1ac43

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: pip_publish.yml on Robertleoj/slam_dunk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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