-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfdf.h
94 lines (83 loc) · 2.27 KB
/
fdf.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kmummadi <kmummadi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/22 13:04:13 by kmummadi #+# #+# */
/* Updated: 2024/12/21 11:29:29 by kmummadi ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# define _USE_MATH_DEFINES
# include "./MLX42/include/MLX42/MLX42.h"
# include "./ft_printf/ft_printf.h"
# include "get_next_line.h"
# include <fcntl.h>
# include <limits.h>
# include <math.h>
# include <stdio.h>
# include <stdlib.h>
# define WIDTH 1700
# define HEIGHT 1700
# define CELLS 35
# define COLOR1 0xE0E0E055
# define COLOR2 0xFF7619FF
typedef struct s_point
{
int x;
int y;
int z;
} t_point;
typedef struct s_algo
{
int xacc;
int yacc;
int dx;
int dy;
int step;
} t_algo;
typedef struct s_line
{
int x_start;
int y_start;
int x_end;
int y_end;
double z_start;
double z_end;
int max_z;
} t_line;
typedef struct s_dimensions
{
int width;
int height;
int **values;
int max_z;
int min_z;
int cells;
} t_dim;
typedef struct s_i_or_j
{
int i;
int j;
} t_ij;
typedef struct s_color
{
uint8_t r;
uint8_t g;
uint8_t b;
} t_color;
t_dim *setup_dim(int fd, char *file);
void initialize_window(t_dim *dim);
void draw_line(mlx_image_t *image, t_line *pos, uint32_t color);
void dda_algorithm(t_line *pos, t_algo *dda, t_line *line);
void draw_fdf(mlx_image_t *image, t_dim *dim);
int find_step(int dx, int dy);
void isometric_projection(int *x, int *y, int z, t_dim *dim);
void draw_pixel(mlx_image_t *image, uint32_t x, uint32_t y,
uint32_t color);
uint32_t ft_atoi_base(const char *str);
void free_all(t_dim **dim);
#endif