From 138d55d33c4139125f3c7246d499943f67d93146 Mon Sep 17 00:00:00 2001 From: John Lindsay Date: Mon, 12 Dec 2022 08:58:48 -0500 Subject: [PATCH] updates due to negative z_factors --- .DS_Store | Bin 18436 -> 18436 bytes whitebox-lidar/.DS_Store | Bin 0 -> 6148 bytes whitebox-plugins/.DS_Store | Bin 6148 -> 6148 bytes whitebox-raster/.DS_Store | Bin 0 -> 6148 bytes whitebox-runner/.DS_Store | Bin 6148 -> 6148 bytes whitebox-tools-app/.DS_Store | Bin 6148 -> 6148 bytes .../src/tools/terrain_analysis/aspect.rs | 10 +++++----- .../terrain_analysis/gaussian_curvature.rs | 8 ++++---- .../src/tools/terrain_analysis/hillshade.rs | 10 +++++----- .../terrain_analysis/maximal_curvature.rs | 8 ++++---- .../tools/terrain_analysis/mean_curvature.rs | 8 ++++---- .../terrain_analysis/minimal_curvature.rs | 8 ++++---- .../multidirectional_hillshade.rs | 10 +++++----- .../tools/terrain_analysis/plan_curvature.rs | 8 ++++---- .../tools/terrain_analysis/prof_curvature.rs | 8 ++++---- .../tools/terrain_analysis/relative_aspect.rs | 10 +++++----- .../src/tools/terrain_analysis/slope.rs | 10 +++++----- .../tools/terrain_analysis/tan_curvature.rs | 8 ++++---- whitebox-vector/.DS_Store | Bin 0 -> 6148 bytes 19 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 whitebox-lidar/.DS_Store create mode 100644 whitebox-raster/.DS_Store create mode 100644 whitebox-vector/.DS_Store diff --git a/.DS_Store b/.DS_Store index 8ef3f0fdff8c5a7cbd548c83f8314e21b734c179..325aabac3a906547be1aa6bab167a9e1d099ccce 100755 GIT binary patch delta 628 zcmZpfz}PZ@ae_E64+Db*Hv@wLkT&3+sG`m2w=rNhKcm#-4FW2g|46N80x>2V2-GoN zn7m#fktrvA@&f^-%_f4A7?~D(Ox_@&Q#7@2k>>qRst9}u-=Gy!T8pX@EhyID!>DdWZlL)OXM3Q}=D-zPCJFt9M_F{CqOGL+=z zySOCf0SwDm5fysuN!ke!tn({G9PUbPluV-T@VMt^s0=hMop(H0A zVb{zofulexQRI>RviaO(?zTl>zo4l>I0Tm(gqzqH7-m-sFifs6c*<gM+ zkK}FP`IBo5B@`h{uqDh4;S5d;AqcI&Ft$6ed8?rqBcs(MW2MdSjP^1zrP@yx(2(5h zr@D=4GmFG;rp;GOjG1{jxwv_F<=s8pJ$bw*Pt>a3yi?7aQ332bAi==k08B0nt_%zU XC`o5y;cMo}{4Sq1Uo$gg#BK%vTLrFv delta 524 zcmZpfz}PZ@ae_E6Hv@wN5G(L7Fc|PmRMBSi+8D5#pHXr$qp8YdX5l)<1(QrwCodPa zVanE;94Ml+nO$TOBa`)=$rnXcChr$5XJ$FT0Awp|juwk!Wc%@ffq_A2vZJK%WIhSu z$xp>w*d_o)ph9(Gf|Dmp*fIufz9_-TG}*v~Wiz+M7pBd|0&AEiZ&&u%EN3IcG_js- zGPi?IX|}m zsE2_gK45aQ!VYHcWigZO6xBHRc-hT&H63vTa%6-M#vlnx@gwVJ;65Ui+yZRx!z3QL(02+-7Pys4H1*pKkRscQQ ztU3zhN(HC@75GrVz7GX%SSNOY{^`KtBLL8Tfr!8~sKB6Vju;wr z#7oxIiCtjOMg3-+lQ(NlDC)N(Uc6ki4&+J&sKCAgqu5TY|DVIZng91m+))84@TU~e zaWijbc%|&EgO{^jTi_S)cSEh0WARoD^j3_Gwc_JmU9o56>%=b5>4-ZW$R7dIg+>K_ GLxDGE#ws}g literal 0 HcmV?d00001 diff --git a/whitebox-plugins/.DS_Store b/whitebox-plugins/.DS_Store index 03e44cfbb13d50e7807defc6d340c12ec6adfbda..82056c573412f442a601cdf7dfe7f8ffdc3523c4 100755 GIT binary patch delta 79 zcmZoMXffEp!ffOEf`Ng7nW31Wh#@&Q-^C>2WBb8 Kg3Zy)D@6bx;uM1b diff --git a/whitebox-raster/.DS_Store b/whitebox-raster/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..13f7503d4b374dc2b166cc8901e785a611582d3f GIT binary patch literal 6148 zcmeHKyG{c^475oEC#6YAxs;SC>6Yl|khA-> z?a_wTG+W%1{Iln;%(AKL>7tn;Qe9SuuP+Zz=Vf-j%bs4n-@l!d+0|`%>LX}jp+G1Q z3WNfoz`s@iJzK0A7{(e3gaV$5kqorzKcszPJR+lgrhTo^IhQV$pXw0Y*3~ivm_G> K!)8zB-68-vU=hv$ delta 61 zcmZoMXffFEiAhe?gMop8nW31Wh#@&Q-^C>?Xu@EW% diff --git a/whitebox-tools-app/.DS_Store b/whitebox-tools-app/.DS_Store index 11a2e865c1f1deb333e7e49e71d563e029d83b07..1c539d2f7c9cd1636ecdb94571d16b3ddf1fb7e2 100755 GIT binary patch delta 21 dcmZoMXffFEk%?)=-pQYtLKqD;dob@20RUnT2u=V1 delta 21 dcmZoMXffFEk%?*fr^%n0LKqb`dob@20RUtk2yy@b diff --git a/whitebox-tools-app/src/tools/terrain_analysis/aspect.rs b/whitebox-tools-app/src/tools/terrain_analysis/aspect.rs index ebfcd7e7..c2d8d344 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/aspect.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/aspect.rs @@ -158,7 +158,7 @@ impl WhiteboxTool for Aspect { let mut input_file = String::new(); let mut output_file = String::new(); - let mut z_factor = -1f64; + let mut z_factor = 1f64; if args.len() == 0 { return Err(Error::new( @@ -277,11 +277,11 @@ impl WhiteboxTool for Aspect { of Digital Terrain Modelling, Chapter 4, pg. 117. I can't figure out why, but this only works if you change the sign of q below. */ - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -409,10 +409,10 @@ impl WhiteboxTool for Aspect { of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/gaussian_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/gaussian_curvature.rs index bf16574d..6b4e45f0 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/gaussian_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/gaussian_curvature.rs @@ -339,11 +339,11 @@ impl WhiteboxTool for GaussianCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -505,10 +505,10 @@ impl WhiteboxTool for GaussianCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/hillshade.rs b/whitebox-tools-app/src/tools/terrain_analysis/hillshade.rs index 14206e55..cc6cf122 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/hillshade.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/hillshade.rs @@ -183,7 +183,7 @@ impl WhiteboxTool for Hillshade { let mut output_file = String::new(); let mut azimuth = 315.0f64; let mut altitude = 30.0f64; - let mut z_factor = -1f64; + let mut z_factor = 1f64; if args.len() == 0 { return Err(Error::new( @@ -348,11 +348,11 @@ impl WhiteboxTool for Hillshade { The following equations have been taken from Florinsky (2016) Principles and Methods of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -498,10 +498,10 @@ impl WhiteboxTool for Hillshade { of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/maximal_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/maximal_curvature.rs index a64bb990..948aab5b 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/maximal_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/maximal_curvature.rs @@ -341,11 +341,11 @@ impl WhiteboxTool for MaximalCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -511,10 +511,10 @@ impl WhiteboxTool for MaximalCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/mean_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/mean_curvature.rs index b0aab7dd..0c1936a9 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/mean_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/mean_curvature.rs @@ -342,11 +342,11 @@ impl WhiteboxTool for MeanCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -507,10 +507,10 @@ impl WhiteboxTool for MeanCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/minimal_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/minimal_curvature.rs index c1107058..44030877 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/minimal_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/minimal_curvature.rs @@ -342,11 +342,11 @@ impl WhiteboxTool for MinimalCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -512,10 +512,10 @@ impl WhiteboxTool for MinimalCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/multidirectional_hillshade.rs b/whitebox-tools-app/src/tools/terrain_analysis/multidirectional_hillshade.rs index fb02ceea..cd231dbf 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/multidirectional_hillshade.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/multidirectional_hillshade.rs @@ -201,7 +201,7 @@ impl WhiteboxTool for MultidirectionalHillshade { let mut input_file = String::new(); let mut output_file = String::new(); let mut altitude = 30.0f64; - let mut z_factor = -1f64; + let mut z_factor = 1f64; let mut multidirection360mode = false; if args.len() == 0 { @@ -476,11 +476,11 @@ impl WhiteboxTool for MultidirectionalHillshade { The following equations have been taken from Florinsky (2016) Principles and Methods of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -656,10 +656,10 @@ impl WhiteboxTool for MultidirectionalHillshade { of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/plan_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/plan_curvature.rs index 2ca7f07f..1365ca9e 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/plan_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/plan_curvature.rs @@ -343,11 +343,11 @@ impl WhiteboxTool for PlanCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -511,10 +511,10 @@ impl WhiteboxTool for PlanCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/prof_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/prof_curvature.rs index 759ca601..58ed013c 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/prof_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/prof_curvature.rs @@ -340,11 +340,11 @@ impl WhiteboxTool for ProfileCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -508,10 +508,10 @@ impl WhiteboxTool for ProfileCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/relative_aspect.rs b/whitebox-tools-app/src/tools/terrain_analysis/relative_aspect.rs index 31c848b3..fa8a00a6 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/relative_aspect.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/relative_aspect.rs @@ -165,7 +165,7 @@ impl WhiteboxTool for RelativeAspect { let mut input_file = String::new(); let mut output_file = String::new(); let mut azimuth = 0.0f64; - let mut z_factor = -1f64; + let mut z_factor = 1f64; if args.len() == 0 { return Err(Error::new( @@ -314,11 +314,11 @@ impl WhiteboxTool for RelativeAspect { hillslopes have aspects that face the appropriate direction, you need to reverse their signs of p and q. */ - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -450,10 +450,10 @@ impl WhiteboxTool for RelativeAspect { of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/slope.rs b/whitebox-tools-app/src/tools/terrain_analysis/slope.rs index c0aaf067..229b26c9 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/slope.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/slope.rs @@ -179,7 +179,7 @@ impl WhiteboxTool for Slope { let mut input_file = String::new(); let mut output_file = String::new(); - let mut z_factor = -1f64; + let mut z_factor = 1f64; let mut units_numeric = 1; // degrees if args.len() == 0 { @@ -308,11 +308,11 @@ impl WhiteboxTool for Slope { The following equations have been taken from Florinsky (2016) Principles and Methods of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -442,10 +442,10 @@ impl WhiteboxTool for Slope { of Digital Terrain Modelling, Chapter 4, pg. 117. */ - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-tools-app/src/tools/terrain_analysis/tan_curvature.rs b/whitebox-tools-app/src/tools/terrain_analysis/tan_curvature.rs index 7bbc97df..13ca105d 100755 --- a/whitebox-tools-app/src/tools/terrain_analysis/tan_curvature.rs +++ b/whitebox-tools-app/src/tools/terrain_analysis/tan_curvature.rs @@ -351,11 +351,11 @@ impl WhiteboxTool for TangentialCurvature { s = 1. / (100. * res * res) * (z[8] + z[16] - z[6] - z[18] + 4. * (z[4] + z[20] - z[0] - z[24]) + 2. * (z[3] + z[9] + z[15] + z[21] - z[1] - z[5] - z[19] - z[23])); - p = -1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + p = 1. / (420. * res) * (44. * (z[3] + z[23] - z[1] - z[21]) + 31. * (z[0] + z[20] - z[4] - z[24] + 2. * (z[8] + z[18] - z[6] - z[16])) + 17. * (z[14] - z[10] + 4. * (z[13] - z[11])) + 5. * (z[9] + z[19] - z[5] - z[15])); - q = -1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + q = 1. / (420. * res) * (44. * (z[5] + z[9] - z[15] - z[19]) + 31. * (z[20] + z[24] - z[0] - z[4] + 2. * (z[6] + z[8] - z[16] - z[18])) + 17. * (z[2] - z[22] + 4. * (z[7] - z[17])) + 5. * (z[1] + z[3] - z[21] - z[23])); @@ -519,10 +519,10 @@ impl WhiteboxTool for TangentialCurvature { s = (c * (a * a * (d + e) + b * b * e) * (z[2] - z[0]) - b * (a * a * d - c * c * e) * (z[3] - z[5]) + a * (c * c * (d + e) + b * b * d) * (z[6] - z[8])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e))); - p = -((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) + p = ((a * a * c * d * (d + e) * (z[2] - z[0]) + b * (a * a * d * d + c * c * e * e) * (z[5] - z[3]) + a * c * c * e * (d + e) * (z[8] - z[6])) / (2. * (a * a * c * c * (d + e).powi(2) + b * b * (a * a * d * d + c * c * e * e)))); - q = -(1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) + q = (1. / (3. * d * e * (d + e) * (a.powi(4) + b.powi(4) + c.powi(4))) * ((d * d * (a.powi(4) + b.powi(4) + b * b * c * c) + c * c * e * e * (a * a - b * b)) * (z[0] + z[2]) - (d * d * (a.powi(4) + c.powi(4) + b * b * c * c) - e * e * (a.powi(4) + c.powi(4) + a * a * b * b)) * (z[3] + z[5]) - (e * e * (b.powi(4) + c.powi(4) + a * a * b * b) - a * a * d * d * (b * b - c * c)) * (z[6] + z[8]) diff --git a/whitebox-vector/.DS_Store b/whitebox-vector/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..06d76a9b5e24275c8766fb715ad950932cb33cde GIT binary patch literal 6148 zcmeHKJ5B>J5FL{gE77E+G)Kq*kW93kASDe-B0-U8LlC_?S`Ni&khlYHJ_tuE5ETWy zk;ZR5Gtbt(VrNH0(&BM57nzAj2UnCQUB;$)^^u)KWC~1r#(cRRc6*Cr|07fGL>}ZI z>+NmJzdrrU?1sKyZHE;i-TlSu^V|8$Wt-i6lilC7r&iEtRDcRl0V+TR{@8}`*dKj5df&a@n(3oSpt|f04#yk5fNB&D$uDZMvUZi#B^NiJMbQD9LU|JX^V>;>eW>P=R9wCcd3%|G$ENG5;TvxT6A8;7=)#rv0*C z;FY4cj$TfCZHC{#KMb{2j>TFr&{{Dz+KSJbx~$L0m%!?1bi|Dg