-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a method to change the camera parameters. Change "process" to "to…
…_html".
- Loading branch information
1 parent
f7e918a
commit 780fc8b
Showing
26 changed files
with
331 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,36 @@ | ||
from numpy import load, zeros, mean | ||
from os.path import join | ||
from numpy import load, zeros, mean, array | ||
from vedo import Mesh | ||
|
||
from SimExporter.core import Exporter | ||
|
||
|
||
# Load the data | ||
heart = Mesh('heart.obj') | ||
heart_positions = load('heart.npy') | ||
heart = Mesh(join('data', 'heart.obj')) | ||
heart_positions = load(join('data', 'heart.npy')) | ||
|
||
|
||
# Create the exporter | ||
exporter = Exporter(animation=True, | ||
fps=50) | ||
exporter = Exporter(animation=True, fps=50) | ||
|
||
|
||
# Add mesh and arrows to the scene | ||
exporter.objects.add_mesh(positions=mean(heart_positions, axis=0), | ||
time_positions=array([mean(heart_positions, axis=0) for _ in range(heart_positions.shape[0])]), | ||
cells=heart.cells, | ||
color='grey', | ||
alpha=0.6, | ||
wireframe=True) | ||
exporter.objects.add_arrows(positions=mean(heart_positions, axis=0), | ||
vectors=zeros((heart.npoints, 3)), | ||
time_positions=array([mean(heart_positions, axis=0) for _ in range(heart_positions.shape[0])]), | ||
scale=3, | ||
line_width=0.5, | ||
head_size=0., | ||
time_vectors=heart_positions[:] - mean(heart_positions, axis=0)) | ||
|
||
exporter.process(filename='arrows.html', | ||
background_color='white', | ||
menu_visible=True, | ||
grid_visible=False, | ||
frame_visible=False) | ||
|
||
# Export to HTML with custom camera parameters | ||
exporter.set_camera(factor=0.8, yaw=-80, pitch=60) | ||
exporter.to_html(filename=join('html', 'arrows.html'), background_color='#0D1117', grid_visible=False, | ||
menu_visible=True, frame_visible=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
from os.path import join | ||
from vedo import Mesh | ||
|
||
from SimExporter.core import Exporter | ||
|
||
|
||
# Load the data and create tetra mesh | ||
mesh = Mesh('heart.obj') | ||
mesh = Mesh(join('data', 'heart.obj')) | ||
tetra = mesh.clone().tetralize(side=0.05) | ||
|
||
|
||
# Create the exporter | ||
exporter = Exporter() | ||
|
||
|
||
# Add meshes to the scene | ||
exporter.objects.add_mesh(positions=mesh.vertices, | ||
cells=mesh.cells, | ||
color='#f5c211', | ||
alpha=0.9, | ||
alpha=0.2, | ||
wireframe=True) | ||
exporter.objects.add_mesh(positions=tetra.vertices, | ||
cells=tetra.cells, | ||
color='#1c71d8', | ||
alpha=0.05) | ||
|
||
# Export to HTML | ||
exporter.process(filename='tetra.html', | ||
background_color='white', | ||
menu_visible=True, | ||
grid_visible=False, | ||
|
||
# Export to HTML with custom camera parameters | ||
exporter.set_camera(factor=0.8, yaw=-80, pitch=60) | ||
exporter.to_html(filename=join('html', 'tetra.html'), background_color='grey', grid_visible=False, menu_visible=True, | ||
frame_visible=True) |
Oops, something went wrong.