-
Notifications
You must be signed in to change notification settings - Fork 8
How to perform isometric transformations?
VBrazhnik edited this page Aug 23, 2018
·
2 revisions
There are true isometric projection and 2:1 isometric projection.
True isometric projection uses a 30° angle (0.523599 rad).
2:1 isometric projection uses a 26.57° angle (0.46373398 rad).
Code for transforming:
static void iso(int *x, int *y, int z)
{
int previous_x;
int previous_y;
previous_x = *x;
previous_y = *y;
*x = (previous_x - previous_y) * cos(0.523599);
*y = -z + (previous_x + previous_y) * sin(0.523599);
}
t_point project(t_point p, t_fdf *fdf)
{
// ...
if (fdf->camera->projection == ISO)
iso(&p.x, &p.y, p.z);
// ...
}