pydistsim.utils.localization.basestitcher.BaseStitcher
- class BaseStitcher(selector=None)[source]
Bases:
objectBase class for stitching two clusters.
- Subclasses should implement own methods for subcluster stitching named:
stitch_subclusters
These methods should take two subclusters as dictionary {node: position} where position is array([x,y,theta]) with at least one common node and return rotation matrix R, scaling factor s and translation vector t.
If stitch_subclusters method can’t be sure that all parameters are correct i.e. when common nodes are not in generic formation then it should return None for all parameters.
Methods
__init__Align (modify) src w.r.t.
intrastitchStitch src cluster to dst cluster based on selector and its criteria.
Transform node position.
- _get_rotation_matrix_horn(commonNodes, dstSubPos, srcSubPos, p_d, p_s)[source]
Horn method for calculating rotation matrix.
- _stitch(dst, src, is_intra=False)[source]
- Iteratively:
selects subclusters to stitch using self.selector
stitch - find out R, s and t
append transformed node positions from src to dst subcluster
- Return stitched dictionary where:
keys - are pairs of indexes of all stitched subclusters values - are their R, s and t transformation parameters
or all of them are None if can’t be calculated reliably or () if src subcluster is subset of dst
- stitch(dst, src, do_intra=True)[source]
Stitch src cluster to dst cluster based on selector and its criteria.
Stitch all src subclusters to dst.
Append unstitched source subclusters to dst cluster.
If do_intra stitch subclusters internally.
src and dst clusters are in format defined in pydistsim.utils.memory.positions.Positions.subclusters: [{node1: array(x1,y1), node2: array(x2,y2), …}, …]