<commit_before>/*
 *   Copyright (C) 2011 by <NAME>
 *
 *   Permission is hereby granted, free of charge, to any person obtaining a copy
 *   of this software and associated documentation files (the "Software"), to deal
 *   in the Software without restriction, including without limitation the rights
 *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *   copies of the Software, and to permit persons to whom the Software is
 *   furnished to do so, subject to the following conditions:
 */

#ifndef HSTEFAN_TRANSFORM_HPP
#define HSTEFAN_TRANSFORM_HPP

#include "vector.hpp"
#include "matrix.hpp"
#include <cmath>

namespace hstefan
{
namespace math
{

inline vec2 RotateClockwise(const vec2& vec, float angle)
{
   mat2d m = { 
      std::cos(angle) , std::sin(angle), 
      -std::sin(angle), std::cos(angle) 
   };

   return m*vec;
}

inline vec2 RotateAntiClockwise(const vec2& vec, float angle)
{
   mat2d m = {
      std::cos(angle), -std::sin(angle), 
      std::sin(angle),  std::cos(angle)
   };

   return m*vec;
}

} //namespace math
} //namespace hstefan
#endif<commit_msg>offering a methods to homogeneous transformations<commit_after>/*
 *   Copyright (C) 2011 by <NAME>
 *
 *   Permission is hereby granted, free of charge, to any person obtaining a copy
 *   of this software and associated documentation files (the "Software"), to deal
 *   in the Software without restriction, including without limitation the rights
 *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *   copies of the Software, and to permit persons to whom the Software is
 *   furnished to do so, subject to the following conditions:
 */

#ifndef HSTEFAN_TRANSFORM_HPP
#define HSTEFAN_TRANSFORM_HPP

#include "vector.hpp"
#include "matrix.hpp"
#include <cmath>

namespace hstefan
{
namespace math
{
//deprecated
inline vec2 rotateClockwise(const vec2& vec, float angle)
{
   mat2d m = { 
      std::cos(angle) , std::sin(angle), 
      -std::sin(angle), std::cos(angle) 
   };

   return m*vec;
}

//deprecated
inline vec2 rotateAntiClockwise(const vec2& vec, float angle)
{
   mat2d m = {
      std::cos(angle), -std::sin(angle), 
      std::sin(angle),  std::cos(angle)
   };

   return m*vec;
}

inline mat3d rotMat2dh(float angle)
{ 
   mat3d m = {
      std::cos(angle), -std::sin(angle), 0,
      std::sin(angle), std::cos(angle) , 0,
      0              , 0,                1
   }

   return m;
}

inline mat3d scaleMat2dh(float sx, float sy)
{ 
   mat3d m = {
      sx, 0 , 0,
      0 , sy, 0,
      0 , 0 , 1
   }

   return m;
}

inline mat3d transMat2dh(int tx, int ty)
{
   mat3d m = {
      1, 0, tx,
      0, 1, ty,
      0, 0, 1
   }

   return m;
}

} //namespace math
} //namespace hstefan
#endif
{'fraction_non_alphanumeric': 0.11545421643141512, 'fraction_numerical': 0.01737242128121607, 'mean_word_length': 3.119225037257824, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4083671', 'n_tokens_mistral': 968, 'n_tokens_neox': 921, 'n_words': 303}