freevec.org

  • about
  • benchmarks
Home

Search

Primary links

  • About
    • History of libfreevec
  • Benchmarks
    • libfreevec

Please donate to libfreevec to ensure its continuing development! Donations are done via Paypal.





Matrix 4x4 Translation of a vector

markos — Sat, 01/03/2008 - 20:56

(Please see Matrix 4x4 addition/subtraction (floats) for the typedefs and definitions used.)

Getting the translation matrix of a vector is essential to do movements of a vector in 3D space.

For the theory behind translation matrices please see http://en.wikipedia.org/wiki/Translation_(geometry)

We follow a similar method as in the Identity matrix:

void Mat44Identity(Mat44 m, Vec4f pVec)
{
        vector float v0 = vec_ctf(vec_splat_u32(0), 0);
        LOAD_VECTOR(vvec, pVec);
 
        CLEAR_VECTOR(&m[0]);
        CLEAR_VECTOR(&m[4]);
        CLEAR_VECTOR(&m[8]);
        STORE_VECTOR(vvec, &m[12]);
        m[15] = 1.0f;
}

where we defined CLEAR_VECTOR as the macro:

#define CLEAR_VECTOR(vs)                          \
{                                                 \
        vec_st(vec_splat_s8(0), 0, (float *)vs);  \
}

SIMD

  • AltiVec
  • simdX86
  • Matrix operations
  • Login or register to post comments

SIMD

  • Algorithms (31)
    • Algebra (9)
      • Matrix operations (8)
    • Bit operations (0)
    • Codecs (0)
      • Audio (0)
      • Video (0)
    • Comparison (0)
      • image comparison (0)
      • Levenshtein (0)
    • Compression (0)
      • Bzip2 (0)
      • Gzip (0)
      • LZMA (0)
      • LZW (0)
      • Squashfs (0)
      • Zlib (0)
    • Encryption (0)
      • AES (0)
      • DES (0)
      • RSA (0)
      • Salsa (0)
      • SSL (0)
    • Hashing (1)
      • CRC (0)
      • TCP/IP checksum (0)
      • UMAC (0)
    • Memory operations (15)
    • Multiprecision (0)
    • Searching (5)
      • String searching (5)
    • Sorting (0)
  • Software (32)
    • Benchmarking (2)
    • Libraries (30)
      • Eigen2 (0)
      • libfreevec (22)
      • simdX86 (8)
  • Architecture (32)
    • AltiVec (32)
    • ARM NEON (0)
    • CELL SPU (0)
    • SSE (0)
    • VIS (0)

User login

  • Create new account
  • Request new password
  • about
  • benchmarks

Copyright (c)2008 by CODEX.
Powered by Drupal. Using theme Deco.
All Google charts have been created by the CSV Chart and Chart API Drupal modules.