Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <towr/terrain/examples/height_map_examples.h>
00031
00032 namespace towr {
00033
00034
00035 FlatGround::FlatGround(double height)
00036 {
00037 height_ = height;
00038 }
00039
00040 double
00041 Block::GetHeight (double x, double y) const
00042 {
00043 double h = 0.0;
00044
00045
00046 if (block_start <= x && x <=block_start+eps_)
00047 h = slope_*(x-block_start);
00048
00049 if (block_start+eps_ <= x && x <= block_start+length_)
00050 h = height_;
00051
00052 return h;
00053 }
00054
00055 double
00056 Block::GetHeightDerivWrtX (double x, double y) const
00057 {
00058 double dhdx = 0.0;
00059
00060
00061 if (block_start <= x && x <=block_start+eps_)
00062 dhdx = slope_;
00063
00064 return dhdx;
00065 }
00066
00067
00068
00069 double
00070 Stairs::GetHeight (double x, double y) const
00071 {
00072 double h = 0.0;
00073
00074 if (x>=first_step_start_)
00075 h = height_first_step;
00076
00077 if (x>=first_step_start_+first_step_width_)
00078 h = height_second_step;
00079
00080 if (x>=first_step_start_+first_step_width_+width_top)
00081 h = 0.0;
00082
00083 return h;
00084 }
00085
00086
00087
00088 double
00089 Gap::GetHeight (double x, double y) const
00090 {
00091 double h = 0.0;
00092
00093
00094 if (gap_start_ <= x && x <= gap_end_x)
00095 h = a*x*x + b*x + c;
00096
00097 return h;
00098 }
00099
00100 double
00101 Gap::GetHeightDerivWrtX (double x, double y) const
00102 {
00103 double dhdx = 0.0;
00104
00105 if (gap_start_ <= x && x <= gap_end_x)
00106 dhdx = 2*a*x + b;
00107
00108 return dhdx;
00109 }
00110
00111 double
00112 Gap::GetHeightDerivWrtXX (double x, double y) const
00113 {
00114 double dzdxx = 0.0;
00115
00116 if (gap_start_ <= x && x <= gap_end_x)
00117 dzdxx = 2*a;
00118
00119 return dzdxx;
00120 }
00121
00122
00123
00124 double
00125 Slope::GetHeight (double x, double y) const
00126 {
00127 double z = 0.0;
00128 if (x >= slope_start_)
00129 z = slope_*(x-slope_start_);
00130
00131
00132 if (x >= x_down_start_) {
00133 z = height_center - slope_*(x-x_down_start_);
00134 }
00135
00136
00137 if (x >= x_flat_start_)
00138 z = 0.0;
00139
00140 return z;
00141 }
00142
00143 double
00144 Slope::GetHeightDerivWrtX (double x, double y) const
00145 {
00146 double dzdx = 0.0;
00147 if (x >= slope_start_)
00148 dzdx = slope_;
00149
00150 if (x >= x_down_start_)
00151 dzdx = -slope_;
00152
00153 if (x >= x_flat_start_)
00154 dzdx = 0.0;
00155
00156 return dzdx;
00157 }
00158
00159
00160
00161 double
00162 Chimney::GetHeight (double x, double y) const
00163 {
00164 double z = 0.0;
00165
00166 if (x_start_<=x && x<=x_end_)
00167 z = slope_*(y-y_start_);
00168
00169 return z;
00170 }
00171
00172 double
00173 Chimney::GetHeightDerivWrtY (double x, double y) const
00174 {
00175 double dzdy = 0.0;
00176
00177 if (x_start_<= x && x<= x_end_)
00178 dzdy = slope_;
00179
00180 return dzdy;
00181 }
00182
00183
00184
00185 double
00186 ChimneyLR::GetHeight (double x, double y) const
00187 {
00188 double z = 0.0;
00189
00190 if (x_start_<=x && x<=x_end1_)
00191 z = slope_*(y-y_start_);
00192
00193 if (x_end1_<=x && x<=x_end2_)
00194 z = -slope_*(y+y_start_);
00195
00196 return z;
00197 }
00198
00199 double
00200 ChimneyLR::GetHeightDerivWrtY (double x, double y) const
00201 {
00202 double dzdy = 0.0;
00203
00204 if (x_start_ <= x && x <= x_end1_)
00205 dzdy = slope_;
00206
00207 if (x_end1_<=x && x<=x_end2_)
00208 dzdy = -slope_;
00209
00210 return dzdy;
00211 }
00212
00213 }