# computeLinearTransform

Compute a linear transformation matrix from two points.

## Syntax

    [rotMat, offsetPos] = computeLinearTransform(pos1, pos2)
    [rotMat, offsetPos] = computeLinearTransform(pos1, pos2, offset)

## Description

`computeLinearTransform` calculates a linear transformation matrix that maps from the origin to a point in space, where the orientation of the transformation is defined by a second point in space. It can be used to generate a transformation matrix for bowl (or disc) transducers, where `pos1` is the Cartesian position of the centre of the rear surface of the bowl or disc, and `pos2` is any point on the beam axis.

An offset can optionally be defined which specifies a distance along the vector from `pos1` to `pos2`. The position of this offset in transformed space is returned as `offsetPos`. Note, giving a value for `offset` does not modify the rotation matrix.

## Inputs

`pos1` | Cartesian position given as a three element vector `[bx, by, bz]` [m]
`pos2` | Cartesian position given as a three element vector `[fx, fy, fz]` [m]

## Optional Inputs

`offset` | Scalar distance along the vector `pos1->pos2` [m]

## Outputs

`rotMat` | Rotation matrix
`offsetPos` | Vector position of offset input [m]

## See Also

`getAffineMatrix`