MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / save_hair_strands

Function save_hair_strands

utils/strand_util.py:70–86  ·  view source on GitHub ↗
(path,strands)

Source from the content-addressed store, hash-verified

68
69
70def save_hair_strands(path,strands):
71 segments = [strands[i].shape[0] for i in range(len(strands))]
72 hair_count=len(segments)
73 point_count=sum(segments)
74 points = np.concatenate(strands,0)
75
76 with open(path, 'wb')as f:
77 f.write(struct.pack('I', hair_count))
78 f.write(struct.pack('I', point_count))
79 for num_every_strand in segments:
80 f.write(struct.pack('H', num_every_strand ))
81
82 for vec in points:
83 f.write(struct.pack('f', vec[0]))
84 f.write(struct.pack('f', vec[1]))
85 f.write(struct.pack('f', vec[2]))
86 f.close()
87
88
89def get_strands(points):

Callers

nothing calls this directly

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected