geolib2
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
geo::HeightMap Class Reference

A geometric description of a Heightmap using a quad tree. More...

#include <HeightMap.h>

Inheritance diagram for geo::HeightMap:
Inheritance graph
[legend]

Public Member Functions

HeightMapclone () const
 
 HeightMap ()
 
 HeightMap (const HeightMap &orig)
 
bool intersect (const Ray &, float t0, float t1, double &distance) const
 intersect: currently always throws a logic error More...
 
virtual ~HeightMap ()
 
- Public Member Functions inherited from geo::Shape
virtual bool contains (const Vector3 &p) const
 Determines whether a point p lies within the shape. More...
 
virtual bool empty () const
 empty Test whether the shape(mesh) is empty. More...
 
virtual Box getBoundingBox () const
 Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape. More...
 
virtual double getMaxRadius () const
 Calculate the maximum distance from the origin of the shape to any point of the shape. More...
 
virtual const MeshgetMesh () const
 return the mesh defining the shape More...
 
virtual bool intersect (const Vector3 &p, const double radius) const
 Determines whether the shape intersects a sphere with center p. More...
 
virtual void setMesh (const Mesh &mesh)
 set the Mesh Any child classes should throw a std::logic_error in case the mesh should not be changed via setMesh. More...
 
 Shape ()
 
virtual bool write (std::ostream &output) const
 write, serialise the shape More...
 
virtual ~Shape ()
 

Static Public Member Functions

static HeightMap fromGrid (const std::vector< std::vector< double > > &grid, double resolution)
 fromGrid: instantiate a Heightmap from a grid More...
 
- Static Public Member Functions inherited from geo::Shape
static ShapePtr read (std::istream &input)
 read serialised data from an input stream and create a shape More...
 

Static Protected Member Functions

static HeightMapNodecreateQuadTree (const std::vector< std::vector< double > > &map, unsigned int mx_min, unsigned int my_min, unsigned int mx_max, unsigned int my_max, double resolution)
 createQuadTree: divide a grid over a quad tree More...
 

Protected Attributes

HeightMapNoderoot_
 
- Protected Attributes inherited from geo::Shape
Mesh mesh_
 Should not be read or written to directly in general. Use setMesh and getMesh to write respectively read the mesh. In a few exceptions, the mesh can be written direcly. Make sure that mesh keeps consistent with other member variables. More...
 

Additional Inherited Members

- Static Public Attributes inherited from geo::Shape
static const std::string TYPE = "mesh"
 

Detailed Description

A geometric description of a Heightmap using a quad tree.

Definition at line 15 of file HeightMap.h.

Constructor & Destructor Documentation

◆ HeightMap() [1/2]

geo::HeightMap::HeightMap ( )

Definition at line 7 of file HeightMap.cpp.

◆ HeightMap() [2/2]

geo::HeightMap::HeightMap ( const HeightMap orig)

Definition at line 10 of file HeightMap.cpp.

◆ ~HeightMap()

geo::HeightMap::~HeightMap ( )
virtual

Definition at line 19 of file HeightMap.cpp.

Member Function Documentation

◆ clone()

HeightMap * geo::HeightMap::clone ( ) const
virtual

Reimplemented from geo::Shape.

Definition at line 23 of file HeightMap.cpp.

◆ createQuadTree()

HeightMapNode * geo::HeightMap::createQuadTree ( const std::vector< std::vector< double > > &  map,
unsigned int  mx_min,
unsigned int  my_min,
unsigned int  mx_max,
unsigned int  my_max,
double  resolution 
)
staticprotected

createQuadTree: divide a grid over a quad tree

Parameters
mapheightmap in the form of a grid. Must be square.
mx_minindices describing a square region in the map from which to create the node
my_minindex to describe the region in the map
mx_maxindex to describe the region in the map
my_maxindex to describe the region in the map
resolutionresolution of the map in meters per index.
Returns
pointer to the root node of the quadtree.

Definition at line 194 of file HeightMap.cpp.

◆ fromGrid()

HeightMap geo::HeightMap::fromGrid ( const std::vector< std::vector< double > > &  grid,
double  resolution 
)
static

fromGrid: instantiate a Heightmap from a grid

Parameters
gridHeightmap in the form of a grid
resolutionresolution of the grid in meters per index
Returns
Heightmap

Definition at line 34 of file HeightMap.cpp.

◆ intersect()

bool geo::HeightMap::intersect ( const Ray r,
float  t0,
float  t1,
double &  distance 
) const
virtual

intersect: currently always throws a logic error

Parameters
r
t0
t1
distance
Returns
true when the ray intersects the shape

Reimplemented from geo::Shape.

Definition at line 27 of file HeightMap.cpp.

Member Data Documentation

◆ root_

HeightMapNode* geo::HeightMap::root_
protected

Definition at line 41 of file HeightMap.h.


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