Commit 13bbea51 authored by Isaak Lim's avatar Isaak Lim

rename meshvis to threevis and update om mesh reading calls

parent b2cf6f9f
# MeshVis [[#]] ThreeVis
## Setup ## Setup
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
## Example ## Example
```python ```python
import meshvis import threevis
m = om.TriMesh() m = om.TriMesh()
om.read_mesh(m, '/home/dseyb/git/openmesh-python/tests/TestFiles/cube-minimal-normals.ply') om.read_mesh(m, '/home/dseyb/git/openmesh-python/tests/TestFiles/cube-minimal-normals.ply')
meshvis.display_openmesh(m) threevis.display_openmesh(m)
meshvis.display_file('/home/dseyb/git/openmesh-python/tests/TestFiles/square_material_texture.obj') threevis.display_file('/home/dseyb/git/openmesh-python/tests/TestFiles/square_material_texture.obj')
``` ```
```python ```python
import meshvis import threevis
import openmesh as om import openmesh as om
import numpy as np import numpy as np
...@@ -36,17 +36,17 @@ m = om.TriMesh() ...@@ -36,17 +36,17 @@ m = om.TriMesh()
om.read_mesh(m, "./mouse.obj") om.read_mesh(m, "./mouse.obj")
# Create Context # Create Context
ctx = meshvis.Context(width=640, height=480) ctx = threevis.Context(width=640, height=480)
# Get vertices and faces from the mesh # Get vertices and faces from the mesh
vertices = m.points() vertices = m.points()
faces = m.face_vertex_indices() faces = m.face_vertex_indices()
# We don't have normals, calculate them # We don't have normals, calculate them
normals = meshvis.calculateFaceNormals(m.points(), m.face_vertex_indices()) normals = threevis.calculateFaceNormals(m.points(), m.face_vertex_indices())
# Choose a random color for each face # Choose a random color for each face
colors = meshvis.FaceAttribute(np.random.rand(len(faces), 3)) colors = threevis.FaceAttribute(np.random.rand(len(faces), 3))
# Draw the mesh with flat shading # Draw the mesh with flat shading
ctx.draw_faces(vertices, faces, ctx.draw_faces(vertices, faces,
...@@ -56,11 +56,11 @@ ctx.draw_faces(vertices, faces, ...@@ -56,11 +56,11 @@ ctx.draw_faces(vertices, faces,
# Draw edges on top with random colors # Draw edges on top with random colors
ctx.draw_edges(vertices, m.ev_indices(), ctx.draw_edges(vertices, m.ev_indices(),
colors = meshvis.FaceAttribute(np.random.rand(len(m.ev_indices()), 3)), colors = threevis.FaceAttribute(np.random.rand(len(m.ev_indices()), 3)),
linewidth=3) linewidth=3)
# Calculate data to display normals as edges # Calculate data to display normals as edges
normal_vis_verts, normal_vis_edges = meshvis.calculateNormalEdges(vertices, faces, normals, length=0.05) normal_vis_verts, normal_vis_edges = threevis.calculateNormalEdges(vertices, faces, normals, length=0.05)
# Draw the normals in # Draw the normals in
ctx.draw_edges(normal_vis_verts, normal_vis_edges, colors = colors) ctx.draw_edges(normal_vis_verts, normal_vis_edges, colors = colors)
...@@ -72,4 +72,4 @@ ctx.draw_vertices(vertices, point_size=4, colors='red') ...@@ -72,4 +72,4 @@ ctx.draw_vertices(vertices, point_size=4, colors='red')
ctx.display() ctx.display()
``` ```
![mouse](https://www.graphics.rwth-aachen.de:9000/dseyb/meshvis/raw/master/docs/images/mouse.PNG) ![mouse](https://www.graphics.rwth-aachen.de:9000/threevis/threevis/raw/master/docs/images/mouse.PNG)
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXOPTS = SPHINXOPTS =
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
SPHINXPROJ = meshvis SPHINXPROJ = threevis
SOURCEDIR = source SOURCEDIR = source
BUILDDIR = build BUILDDIR = build
...@@ -17,4 +17,4 @@ help: ...@@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new # Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile %: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
...@@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ...@@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" (
) )
set SOURCEDIR=source set SOURCEDIR=source
set BUILDDIR=build set BUILDDIR=build
set SPHINXPROJ=meshvis set SPHINXPROJ=threevis
if "%1" == "" goto help if "%1" == "" goto help
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
# #
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('../../meshvis/')) sys.path.insert(0, os.path.abspath('../../threevis/'))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = u'meshvis' project = u'threevis'
copyright = u'2018, Dario Seyb, Isaak Lim, Janis Born' copyright = u'2018, Dario Seyb, Isaak Lim, Janis Born'
author = u'Dario Seyb, Isaak Lim, Janis Born' author = u'Dario Seyb, Isaak Lim, Janis Born'
...@@ -110,7 +110,7 @@ html_static_path = ['_static'] ...@@ -110,7 +110,7 @@ html_static_path = ['_static']
# -- Options for HTMLHelp output --------------------------------------------- # -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'meshvisdoc' htmlhelp_basename = 'threevisdoc'
# -- Options for LaTeX output ------------------------------------------------ # -- Options for LaTeX output ------------------------------------------------
...@@ -137,7 +137,7 @@ latex_elements = { ...@@ -137,7 +137,7 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'meshvis.tex', u'meshvis Documentation', (master_doc, 'threevis.tex', u'threevis Documentation',
u'Dario Seyb, Isaak Lim, Janis Born', 'manual'), u'Dario Seyb, Isaak Lim, Janis Born', 'manual'),
] ]
...@@ -147,7 +147,7 @@ latex_documents = [ ...@@ -147,7 +147,7 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
(master_doc, 'meshvis', u'meshvis Documentation', (master_doc, 'threevis', u'threevis Documentation',
[author], 1) [author], 1)
] ]
...@@ -158,8 +158,8 @@ man_pages = [ ...@@ -158,8 +158,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
(master_doc, 'meshvis', u'meshvis Documentation', (master_doc, 'threevis', u'threevis Documentation',
author, 'meshvis', 'Visualize meshes, point clouds, volumes and other geometry in a Jupyter Notebook', author, 'threevis', 'Visualize meshes, point clouds, volumes and other geometry in a Jupyter Notebook',
'Miscellaneous'), 'Miscellaneous'),
] ]
...@@ -169,4 +169,4 @@ texinfo_documents = [ ...@@ -169,4 +169,4 @@ texinfo_documents = [
# -- Options for todo extension ---------------------------------------------- # -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing. # If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True todo_include_todos = True
\ No newline at end of file
...@@ -6,27 +6,26 @@ ...@@ -6,27 +6,26 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import meshvis\n", "import threevis\n",
"import openmesh as om\n", "import openmesh as om\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"m = om.PolyMesh()\n", "m = om.read_polymesh('models/model_mixed_valence.obj')\n",
"om.read_mesh(m, 'models/model_mixed_valence.obj')\n",
"\n", "\n",
"vertices = m.points()\n", "vertices = m.points()\n",
"faces = m.face_vertex_indices()\n", "faces = m.face_vertex_indices()\n",
"edges = m.ev_indices()\n", "edges = m.ev_indices()\n",
"\n", "\n",
"mesh = meshvis.Mesh(vertices, faces)\n", "mesh = threevis.Mesh(vertices, faces)\n",
"mesh.colors = meshvis.FaceAttribute(np.random.rand(len(faces), 3))\n", "mesh.colors = threevis.FaceAttribute(np.random.rand(len(faces), 3))\n",
"mesh.normals = meshvis.calculatePointNormals(vertices, faces)\n", "mesh.normals = threevis.calculatePointNormals(vertices, faces)\n",
"\n", "\n",
"\n", "\n",
"normal_vis_verts, normal_vis_edges = meshvis.calculateNormalEdges(vertices, faces, mesh.normals, 0.5)\n", "normal_vis_verts, normal_vis_edges = threevis.calculateNormalEdges(vertices, faces, mesh.normals, 0.5)\n",
"\n", "\n",
"ctx = meshvis.Context()\n", "ctx = threevis.Context()\n",
"\n", "\n",
"ctx.draw(mesh).draw(meshvis.EdgeList(vertices, edges)).draw(meshvis.PointList(vertices, colors='#aaaaaa'), point_size=3)\n", "ctx.draw(mesh).draw(threevis.EdgeList(vertices, edges)).draw(threevis.PointList(vertices, colors='#aaaaaa'), point_size=3)\n",
"\n", "\n",
"ctx.draw_edges(normal_vis_verts, normal_vis_edges)\n", "ctx.draw_edges(normal_vis_verts, normal_vis_edges)\n",
"\n", "\n",
...@@ -37,20 +36,21 @@ ...@@ -37,20 +36,21 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2" "pygments_lexer": "ipython3",
"version": "3.5.3rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,41 +6,40 @@ ...@@ -6,41 +6,40 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import meshvis\n", "import threevis\n",
"import openmesh as om\n", "import openmesh as om\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"m = om.PolyMesh()\n", "m = om.read_polymesh('models/bunny.obj')\n",
"\n",
"om.read_mesh(m, 'models/bunny.obj')\n",
"\n", "\n",
"vertices = m.points()\n", "vertices = m.points()\n",
"faces = m.face_vertex_indices()\n", "faces = m.face_vertex_indices()\n",
"\n", "\n",
"\n", "\n",
"mesh = meshvis.Mesh(vertices, faces, \n", "mesh = threevis.Mesh(vertices, faces, \n",
" normals = meshvis.calculateFaceNormals(vertices, faces))\n", " normals = threevis.calculateFaceNormals(vertices, faces))\n",
"\n", "\n",
"meshvis.display(mesh, show_bounds=True)\n" "threevis.display(mesh, show_bounds=True)\n"
] ]
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2" "pygments_lexer": "ipython3",
"version": "3.5.3rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -6,52 +6,44 @@ ...@@ -6,52 +6,44 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import meshvis\n", "import threevis\n",
"import openmesh as om\n", "import openmesh as om\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"m = om.PolyMesh()\n", "m = om.read_polymesh('models/bunny.obj')\n",
"\n",
"om.read_mesh(m, 'models/bunny.obj')\n",
"\n", "\n",
"vertices = m.points()\n", "vertices = m.points()\n",
"faces = m.face_vertex_indices()\n", "faces = m.face_vertex_indices()\n",
"\n", "\n",
"\n", "\n",
"mesh = meshvis.Mesh(vertices, faces, \n", "mesh = threevis.Mesh(vertices, faces, \n",
" normals = meshvis.calculateFaceNormals(vertices, faces))\n", " normals = threevis.calculateFaceNormals(vertices, faces))\n",
"\n", "\n",
"ctx = meshvis.Context()\n", "ctx = threevis.Context()\n",
"ctx.draw(mesh, shading='flat', clipping_planes=[meshvis.Plane((1.0, 0.0, 0.0) , 0)])\n", "ctx.draw(mesh, shading='flat', clipping_planes=[threevis.Plane((1.0, 0.0, 0.0) , 0)])\n",
"ctx.display()\n", "ctx.display()\n",
"\n", "\n",
"ctx.setCameraPosition([0.2, 0, 0])" "ctx.setCameraPosition([0.2, 0, 0])"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2" "pygments_lexer": "ipython3",
"version": "3.5.3rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -131,9 +131,9 @@ ...@@ -131,9 +131,9 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.3" "version": "3.5.3rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -1132,21 +1132,21 @@ ...@@ -1132,21 +1132,21 @@
"metadata": { "metadata": {
"anaconda-cloud": {}, "anaconda-cloud": {},
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython3",
"version": "2.7.13" "version": "3.5.3rc1"
}, },
"widgets": { "widgets": {
"application/vnd.jupyter.widget-state+json": { "application/vnd.jupyter.widget-state+json": {
...@@ -2154,5 +2154,5 @@ ...@@ -2154,5 +2154,5 @@
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 1 "nbformat_minor": 2
} }
...@@ -6,27 +6,26 @@ ...@@ -6,27 +6,26 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import meshvis\n", "import threevis\n",
"import openmesh as om\n", "import openmesh as om\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"m = om.PolyMesh()\n", "m = om.read_polymesh('models/model_mixed_valence.obj')\n",
"om.read_mesh(m, 'models/model_mixed_valence.obj')\n",
"\n", "\n",
"vertices = m.points()\n", "vertices = m.points()\n",
"faces = m.face_vertex_indices()\n", "faces = m.face_vertex_indices()\n",
"edges = m.ev_indices()\n", "edges = m.ev_indices()\n",
"\n", "\n",
"mesh = meshvis.Mesh(vertices, faces)\n", "mesh = threevis.Mesh(vertices, faces)\n",
"mesh.colors = meshvis.FaceAttribute(np.random.rand(len(faces), 3))\n", "mesh.colors = threevis.FaceAttribute(np.random.rand(len(faces), 3))\n",
"mesh.normals = meshvis.calculatePointNormals(vertices, faces)\n", "mesh.normals = threevis.calculatePointNormals(vertices, faces)\n",
"\n", "\n",
"\n", "\n",
"normal_vis_verts, normal_vis_edges = meshvis.calculateNormalEdges(vertices, faces, mesh.normals, 0.5)\n", "normal_vis_verts, normal_vis_edges = threevis.calculateNormalEdges(vertices, faces, mesh.normals, 0.5)\n",
"\n", "\n",
"ctx = meshvis.Context()\n", "ctx = threevis.Context()\n",
"\n", "\n",
"ctx.draw(mesh).draw(meshvis.EdgeList(vertices, edges)).draw(meshvis.PointList(vertices, colors='#aaaaaa'), point_size=3)\n", "ctx.draw(mesh).draw(threevis.EdgeList(vertices, edges)).draw(threevis.PointList(vertices, colors='#aaaaaa'), point_size=3)\n",
"\n", "\n",
"ctx.draw_edges(normal_vis_verts, normal_vis_edges)\n", "ctx.draw_edges(normal_vis_verts, normal_vis_edges)\n",
"\n", "\n",
...@@ -37,20 +36,21 @@ ...@@ -37,20 +36,21 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2" "pygments_lexer": "ipython3",
"version": "3.5.3rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -6,18 +6,11 @@ ...@@ -6,18 +6,11 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import meshvis\n", "import threevis\n",
"import openmesh as om\n", "import openmesh as om\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"m = om.PolyMesh()\n", "m = om.read_polymesh('models/spot_quadrangulated.obj', vertex_tex_coord=True)\n",
"\n",