Share via


_Xform3dV

9/7/2007

Multiplies a three-dimensional vector by a 3x3 matrix. This intrinsic will load a constant zero into Bank1 floating-point registers (fr12, fr13, fr14, fr15) and Bank0 floating-point register (fr3).

Syntax

float* _Xform3dV( 
  float* dst, 
  float* src, 
  float* matrix 
);

Parameters

  • dst
    [out] Pointer to a three-dimensional destination vector.
  • src
    [in] Pointer to a three-dimensional source vector.
  • matrix
    [in] Pointer to an array of float values arranged such that the indices of the array are the [row][column] values of the 3x3 matrix.

Return Values

Pointer to the three-dimensional destination vector.

Remarks

The following code shows how to use _Xform3dV.

#include <stdio.h>
#include <shintr.h>

void print_matrix(float *matrix, float *src, float *dest)
{
    int row, col;

    printf("Matrix:\t\t\tSrc:\tDest:\n");
    for (row = 0; row < 3; row++)
    {
        printf("| ");
        for (col = 0; col < 3; col++)
        {
            printf("%6.2f", *matrix++);
        }
        printf(" |");
        printf(" |%6.2f|", *src++);
        printf("\t|%10.4f|\n", *dest++);
    }
}

void main()
{
    int i;
    float dest[3];
    float src[3] = {1.0, 2.0, 3.0}

    float matrix[9]={1.0, 2.0, 3.0,
                     4.0, 5.0, 6.0,
                     7.0, 8.0, 9.0};

      _Xform3dV(dest, src, matrix);   // [matrix]x[src[i]] à dest[i]
      print_matrix(matrix, src, dest);
}
Output
Matrix:                 Src:    Dest:
|   1.00  2.00  3.00 | |  1.00| |   14.0000|
|   4.00  5.00  6.00 | |  2.00| |   32.0000|
|   7.00  8.00  9.00 | |  3.00| |   50.0000|

Requirements

Routine Required header Architecture

_Xform3dV

<shintr.h>

SH-4

See Also

Reference

Intrinsic Functions for Renesas Microprocessors
_Xform4dV
_XDXform4dV
_XDXform3dV
_LoadMatrix
_SaveMatrix