该函数用于创建并返回一个HashSet对象的拷贝,该拷贝包含原对象中的所有元素。
def clone(self) -> open3d.core.HashSet
无参数。
返回一个HashSet对象的拷贝。
import open3d.core as o3c
# 创建一个HashSet对象
hash_set = o3c.HashSet([1, 2, 3, 4, 5])
# 复制HashSet对象
hash_set_copy = hash_set.clone()
# 修改hash_set_copy的元素
hash_set_copy.add(6)
# 打印结果
print("hash_set:", hash_set)
print("hash_set_copy:", hash_set_copy)
hash_set: {1, 2, 3, 4, 5}
hash_set_copy: {1, 2, 3, 4, 5, 6}