public void Dispose() { if (m_tree != null) { m_tree.Dispose(); } }
/// <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); }
/// <summary> /// Constructs a new tree with an element for each face in the mesh. /// The element id is set to the index of the face. /// </summary> /// <param name="mesh">A mesh.</param> /// <returns>A new tree, or null on error.</returns> public static RTree CreateMeshFaceTree(Mesh mesh) { if (mesh == null) { throw new ArgumentNullException(nameof(mesh)); } RTree rc = new RTree(); IntPtr pRtree = rc.NonConstPointer(); IntPtr pConstMesh = mesh.ConstPointer(); if (!UnsafeNativeMethods.ON_RTree_CreateMeshFaceTree(pRtree, pConstMesh)) { rc.Dispose(); return(null); } uint size = UnsafeNativeMethods.ON_RTree_SizeOf(pRtree); rc.m_memory_pressure = size; GC.AddMemoryPressure(rc.m_memory_pressure); rc.m_count = mesh.Faces.Count; GC.KeepAlive(mesh); return(rc); }
/// <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; }