LCOV - code coverage report
Current view: top level - math3d - tf.hpp (source / functions) Coverage Total Hit
Test: coverage_clean.info Lines: 100.0 % 8 8
Test Date: 2026-03-30 03:13:12 Functions: 100.0 % 5 5

            Line data    Source code
       1              : #pragma once
       2              : #include "vec3.hpp"
       3              : #include "quat.hpp"
       4              : 
       5              : namespace m3d
       6              : {
       7              :     struct tf
       8              :     {
       9              :         vec3 pos;
      10              :         quat rot;
      11              : 
      12          111 :         tf() : pos(0, 0, 0), rot(1, 0, 0, 0) {}
      13        20010 :         tf(const vec3 &p, const quat &q) : pos(p), rot(q) {}
      14              : 
      15              :         // Converts a point in the local frame of this transform to world space
      16         4349 :         inline vec3 transform_point(const vec3 &p) const
      17              :         {
      18         4349 :             return pos + rotate(rot, p);
      19              :         }
      20              : 
      21              :         // Rotates a vectors (Ignore translation)
      22         4271 :         inline vec3 rotate_vector(const vec3 &d) const
      23              :         {
      24         4271 :             return rotate(rot, d);
      25              :         }
      26              : 
      27              :         // Rotates a vector by the inverse of this transform's rotation (useful for transforming directions into local space)
      28         9653 :         inline vec3 inverse_rotate_vector(const vec3 &d) const
      29              :         {
      30         9653 :             return rotate(conjugate(rot), d);
      31              :         }
      32              :     };
      33              : }
        

Generated by: LCOV version 2.0-1