hex.h File Reference

#include <list>
#include <set>
#include <map>
#include <stdexcept>
#include <ostream>
#include <string>

Go to the source code of this file.

Namespaces

namespace  hex
namespace  hex::svg

Classes

class  hex::exception
 Base class for hex exceptions. More...
class  hex::invalid_argument
class  hex::out_of_range
class  hex::svg::Identity
 Parent class for objects that can have an id, SVG style & SVG class name. More...
struct  hex::Point
 X-Y coordinate. More...
class  hex::Grid
 A square field of hexagons that form the universe in which the other objects exist. More...
class  hex::Edge
 The interface between a hex and one of its six neighbours. More...
class  hex::Hex
 A single hexagonal quanta of area. More...
class  hex::Area
 A connected set of hexes. More...
class  hex::Path
 A sequence of adjacent hexes. More...
class  hex::Boundary
 A sequence of adjacent edges. More...

Defines

#define FIRETREE__HEX_H   1
#define HEX_PARANOID_CHECKS

Typedefs

typedef double hex::Distance

Enumerations

enum  hex::Direction {
  hex::A = 0, hex::B = 1, hex::C = 2, hex::D = 3,
  hex::E = 4, hex::F = 5
}
 The six directions are labelled A to F anti-clockwise. More...

Functions

Direction hex::to_direction (char c) throw (hex::invalid_argument)
char hex::to_char (Direction d)
Direction & hex::operator+= (Direction &d, int i)
Direction hex::operator+ (const Direction &d, int i)
Direction & hex::operator++ (Direction &d)
 Prefix increment.
Direction hex::operator++ (const Direction &d, int)
 Postfix increment.
Direction & hex::operator-= (Direction &d, int i)
Direction hex::operator- (const Direction &d, int i)
Direction & hex::operator-- (Direction &d)
 Prefix decrement.
Direction hex::operator-- (const Direction &d, int)
 Postfix decrement.
std::ostream & hex::operator<< (std::ostream &os, const Direction &d)
std::string hex::rotate (const std::string &steps, int i)
 steps is a string of characters A-F, representing a set of Directions.
void hex::go (int &i, int &j, Direction d, int distance=1)
 Translates coordinates i,j in direction d.
void hex::go (int &i, int &j, const std::string &steps)
 Translates coordinates i,j along steps.
std::string hex::steps (const Hex *from, const Hex *to)
 Calculates a minimum-length path between two hexes.
int hex::distance (const Hex *from, const Hex *to)
 The length of the shortest path between two hexes.
std::set< Hex * > hex::range (Hex *h, int distance)
 Calculates the set of hexes that are range r from hex h.
std::set< Hex * > hex::set_difference (const std::set< Hex * > &a, const std::set< Hex * > &b)
 The set difference between a and b.
std::set< Hex * > hex::set_intersection (const std::set< Hex * > &a, const std::set< Hex * > &b)
 The set intersection between a and b.
std::set< Hex * > hex::set_union (const std::set< Hex * > &a, const std::set< Hex * > &b)
 The set union between a and b.
std::string hex::set_str (const std::set< Hex * > &a)
 Generates a string representation of hex-set a.
bool hex::bounding_box (const std::set< Hex * > &a, int &i0, int &j0, int &i1, int &j1)
 Calculate a bounding box for hex-set a.
Area hex::fill (const std::set< Hex * > &beyond, Hex *h)
 Calc.
Area hex::fill (const std::set< Hex * > &beyond, const Area &a)
 Max.
std::list< Area > hex::areas (const std::set< Hex * > &s)
 Find all of the Areas (connected sets) in s.
bool hex::is_connected (const std::set< Hex * > &s)
 TRUE iff s is connected.
std::list< Boundary > hex::skeleton (const std::list< Area > &a, bool include_boundary=true)
 The skeletons of areas a.

Variables

const Distance hex::M_SQRT3 = 1.73205080756887729352744634150587236
const Distance hex::I = 1.0
 Distance between centres of adjacent hexes.
const Distance hex::J = M_SQRT3/2.0
 Distance between adjacent hex rows.
const Distance hex::K = 1.0/M_SQRT3
 Length of hex's edge.
const int hex::DIRECTIONS = 6


Define Documentation

#define FIRETREE__HEX_H   1

Definition at line 58 of file hex.h.

#define HEX_PARANOID_CHECKS

Definition at line 69 of file hex.h.


Generated on Thu Feb 21 00:00:54 2008 for libhex by  doxygen 1.5.1