Skip to content

Commit 44cb227

Browse files
authored
calc gauss code using pyknotid
SPOCKnots/pyknotid#13
1 parent d5906e6 commit 44cb227

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

spectre_tiles_blender.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,23 @@ def find_curve_knots( cu ):
19871987
print('knotoid:')
19881988
print(info)
19891989

1990+
def calc_gauss_code( cu ):
1991+
assert len(cu.data.splines)==1
1992+
points = []
1993+
for pnt in cu.data.splines[0].bezier_points:
1994+
x,y,z = pnt.handle_left
1995+
points.append([x,y,z])
1996+
x,y,z = pnt.co
1997+
points.append([x,y,z])
1998+
x,y,z = pnt.handle_right
1999+
points.append([x,y,z])
2000+
2001+
k = knotid.sp.SpaceCurve( points )
2002+
print(k)
2003+
g = k.gauss_code(recalculate=True, try_cython=False)
2004+
print('guass code:', g)
2005+
return g
2006+
19902007

19912008
if __name__ == '__main__':
19922009
args = []
@@ -2459,6 +2476,8 @@ def find_curve_knots( cu ):
24592476
#knots = knotoid.calc_knotoid( ktrace )
24602477
knots = find_curve_knots( trace_cu )
24612478
print(knots)
2479+
if knotid:
2480+
gauss = calc_gauss_code( trace_cu )
24622481

24632482
#bpy.ops.wm.save_as_mainfile(filepath=tmp, check_existing=False)
24642483
if matplotlib and GLOBALS['plot']:

0 commit comments

Comments
 (0)