function getFlatCoordinatesXYM(flatCoords, stride, layout) {
  if (stride === 3 && layout === 'XYM') {
    return flatCoords;
  }
  // this is XYZM layout
  if (stride === 4) {
    return flatCoords.filter((v, i) => i % stride !== 2);
  }
  // this is XYZ layout
  if (stride === 3) {
    return flatCoords.map((v, i) => (i % stride !== 2 ? v : 0));
  }
  // this is XY layout
  return new Array(flatCoords.length * 1.5)
    .fill(0)
    .map((v, i) => (i % 3 === 2 ? 0 : flatCoords[Math.round(i / 1.5)]));
}
@param {Array<number>} flatCoords Flat coords
@param {number} stride Stride
@param {string} layout Layout
@return {Array<number>} Flat coords with only XY components