tgrekov-fdf
HIVE fdf May 2024
Loading...
Searching...
No Matches
project_map.c File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* project_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/15 06:23:14 by tgrekov #+# #+# */
/* Updated: 2024/06/24 08:54:11 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file project_map.c.

#include <math.h>
#include "../fdf.h"
#include "map.h"
Include dependency graph for project_map.c:

Go to the source code of this file.

Functions

static void apply_offset (t_map map, int x_offset, int y_offset)
 Apply offset to projected coordinates.
 
static void project (t_map map, int scale)
 Generate coordinates from map input and scale via isometric projection.
 
static void calc_size (t_map map, int *size)
 Get boundaries of projected map.
 
int project_map (t_map map, int *size)
 Project map and attempt to automatically scale to viewport.
 

Function Documentation

◆ apply_offset()

static void apply_offset ( t_map  map,
int  x_offset,
int  y_offset 
)
static

Apply offset to projected coordinates.

Parameters
map
x_offsetOffset required for left-most x to be zero
y_offsetOffset required for top-most y to be zero

Definition at line 31 of file project_map.c.

References s_map::height, s_map::point, s_point::projected, and s_map::width.

Here is the caller graph for this function:

◆ calc_size()

static void calc_size ( t_map  map,
int *  size 
)
static

Get boundaries of projected map.

Parameters
map
size

Definition at line 91 of file project_map.c.

References s_map::height, s_map::point, s_point::projected, and s_map::width.

Here is the caller graph for this function:

◆ project()

static void project ( t_map  map,
int  scale 
)
static

Generate coordinates from map input and scale via isometric projection.

Parameters
map
scale

Definition at line 56 of file project_map.c.

References apply_offset(), s_point::height, s_map::height, s_map::point, s_point::projected, and s_map::width.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ project_map()

int project_map ( t_map  map,
int *  size 
)

Project map and attempt to automatically scale to viewport.

Parameters
map
size
Return values
int0 if scaling was successful, 1 if map was too large

Definition at line 121 of file project_map.c.

References calc_size(), s_map::height, project(), and s_map::width.

Here is the call graph for this function:
Here is the caller graph for this function: