In C++ SDK, can two pointclouds be combined without resorting to point-by-point addition?

I use a Python script to call a DLL that uses the C++ SDK for higher performance. I have large pointclouds that I need to combine. Is there a way to do this efficiently using the C++ SDK like for meshes where you can use mesh.Append(count, meshes):

Append() [2/2]

void ON_Mesh::Append(int count, const ON_Mesh *const meshes)

I do not see a comparable Member Function for ON_PointCloud.

Can SetPointCloud be used to do this? I see one of its overloads says:

Description: Copies cloud and moves user data from point_cloud to m_point_cloud. Paramters: pointCloud - [in] information in point_cloud is copied. Any attached [ON_UserData]( is moved from point_cloud to m_point_cloud.

I will try this next but fear it only works for copying a pointcloud to a new container.


Hi @Terry_Chappell,

Given two point clouds:

ON_PointCloud A;
ON_PointCloud B;

You can create a third point cloud which contains the other two like this:

ON_PointCloud C(A);
C.m_P.Append(B.m_P.Count(), B.m_P.Array());
C.m_H.Append(B.m_H.Count(), B.m_H.Array());
C.m_C.Append(B.m_C.Count(), B.m_C.Array());
C.m_V.Append(B.m_V.Count(), B.m_V.Array());
C.m_N.Append(B.m_N.Count(), B.m_N.Array());
C.m_hidden_count += B.m_hidden_count;

– Dale