Skip to content
Snippets Groups Projects
Commit 723d42ad authored by Harry Carey's avatar Harry Carey
Browse files
parents 10061f03 9024ecb2
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,15 @@ def load_visualign_json(filename):
# save with .json extension need to see if i can remove this
with open(filename.replace(".waln", ".json").replace(".wwrp", ".json"), "w") as f:
json.dump(lz_compat_file, f, indent=4)
for slice in slices:
if "markers" in slice:
slice["markers"] = [
[marker["x"], marker["y"], marker["nx"], marker["ny"]
] for marker in slice["markers"]
]
else:
slices = vafile["slices"]
slices = propagate(slices)
return slices
......
"""This code was written by Gergely Csucs and Rembrandt Bakker"""
import numpy as np
from scipy.spatial import Delaunay
def triangulate(w, h, markers):
vertices = [
......@@ -10,6 +9,7 @@ def triangulate(w, h, markers):
[-0.1 * w, 1.1 * h, -0.1 * w, 1.1 * h],
[ 1.1 * w, 1.1 * h, 1.1 * w, 1.1 * h],
]
edges = [0] * ((len(markers) + 4) * (len(markers) + 4 - 1) // 2)
triangles = [Triangle(0, 1, 2, vertices, edges), Triangle(1, 2, 3, vertices, edges)]
edges[0] = edges[1] = edges[4] = edges[5] = 2
......@@ -233,3 +233,22 @@ class Triangle:
+ (self.B[1] - self.A[1]) * uv1[ok, 0]
+ (self.C[1] - self.A[1]) * uv1[ok, 1]
)
##below this is a test
vertices = [[0, 0,43.54623148539514, 26.174656909777603],
[0, 0,90.8065913697207, 46.20231798893295],
[0, 0,56.29635559428633, 51.23696264352707],
[0, 0,90.87928419178107, 15.497996125973435],
[0, 0,33.966820908745454, 11.999395004637503],
[0, 0,37.29543353675751, 79.4420010252766]]
triangulation = triangulate(100,100,vertices)
new_coords = transform(triangulation, new_coords[0], new_coords[1])
from scipy.spatial import Delaunay
# assuming you have a list of points called "points"
tri = Delaunay(points)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment