Ejemplo n.º 1
0
        //-- Types assisting k-neighbor search

        /// <summary>
        /// Finds a certain amout of points in a list of 3D points that are the k-closest to a test point.
        /// </summary>
        /// <param name="pointcloud">A point cloud to be searched.</param>
        /// <param name="needlePts">Points to search for.</param>
        /// <param name="amount">The required amount of closest neighbors to find.</param>
        /// <returns>An enumerable of arrays of indices; each array contains the indices for each of the needlePts.</returns>
        /// <seealso cref="RhinoList.PointCloudKNeighbors(PointCloud, IEnumerable{Point3d}, int)"/>
        public static IEnumerable <int[]> PointCloudKNeighbors(PointCloud pointcloud, IEnumerable <Point3d> needlePts, int amount)
        {
            var tree   = RTree.CreatePointCloudTree(pointcloud);
            var points = pointcloud.AsReadOnlyListOfPoints();

            return(new LazyClosestPointsAmountEnumerator(tree, points, needlePts, amount));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Finds the point in a list of 3D points that is closest to a test point.
        /// </summary>
        /// <param name="pointcloud">A point cloud to be searched.</param>
        /// <param name="needlePts">Points to search for.</param>
        /// <param name="limitDistance">The maximum allowed distance.</param>
        /// <returns>An enumerable of arrays of indices; each array contains the indices for each of the needlePts.</returns>
        public static IEnumerable <int[]> PointCloudClosestPoints(PointCloud pointcloud, IEnumerable <Point3d> needlePts, double limitDistance)
        {
            var tree   = RTree.CreatePointCloudTree(pointcloud);
            var points = pointcloud.AsReadOnlyListOfPoints();

            return(new LazyClosestPointsDistanceEnumerator(tree, points, needlePts, limitDistance));
        }