private List < List < Integer > > orientLayerLines ( List < List < Integer > > layerLines ) { Matrix4d transformation = helixAxisAligner . getTransformation ( ) ; List < Point3d > centers = helixAxisAligner . getSubunits ( ) . getOriginalCenters ( ) ; for ( int i = 0 ; i < layerLines . size ( ) ; i ++ ) { List < Integer > layerLine = layerLines . get ( i ) ; // get center of first subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int first = layerLine . get ( 0 ) ; Point3d firstSubunit = new Point3d ( centers . get ( first ) ) ; transformation . transform ( firstSubunit ) ; // get center of last subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int last = layerLine . get ( layerLine . size ( ) - 1 ) ; Point3d lastSubunit = new Point3d ( centers . get ( last ) ) ; transformation . transform ( lastSubunit ) ; // a layerline should start at the lowest y-value, so all layerlines have a consistent direction from -y value to +y value if ( firstSubunit . y > lastSubunit . y ) { // System.out.println("reorienting layer line: " + layerLine); Collections . reverse ( layerLine ) ; } } return layerLines ; }
Orients layer lines from lowest y - axis value to largest y - axis value