Add create_rotation helper function
Rotation matrix construction not implemented in MTL yet
This commit is contained in:
parent
65c395c551
commit
d8235f1266
@ -6,6 +6,10 @@
|
|||||||
#include <mtl/fixed.hpp>
|
#include <mtl/fixed.hpp>
|
||||||
#include <mtl/vec.hpp>
|
#include <mtl/vec.hpp>
|
||||||
#include <mtl/mat.hpp>
|
#include <mtl/mat.hpp>
|
||||||
|
#include <mtl/exception.hpp>
|
||||||
|
|
||||||
|
// TODO: Implement in MTL and create version that doesn't need cos of the angle
|
||||||
|
mtl::mat<2, 2> create_rotation(mtl::fixed angle_cos);
|
||||||
|
|
||||||
namespace fractal {
|
namespace fractal {
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,23 @@
|
|||||||
|
|
||||||
#include <mtl/exception.hpp>
|
#include <mtl/exception.hpp>
|
||||||
#include <mtl/log.hpp>
|
#include <mtl/log.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
using mtl::endl;
|
using mtl::endl;
|
||||||
namespace log = mtl::log;
|
namespace mlog = mtl::log;
|
||||||
|
|
||||||
|
using mtl::fixed;
|
||||||
|
using mtl::vec2;
|
||||||
|
using mtl::mat;
|
||||||
|
|
||||||
|
mtl::mat<2, 2> create_rotation(mtl::fixed angle_cos) {
|
||||||
|
fixed angle_sin = fixed(1) - angle_cos * angle_cos;
|
||||||
|
|
||||||
|
return mat<2, 2>({
|
||||||
|
{ angle_cos, -angle_sin },
|
||||||
|
{ angle_sin, angle_cos }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
namespace fractal {
|
namespace fractal {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user