Skip to main content

threevis

A Python library for visualizing meshes, point clouds, and other geometry in Jupyter notebooks

Installation

pip install threevis

Examples

Quick Mesh Inspection

import threevis
import openmesh as om

m = om.read_trimesh('examples/models/bunny.obj')

threevis.display_openmesh(m)

Custom Rendering

import threevis
import openmesh as om
import numpy as np

# Load Mesh
m = om.read_trimesh('mouse.obj')

# Create Context
ctx = threevis.Context(width=640, height=480)

# Get vertices and faces from the mesh
vertices = m.points()
faces = m.face_vertex_indices()

# We don't have normals, calculate them
normals = threevis.calculateFaceNormals(m.points(), m.face_vertex_indices())

# Choose a random color for each face
colors = threevis.FaceAttribute(np.random.rand(len(faces), 3))

# Draw the mesh with flat shading
ctx.draw_faces(vertices, faces, 
               normals = normals,
               colors = colors,
               shading = 'flat')

# Draw edges on top with random colors
ctx.draw_edges(vertices, m.ev_indices(), 
               colors = threevis.FaceAttribute(np.random.rand(len(m.ev_indices()), 3)),
               linewidth=3)

# Calculate data to display normals as edges
normal_vis_verts, normal_vis_edges = threevis.calculateNormalEdges(vertices, faces, normals, length=0.05)

# Draw the normals in
ctx.draw_edges(normal_vis_verts, normal_vis_edges, colors = colors)

# Draw a point for each vertex
ctx.draw_vertices(vertices, point_size=4, colors='red')

# Finally display it
ctx.display()

Development Setup

  • Install dependencies
  • Clone the repository
  • pip install -e .

Dependencies

Optional

Release files for threevis 0.1.0.post25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for threevis 0.1.0.post25
File Size Uploaded
threevis-0.1.0.post25.tar.gz 506.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for threevis 0.1.0.post25
File Interpreter ABI Platform
threevis-0.1.0.post25-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 517.5 kB

Release files / threevis-0.1.0.post25.tar.gz

Download URL threevis-0.1.0.post25.tar.gz
Size 506.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f1d9d2b2805283cb1e2beb4ffb3d2962ac44c23ef0444d4289f08705632d31ae
BLAKE2b-256 checksum
How to use checksums
43033162174df26ca0a4ea057d772903396c53d275665c997dbc787fdd41fae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / threevis-0.1.0.post25-py2.py3-none-any.whl

Download URL threevis-0.1.0.post25-py2.py3-none-any.whl
Size 11.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ca989d2d2c6f63da14c4b977dc109b662ffebefb8976980c0fc62a1a7afaffe8
BLAKE2b-256 checksum
How to use checksums
b2ff9597cc0ff28c940bc0f229b1c67e8357ecad95edc7b08ac14752c119d7e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0.post25 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page