PointCloud.concatenate#
- PointCloud.concatenate(*others: PointCloud, color: Any = (0.7, 0.7, 0.7)) PointCloud[source][source]#
Join point clouds
- Parameters:
others (
PointCloud) – one or more point clouds to join to this onecolor (array_like(3), str or None, optional) – color for the points of clouds that have no color: an RGB value in the range [0, 1] or a color name, or
Noneto remove the colors from the result, defaults to light gray
- Returns:
a new point cloud containing the points of all the clouds
- Return type:
- Raises:
ValueError –
coloris a string that is not a known color name
The points are joined in order, this cloud first. The clouds that are joined are not changed.
If none of the clouds has color, the result has none. If some of them have color and others do not, every point must have a color, so the points that have none are given
color. Withcolor=Nonethe colors of all points are dropped instead. An empty point cloud has no color, and does not affect the colors of the result.The
+operator does the same with the defaultcolor.Added in version 2.5.0.
Examples
>>> import numpy as np >>> from machinevisiontoolbox import PointCloud >>> red = PointCloud(np.random.rand(3, 4)).paint("red") >>> plain = PointCloud(np.random.rand(3, 3)) >>> both = red.concatenate(plain, color="blue") >>> both.colors array([[1., 1., 1., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 1., 1., 1.]], shape=(3, 7)) >>> red.concatenate(plain, color=None).iscolor False