Visualize meshes, point clouds, and other geometry in a Jupyter Notebook
Project description

# threevis
[](https://www.graphics.rwth-aachen.de:9000/threevis/threevis/commits/master)
A Python library for visualizing meshes, point clouds, and other geometry in Jupyter notebooks
## Installation
`pip install threevis`
## Examples
### Quick Mesh Inspection
```python
import threevis
import openmesh as om
m = om.read_trimesh('examples/models/bunny.obj')
threevis.display_openmesh(m)
```
### Custom Rendering
```python
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
- [pythreejs](https://github.com/jovyan/pythreejs/) >= 1.0.0
### Optional
- [openmesh-python](https://graphics.rwth-aachen.de:9000/adielen/openmesh-python) latest
# threevis
[](https://www.graphics.rwth-aachen.de:9000/threevis/threevis/commits/master)
A Python library for visualizing meshes, point clouds, and other geometry in Jupyter notebooks
## Installation
`pip install threevis`
## Examples
### Quick Mesh Inspection
```python
import threevis
import openmesh as om
m = om.read_trimesh('examples/models/bunny.obj')
threevis.display_openmesh(m)
```
### Custom Rendering
```python
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
- [pythreejs](https://github.com/jovyan/pythreejs/) >= 1.0.0
### Optional
- [openmesh-python](https://graphics.rwth-aachen.de:9000/adielen/openmesh-python) latest
Project details
Release history Release notifications | RSS feed
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.post20.tar.gz
(510.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file threevis-0.1.0.post20.tar.gz.
File metadata
- Download URL: threevis-0.1.0.post20.tar.gz
- Upload date:
- Size: 510.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cba7b8730270e7c264bb3af518909274577730ef61361b55c32034e4d8cecc63
|
|
| MD5 |
f852b4be2f0ea1c60b6443acae94d49f
|
|
| BLAKE2b-256 |
50dc835ba3aee0cc4bdedab1aa09985164a993d900dde89ae676a1aefeea9c6e
|
File details
Details for the file threevis-0.1.0.post20-py2.py3-none-any.whl.
File metadata
- Download URL: threevis-0.1.0.post20-py2.py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4261ce58f88bf29c7bf92029db5edad6402a1fc2f4f3a3d6562f44c23ba5df4f
|
|
| MD5 |
5b99568f588aa299b5c25d310d6edf1b
|
|
| BLAKE2b-256 |
0e1019c708774323efc95d38d0a7c6784f9fad238b1f86898a976accb3ad64cf
|