Skip to content

Commit

Permalink
ongoing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Leitner committed Mar 16, 2023
1 parent 3078b41 commit cd5fe05
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/functional/Perirhizal.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def get_voronoi_mesh(self, domain = None):

points_array = vtk.vtkPoints() # Add the Voronoi vertices as points
for v in vor.vertices:
points_array.InsertNextPoint(v)
if domain.dist(v) <= 0:
points_array.InsertNextPoint(v)
else:
points_array.InsertNextPoint([0, 0, 0]) # simpler for vizualizing in ParaView
grid.SetPoints(points_array)

vol = []
Expand Down Expand Up @@ -207,25 +210,20 @@ def get_voronoi_mesh(self, domain = None):
return grid

def make_periodic_(self, nodes, width):
"""
""" maps the point periodically into [-width / 2., width / 2.] for x and y
"""
nodes_ = nodes.copy()
for n in nodes_:
n[0] = n[0] - ((n[0] + width[0] / 2.) // width[0]) * width[0]
n[1] = n[1] - ((n[1] + width[1] / 2.) // width[1]) * width[1]

if n[0] < -width[0] / 2:
print("n[0] < -width[0] / 2", n)

if n[0] > width[0] / 2:
print("n[0] > width[0] / 2", n)

if n[1] < -width[1] / 2:
print("n[1] < -width[0] / 2", n)

if n[1] > width[1] / 2:
print("n[1] > width[0] / 2", n)

# if n[0] < -width[0] / 2:
# print("n[0] < -width[0] / 2", n)
# if n[0] > width[0] / 2:
# print("n[0] > width[0] / 2", n)
# if n[1] < -width[1] / 2:
# print("n[1] < -width[0] / 2", n)
# if n[1] > width[1] / 2:
# print("n[1] > width[0] / 2", n)
return nodes_

def intersect_polygon_quader_(self, polygon, quader):
Expand Down

0 comments on commit cd5fe05

Please sign in to comment.