\( \def\bold#1{\bf #1} \newcommand{\d}{\mathrm{d}} \) BTP: Manual and Source Code Documentation

Power Uphill

bike mass [kg]
body mass [kg]
altitude gain [m]
climb length [km]
gradient [%]
time [s]
speed [km/h]
power [W]
power/mass [W/kg]
climbrate [m/min]

average power on climb stage

BTP  3.0
Routing/ClimbAnalysis/PowerCalculation
HeightData Class Reference

holds digital elevation model extracted from SRTM3 data More...

#include <HeightData.h>

Collaboration diagram for HeightData:

Public Member Functions

double height (double lon, double lat, void *hc, short mode)
 returns height data More...
 
void set_SRTM3_folder (char *folder)
 specifies the folder where hgt-files of SRTM3 data are searched
 
void set_rect (double minlat, double maxlat, double minlon, double maxlon)
 specifies area of the precalculated data grid
 
void reset_t (double minlat, double maxlat, double minlon, double maxlon)
 generates the data grid being
 
int max_t ()
 maximum height of the precalculated data grid
 
double height_t (double lon, double lat, void *hc, short mode)
 returns height data operating at the precalculated data grid More...
 
void paek_pro (double lon, double lat, qint64 **c, float *Ahigher, int cc, int ac, float d, float mperlon, float mperlat)
 evaluates prominence of summits
 
void interpolate_linear (int width, int height, double alpha, double **h, double **dhdx, double **dhdy)
 returns heigth data grid h with size (width,height) More...
 
void interpolate_linear_mercator (int width, int height, double alpha, double **h, double **dhdx, double **dhdy)
 returns heigth data grid h with size (width,height) More...
 
void interpolate_bicubic_conv3 (int width, int height, double alpha, double **h, double **dhdx, double **dhdy)
 returns heigth data grid h with size (width,height) More...
 
void interpolate_bicubic_conv3_mercator (int width, int height, double alpha, double **h, double **dhdx, double **dhdy)
 returns heigth data grid h with size (width,height) More...
 
void get_sorted_grid_data (short **heights, double **lons, double **lats, long *count)
 returns sorted raw data heights within the specified area More...
 
recti get_GridRect ()
 
int correct_hgt (char *filename)
 

Private Member Functions

void create_grid ()
 
void free_grid ()
 
int lty (double lat)
 
int ltx (double lon)
 
double ltdy (double lat)
 
double ltdx (double lon)
 
void sort_GridList (long s, long e)
 quick sort used by get_sorted_grid_data()
 
double Cubic_conv_kernel3 (double x)
 calculates weights of the bicubic convolution for the absolute height
 
double Cubic_conv_kernel3_d (double x)
 calculates weights of the bicubic convolution for the gradient
 
double Bicubic_conv3 (CubicKernel3 kx, CubicKernel3 ky)
 executes the bicubic convolution with the kernels kx and ky
 

Private Attributes

int sx
 
int sy
 
int nReserve
 
rect DEMRect
 
recti GridRect
 
char SRTM3folder [1000]
 
short ** grid
 
short * qsh
 
double * qslon
 
double * qslat
 

Detailed Description

holds digital elevation model extracted from SRTM3 data

acts on requests concerning heightdata at point (lon,lat). hgt files of SRTM3 data are used to generate height data grid, being interpolateted either lineary or bicubic. There exist fast serving functions acting on precalculated data grid labeled with "_t" (=templat) at the end of its name. height() and height_t() not only extract the height but can as well extract the gradient and the reliability of the heightdata with respect to its direction. This has to be specified by the mode-argument.

Definition at line 26 of file HeightData.h.

Member Function Documentation

void HeightData::create_grid ( )
private

creates data grid

Definition at line 22 of file HeightData.cpp.

void HeightData::free_grid ( )
private

deletes data grid

Definition at line 85 of file HeightData.cpp.

void HeightData::get_sorted_grid_data ( short **  heights,
double **  lons,
double **  lats,
long *  count 
)

returns sorted raw data heights within the specified area

create grid has to be called before. Data arrays are allocated by the function. Uses quicksort algorithm to sort. Real variable y mercator spacing is applied.

Definition at line 519 of file HeightData.cpp.

double HeightData::height ( double  lon,
double  lat,
void *  hc,
short  mode 
)

returns height data

Depending on the selected mode the following heigt data is returned:
mode 0: height
mode 1: longitudinal descent [m /(°/1200)]
mode 2: latitudinal descent [m /(°/1200)]
mode 3: azimut in [rad] of the gradient
mode 4: takes hc = double[3] with hc[1] = latitude part and hc[2] = longitude part to define direction, returns height and saves mistrust indec in hc[0]
mistrust index = abs(rx*gy-ry*gx)*grr with rx,ry...road direction, gx and gy as the DEM gradient and grr the 2nd derivativ of DEM in road direction indicating how fast the gradient will change.
This function uses bicubic convolution of 36 grid points. Internally for every request the related grid is created making this function slow. For fast purpose use height_t() instead.

Definition at line 418 of file HeightData.cpp.

double HeightData::height_t ( double  lon,
double  lat,
void *  hc,
short  mode 
)

returns height data operating at the precalculated data grid

base function of height. Operates on a precalculated data grid an takes the same requests as height().

Definition at line 343 of file HeightData.cpp.

void HeightData::interpolate_bicubic_conv3 ( int  width,
int  height,
double  alpha,
double **  h,
double **  dhdx,
double **  dhdy 
)

returns heigth data grid h with size (width,height)

interpolating bicubic the raw data. Data area has to be set with set_rect() command. Gradient out put dhdx and dhdy is optional, set NULL if not required.

Definition at line 106 of file HeightData.cpp.

void HeightData::interpolate_bicubic_conv3_mercator ( int  width,
int  height,
double  alpha,
double **  h,
double **  dhdx,
double **  dhdy 
)

returns heigth data grid h with size (width,height)

interpolating bicubic the raw data. Data area has to be set with set_rect() command. Gradient out put dhdx and dhdy is optional, set NULL if not required. Constant y spacing is applied.

Definition at line 194 of file HeightData.cpp.

void HeightData::interpolate_linear ( int  width,
int  height,
double  alpha,
double **  h,
double **  dhdx,
double **  dhdy 
)

returns heigth data grid h with size (width,height)

interpolating lineary the raw data. Data area has to be set with set_rect() command. Gradient out put dhdx and dhdy is optional, set NULL if not required. Constant y spacing is applied.

Definition at line 480 of file HeightData.cpp.

void HeightData::interpolate_linear_mercator ( int  width,
int  height,
double  alpha,
double **  h,
double **  dhdx,
double **  dhdy 
)

returns heigth data grid h with size (width,height)

interpolating lineary the raw data. Data area has to be set with set_rect() command. Gradient out put dhdx and dhdy is optional, set NULL if not required. Real variable y mercator spacing is applied.

Definition at line 498 of file HeightData.cpp.

double HeightData::ltdx ( double  lon)
private

weight of left data grid point

Definition at line 103 of file HeightData.cpp.

double HeightData::ltdy ( double  lat)
private

weight of bottom data grid point

Definition at line 100 of file HeightData.cpp.

int HeightData::ltx ( double  lon)
private

left data grid index

Definition at line 97 of file HeightData.cpp.

int HeightData::lty ( double  lat)
private

bottom data grid index

Definition at line 94 of file HeightData.cpp.

Member Data Documentation

rect HeightData::DEMRect
private

coordinates of data grid

Definition at line 105 of file HeightData.h.

short** HeightData::grid
private

data grid

Definition at line 110 of file HeightData.h.

recti HeightData::GridRect
private

coordinates*1200 of data grid

Definition at line 106 of file HeightData.h.

int HeightData::nReserve
private

dimensions of data grid

Definition at line 104 of file HeightData.h.

char HeightData::SRTM3folder[1000]
private

folder to contain files

Definition at line 107 of file HeightData.h.


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