#! /usr/bin/python3 # Last edited on 2020-03-08 08:54:54 by jstolfi # This module provides functions to convert from absolute # matchstick part placements to parent-relative ones. # For a description of the matchstick model and of the structure # of (absolute) placement data, see {nmwk_compute_abs_matchstick_parms.py} import sys, math, rn, rmxn def nmwk_model_abs_to_rel(Labs): # Each element of {Labs} should be a part placement tuple with the # coordinates of the local origin and axis vectors relative to the # scene's coordinate system. The first two elements of the placement # tuple should be the name of the part and the name of its parent, the # proximal body part to which it is attached; or "none" if the part is # a /root part/ (has no parent). These parent links must define a # forest structure. # The function returns the list of the same placements, except that # the origin and axis vector of each part which has a parent are # expressed relative to the local coordinate system of that parent. assert False # To be implemented. #--------------------------------------------------------------------- def nmwk_part_abs_to_rel(Pabs, Rabs): # Given the absolure placement data {Pabs,Rabs} for some # part {P} and for its parent part {R}, returns the # placement {Prel} of {P} relative to {R}. Namely, # the origin and axis vectors of {P} are expressed relative to # the coordinate system of {R}. assert False # To be implemented. #---------------------------------------------------------------------