insert
是open3d.core.Scalar
类的成员函数,用于插入新值到标量的指定位置上。
insert(self, index: int, value: float)
index
:插入新值的位置,类型为int
。value
:待插入的新值,类型为float
。该函数没有返回值,会直接修改原对象。
import open3d.core as o3c
scalar = o3c.Scalar([0, 1, 2, 3, 4])
scalar.insert(3, 3.5)
print(scalar)
# 输出:[0.0, 1.0, 2.0, 3.5, 3.0, 4.0]
如果插入位置index
不在合法范围内,会抛出IndexError
异常。