66 virtual const XYZ up(
const XYZ& p)
const
97 const boost::array<XYZ,3>& v,
147 return XYZ(0.0f,0.0f,1.0f);
153 return XYZ(0.0f,1.0f,0.0f);
159 return XYZ(1.0f,0.0f,0.0f);
180 const boost::array<XYZ,3>& v,
216 const float h_av=0.5f*(h0+h1);
218 const XYZ m(0.5f*(v0+v1));
239 if (p.x==0.0f && p.y==0.0f)
240 return XYZ(0.0f,0.0f,0.0f);
242 return (
up(p)*
east(p)).normalised();
250 if (p.x==0.0f && p.y==0.0f)
251 return XYZ(0.0f,0.0f,0.0f);
253 return (
XYZ(0.0f,0.0f,1.0f)*
up(p)).normalised();
277 const boost::array<XYZ,3>& v,
void scan_convert(const boost::array< XYZ, 3 > &v, const ScanConvertBackend &) const
Definition: geometry.cpp:114
virtual const XYZ midpoint(const XYZ &v0, const XYZ &v1) const =0
Return a point halfway between the two given points.
float epsilon() const
This needs to return something small for the lake flooding algorithm to work.
Definition: geometry.h:270
virtual float normalised_latitude(const XYZ &p) const =0
Really only meaningful for spherical geometries.
Geometry(uint seed)
Constructor.
Definition: geometry.h:41
virtual const XYZ east(const XYZ &p) const =0
Return the direction of "east" at the specified point.
~GeometrySpherical()
Destructor.
Definition: geometry.h:195
GeometrySpherical(uint seed)
Constructor.
Definition: geometry.h:190
uint scan_convert_image_aspect_ratio() const
Return 2.0 for spheres because vertical range is +/- pi/2, horizontal is +/- pi.
Definition: geometry.h:282
float height(const XYZ &p) const
Height is just the z co-ordinate of a point.
Definition: geometry.h:121
const XYZ midpoint(const XYZ &v0, const XYZ &v1) const
The mid-point between two points is simply their average.
Definition: geometry.h:133
Random01 _r01
Random number generator used for perturbations and the like.
Definition: geometry.h:105
virtual void scan_convert(const boost::array< XYZ, 3 > &v, const ScanConvertBackend &) const
Definition: geometry.cpp:95
Generates random points in a recnangular box centred on the origin.
Definition: xyz.h:245
const XYZ perturb(const XYZ &p, const XYZ &variation) const
Add a random variation to a point.
Definition: geometry.h:163
float normalised_latitude(const XYZ &) const
This doesn't really mean anything here, so return zero, which would correspond to the equator of a sp...
Definition: geometry.h:139
Class to provide abstract interface to different world geometries.
Definition: geometry.h:36
virtual uint scan_convert_image_aspect_ratio() const
Multiplier for width of a scan-converted image.
Definition: geometry.h:87
Class to hold vectors in 3D cartesian co-ordinates.
Definition: xyz.h:34
virtual void set_height(XYZ &p, float v) const =0
Move the specified point vertically until.
float magnitude() const
Return the magnitude.
Definition: xyz.h:131
float height(const XYZ &p) const
Height is relative to the surface of the unit radius sphere.
Definition: geometry.h:199
float epsilon() const
Returns zero. Heights are stored exactly once assigned so no need for non-zero epsilon.
Definition: geometry.h:173
virtual const XYZ up(const XYZ &p) const =0
Return the direction of "up" at the specified point.
virtual ~Geometry()
Destructor.
Definition: geometry.h:46
const XYZ east(const XYZ &) const
Returns unit x vector. (East is the same everywhere in this geometry).
Definition: geometry.h:157
Interface for class Vertex.
const XYZ up(const XYZ &p) const
Up is normal to the sphere.
Definition: geometry.h:229
void set_height(XYZ &p, float v) const
Setting a height is simply assigning to the z-coordinate.
Definition: geometry.h:127
Generates random numbers in the range [0,1).
Definition: random.h:28
static void scan_convert_common(const boost::array< XYZ, 3 > &v, const ScanConvertBackend &backend)
Common scan-converter code.
Definition: geometry.cpp:27
virtual float height(const XYZ &p) const =0
Return the height of the given point.
Concrete class providing a flat geometry (in the XY-plane, with Z up).
Definition: geometry.h:109
virtual float epsilon() const =0
Nasty hack to work around height setting possibly not being exact.
Interface for classes for scan conversion.
const XYZ up(const XYZ &) const
Returns unit z vector. (Up is the same everywhere in this geometry).
Definition: geometry.h:145
const XYZ north(const XYZ &) const
Returns unit y vector. (North is the same everywhere in this geometry).
Definition: geometry.h:151
void set_height(XYZ &p, float h) const
The height set is relative to the surface of the unit radius sphere.
Definition: geometry.h:205
const XYZ east(const XYZ &p) const
East is perpendicular to "up" and the polar vector.
Definition: geometry.h:248
const XYZ midpoint(const XYZ &v0, const XYZ &v1) const
Don't just take the mid-point of the straight-line path through the sphere's surface: must work relat...
Definition: geometry.h:212
virtual const XYZ north(const XYZ &p) const =0
Return the direction of "north" at the specified point.
float normalised_latitude(const XYZ &p) const
Normalised latitude is 1.0 at the north pole, -1.0 at the south pole.
Definition: geometry.h:223
Concrete class providing a flat geometry (a sphere with nominal radius 1, equator in the XY-plane...
Definition: geometry.h:186
const XYZ normalised() const
Return the vector normalised.
Definition: xyz.h:217
virtual const XYZ perturb(const XYZ &v, const XYZ &variation) const =0
Add a random variation to a point.
const XYZ perturb(const XYZ &p, const XYZ &variation) const
Add a random variation to a point.
Definition: geometry.h:259
const XYZ north(const XYZ &p) const
North is perpendicular to "up" and "east".
Definition: geometry.h:237