Jamie Slowgrove - MGP Assignment 2 - JAM
 All Classes Namespaces Files Functions Variables Macros
Functions
JAM_LOS Namespace Reference

A Namespace that contains functions for the Line Of Sight. More...

Functions

bool lineOfSight (JAM_Vec2 a, JAM_Vec2 b, std::vector< std::vector< JAM_Node * >> map, int nodeSize)
 
bool lineLineIntersectionCheck (JAM_Vec2 a, JAM_Vec2 b, JAM_Vec2 c, JAM_Vec2 d, char axis)
 
void drawLineOfSight (JAM_Vec2 a, JAM_Vec2 b, std::vector< std::vector< JAM_Node * >> map, int nodeSize, SDL_Renderer *renderer)
 
JAM_Vec2 getNewTarget (JAM_Vec2 a, std::vector< std::vector< JAM_Node * >> map, int nodeSize)
 

Detailed Description

A Namespace that contains functions for the Line Of Sight.

Author
Jamie Slowgrove Reference ~ This is a modified version of my LOS from my AI assignment.

Function Documentation

void JAM_LOS::drawLineOfSight ( JAM_Vec2  a,
JAM_Vec2  b,
std::vector< std::vector< JAM_Node * >>  map,
int  nodeSize,
SDL_Renderer *  renderer 
)

Check if two positions can see each other and draw the tested tiles.

Parameters
aPosition a.
bPosition b.
mapA 2D vector of nodes.
nodeSizeThe size of the node.
rendererA pointer to the renderer.

Here is the call graph for this function:

JAM_Vec2 JAM_LOS::getNewTarget ( JAM_Vec2  a,
std::vector< std::vector< JAM_Node * >>  map,
int  nodeSize 
)

Find a new target position to go to.

Parameters
aPosition a.
mapA 2D vector of nodes.
nodeSizeThe size of the node.
Returns
The new target position.

Here is the call graph for this function:

bool JAM_LOS::lineLineIntersectionCheck ( JAM_Vec2  a,
JAM_Vec2  b,
JAM_Vec2  c,
JAM_Vec2  d,
char  axis 
)

Check if two lines intersect.

Parameters
aPosition a. (line 1)
bPosition b. (line 1)
vPosition c. (line 2)
dPosition d. (line 2)
axisAxis that the second line being tested is on.
Returns
If the lines intersect.

Here is the caller graph for this function:

bool JAM_LOS::lineOfSight ( JAM_Vec2  a,
JAM_Vec2  b,
std::vector< std::vector< JAM_Node * >>  map,
int  nodeSize 
)

Check if two positions can see each other.

Parameters
aPosition a.
bPosition b.
mapA 2D vector of nodes.
nodeSizeThe size of the node.
Returns
If the position can see each other.

Here is the call graph for this function:

Here is the caller graph for this function: