Saves transformation matrix for the list of current chains
433151
private void saveMatrix() {

		for (String chainId : currentChainIDs) {
			BiologicalAssemblyTransformation transformation = new BiologicalAssemblyTransformation();
			transformation.setRotationMatrix(currentMatrix.getArray());
			transformation.setTranslation(shift);
			transformation.setId(String.valueOf(modelNumber));
			transformation.setChainId(chainId);
			transformations.add(transformation);
		}

		if (!transformationMap.containsKey(currentBioMolecule)) {
			BioAssemblyInfo bioAssembly = new BioAssemblyInfo();
			bioAssembly.setId(currentBioMolecule);
			bioAssembly.setTransforms(transformations);
			transformationMap.put(currentBioMolecule,bioAssembly);
		}
	}
23360
@Override
  public void getTransform(Matrix transform) {
    super.getTransform(transform);
    if (mDrawMatrix != null) {
      transform.preConcat(mDrawMatrix);
    }
  }
249539
def toarray(self):
        
        return asarray([value.toarray() for (key, value) in sorted(self.transformations.items())])
201968
function transform() {
    for (var _len = arguments.length, matrices = Array(_len), _key = 0; _key < _len; _key++) {
        matrices[_key] = arguments[_key];
    }

    matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;

    var multiply = function multiply(m1, m2) {
        return {
            a: m1.a * m2.a + m1.c * m2.b, c: m1.a * m2.c + m1.c * m2.d, e: m1.a * m2.e + m1.c * m2.f + m1.e,
            b: m1.b * m2.a + m1.d * m2.b, d: m1.b * m2.c + m1.d * m2.d, f: m1.b * m2.e + m1.d * m2.f + m1.f
        };
    };

    switch (matrices.length) {
        case 0:
            throw new Error('no matrices provided');

        case 1:
            return matrices[0];

        case 2:
            return multiply(matrices[0], matrices[1]);

        default:
            var _matrices = matrices,
                _matrices2 = _toArray(_matrices),
                m1 = _matrices2[0],
                m2 = _matrices2[1],
                rest = _matrices2.slice(2);

            var m = multiply(m1, m2);
            return transform.apply(undefined, [m].concat(_toConsumableArray(rest)));
    }
}
462145
def as_matrix_transform(transform):
    
    if isinstance(transform, ChainTransform):
        matrix = np.identity(4)
        for tr in transform.transforms:
            # We need to do the matrix multiplication manually because VisPy
            # somehow doesn't mutliply matrices if there is a perspective
            # component. The equation below looks like it's the wrong way
            # around, but the VisPy matrices are transposed.
            matrix = np.matmul(as_matrix_transform(tr).matrix, matrix)
        return MatrixTransform(matrix)
    elif isinstance(transform, InverseTransform):
        matrix = as_matrix_transform(transform._inverse)
        return MatrixTransform(matrix.inv_matrix)
    elif isinstance(transform, NullTransform):
        return MatrixTransform()
    elif isinstance(transform, STTransform):
        return transform.as_matrix()
    elif isinstance(transform, MatrixTransform):
        return transform
    else:
        raise TypeError("Could not simplify transform of type {0}".format(type(transform)))
734172
def to_twodim_list(self):
        
        if self._timestampFormat is None:
            return self._timeseriesData

        datalist = []
        append   = datalist.append
        convert  = TimeSeries.convert_epoch_to_timestamp
        for entry in self._timeseriesData:
            append([convert(entry[0], self._timestampFormat), entry[1:]])

        return datalist
1281085
def source_changed(self, event):
        
        # bail out early if the chain is empty
        transforms = self._chain.transforms[:]
        if len(transforms) == 0:
            self.transforms = []
            return
        
        # If the change signal comes from a transform that already appears in
        # our simplified transform list, then there is no need to re-simplify.
        if event is not None:
            for source in event.sources[::-1]:
                if source in self.transforms:
                    self.update(event)
                    return
        
        # First flatten the chain by expanding all nested chains
        new_chain = []
        while len(transforms) > 0:
            tr = transforms.pop(0)
            if isinstance(tr, ChainTransform) and not tr.dynamic:
                transforms = tr.transforms[:] + transforms
            else:
                new_chain.append(tr)
        
        # Now combine together all compatible adjacent transforms
        cont = True
        tr = new_chain
        while cont:
            new_tr = [tr[0]]
            cont = False
            for t2 in tr[1:]:
                t1 = new_tr[-1]
                pr = t1 * t2
                if (not t1.dynamic and not t2.dynamic and not 
                   isinstance(pr, ChainTransform)):
                    cont = True
                    new_tr.pop()
                    new_tr.append(pr)
                else:
                    new_tr.append(t2)
            tr = new_tr

        self.transforms = tr
474511
public void resetTransform() {
		sx = 1;
		sy = 1;
		
		if (pushed) {
			predraw();
			GL.glPopMatrix();
			pushed = false;
			postdraw();
		}
	}
543360
@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	protected void doTransform(ITransformable transformable, float comp)
	{
		if (listTransformations.size() == 0)
			return;

		for (Transformation transformation : listTransformations)
			transformation.transform(transformable, elapsedTimeCurrentLoop);
	}
945976
def _update_y_transform(self):
        
        # sort all phis wrt increasing y.
        sorted_data_indices = self._yi_sorted
        sorted_xtransforms = []
        for xt in self.x_transforms:
            sorted_xt = sort_vector(xt, sorted_data_indices)
            sorted_xtransforms.append(sorted_xt)

        sum_of_x_transformations_choppy = numpy.sum(sorted_xtransforms, axis=0)
        y_sorted = sort_vector(self.y, sorted_data_indices)
        smooth = perform_smooth(y_sorted, sum_of_x_transformations_choppy,
                                smoother_cls=self._smoother_cls)
        sum_of_x_transformations_smooth = smooth.smooth_result

        sum_of_x_transformations_smooth -= numpy.mean(sum_of_x_transformations_smooth)
        sum_of_x_transformations_smooth /= numpy.std(sum_of_x_transformations_smooth)

        # unsort to save in the original data
        self.y_transform = unsort_vector(sum_of_x_transformations_smooth, sorted_data_indices)
1064023
def matrixToMathTransform(matrix):
    
    if isinstance(matrix, ShallowTransform):
        return matrix
    off, scl, rot = MathTransform(matrix).decompose()
    return ShallowTransform(off, scl, rot)
372182
def set_rotation_matrices(self):
        """"""
        for i in range(len(self.vertices)):
            self.vertices[i].meta['C'] = rotation_matrix(self.vertices[i].meta['axis'][0], 
                                                         self.vertices[i].meta['axis'][1], 
                                                         self.vertices[i].meta['axis'][2], 
                                                         self.vertices[i].meta['axis_order'],
                                                         degrees=True)
            # Todo: invert this by applying angle operations in reverse order
            self.vertices[i].meta['Cinv'] = np.linalg.inv(self.vertices[i].meta['C'])
55033
def transform(self, trans):
        
        if isinstance(trans, vtk.vtkMatrix4x4):
            t = vtki.trans_from_matrix(trans)
        elif isinstance(trans, vtk.vtkTransform):
            t = vtki.trans_from_matrix(trans.GetMatrix())
        elif isinstance(trans, np.ndarray):
            if trans.shape[0] != 4 or trans.shape[1] != 4:
                raise Exception('Transformation array must be 4x4')
            t = trans
        else:
            raise TypeError('Input transform must be either:\n'
                            + '\tvtk.vtkMatrix4x4\n'
                            + '\tvtk.vtkTransform\n'
                            + '\t4x4 np.ndarray\n')

        x = (self.points*t[0, :3]).sum(1) + t[0, -1]
        y = (self.points*t[1, :3]).sum(1) + t[1, -1]
        z = (self.points*t[2, :3]).sum(1) + t[2, -1]

        # overwrite points
        self.points[:, 0] = x
        self.points[:, 1] = y
        self.points[:, 2] = z
9455
public String serializeTransformList(List<Transform> list) {
        ObjectMapper om = getObjectMapper();
        try {
            return om.writeValueAsString(new ListWrappers.TransformList(list));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
789375
function () {
        var roamTransformable = this._roamTransformable;
        var rawTransformable = this._rawTransformable;

        rawTransformable.parent = roamTransformable;
        roamTransformable.updateTransform();
        rawTransformable.updateTransform();

        matrix.copy(this.transform || (this.transform = []), rawTransformable.transform || matrix.create());

        this._rawTransform = rawTransformable.getLocalTransform();

        this.invTransform = this.invTransform || [];
        matrix.invert(this.invTransform, this.transform);

        this.decomposeTransform();
    }
330438
def _saveL2Representation(self, objectName):
    
    self.objectL2Representations[objectName] = self.getL2Representations()

    try:
      objectIndex = self.objectNameToIndex[objectName]
    except KeyError:
      # Grow the matrices as needed.
      if self.objectNamesAreIndices:
        objectIndex = objectName
        if objectIndex >= self.objectL2RepresentationsMatrices[0].nRows():
          for matrix in self.objectL2RepresentationsMatrices:
            matrix.resize(objectIndex + 1, matrix.nCols())
      else:
        objectIndex = self.objectL2RepresentationsMatrices[0].nRows()
        for matrix in self.objectL2RepresentationsMatrices:
          matrix.resize(matrix.nRows() + 1, matrix.nCols())

      self.objectNameToIndex[objectName] = objectIndex

    for colIdx, matrix in enumerate(self.objectL2RepresentationsMatrices):
      activeCells = self.L2Columns[colIdx]._pooler.getActiveCells()
      matrix.setRowFromSparse(objectIndex, activeCells,
                              np.ones(len(activeCells), dtype="float32"))
893173
function (transformFnc) {
            var ret = [];
            transformFnc = transformFnc || function (item, index) {
                return item;
            };


            this.each(function (item, index) {
                ret.push(transformFnc(item, index));
            });

            return ret;
        }