PyMSES

Table Of Contents

Previous topic

Data structures and containers

Next topic

Sources module

This Page

Dataset transformations

pymses.core.transformations Geometrical transformations module

class Transformation

Bases: object

Base class for all geometric transformations acting on Numpy arrays

inverse()

Returns the inverse transformation

transform_points(coords)

Abstract method. Returns transformed coordinates.

Parameters:
coords – a Numpy array with data points along axis 0 and
coordinates along axis 1+
transform_vectors(vectors, coords)

Abstract method. Returns transformed vector components for vectors attached to the provided coordinates.

Parameters:

vectors – a Numpy array of shape (ndata, ndim) containing the
vector components
coords – a Numpy array of shape (ndata, ndim) containing the point
coordinates
class AffineTransformation(lin_xform, shift)

Bases: pymses.core.transformations.Transformation

An affine transformation (of the type x -> L(x) + shift)

inverse()

Inverse of an affine transformation

transform_points(coords)

Apply the affine transformation to coordinates

transform_vectors(vectors, coords)

Apply the affine transformation to vectors

class LinearTransformation(matrix)

Bases: pymses.core.transformations.Transformation

A generic (matrix-based) linear transformation

inverse()

Inverse of the linear transformation

transform_points(coords)

Applies a linear transformation to coordinates

transform_vectors(vectors, coords)

Applies a linear transformation to vectors

class ChainTransformation(xform_seq)

Bases: pymses.core.transformations.Transformation

Defines the composition of a list of transformations

inverse()

Inverse of a chained transformation

transform_points(coords)

Applies a chained transformation to coordinates

transform_vectors(vectors, coords)

Applies a chained transformation to vectors

identity(n)
Returns :the identity as a LinearTransformation object :
translation(vect)
Returns :

an AffineTransformation object corresponding to a translation :

of the specified vector :

rot3d_axvector_matrix(axis_vect, angle)

Returns the rotation matrix of the rotation with the specified axis vector and angle

rot3d_axvector(axis_vect, angle, rot_center=None)

Returns the Transformation corresponding to the rotation specified by its axis vector, angle, and rotation center.

If rot_center is not specified, it is assumed to be [0, 0, 0].

rot3d_euler(axis_sequence, angles, rot_center=None)

Returns the Transformation corresponding to the rotation specified by its Euler angles and the corresponding axis sequence convention.

The rotation is performed by successively rotating the object around its current local axis axis_sequence[i] with an angle angle[i], for i = 0, 1, 2.

See http://en.wikipedia.org/wiki/Euler_angles for details.

rot3d_align_vectors(source_vect, dest_vect, dest_vect_angle=0.0, rot_center=None)

Gives a Transformation which brings a given source_vect in alignment with a given dest_vect.

Optionally, a second rotation around dest_vect can be specified by the parameter dest_vect_angle.

Parameters :

source_vect : array

source vector coordinates array

dest_vect : array

destination vector coordinates array

dest_vect_angle : float (default 0.0)

optional final rotation angle around the dest_vect vector

Returns :

rot : Transformation

rotation bringing source_vect in alignment with dest_vect. This is done by rotating around the normal to the (source_vect, dest_vect) plane.

Examples

>>> R = rot3d_align_vectors(array([0.,0.,1.]), array([0.5,0.5,0.5]))
scale(n, scale_factor, scale_center=None)