include fix

This commit is contained in:
2022-03-03 20:58:10 +01:00
parent 83f1872f43
commit 3e342396fe
3 changed files with 44 additions and 7 deletions

View File

@@ -2,14 +2,27 @@
#include <iostream>
#include <thread>
#include <vector>
#include <cmath>
using namespace std::chrono_literals;
#include "display/EPD_7in5_V2.hpp"
#include "render/RenderTarget.hpp"
int main()
{
double const pi = 3.14159;
std::cout << "pi: " << pi << " " << 3.14159f << std::endl;
std::cout << "pi / 180;" << pi / 180.f << std::endl;
for(int i = 0; i < 360; i += 45)
{
std::cout << "(i): " << i << std::endl;
std::cout << "rad: " << (float)i * pi / 180.f << std::endl;
}
return 0;
frame::display::EPD_7in5_V2 display{};
@@ -21,15 +34,28 @@ int main()
frame::Vector const center = (display.getSize() / 2);
frame::Vector v = {10, 12};
std::cout << "Main: " << v << std::endl;
target.DrawPixel({10, 10}, frame::BLACK);
target.DrawLine({10, 12}, {100, 12}, frame::BLACK);
target.DrawLine(v, {100, 12}, frame::BLACK);
for(int i = 0; i < 360; i += 45)
{
auto end = center;
end.x += (int)std::cos(i * 0.01745329);
end.y += (int)std::sin(i * 0.01745329);
double const cos_ = i * 0.01745329;
std::cout << i << " cos: " << cos_ << std::endl;
double x = std::cos(cos_);
double y = std::sin(i * 0.01745329);
x *= 50.f;
y *= 50.f;
std::cout << x << " " << (int)x << " " << y << std::endl;
end.x += (int)x;
end.y += (int)y;
std::cout << end << std::endl;
target.DrawLine(center, end);
}