Пример #1
0
        /// <summary>
        /// Copies the point values of another pointcloud into this one.
        /// </summary>
        /// <param name="other">PointCloud to merge with this one.</param>
        public void Merge(PointCloud other)
        {
            IntPtr ptr_other = other.ConstPointer();
            IntPtr ptr       = NonConstPointer();

            UnsafeNativeMethods.ON_PointCloud_MergeCloud(ptr, ptr_other);
        }
Пример #2
0
        /// <summary>
        /// Constructs a new tree with an element for each pointcloud point.
        /// </summary>
        /// <param name="cloud">A pointcloud.</param>
        /// <returns>A new tree, or null on error.</returns>
        public static RTree CreatePointCloudTree(PointCloud cloud)
        {
            RTree  rc          = new RTree();
            IntPtr pRtree      = rc.NonConstPointer();
            IntPtr pConstCloud = cloud.ConstPointer();

            if (!UnsafeNativeMethods.ON_RTree_CreatePointCloudTree(pRtree, pConstCloud))
            {
                rc.Dispose();
                return(null);
            }
            uint size = UnsafeNativeMethods.ON_RTree_SizeOf(pRtree);

            rc.m_memory_pressure = size;
            GC.AddMemoryPressure(rc.m_memory_pressure);
            return(rc);
        }
Пример #3
0
        /// <summary>
        /// Constructs a new tree with an element for each pointcloud point.
        /// </summary>
        /// <param name="cloud">A pointcloud.</param>
        /// <returns>A new tree, or null on error.</returns>
        public static RTree CreatePointCloudTree(PointCloud cloud)
        {
            if (cloud == null)
            {
                throw new ArgumentNullException(nameof(cloud));
            }

            IntPtr const_ptr_cloud = cloud.ConstPointer();
            IntPtr ptr_rtree       = UnsafeNativeMethods.ON_RTree_CreatePointCloudTree(const_ptr_cloud);

            if (IntPtr.Zero == ptr_rtree)
            {
                return(null);
            }

            RTree rc   = new RTree(ptr_rtree);
            uint  size = UnsafeNativeMethods.ON_RTree_SizeOf(ptr_rtree);

            rc.m_memory_pressure = size;
            GC.AddMemoryPressure(rc.m_memory_pressure);
            rc.m_count = cloud.Count;
            GC.KeepAlive(cloud);
            return(rc);
        }