getTriangle method
Get a triangle from the heightfield
Implementation
void getTriangle(int xi, int yi, bool upper, Vec3 a, Vec3 b, Vec3 c) {
final data = this.data;
final elementSize = this.elementSize.toDouble();
if (upper) {
// Top triangle verts
a.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);
b.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);
c.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);
} else {
// Top triangle verts
a.set(xi * elementSize, yi * elementSize, data[xi][yi]);
b.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);
c.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);
}
}