Last active
February 15, 2017 11:42
-
-
Save zeffii/f06c49d67724d637aa258fac001497d9 to your computer and use it in GitHub Desktop.
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
""" | |
in gp_verts v | |
in filter_dist s d=0.2 n=2 | |
out points v | |
""" | |
import math | |
def dist(a, b): | |
v = a[0]-b[0], a[1]-b[1], a[2]-b[2] | |
return math.sqrt((v[0] * v[0]) + (v[1] * v[1]) + (v[2] * v[2])) | |
points = [] | |
for vecs in gp_verts: | |
new_points = [] | |
append = new_points.append | |
append(vecs[0]) | |
for idx in range(0, len(vecs)-2): | |
a = new_points[-1] | |
b = vecs[idx + 1] | |
d = dist(a, b) | |
if d < filter_dist: | |
continue | |
append(b) | |
append(vecs[-1]) | |
points.append(new_points) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment