Example #1
0
        /// <summary>
        /// Produces an index for ij coordinates anchored by an origin.
        ///
        /// The coordinate space used by this function may have deleted
        /// regions or warping due to pentagonal distortion.
        ///
        /// Failure may occur if the index is too far away from the origin
        /// or if the index is on the other side of a pentagon.
        ///
        /// This function is experimental, and its output is not guaranteed
        /// to be compatible across different versions of H3.
        /// </summary>
        /// <param name="origin">An anchoring index for the ij coordinate system.</param>
        /// <param name="ij">ij coordinates to index.</param>
        /// <param name="out_h3">Index will be placed here on success.</param>
        /// <returns>0 on succedd, or another value on failure</returns>
        /// <!-- Based off 3.2.0 -->
        public static int experimentalLocalIjToH3(H3Index origin, CoordIJ ij,
                                                  ref H3Index out_h3)
        {
            // This function is currently experimental. Once ready to be part of the
            // non-experimental API, this function (with the experimental prefix) will
            // be marked as deprecated and to be removed in the next major version. It
            // will be replaced with a non-prefixed function name.
            CoordIJK ijk = new CoordIJK();

            CoordIJK.ijToIjk(ij, ref ijk);

            return(localIjkToH3(origin, ijk, ref out_h3));
        }
Example #2
0
        /// <summary>
        /// Produces ij coordinates for an index anchored by an origin.
        ///
        /// The coordinate space used by this function may have deleted
        /// regions or warping due to pentagonal distortion.
        ///
        /// Coordinates are only comparable if they come from the same
        /// origin index.
        ///
        /// Failure may occur if the index is too far away from the origin
        /// or if the index is on the other side of a pentagon.
        ///
        /// This function is experimental, and its output is not guaranteed
        /// to be compatible across different versions of H3.
        /// </summary>
        /// <param name="origin">An anchoring index for the ij coordinate system.</param>
        /// <param name="h3">Index to find the coordinates of</param>
        /// <param name="out_coord">ij coordinates of the index will be placed here on success</param>
        /// <returns>0 on success, or another value on failure.</returns>
        /// <!-- Based off 3.2.0 -->
        public static int experimentalH3ToLocalIj(H3Index origin, H3Index h3, CoordIJ out_coord)
        {
            // This function is currently experimental. Once ready to be part of the
            // non-experimental API, this function (with the experimental prefix) will
            // be marked as deprecated and to be removed in the next major version. It
            // will be replaced with a non-prefixed function name.
            CoordIJK ijk    = new CoordIJK();
            int      failed = h3ToLocalIjk(origin, h3, ref ijk);

            if (failed != 0)
            {
                return(failed);
            }

            CoordIJK.ijkToIj(ijk, ref out_coord);

            return(0);
        }