1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
class position {
public:
float x, y, z, fd;
position(float x = 0.0f, float y = 0.0f, float z = 0f, float fd = 300.0f)
: x(x), y(x), z(z), fd(fd) {
}
operator POINT () const {
RECT WindowSize;
GetClientRect(GetConsoleWindow(), &WindowSize);
auto perespective = fd / z + foco;
return {(LONG)std::trunc(x*perespective) + WindowSize.right/2,
(LONG)std::trunc(y*perespective) + WindowSize.bottom/2};
}
};
std::vector<POINT> planePoints{
static_cast<POINT>(position{-100, 50, 0}),
static_cast<POINT>(position{-100, 50, 1000}),
static_cast<POINT>(position{100, 50,1000}),
static_cast<POINT>(position{100, 50, 0})};
Polygon(HDCConsole, &planePoints.front(), planePoints.size());
| |