My Project
 All Classes Files Functions Variables Enumerations Pages
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Geometry Class Referenceabstract

Class to provide abstract interface to different world geometries. More...

#include <geometry.h>

Inheritance diagram for Geometry:
ScanConverter GeometryFlat GeometrySpherical

Public Member Functions

 Geometry (uint seed)
 Constructor.
 
virtual ~Geometry ()
 Destructor.
 
virtual float height (const XYZ &p) const =0
 Return the height of the given point.
 
virtual void set_height (XYZ &p, float v) const =0
 Move the specified point vertically until.
 
virtual const XYZ midpoint (const XYZ &v0, const XYZ &v1) const =0
 Return a point halfway between the two given points.
 
virtual float normalised_latitude (const XYZ &p) const =0
 Really only meaningful for spherical geometries.
 
virtual const XYZ up (const XYZ &p) const =0
 Return the direction of "up" at the specified point.
 
virtual const XYZ north (const XYZ &p) const =0
 Return the direction of "north" at the specified point.
 
virtual const XYZ east (const XYZ &p) const =0
 Return the direction of "east" at the specified point.
 
virtual const XYZ perturb (const XYZ &v, const XYZ &variation) const =0
 Add a random variation to a point.
 
virtual float epsilon () const =0
 Nasty hack to work around height setting possibly not being exact. More...
 
virtual uint scan_convert_image_aspect_ratio () const
 Multiplier for width of a scan-converted image.
 
- Public Member Functions inherited from ScanConverter
virtual void scan_convert (const boost::array< XYZ, 3 > &v, const ScanConvertBackend &) const =0
 Set-up for scan conversion of given vertices to the given map.
 

Static Protected Member Functions

static void scan_convert_common (const boost::array< XYZ, 3 > &v, const ScanConvertBackend &backend)
 Common scan-converter code. More...
 

Protected Attributes

Random01 _r01
 Random number generator used for perturbations and the like. More...
 

Detailed Description

Class to provide abstract interface to different world geometries.

This is an abstract base class providing methods which will differ between world geometries. For example, the direction of "up" at a given point will vary depending on whether we are generating a flat world or a spherical one.

Todo:
Most of these methods should have their implementation moved geometry.cpp

Member Function Documentation

virtual float Geometry::epsilon ( ) const
pure virtual

Nasty hack to work around height setting possibly not being exact.

In some geometries (e.g spherical, but not flat) modifying a point to be at a particular height does not guarantee that exact value will be returned on a susequent height query. If this is the case, a non-zero epsilon value can be returned and used as an error tolerence when comparing two heights for equivalence.

Implemented in GeometrySpherical, and GeometryFlat.

void Geometry::scan_convert_common ( const boost::array< XYZ, 3 > &  v,
const ScanConvertBackend backend 
)
staticprotected

Common scan-converter code.

Common scan-converter code

Member Data Documentation

Random01 Geometry::_r01
mutableprotected

Random number generator used for perturbations and the like.

Declared mutable so it can be used in const methods.

Todo:
Perhaps theres a better place for the geometry random number generator to live: having it here creates the anomaly of having to pass random seeds into apparently non-random objects like icosahedrons etc.

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