Adventure at Umalu  22nd March, 2013
Rogue-like Dungeon Crawler, written in Java
 All Classes Functions Variables Pages
Public Member Functions | Protected Member Functions | List of all members
jade.fov.RayCaster Class Reference
Inheritance diagram for jade.fov.RayCaster:
jade.fov.ViewField

Public Member Functions

 RayCaster ()
 
- Public Member Functions inherited from jade.fov.ViewField
final Collection< CoordinategetViewField (World world, int x, int y, int r)
 
final Collection< CoordinategetViewFieldplayer (World world, int x, int y, int r)
 
final Collection< CoordinategetViewField (World world, Coordinate coord, int r)
 

Protected Member Functions

Collection< CoordinatecalcViewField (World world, int x, int y, int r)
 
Collection< CoordinatecalcViewFieldplayer (World world, int x, int y, int r)
 

Detailed Description

Uses a simple raycasting algorithm to compute field of view. This algorithm works by sending digital line rays to each point on the outside of the view radius. This algorithm is very simple, and therefore can often be very fast, especially if the radius is small, or the map is very closed. However, on large and open maps the algorithm results in inefficiencies as tiles close the origin of the view field are rechecked many times over.

Constructor & Destructor Documentation

jade.fov.RayCaster.RayCaster ( )

Constructs a new

.

Member Function Documentation

Collection<Coordinate> jade.fov.RayCaster.calcViewField ( World  world,
int  x,
int  y,
int  r 
)
protectedvirtual

Calculates the field of view on the given

World

from the given (x, y) coordinates with the specified radius.

Parameters
worldthe
World
on which field of view is being calculated
xthe x value of the coordinate being queried
ythe y value of the coordinate being queried
rthe radius of the field of view
Returns
the field of view on world from (x, y)

Implements jade.fov.ViewField.


The documentation for this class was generated from the following file: