Class to provide abstract interface to different world geometries. More...
#include <geometry.h>
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. | |
![]() | |
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... | |
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.
|
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.
|
staticprotected |
Common scan-converter code.
Common scan-converter code
|
mutableprotected |
Random number generator used for perturbations and the like.
Declared mutable so it can be used in const methods.