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

Function compute_dirs

utils/strand_util.py:506–517  ·  view source on GitHub ↗
(strand_positions, append_last_dir=True)

Source from the content-addressed store, hash-verified

504
505#strand positions should be [nr_strands,nr_verts,3]
506def compute_dirs(strand_positions, append_last_dir=True):
507 nr_verts_per_strand=strand_positions.shape[1]
508 cur_points = strand_positions[:, 0:nr_verts_per_strand - 1, :]
509 next_points = strand_positions[:, 1:nr_verts_per_strand, :]
510 dirs = next_points - cur_points
511
512 #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
513 if append_last_dir:
514 last_dir=dirs[:,-1:,:]
515 dirs = torch.cat([dirs, last_dir],1) # make the direction nr_strands, 100, 3
516
517 return dirs
518
519#strand positions should be [nr_strands,nr_verts,3]
520def compute_curv(strand_dirs, append_last_curv=True):

Callers 6

prepare_gt_batchFunction · 0.90
prepare_gt_batchFunction · 0.90
compute_loss_dir_dotFunction · 0.90
compute_loss_dir_l1Function · 0.90
compute_loss_curv_l1Function · 0.90
prepare_gt_batchFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected