af_transform_coord

The C interface for affine coordinate transforms. More...

afError af_transform_coord_S (float *d_dst, const float *d_src, const unsigned *dims, const float *d_tf, const unsigned *hdims, unsigned batch)
 
afError af_transform_coord_D (double *d_dst, const double *d_src, const unsigned *dims, const double *d_tf, const unsigned *hdims, unsigned batch)
 

Detailed Description

The C interface for affine coordinate transforms.

Using transformation matrices containing homogeneous coordinates,

Using transformation matrices containing homogeneous coordinates, translations can be seamlessly intermixed with all other types of transformations. The reason is that the real plane is mapped to the w = 1 plane in real projective space, and so translation in real Euclidean space can be represented as a shear in real projective space. Although a translation is a non-linear transformation in a 2-D or 3-D Euclidean space described by Cartesian coordinates, it becomes, in a 3-D or 4-D projective space described by homogeneous coordinates, a simple linear transformation (a shear).

When using affine transformations, the homogeneous component of a coordinate vector (normally called w) will never be altered. One can therefore safely assume that it is always 1 and ignore it. However, this is not true when using perspective projections.

The inputs to the transform_coord function are the vertex array of size m x n, where m is the number of points and n is dimensionality of the points, ie. if vertices are 3D then n is 3.

Each column of the vertex array represent a coordinate axis. The 0th column is x, 1st column is y, 2nd column is z, 3rd column is w.

The other input is the transformation matrix. This always need to be a square matrix of size 4x4 or less.

For more about homogeneous transforms, see: Affine Transformations

Function Documentation

afError af_transform_coord_S ( float *  d_dst,
const float *  d_src,
const unsigned *  dims,
const float *  d_tf,
const unsigned *  hdims,
unsigned  batch 
)
Parameters
[out]d_dstthe transformed vertices
[in]d_srcthe input vertices
[in]dimsdimensions fo the input vertex array
[in]d_tfhomogenous transformation matrix (max 4x4)
[in]hdimsdimensions of the homogenous transformation matrix
[in]batchnumber of input batches of vertices
afError af_transform_coord_D ( double *  d_dst,
const double *  d_src,
const unsigned *  dims,
const double *  d_tf,
const unsigned *  hdims,
unsigned  batch 
)