Metadata-Version: 2.0
Name: threevis
Version: 0.1.0.post11
Summary: Visualize meshes, point clouds, and other geometry in a Jupyter Notebook
Home-page: https://graphics.rwth-aachen.de:9000/threevis/threevis
Author: Dario Seyb, Isaak Lim, Janis Born
Author-email: isaak.lim@cs.rwth-aachen.de
License: BSD 3-Clause
Project-URL: Tracker, https://www.graphics.rwth-aachen.de:9000/threevis/threevis/issues
Project-URL: Source, https://www.graphics.rwth-aachen.de:9000/threevis/threevis
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
Requires-Dist: numpy
Requires-Dist: pythreejs (>=1.0.0)

|threevis| # threevis |pipeline status|

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

Installation
------------

``pip install threevis``

Examples
--------

Quick Mesh Inspection
~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    import threevis
    import openmesh as om

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

    threevis.display_openmesh(m)

Custom Rendering
~~~~~~~~~~~~~~~~

.. code:: 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()

.. figure:: https://www.graphics.rwth-aachen.de:9000/threevis/threevis/raw/master/docs/images/mouse.PNG
   :alt: mouse

   mouse

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| image:: https://www.graphics.rwth-aachen.de:9000/threevis/threevis/raw/master/docs/images/logo-90.png
.. |pipeline status| image:: https://www.graphics.rwth-aachen.de:9000/threevis/threevis/badges/master/pipeline.svg
   :target: https://www.graphics.rwth-aachen.de:9000/threevis/threevis/commits/master


