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.1.13-cp314-cp314t-manylinux_2_28_x86_64.whl (67.9 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

slamd-2.1.13-cp314-cp314t-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

slamd-2.1.13-cp314-cp314-manylinux_2_28_x86_64.whl (67.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

slamd-2.1.13-cp314-cp314-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

slamd-2.1.13-cp313-cp313-manylinux_2_28_x86_64.whl (67.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

slamd-2.1.13-cp313-cp313-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

slamd-2.1.13-cp312-cp312-manylinux_2_28_x86_64.whl (67.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

slamd-2.1.13-cp312-cp312-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

slamd-2.1.13-cp311-cp311-manylinux_2_28_x86_64.whl (67.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

slamd-2.1.13-cp311-cp311-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for slamd-2.1.13-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b73ef1bfcbb76b82fc7aa7d5b61cc52c76af74a21bcc223ceaaf029c91861e8d
MD5 b9f66dcc503021a489a50cb9e8071828
BLAKE2b-256 7ebe3cf548b8bf621404cd6a865fe96cacf2afb82a98621f1ab32e2b8bac80ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4d465ef40a9477e3906f23381ed5bbafa42f0059836613dc35ccc4b72e2eab6
MD5 5a01438c8a552b63d5ccf7204e607bc8
BLAKE2b-256 96143f7cb08f708d0314c31139f376bf9c7c60d54b69ae9d1ad7759d4bc8a3d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e17f6feeb3a5b4d989c3ea153c803960a59347698bd51c583497346c6905447
MD5 aac96f74aeb635fe2af6ac6274eec7b1
BLAKE2b-256 7478794979ea11705615af1b513778e6f87f8f1b061e42574bc5a492b80dc5fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 055f03cf231918f35711dcb6966a9f4ec5a6baf2a5a2bbf35650ff02d28903e0
MD5 4fc00922383a7ad246343cf4db355f3f
BLAKE2b-256 78c279fc6f6f31795c88323a03a1905a451287f1387af74fd94890f0b7c5912d

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 42743da006a1a27b29edb1ad05267432d97159a3b725c08555205e3428763dd2
MD5 0e3cc3c5404d35e01240ce68cbe45cce
BLAKE2b-256 f401a52e4f11835f0aa1f596a9ffd1fe574cef6bf27f516fcb5626a789e57822

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d503c2511a7b29173492564e64b115d026df3955d0846efa0b45aca32d542021
MD5 de90a0808e84c9c10d573d08b9c182d5
BLAKE2b-256 72d7dc8fb5f660ea7e89b05353b85cb9566ade63ba9e34c041f4bbe9655ec517

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f596cc452b54e32d46647da722b3fa6f6d4131a2158b2aee2bc6d82a418e890a
MD5 352616d32ec92a3566ce835bee2fb00c
BLAKE2b-256 8a64eb812f106e0bb69946c08b1e837ca2e898e5d98e5b1af18ce90546b4eb28

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 123b8f284695e8748b18167be3d9931bfb3341ca95d89c223fd03c6b1bff0d00
MD5 57c3d7a45d48536d54f413eba19bccf4
BLAKE2b-256 b0f99e2da849789c30f4ab13144596b11c25e728600591f91dbeef4183b95576

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 48440a780472940358ad0bda284a305c1cb16e3c2fc7e97d14e01a065db543f2
MD5 be0c34d6c97b6a15f7205222d97af248
BLAKE2b-256 1c09f8e9d296b2abc71cea924bb0d1571ed39c28ddf0f8343e27581daa1ec44f

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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.1.13-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slamd-2.1.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1eb2a938f7769f4f361cf5c68b8318d1316a1e1bdc6e48cffe568a4583b72ccc
MD5 5e15f5356ae7c475390942199d45d474
BLAKE2b-256 967654620a9f59bc91ea464d19b2ead430fa6ad825de3ba30f75fe94fcb65d79

See more details on using hashes here.

Provenance

The following attestation bundles were made for slamd-2.1.13-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