this is it (your draw triangle function was completely wrong so I just kept the output of it
20:57:34.409 [TriangleTerrain Debug] UpdCube called with: - Edit - TerrainEditor:344
20:57:34.409 [TriangleTerrain Debug] Points: -452.4280090332031, 283.8387756347656, -164.3352508544922 -408.4280090332031, 313.34033203125, -170.3352508544922 -449.4280090332031, 301.339599609375, -111.33525085449219 -409.4280090332031, 282.6388854980469, -121.33525085449219 - Edit - TerrainEditor:344
20:57:34.409 [TriangleTerrain Debug] Wedges: Wedge(16 , 17 , 26 , 27, Size=27.52, Pos=-429.43,291.94,-116.34) Wedge(16 , 17 , 26 , 27, Size=45.33, Pos=-408.93,297.94,-145.84) Wedge(16 , 17 , 26 , 27, Size=38.36, Pos=-450.93,292.59,-137.84) Wedge(16 , 17 , 26 , 27, Size=34.49, Pos=-430.43,298.59,-167.34) - Edit - TerrainEditor:344
20:57:34.409 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.409 [TriangleTerrain Debug] Before sorting: Wedge(16 , 17 , 26 , 27, Size=27.52, Pos=-429.43,291.94,-116.34) Wedge(16 , 17 , 26 , 27, Size=45.33, Pos=-408.93,297.94,-145.84) Wedge(16 , 17 , 26 , 27, Size=38.36, Pos=-450.93,292.59,-137.84) Wedge(16 , 17 , 26 , 27, Size=34.49, Pos=-430.43,298.59,-167.34) - Edit - TerrainEditor:344
20:57:34.409 [TriangleTerrain Debug] After sorting: Wedge(16 , 17 , 26 , 27, Size=45.33, Pos=-408.93,297.94,-145.84) Wedge(16 , 17 , 26 , 27, Size=38.36, Pos=-450.93,292.59,-137.84) Wedge(16 , 17 , 26 , 27, Size=34.49, Pos=-430.43,298.59,-167.34) Wedge(16 , 17 , 26 , 27, Size=27.52, Pos=-429.43,291.94,-116.34) - Edit - TerrainEditor:344
20:57:34.410 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.410 [TriangleTerrain Debug] Positions: -452.4280090332031, 283.8387756347656, -164.3352508544922 -408.4280090332031, 313.34033203125, -170.3352508544922 -449.4280090332031, 301.339599609375, -111.33525085449219 - Edit - TerrainEditor:344
20:57:34.410 [TriangleTerrain Debug] Wedges before: Wedge(16 , 17 , 26 , 27, Size=45.33, Pos=-408.93,297.94,-145.84) Wedge(16 , 17 , 26 , 27, Size=38.36, Pos=-450.93,292.59,-137.84) - Edit - TerrainEditor:344
20:57:34.410 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] Wedges after: Wedge(16 , 17 , 26 , 27, Size=38.36, Pos=-450.93,292.59,-137.84) Wedge(16 , 17 , 26 , 27, Size=34.49, Pos=-430.43,298.59,-167.34) - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] Positions: -408.4280090332031, 313.34033203125, -170.3352508544922 -449.4280090332031, 301.339599609375, -111.33525085449219 -409.4280090332031, 282.6388854980469, -121.33525085449219 - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] Wedges before: Wedge(16 , 17 , 26 , 27, Size=34.49, Pos=-430.43,298.59,-167.34) Wedge(16 , 17 , 26 , 27, Size=27.52, Pos=-429.43,291.94,-116.34) - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] Wedges after: Wedge(16 , 17 , 26 , 27, Size=27.53, Pos=-429.43,291.99,-116.34) Wedge(16 , 17 , 26 , 27, Size=45.31, Pos=-408.93,297.99,-145.84) - Edit - TerrainEditor:344
20:57:34.411 [TriangleTerrain Debug] UpdCube completed - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] UpdCube called with: - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Points: -408.4280090332031, 313.34033203125, -170.3352508544922 -357.4280090332031, 286.0387268066406, -169.3352508544922 -409.4280090332031, 282.6388854980469, -121.33525085449219 -350.4280090332031, 288.4391784667969, -112.33525085449219 - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Wedges: Wedge(17 , 18 , 27 , 28, Size=35.40, Pos=-382.93,299.69,-169.84) Wedge(17 , 18 , 27 , 28, Size=35.45, Pos=-408.93,297.94,-145.84) Wedge(17 , 18 , 27 , 28, Size=37.49, Pos=-379.93,285.49,-116.84) Wedge(17 , 18 , 27 , 28, Size=33.36, Pos=-353.93,287.24,-140.84) - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Before sorting: Wedge(17 , 18 , 27 , 28, Size=35.40, Pos=-382.93,299.69,-169.84) Wedge(17 , 18 , 27 , 28, Size=35.45, Pos=-408.93,297.94,-145.84) Wedge(17 , 18 , 27 , 28, Size=37.49, Pos=-379.93,285.49,-116.84) Wedge(17 , 18 , 27 , 28, Size=33.36, Pos=-353.93,287.24,-140.84) - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] After sorting: Wedge(17 , 18 , 27 , 28, Size=37.49, Pos=-379.93,285.49,-116.84) Wedge(17 , 18 , 27 , 28, Size=35.45, Pos=-408.93,297.94,-145.84) Wedge(17 , 18 , 27 , 28, Size=35.40, Pos=-382.93,299.69,-169.84) Wedge(17 , 18 , 27 , 28, Size=33.36, Pos=-353.93,287.24,-140.84) - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Positions: -408.4280090332031, 313.34033203125, -170.3352508544922 -357.4280090332031, 286.0387268066406, -169.3352508544922 -409.4280090332031, 282.6388854980469, -121.33525085449219 - Edit - TerrainEditor:344
20:57:34.412 [TriangleTerrain Debug] Wedges before: Wedge(17 , 18 , 27 , 28, Size=37.49, Pos=-379.93,285.49,-116.84) Wedge(17 , 18 , 27 , 28, Size=35.45, Pos=-408.93,297.94,-145.84) - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] Wedges after: Wedge(17 , 18 , 27 , 28, Size=35.40, Pos=-408.93,297.99,-145.84) Wedge(17 , 18 , 27 , 28, Size=35.44, Pos=-382.93,299.69,-169.84) - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] Positions: -357.4280090332031, 286.0387268066406, -169.3352508544922 -409.4280090332031, 282.6388854980469, -121.33525085449219 -350.4280090332031, 288.4391784667969, -112.33525085449219 - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] Wedges before: Wedge(17 , 18 , 27 , 28, Size=35.40, Pos=-382.93,299.69,-169.84) Wedge(17 , 18 , 27 , 28, Size=33.36, Pos=-353.93,287.24,-140.84) - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] Wedges after: Wedge(17 , 18 , 27 , 28, Size=37.48, Pos=-379.93,285.54,-116.84) Wedge(17 , 18 , 27 , 28, Size=33.36, Pos=-353.93,287.24,-140.84) - Edit - TerrainEditor:344
20:57:34.413 [TriangleTerrain Debug] UpdCube completed - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] UpdCube called with: - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Points: -409.4280090332031, 282.6388854980469, -121.33525085449219 -350.4280090332031, 288.4391784667969, -112.33525085449219 -404.4280090332031, 278.4387512207031, -66.33525085449219 -348.4280090332031, 312.4394226074219, -60.33525085449219 - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Wedges: Wedge(27 , 28 , 37 , 38, Size=43.11, Pos=-376.43,295.44,-63.34) Wedge(27 , 28 , 37 , 38, Size=32.12, Pos=-406.93,280.49,-93.84) Wedge(27 , 28 , 37 , 38, Size=28.53, Pos=-349.43,300.44,-86.34) Wedge(27 , 28 , 37 , 38, Size=39.52, Pos=-379.93,285.49,-116.84) - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Before sorting: Wedge(27 , 28 , 37 , 38, Size=43.11, Pos=-376.43,295.44,-63.34) Wedge(27 , 28 , 37 , 38, Size=32.12, Pos=-406.93,280.49,-93.84) Wedge(27 , 28 , 37 , 38, Size=28.53, Pos=-349.43,300.44,-86.34) Wedge(27 , 28 , 37 , 38, Size=39.52, Pos=-379.93,285.49,-116.84) - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] After sorting: Wedge(27 , 28 , 37 , 38, Size=43.11, Pos=-376.43,295.44,-63.34) Wedge(27 , 28 , 37 , 38, Size=39.52, Pos=-379.93,285.49,-116.84) Wedge(27 , 28 , 37 , 38, Size=32.12, Pos=-406.93,280.49,-93.84) Wedge(27 , 28 , 37 , 38, Size=28.53, Pos=-349.43,300.44,-86.34) - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Positions: -409.4280090332031, 282.6388854980469, -121.33525085449219 -350.4280090332031, 288.4391784667969, -112.33525085449219 -404.4280090332031, 278.4387512207031, -66.33525085449219 - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] Wedges before: Wedge(27 , 28 , 37 , 38, Size=43.11, Pos=-376.43,295.44,-63.34) Wedge(27 , 28 , 37 , 38, Size=39.52, Pos=-379.93,285.49,-116.84) - Edit - TerrainEditor:344
20:57:34.414 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Wedges after: Wedge(27 , 28 , 37 , 38, Size=32.13, Pos=-406.93,280.54,-93.84) Wedge(27 , 28 , 37 , 38, Size=39.50, Pos=-379.93,285.54,-116.84) - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Positions: -350.4280090332031, 288.4391784667969, -112.33525085449219 -404.4280090332031, 278.4387512207031, -66.33525085449219 -348.4280090332031, 312.4394226074219, -60.33525085449219 - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Wedges before: Wedge(27 , 28 , 37 , 38, Size=32.12, Pos=-406.93,280.49,-93.84) Wedge(27 , 28 , 37 , 38, Size=28.53, Pos=-349.43,300.44,-86.34) - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Wedges after: Wedge(27 , 28 , 37 , 38, Size=43.11, Pos=-376.43,295.44,-63.34) Wedge(27 , 28 , 37 , 38, Size=28.53, Pos=-349.43,300.44,-86.34) - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] UpdCube completed - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] UpdCube called with: - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Points: -449.4280090332031, 301.339599609375, -111.33525085449219 -409.4280090332031, 282.6388854980469, -121.33525085449219 -448.4280090332031, 299.2394714355469, -60.33525085449219 -404.4280090332031, 278.4387512207031, -66.33525085449219 - Edit - TerrainEditor:344
20:57:34.415 [TriangleTerrain Debug] Wedges: Wedge(26 , 27 , 36 , 37, Size=40.87, Pos=-448.93,300.29,-85.84) Wedge(26 , 27 , 36 , 37, Size=41.61, Pos=-406.93,280.49,-93.84) Wedge(26 , 27 , 36 , 37, Size=32.70, Pos=-426.43,288.84,-63.34) Wedge(26 , 27 , 36 , 37, Size=33.43, Pos=-429.43,291.94,-116.34) - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] Before sorting: Wedge(26 , 27 , 36 , 37, Size=40.87, Pos=-448.93,300.29,-85.84) Wedge(26 , 27 , 36 , 37, Size=41.61, Pos=-406.93,280.49,-93.84) Wedge(26 , 27 , 36 , 37, Size=32.70, Pos=-426.43,288.84,-63.34) Wedge(26 , 27 , 36 , 37, Size=33.43, Pos=-429.43,291.94,-116.34) - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] After sorting: Wedge(26 , 27 , 36 , 37, Size=41.61, Pos=-406.93,280.49,-93.84) Wedge(26 , 27 , 36 , 37, Size=40.87, Pos=-448.93,300.29,-85.84) Wedge(26 , 27 , 36 , 37, Size=33.43, Pos=-429.43,291.94,-116.34) Wedge(26 , 27 , 36 , 37, Size=32.70, Pos=-426.43,288.84,-63.34) - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] Positions: -449.4280090332031, 301.339599609375, -111.33525085449219 -409.4280090332031, 282.6388854980469, -121.33525085449219 -448.4280090332031, 299.2394714355469, -60.33525085449219 - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] Wedges before: Wedge(26 , 27 , 36 , 37, Size=41.61, Pos=-406.93,280.49,-93.84) Wedge(26 , 27 , 36 , 37, Size=40.87, Pos=-448.93,300.29,-85.84) - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.416 [TriangleTerrain Debug] Wedges after: Wedge(26 , 27 , 36 , 37, Size=40.89, Pos=-448.93,300.29,-85.84) Wedge(26 , 27 , 36 , 37, Size=33.39, Pos=-429.43,291.99,-116.34) - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] Updating triangle: - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] Positions: -409.4280090332031, 282.6388854980469, -121.33525085449219 -448.4280090332031, 299.2394714355469, -60.33525085449219 -404.4280090332031, 278.4387512207031, -66.33525085449219 - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] Wedges before: Wedge(26 , 27 , 36 , 37, Size=33.43, Pos=-429.43,291.94,-116.34) Wedge(26 , 27 , 36 , 37, Size=32.70, Pos=-426.43,288.84,-63.34) - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] New Angle: true - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] Wedges after: Wedge(26 , 27 , 36 , 37, Size=32.68, Pos=-426.43,288.84,-63.34) Wedge(26 , 27 , 36 , 37, Size=41.60, Pos=-406.93,280.54,-93.84) - Edit - TerrainEditor:344
20:57:34.417 [TriangleTerrain Debug] UpdCube completed - Edit - TerrainEditor:344