-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
419 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Adds new points to an input point cloud. | ||
The new points are created in such a way that | ||
all points in any local neighborhood are | ||
within a target distance of one another. | ||
""" | ||
from vtkplotter import * | ||
import numpy as np | ||
np.random.seed(3) | ||
|
||
npts = 200 # nr. of points | ||
coords = np.random.rand(npts, 3) # range is [0, 1] | ||
scals = np.abs(coords[:, 2]) # let the scalar be the z of point itself | ||
|
||
apts = Points(coords, r=9).addPointScalars(scals, name='scals') | ||
|
||
densecloud = densifyCloud(apts, .05, closestN=10, maxIter=1) | ||
print(apts.N(), '->', densecloud.N()) | ||
|
||
ppp = Points(densecloud.coordinates()) | ||
show(apts, densecloud, Text(__doc__), axes=8) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Make a shadow of 2 meshes on the wall.""" | ||
from vtkplotter import * | ||
|
||
a = load(datadir + "spider.ply").normalize().rotateZ(-90) | ||
s = Sphere(pos=[-0.4, 1.5, 0.3], r=0.3) | ||
|
||
shad = Shadow(a, s, direction="x").x(-4) | ||
|
||
show(a, s, shad, Text(__doc__), axes=1, viewup="z", bg="w") |
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
Scale a mesh asymmetrically in one coordinate | ||
""" | ||
from dolfin import * | ||
from mshr import * | ||
|
||
domain = Rectangle(Point(0.0, 0.0), Point(5.0, 0.01)) | ||
mesh = generate_mesh(domain, 20) | ||
V = FunctionSpace(mesh, "CG", 2) | ||
|
||
e = Expression("sin(2*pi*(x[0]*x[0]+x[1]*x[1]))", degree=2) | ||
f = interpolate(e, V) | ||
|
||
#################################################### | ||
from vtkplotter.dolfin import plot | ||
|
||
plt = plot(f, | ||
warpZfactor=0.05, # add z elevation proportional to expression | ||
style=1, | ||
lw=0, | ||
xtitle = 'y-coord is scaled by factor 100', | ||
text=__doc__, | ||
interactive=False) | ||
plt.actors[0].scale([1,100,1]) # retrieve actor object and scale y | ||
plt.show(interactive=True) # refresh scene |
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Draw the shadow and trailing lines of 2 planes. This is not really | ||
# a simulation.. just a way to illustrate how to move objects around! | ||
from vtkplotter import * | ||
|
||
world = Box([0,0,0], 30, 15, 8).wire() | ||
|
||
p1 = load(datadir+"cessna.vtk").c("green").addTrail(lw=2, n=50) | ||
p2 = p1.clone().c("tomato").addTrail(lw=2, n=50) # make a copy | ||
|
||
# Setup the scene, creating the Plotter object is automatic | ||
show(world, p1, p2, axes=1, bg="white", viewup="z", resetcam=0, interactive=0) | ||
|
||
for x in arange(0, 3.5, 0.01): | ||
p1.pos(9*x-15, 2-x, sin( 3-x)).rotateX(0+x) # make up some fancy movement | ||
p2.pos(8*x-15, -2+x, sin(-3+x)).rotateX(2-x) | ||
|
||
shad = Shadow(p1, p2, direction='z').z(-4) # fix z position of the shadow | ||
show(world, p1, p2, shad) | ||
|
||
interactive() |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# source run_all.sh | ||
# | ||
printf "\033c" | ||
|
||
echo ############################################# | ||
echo Press F1 at anytime to skip example | ||
echo ############################################# | ||
echo | ||
echo | ||
echo | ||
|
||
|
||
################################### simulations | ||
echo Running aspring.py | ||
python aspring.py | ||
|
||
echo Running cell_main.py | ||
python cell_main.py | ||
|
||
echo Running brownian2D.py | ||
python brownian2D.py | ||
|
||
echo Running gas.py | ||
python gas.py | ||
|
||
echo Running gyroscope1.py | ||
python gyroscope1.py | ||
|
||
echo Running gyroscope2.py | ||
python gyroscope2.py | ||
|
||
echo Running multiple_pendulum.py | ||
python multiple_pendulum.py | ||
|
||
echo Running hanoi3d.py | ||
python hanoi3d.py | ||
|
||
echo Running airplanes.py | ||
python airplanes.py | ||
|
||
echo Running pendulum.py | ||
python pendulum.py | ||
|
||
echo Running wave_equation.py | ||
python wave_equation.py | ||
|
||
echo Running turing.py | ||
python turing.py | ||
|
||
echo Running particle_simulator.py | ||
python particle_simulator.py | ||
|
||
echo Running doubleslit.py | ||
python doubleslit.py | ||
|
||
echo Running tunnelling2.py | ||
python tunnelling2.py |
Oops, something went wrong.