-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils2.c
42 lines (35 loc) · 1.41 KB
/
utils2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: junyojeo <junyojeo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/19 00:59:55 by junyojeo #+# #+# */
/* Updated: 2023/05/19 02:14:18 by junyojeo ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void rotate_x(int *y, int *z, double alpha)
{
int prev_y;
prev_y = *y;
*y = prev_y * cos(alpha) + *z * sin(alpha);
*z = -prev_y * sin(alpha) + *z * cos(alpha);
}
void rotate_y(int *x, int *z, double beta)
{
int prev_x;
prev_x = *x;
*x = prev_x * cos(beta) + *z * sin(beta);
*z = -prev_x * sin(beta) + *z * cos(beta);
}
void rotate_z(int *x, int *y, double gamma)
{
int prev_x;
int prev_y;
prev_x = *x;
prev_y = *y;
*x = prev_x * cos(gamma) + prev_y * sin(gamma);
*y = prev_x * sin(gamma) + prev_y * cos(gamma);
}