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

Function compute_curv

utils/strand_util.py:520–531  ·  view source on GitHub ↗
(strand_dirs, append_last_curv=True)

Source from the content-addressed store, hash-verified

518
519#strand positions should be [nr_strands,nr_verts,3]
520def compute_curv(strand_dirs, append_last_curv=True):
521 nr_verts_per_strand=strand_dirs.shape[1]
522 cur_dirs = strand_dirs[:, 0:nr_verts_per_strand - 1, :]
523 next_dirs = strand_dirs[:, 1:nr_verts_per_strand, :]
524 curvs = next_dirs - cur_dirs
525
526 #dirs have nr_verts-1 because the last point doesn-t have a direction. To get the same nr_verts we duplicate the last dir
527 if append_last_curv:
528 last_curv=curvs[:,-1:,:]
529 curvs = torch.cat([curvs, last_curv],1) # make the direction nr_strands, 100, 3
530
531 return curvs
532
533
534

Callers 1

compute_loss_curv_l1Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected