Skip to content

Commit

Permalink
fix typos in functions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Jun 16, 2023
1 parent d3aad81 commit 602fb8c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 72 deletions.
23 changes: 19 additions & 4 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Main changes

- rename module `io.py` to `file_io.py` to avoid override stlib io.
- Rename module `io.py` to `file_io.py` to avoid override stlib io.
- Complete revision of cutter widgets funcionatlity
- Integration in napari thanks to @jo-mueller


### Breaking changes
- method `plotter.add()` no more accepts keyword `render=True/False`. Please use `plotter.add().render()` explicitly. Same thing for `plotter.remove()`.
Expand All @@ -26,7 +29,7 @@
- Update API Documentation for Changing Backend by @bhacha
- Add `application.Browser().play()` to autoplay a slider
- Add `pad()` to padding a Volume with zeros voxels (useful to `dilate()`)
- Add `ProgressBarWindow()` to show a progress bar in the rendering window
- Add `ProgressBarWidget()` to show a progress bar in the rendering window
- Fix Scalarbar3D logscale and change separator symbol by @XushanLu
- Fix `vedo/interactor_modes.mouse_left_move()` by @MiticoDan
- Added `applications.AnimationPlayer` class by @mikaeltulldahl
Expand All @@ -51,11 +54,23 @@ examples/simulations/aspring2_player.py
```
airplane1.py
examples/simulations/trail.py
particle_simulator.py
```
align4.py
bgImage.py
colormap_list.py
mousehover3.py
cut_with_points2.py
interpolate_field.py
goniometer.py
pendulum_3d.pyq

graph_lineage.py
graph_network.py
markpoint.py
plot_stream.py



meshio_read.py



Expand Down
8 changes: 0 additions & 8 deletions tests/dolfinx/run_all.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from vedo.pyplot import plot
import vedo

doshow = 0
doshow = 1

##################################################################### addons.py
box = Box(pos=(1,2,3), length=8, width=9, height=7).alpha(0.1)
Expand All @@ -15,6 +15,7 @@
show(box, axs).close()

######################################################
print("Test 1")
b = Box(pos=(0, 0, 0), length=80, width=90, height=70).alpha(0.1)
if doshow:
show(
Expand All @@ -27,6 +28,7 @@
).close()

##################################################################### base.py
print("Test 2")
c1 = Cube()
c2 = c1.clone().c('violet').alpha(0.5) # copy of c1
v = vector(0.2,1,0)
Expand All @@ -38,6 +40,7 @@


######################################################
print("Test 3")
objs = []
for i in range(-5, 5):
p = [i/3, i/2, i]
Expand All @@ -49,6 +52,7 @@


######################################################
print("Test 4")
c1 = Cube()
c2 = c1.clone().c('violet').alpha(0.5) # copy of c1
v = vector(0.2,1,0)
Expand All @@ -64,6 +68,7 @@


######################################################
print("Test 5")
tetmesh = TetMesh(dataurl+'limb_ugrid.vtk')
tetmesh.color('rainbow')
cu = Cube(side=500).x(500) # any Mesh works
Expand All @@ -72,11 +77,13 @@
show(axes=1).close()

##################################################################### mesh.py
print("Test 6")
s = Sphere().crop(right=0.3, left=0.1)
if doshow:
show(s).close()

######################################################
print("Test 7")
c1 = Cylinder(pos=(0,0,0), r=2, height=3, axis=(1,.0,0), alpha=.1).triangulate()
c2 = Cylinder(pos=(0,0,2), r=1, height=2, axis=(0,.3,1), alpha=.1).triangulate()
intersect = c1.intersect_with(c2).join(reset=True)
Expand All @@ -86,6 +93,7 @@


######################################################
print("Test 8")
grid = Grid()#.triangulate()
circle = Circle(r=0.3, res=24).pos(0.11,0.12)
line = Line(circle, closed=True, lw=4, c='r4')
Expand All @@ -95,6 +103,7 @@


##################################################################### picture.py
print("Test 9")
if doshow:
pic = Picture(dataurl+'dog.jpg').pad()
pic.append([pic,pic,pic], axis='y')
Expand All @@ -103,6 +112,7 @@


######################################################
print("Test 10")
if doshow:
p = vedo.Picture(vedo.dataurl+'images/dog.jpg').bw()
pe = p.clone().enhance()
Expand All @@ -111,6 +121,7 @@


######################################################
print("Test 11")
if doshow:
pic1 = Picture("https://aws.glamour.es/prod/designs/v1/assets/620x459/547577.jpg")
pic2 = pic1.clone().invert()
Expand All @@ -120,6 +131,7 @@


######################################################
print("Test 12")
if doshow:
pic = vedo.Picture(vedo.dataurl+"images/dog.jpg")
pic.rectangle([100,300], [100,200], c='green4', alpha=0.7)
Expand All @@ -129,12 +141,14 @@


##################################################################### plotter.py
print("Test 13")
cone = Cone()
if doshow:
cone.show(axes=1).fly_to([1,0,0])
cone.show().close()

######################################################
print("Test 14")
settings.use_parallel_projection = True # or else it doesnt make sense!
cube = Cube().alpha(0.2)
plt = Plotter(size=(900,600), axes=dict(xtitle='x (um)'))
Expand All @@ -144,12 +158,12 @@
settings.use_parallel_projection = False

######################################################
print("Test 15")
def func(evt): # called every time the mouse moves
# evt is a dotted dictionary
if not evt.actor:
return # no hit, return
print("point coords =", evt.picked3d)
# print("full event dump:", evt)

elli = Ellipsoid()
plt = Plotter(axes=1)
Expand All @@ -159,6 +173,7 @@ def func(evt): # called every time the mouse moves


##################################################################### pointcloud.py
print("Test 16")
s = Ellipsoid().rotate_y(30)
#Camera options: pos, focal_point, viewup, distance,
# clippingRange, parallelScale, thickness, viewAngle
Expand All @@ -171,6 +186,7 @@ def func(evt): # called every time the mouse moves


######################################################
print("Test 17")
def fibonacci_sphere(n):
s = np.linspace(0, n, num=n, endpoint=False)
theta = s * 2.399963229728653
Expand All @@ -185,6 +201,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 18")
s = Sphere(res=10).linewidth(1).c("orange").compute_normals()
point_ids = s.labels('id', on="points").c('green')
cell_ids = s.labels('id', on="cells").c('black')
Expand All @@ -194,6 +211,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 19")
sph = Sphere(quads=True, res=4).compute_normals().wireframe()
sph.celldata["zvals"] = sph.cell_centers()[:,2]
l2d = sph.labels("zvals", on="cells", precision=2).backcolor('orange9')
Expand All @@ -203,6 +221,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 20")
c1 = Cube().rotate_z(5).x(2).y(1)
print("cube1 position", c1.pos())
T = c1.get_transform() # rotate by 5 degrees, sum 2 to x and 1 to y
Expand All @@ -217,6 +236,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 21")
disc = Disc(r1=1, r2=1.2)
mesh = disc.extrude(3, res=50).linewidth(1)
mesh.cut_with_cylinder([0,0,2], r=0.4, axis='y', invert=True)
Expand All @@ -225,6 +245,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 22")
disc = Disc(r1=1, r2=1.2)
mesh = disc.extrude(3, res=50).linewidth(1)
mesh.cut_with_sphere([1,-0.7,2], r=1.5, invert=True)
Expand All @@ -233,6 +254,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 23")
arr = np.random.randn(100000, 3)/2
pts = Points(arr).c('red3').pos(5,0,0)
cube = Cube().pos(4,0.5,0)
Expand All @@ -242,6 +264,7 @@ def fibonacci_sphere(n):


##################################################################### shapes.py
print("Test 24")
pts = [[1, 0, 0], [5, 2, 0], [3, 3, 1]]
ln = Line(pts, c='r', lw=5).pattern('- -', repeats=10)
if doshow:
Expand All @@ -250,6 +273,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 25")
if doshow:
shape = load(dataurl+"timecourse1d.npy")[58]
pts = shape.rotate_x(30).points()
Expand All @@ -259,6 +283,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 26")
if doshow:
shape = load(dataurl+"timecourse1d.npy")[55]
curvs = Line(shape.points()).curvature()
Expand All @@ -270,6 +295,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 27")
aline = Line([(0,0,0),(1,3,0),(2,4,0)])
surf1 = aline.sweep((1,0.2,0), res=3)
surf2 = aline.sweep((0.2,0,1))
Expand All @@ -279,6 +305,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 28")
pts = [(-4,-3),(1,1),(2,4),(4,1),(3,-1),(2,-5),(9,-3)]
ln = Line(pts, c='r', lw=2).z(0.01)
rl = RoundedLine(pts, 0.6)
Expand All @@ -287,6 +314,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 29")
pts = np.random.randn(25,3)
for i,p in enumerate(pts):
p += [5*i, 15*sin(i/2), i*i*i/200]
Expand All @@ -295,6 +323,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 30")
xcoords = np.arange(0, 2, 0.2)
ycoords = np.arange(0, 1, 0.2)
sqrtx = sqrt(xcoords)
Expand All @@ -310,6 +339,7 @@ def fibonacci_sphere(n):


######################################################
print("Test 31")
settings.immediate_rendering = False
plt = Plotter(N=18)
for i in range(18):
Expand Down
2 changes: 1 addition & 1 deletion vedo/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def _on_keypress(self, evt):
pts = self.spline.points()
n = fit_plane(pts, signed=True).normal # compute normal vector to points
rb = Ribbon(pts - tol * n, pts + tol * n, closed=True)
self.mesh.cutWithMesh(rb, invert=inv) # CUT
self.mesh.cut_with_mesh(rb, invert=inv) # CUT
self.txt2d.text(self.msg) # put back original message
if self.drawmode:
self._on_right_click(evt) # toggle mode to normal
Expand Down
4 changes: 2 additions & 2 deletions vedo/interactor_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ def _right_up(self, w, e):
self.right = False

def _wheel_forward(self, w, e):
self.mouse_wheel_forward()
self._mouse_wheel_forward()

def _wheel_backward(self, w, e):
self.mouse_wheel_backward()
self._mouse_wheel_backward()

def _mouse_move(self, w, e):
if self.left:
Expand Down
5 changes: 0 additions & 5 deletions vedo/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,11 +1398,6 @@ def check_validity(self, tol=0):
varr = vald.GetOutput().GetCellData().GetArray("ValidityState")
return vtk2numpy(varr)

@deprecated(reason=vedo.colors.red + "Please use compute_curvature()" + vedo.colors.reset)
def addCurvatureScalars(self, method=0):
"""Deprecated. Please use `compute_curvature()`"""
return self.compute_curvature(method)

def compute_curvature(self, method=0):
"""
Add scalars to `Mesh` that contains the curvature calculated in three different ways.
Expand Down
Loading

0 comments on commit 602fb8c

Please sign in to comment.