All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.geom.flat.flip.js Maven / Gradle / Ivy

The newest version!
/**
 * @module ol/geom/flat/flip
 */

/**
 * @param {Array} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {Array} [dest] Destination.
 * @param {number} [destOffset] Destination offset.
 * @return {Array} Flat coordinates.
 */
export function flipXY(flatCoordinates, offset, end, stride, dest, destOffset) {
  if (dest !== undefined) {
    dest = dest;
    destOffset = destOffset !== undefined ? destOffset : 0;
  } else {
    dest = [];
    destOffset = 0;
  }
  let j = offset;
  while (j < end) {
    const x = flatCoordinates[j++];
    dest[destOffset++] = flatCoordinates[j++];
    dest[destOffset++] = x;
    for (let k = 2; k < stride; ++k) {
      dest[destOffset++] = flatCoordinates[j++];
    }
  }
  dest.length = destOffset;
  return dest;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy