29 lines
1.2 KiB
C
29 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: o_ :::::: ::: */
|
|
/* rotate_x.c :+: / :+::+: :+: */
|
|
/* +:+ > +:++:+ +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
|
|
/* +#+ +#+#+ +#++#+ +#+ \o/ */
|
|
/* Created: 2024/12/20 11:21:52 by whaffman #+#+# #+#+# #+# #+# | */
|
|
/* Updated: 2024/12/20 11:21:52 by whaffman ### ### ### ### / \ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "fdf.h"
|
|
|
|
void rotate_x(t_point_3d **points, double angle, int size)
|
|
{
|
|
int i;
|
|
double previous_y;
|
|
|
|
i = 0;
|
|
while (i < size)
|
|
{
|
|
previous_y = (*points)[i].y;
|
|
(*points)[i].y = previous_y * cos(angle) + (*points)[i].z * sin(angle);
|
|
(*points)[i].z = -previous_y * sin(angle) + (*points)[i].z * cos(angle);
|
|
i++;
|
|
}
|
|
}
|