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

Download files

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

Source Distribution

threevis-0.1.0.post21.tar.gz (510.4 kB view details)

Uploaded Source

Built Distribution

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

threevis-0.1.0.post21-py2.py3-none-any.whl (11.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file threevis-0.1.0.post21.tar.gz.

File metadata

File hashes

Hashes for threevis-0.1.0.post21.tar.gz
Algorithm Hash digest
SHA256 9d7bed390ea85088cfb1cc39fd605658eab567474689e567c16014e6069bc178
MD5 ee3f0c1580e8ee9f039f5ca3c3adc122
BLAKE2b-256 df776c3e4eb63863d56bf0218ebd9930ba7aff3e39d2891aee01e83e8fdd5356

See more details on using hashes here.

File details

Details for the file threevis-0.1.0.post21-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for threevis-0.1.0.post21-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3e3a4f873e96574bc61f6dd113dcabf2feeda7fd00b7011b7ee75be36304a1c4
MD5 466d20cde168b314f4a2cb67284ca067
BLAKE2b-256 ce112bb9abacb3e957e5e9d70c457ecd6d5f03b5ae0fe9e536b8937e529848cd

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.0.post25

2 files

This release

0.1.0.post21 This release

2 files

0.1.0.post20

2 files

0.1.0.post11

1 file

Supported by

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